@contember/binding 1.0.0-rc.8 → 1.1.0-alpha.0

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 (535) hide show
  1. package/dist/development/BindingError.js +0 -1
  2. package/dist/development/BindingError.js.map +1 -1
  3. package/dist/development/accessorPropagation/AccessorProvider.js +3 -5
  4. package/dist/development/accessorPropagation/AccessorProvider.js.map +1 -1
  5. package/dist/development/accessorPropagation/BindingOperationsContext.js +2 -4
  6. package/dist/development/accessorPropagation/BindingOperationsContext.js.map +1 -1
  7. package/dist/development/accessorPropagation/BindingOperationsProvider.js +2 -4
  8. package/dist/development/accessorPropagation/BindingOperationsProvider.js.map +1 -1
  9. package/dist/development/accessorPropagation/EntityKeyContext.js +1 -3
  10. package/dist/development/accessorPropagation/EntityKeyContext.js.map +1 -1
  11. package/dist/development/accessorPropagation/EntityKeyProvider.js +2 -4
  12. package/dist/development/accessorPropagation/EntityKeyProvider.js.map +1 -1
  13. package/dist/development/accessorPropagation/EnvironmentContext.js +2 -4
  14. package/dist/development/accessorPropagation/EnvironmentContext.js.map +1 -1
  15. package/dist/development/accessorPropagation/TreeRootIdContext.js +1 -3
  16. package/dist/development/accessorPropagation/TreeRootIdContext.js.map +1 -1
  17. package/dist/development/accessorPropagation/TreeRootIdProvider.js +2 -4
  18. package/dist/development/accessorPropagation/TreeRootIdProvider.js.map +1 -1
  19. package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js +2 -4
  20. package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
  21. package/dist/development/accessorPropagation/useBindingOperations.js +2 -4
  22. package/dist/development/accessorPropagation/useBindingOperations.js.map +1 -1
  23. package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js +3 -5
  24. package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
  25. package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js +3 -5
  26. package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
  27. package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js +3 -5
  28. package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
  29. package/dist/development/accessorPropagation/useEntity.js +7 -9
  30. package/dist/development/accessorPropagation/useEntity.js.map +1 -1
  31. package/dist/development/accessorPropagation/useEntityKey.js +3 -5
  32. package/dist/development/accessorPropagation/useEntityKey.js.map +1 -1
  33. package/dist/development/accessorPropagation/useEntityList.js +7 -9
  34. package/dist/development/accessorPropagation/useEntityList.js.map +1 -1
  35. package/dist/development/accessorPropagation/useEntityListSubTree.js +4 -6
  36. package/dist/development/accessorPropagation/useEntityListSubTree.js.map +1 -1
  37. package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js +2 -4
  38. package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
  39. package/dist/development/accessorPropagation/useEntitySubTree.js +4 -6
  40. package/dist/development/accessorPropagation/useEntitySubTree.js.map +1 -1
  41. package/dist/development/accessorPropagation/useEntitySubTreeParameters.js +2 -4
  42. package/dist/development/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
  43. package/dist/development/accessorPropagation/useEnvironment.js +2 -4
  44. package/dist/development/accessorPropagation/useEnvironment.js.map +1 -1
  45. package/dist/development/accessorPropagation/useField.js +7 -9
  46. package/dist/development/accessorPropagation/useField.js.map +1 -1
  47. package/dist/development/accessorPropagation/useGetEntityByKey.js +1 -3
  48. package/dist/development/accessorPropagation/useGetEntityByKey.js.map +1 -1
  49. package/dist/development/accessorPropagation/useGetEntityListSubTree.js +4 -6
  50. package/dist/development/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
  51. package/dist/development/accessorPropagation/useGetEntitySubTree.js +4 -6
  52. package/dist/development/accessorPropagation/useGetEntitySubTree.js.map +1 -1
  53. package/dist/development/accessorPropagation/useGetTreeFilters.js +1 -3
  54. package/dist/development/accessorPropagation/useGetTreeFilters.js.map +1 -1
  55. package/dist/development/accessorPropagation/useHasEntity.js +2 -4
  56. package/dist/development/accessorPropagation/useHasEntity.js.map +1 -1
  57. package/dist/development/accessorPropagation/usePersist.js +1 -3
  58. package/dist/development/accessorPropagation/usePersist.js.map +1 -1
  59. package/dist/development/accessorPropagation/useTreeRootId.js +2 -4
  60. package/dist/development/accessorPropagation/useTreeRootId.js.map +1 -1
  61. package/dist/development/accessorSorting/SetOrderFieldOnCreate.js +9 -11
  62. package/dist/development/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
  63. package/dist/development/accessorSorting/addEntityAtIndex.js +2 -4
  64. package/dist/development/accessorSorting/addEntityAtIndex.js.map +1 -1
  65. package/dist/development/accessorSorting/errors.js +1 -3
  66. package/dist/development/accessorSorting/errors.js.map +1 -1
  67. package/dist/development/accessorSorting/moveEntity.js +1 -3
  68. package/dist/development/accessorSorting/moveEntity.js.map +1 -1
  69. package/dist/development/accessorSorting/repairEntitiesOrder.js +0 -1
  70. package/dist/development/accessorSorting/repairEntitiesOrder.js.map +1 -1
  71. package/dist/development/accessorSorting/sortEntities.js +0 -1
  72. package/dist/development/accessorSorting/sortEntities.js.map +1 -1
  73. package/dist/development/accessorSorting/useSortedEntities.js +6 -8
  74. package/dist/development/accessorSorting/useSortedEntities.js.map +1 -1
  75. package/dist/development/accessorTree/AccessorTree.js +4 -6
  76. package/dist/development/accessorTree/AccessorTree.js.map +1 -1
  77. package/dist/development/accessorTree/DirtinessContext.js +1 -3
  78. package/dist/development/accessorTree/DirtinessContext.js.map +1 -1
  79. package/dist/development/accessorTree/MutationStateContext.js +1 -3
  80. package/dist/development/accessorTree/MutationStateContext.js.map +1 -1
  81. package/dist/development/accessorTree/NormalizedPersistedData.js +0 -1
  82. package/dist/development/accessorTree/NormalizedPersistedData.js.map +1 -1
  83. package/dist/development/accessorTree/RuntimeId.js +22 -17
  84. package/dist/development/accessorTree/RuntimeId.js.map +1 -1
  85. package/dist/development/accessorTree/accessorTreeStateReducer.js +0 -1
  86. package/dist/development/accessorTree/accessorTreeStateReducer.js.map +1 -1
  87. package/dist/development/accessorTree/metadataToRequestError.js +0 -1
  88. package/dist/development/accessorTree/metadataToRequestError.js.map +1 -1
  89. package/dist/development/accessorTree/useDataBinding.js +5 -7
  90. package/dist/development/accessorTree/useDataBinding.js.map +1 -1
  91. package/dist/development/accessorTree/useDirtinessState.js +2 -4
  92. package/dist/development/accessorTree/useDirtinessState.js.map +1 -1
  93. package/dist/development/accessorTree/useMutationState.js +2 -4
  94. package/dist/development/accessorTree/useMutationState.js.map +1 -1
  95. package/dist/development/accessors/EntityAccessor.js +5 -7
  96. package/dist/development/accessors/EntityAccessor.js.map +1 -1
  97. package/dist/development/accessors/EntityListAccessor.js +1 -3
  98. package/dist/development/accessors/EntityListAccessor.js.map +1 -1
  99. package/dist/development/accessors/ErrorAccessor.js +0 -1
  100. package/dist/development/accessors/ErrorAccessor.js.map +1 -1
  101. package/dist/development/accessors/FieldAccessor.js +3 -5
  102. package/dist/development/accessors/FieldAccessor.js.map +1 -1
  103. package/dist/development/accessors/TreeRootAccessor.js +0 -1
  104. package/dist/development/accessors/TreeRootAccessor.js.map +1 -1
  105. package/dist/development/bindingTypes.js +0 -1
  106. package/dist/development/bindingTypes.js.map +1 -1
  107. package/dist/development/core/AccessorErrorManager.js +15 -11
  108. package/dist/development/core/AccessorErrorManager.js.map +1 -1
  109. package/dist/development/core/Config.js +18 -12
  110. package/dist/development/core/Config.js.map +1 -1
  111. package/dist/development/core/DataBinding.js +74 -67
  112. package/dist/development/core/DataBinding.js.map +1 -1
  113. package/dist/development/core/DirtinessTracker.js +10 -3
  114. package/dist/development/core/DirtinessTracker.js.map +1 -1
  115. package/dist/development/core/ErrorsPreprocessor.js +3 -5
  116. package/dist/development/core/ErrorsPreprocessor.js.map +1 -1
  117. package/dist/development/core/EventManager.js +20 -16
  118. package/dist/development/core/EventManager.js.map +1 -1
  119. package/dist/development/core/IncrementalMarkerBuilder.js +14 -8
  120. package/dist/development/core/IncrementalMarkerBuilder.js.map +1 -1
  121. package/dist/development/core/MarkerComparator.js +6 -8
  122. package/dist/development/core/MarkerComparator.js.map +1 -1
  123. package/dist/development/core/MarkerMerger.js +18 -19
  124. package/dist/development/core/MarkerMerger.js.map +1 -1
  125. package/dist/development/core/MarkerTreeGenerator.js +18 -13
  126. package/dist/development/core/MarkerTreeGenerator.js.map +1 -1
  127. package/dist/development/core/MutationGenerator.js +13 -15
  128. package/dist/development/core/MutationGenerator.js.map +1 -1
  129. package/dist/development/core/QueryGenerator.js +9 -11
  130. package/dist/development/core/QueryGenerator.js.map +1 -1
  131. package/dist/development/core/RealmKeyGenerator.js +10 -6
  132. package/dist/development/core/RealmKeyGenerator.js.map +1 -1
  133. package/dist/development/core/RequestResponseNormalizer.js +7 -9
  134. package/dist/development/core/RequestResponseNormalizer.js.map +1 -1
  135. package/dist/development/core/StateInitializer.js +28 -26
  136. package/dist/development/core/StateInitializer.js.map +1 -1
  137. package/dist/development/core/TreeAugmenter.js +6 -8
  138. package/dist/development/core/TreeAugmenter.js.map +1 -1
  139. package/dist/development/core/TreeFilterGenerator.js +8 -8
  140. package/dist/development/core/TreeFilterGenerator.js.map +1 -1
  141. package/dist/development/core/TreeParameterMerger.js +2 -4
  142. package/dist/development/core/TreeParameterMerger.js.map +1 -1
  143. package/dist/development/core/TreeStore.js +19 -15
  144. package/dist/development/core/TreeStore.js.map +1 -1
  145. package/dist/development/core/VariableInputTransformer.js +6 -5
  146. package/dist/development/core/VariableInputTransformer.js.map +1 -1
  147. package/dist/development/core/exceptions/ErrorLocator.js +10 -6
  148. package/dist/development/core/exceptions/ErrorLocator.js.map +1 -1
  149. package/dist/development/core/exceptions/LocalizedBindingError.js +1 -3
  150. package/dist/development/core/exceptions/LocalizedBindingError.js.map +1 -1
  151. package/dist/development/core/exceptions/MarkerSugarer.js +7 -9
  152. package/dist/development/core/exceptions/MarkerSugarer.js.map +1 -1
  153. package/dist/development/core/exceptions/TreeParameterSugarer.js +0 -1
  154. package/dist/development/core/exceptions/TreeParameterSugarer.js.map +1 -1
  155. package/dist/development/core/factories/createBatchUpdatesOptions.js +1 -3
  156. package/dist/development/core/factories/createBatchUpdatesOptions.js.map +1 -1
  157. package/dist/development/core/operations/EntityOperations.js +13 -14
  158. package/dist/development/core/operations/EntityOperations.js.map +1 -1
  159. package/dist/development/core/operations/FieldOperations.js +10 -12
  160. package/dist/development/core/operations/FieldOperations.js.map +1 -1
  161. package/dist/development/core/operations/ListOperations.js +12 -14
  162. package/dist/development/core/operations/ListOperations.js.map +1 -1
  163. package/dist/development/core/operations/OperationsHelpers.js +4 -6
  164. package/dist/development/core/operations/OperationsHelpers.js.map +1 -1
  165. package/dist/development/core/requestAliases/MutationAlias.js +2 -4
  166. package/dist/development/core/requestAliases/MutationAlias.js.map +1 -1
  167. package/dist/development/core/requestAliases/mutationOperationSubTreeType.js +0 -1
  168. package/dist/development/core/requestAliases/mutationOperationSubTreeType.js.map +1 -1
  169. package/dist/development/core/requestAliases/mutationOperationType.js +0 -1
  170. package/dist/development/core/requestAliases/mutationOperationType.js.map +1 -1
  171. package/dist/development/core/schema/Schema.js +3 -1
  172. package/dist/development/core/schema/Schema.js.map +1 -1
  173. package/dist/development/core/schema/SchemaLoader.js +9 -5
  174. package/dist/development/core/schema/SchemaLoader.js.map +1 -1
  175. package/dist/development/core/schema/SchemaPreprocessor.js +0 -1
  176. package/dist/development/core/schema/SchemaPreprocessor.js.map +1 -1
  177. package/dist/development/core/state/StateIterator.js +2 -4
  178. package/dist/development/core/state/StateIterator.js.map +1 -1
  179. package/dist/development/core/state/getEntityMarker.js +0 -1
  180. package/dist/development/core/state/getEntityMarker.js.map +1 -1
  181. package/dist/development/core/utils/getCombinedSignal.js +0 -1
  182. package/dist/development/core/utils/getCombinedSignal.js.map +1 -1
  183. package/dist/development/coreComponents/Component.js +2 -4
  184. package/dist/development/coreComponents/Component.js.map +1 -1
  185. package/dist/development/coreComponents/DataBindingProvider.js +3 -5
  186. package/dist/development/coreComponents/DataBindingProvider.js.map +1 -1
  187. package/dist/development/coreComponents/Entity.js +3 -5
  188. package/dist/development/coreComponents/Entity.js.map +1 -1
  189. package/dist/development/coreComponents/EntityList.js +3 -5
  190. package/dist/development/coreComponents/EntityList.js.map +1 -1
  191. package/dist/development/coreComponents/EntityListSubTree.js +13 -23
  192. package/dist/development/coreComponents/EntityListSubTree.js.map +1 -1
  193. package/dist/development/coreComponents/EntitySubTree.js +14 -34
  194. package/dist/development/coreComponents/EntitySubTree.js.map +1 -1
  195. package/dist/development/coreComponents/Field.js +10 -8
  196. package/dist/development/coreComponents/Field.js.map +1 -1
  197. package/dist/development/coreComponents/HasMany.js +10 -14
  198. package/dist/development/coreComponents/HasMany.js.map +1 -1
  199. package/dist/development/coreComponents/HasOne.js +10 -14
  200. package/dist/development/coreComponents/HasOne.js.map +1 -1
  201. package/dist/development/coreComponents/ParentEntity.js +3 -5
  202. package/dist/development/coreComponents/ParentEntity.js.map +1 -1
  203. package/dist/development/dao/Environment.js +147 -89
  204. package/dist/development/dao/Environment.js.map +1 -1
  205. package/dist/development/dao/TreeNodeEnvironmentFactory.js +159 -0
  206. package/dist/development/dao/TreeNodeEnvironmentFactory.js.map +1 -0
  207. package/dist/development/dao/VariableFieldValue.js +0 -1
  208. package/dist/development/dao/VariableFieldValue.js.map +1 -1
  209. package/dist/development/entityEvents/useDerivedField.js +4 -6
  210. package/dist/development/entityEvents/useDerivedField.js.map +1 -1
  211. package/dist/development/entityEvents/useEntityBeforePersist.js +1 -3
  212. package/dist/development/entityEvents/useEntityBeforePersist.js.map +1 -1
  213. package/dist/development/entityEvents/useEntityBeforeUpdate.js +1 -3
  214. package/dist/development/entityEvents/useEntityBeforeUpdate.js.map +1 -1
  215. package/dist/development/entityEvents/useEntityEvent.js +3 -5
  216. package/dist/development/entityEvents/useEntityEvent.js.map +1 -1
  217. package/dist/development/entityEvents/useEntityPersistError.js +1 -3
  218. package/dist/development/entityEvents/useEntityPersistError.js.map +1 -1
  219. package/dist/development/entityEvents/useEntityPersistSuccess.js +1 -3
  220. package/dist/development/entityEvents/useEntityPersistSuccess.js.map +1 -1
  221. package/dist/development/entityEvents/useOnConnectionUpdate.js +1 -3
  222. package/dist/development/entityEvents/useOnConnectionUpdate.js.map +1 -1
  223. package/dist/development/fieldHelpers/helpers/FieldHelper.js +8 -4
  224. package/dist/development/fieldHelpers/helpers/FieldHelper.js.map +1 -1
  225. package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.js +1 -3
  226. package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -1
  227. package/dist/development/fieldHelpers/helpers/UuidFieldHelper.js +2 -4
  228. package/dist/development/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
  229. package/dist/development/helperComponents/DeferredSubTrees.js +9 -11
  230. package/dist/development/helperComponents/DeferredSubTrees.js.map +1 -1
  231. package/dist/development/helperComponents/EntityView.js +2 -4
  232. package/dist/development/helperComponents/EntityView.js.map +1 -1
  233. package/dist/development/helperComponents/FieldView.js +7 -9
  234. package/dist/development/helperComponents/FieldView.js.map +1 -1
  235. package/dist/development/helperComponents/StaticRender.js +2 -4
  236. package/dist/development/helperComponents/StaticRender.js.map +1 -1
  237. package/dist/development/helperComponents/SugaredField.js +3 -5
  238. package/dist/development/helperComponents/SugaredField.js.map +1 -1
  239. package/dist/development/index.js +101 -101
  240. package/dist/development/index.js.map +1 -1
  241. package/dist/development/markers/EntityFieldMarkersContainer.js +5 -7
  242. package/dist/development/markers/EntityFieldMarkersContainer.js.map +1 -1
  243. package/dist/development/markers/EntityFieldsWithHoistablesMarker.js +0 -1
  244. package/dist/development/markers/EntityFieldsWithHoistablesMarker.js.map +1 -1
  245. package/dist/development/markers/EntityListSubTreeMarker.js +8 -4
  246. package/dist/development/markers/EntityListSubTreeMarker.js.map +1 -1
  247. package/dist/development/markers/EntitySubTreeMarker.js +8 -4
  248. package/dist/development/markers/EntitySubTreeMarker.js.map +1 -1
  249. package/dist/development/markers/FieldMarker.js +8 -4
  250. package/dist/development/markers/FieldMarker.js.map +1 -1
  251. package/dist/development/markers/HasManyRelationMarker.js +9 -5
  252. package/dist/development/markers/HasManyRelationMarker.js.map +1 -1
  253. package/dist/development/markers/HasOneRelationMarker.js +8 -4
  254. package/dist/development/markers/HasOneRelationMarker.js.map +1 -1
  255. package/dist/development/markers/MarkerTreeRoot.js +0 -1
  256. package/dist/development/markers/MarkerTreeRoot.js.map +1 -1
  257. package/dist/development/markers/ParentEntityMarker.js +0 -1
  258. package/dist/development/markers/ParentEntityMarker.js.map +1 -1
  259. package/dist/development/markers/PlaceholderGenerator.js +1 -3
  260. package/dist/development/markers/PlaceholderGenerator.js.map +1 -1
  261. package/dist/development/queryLanguage/CacheStore.js +10 -4
  262. package/dist/development/queryLanguage/CacheStore.js.map +1 -1
  263. package/dist/development/queryLanguage/MarkerFactory.js +15 -16
  264. package/dist/development/queryLanguage/MarkerFactory.js.map +1 -1
  265. package/dist/development/queryLanguage/Parser.js +572 -547
  266. package/dist/development/queryLanguage/Parser.js.map +1 -1
  267. package/dist/development/queryLanguage/QueryLanguage.js +32 -27
  268. package/dist/development/queryLanguage/QueryLanguage.js.map +1 -1
  269. package/dist/development/queryLanguage/QueryLanguageError.js +0 -1
  270. package/dist/development/queryLanguage/QueryLanguageError.js.map +1 -1
  271. package/dist/development/queryLanguage/tokenList.js +6 -3
  272. package/dist/development/queryLanguage/tokenList.js.map +1 -1
  273. package/dist/development/structures/BijectiveIndexedMap.js +14 -9
  274. package/dist/development/structures/BijectiveIndexedMap.js.map +1 -1
  275. package/dist/development/structures/LRUCache.js +7 -2
  276. package/dist/development/structures/LRUCache.js.map +1 -1
  277. package/dist/development/structures/WeakIdCache.js +11 -4
  278. package/dist/development/structures/WeakIdCache.js.map +1 -1
  279. package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.js +1 -3
  280. package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.js.map +1 -1
  281. package/dist/development/treeParameters/EntityCreationParameters.js +0 -1
  282. package/dist/development/treeParameters/EntityCreationParameters.js.map +1 -1
  283. package/dist/development/treeParameters/EntityListPreferences.js +0 -1
  284. package/dist/development/treeParameters/EntityListPreferences.js.map +1 -1
  285. package/dist/development/treeParameters/EventListenersStore.js +0 -1
  286. package/dist/development/treeParameters/EventListenersStore.js.map +1 -1
  287. package/dist/development/treeParameters/LeafField.js +0 -1
  288. package/dist/development/treeParameters/LeafField.js.map +1 -1
  289. package/dist/development/treeParameters/QualifiedEntityParameters.js +0 -1
  290. package/dist/development/treeParameters/QualifiedEntityParameters.js.map +1 -1
  291. package/dist/development/treeParameters/Relation.js +0 -1
  292. package/dist/development/treeParameters/Relation.js.map +1 -1
  293. package/dist/development/utils/Hashing.js +0 -1
  294. package/dist/development/utils/Hashing.js.map +1 -1
  295. package/dist/development/utils/assert.js +1 -3
  296. package/dist/development/utils/assert.js.map +1 -1
  297. package/dist/development/utils/assertNever.js +2 -4
  298. package/dist/development/utils/assertNever.js.map +1 -1
  299. package/dist/development/utils/generateEnumerabilityPreventingEntropy.js +0 -1
  300. package/dist/development/utils/generateEnumerabilityPreventingEntropy.js.map +1 -1
  301. package/dist/development/utils/isEmptyObject.js +0 -1
  302. package/dist/development/utils/isEmptyObject.js.map +1 -1
  303. package/dist/development/utils/ucfirst.js +0 -1
  304. package/dist/development/utils/ucfirst.js.map +1 -1
  305. package/dist/production/BindingError.js.map +1 -1
  306. package/dist/production/accessorPropagation/AccessorProvider.js.map +1 -1
  307. package/dist/production/accessorPropagation/BindingOperationsContext.js.map +1 -1
  308. package/dist/production/accessorPropagation/BindingOperationsProvider.js.map +1 -1
  309. package/dist/production/accessorPropagation/EntityKeyContext.js.map +1 -1
  310. package/dist/production/accessorPropagation/EntityKeyProvider.js.map +1 -1
  311. package/dist/production/accessorPropagation/EnvironmentContext.js.map +1 -1
  312. package/dist/production/accessorPropagation/TreeRootIdContext.js.map +1 -1
  313. package/dist/production/accessorPropagation/TreeRootIdProvider.js.map +1 -1
  314. package/dist/production/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
  315. package/dist/production/accessorPropagation/useBindingOperations.js.map +1 -1
  316. package/dist/production/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
  317. package/dist/production/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
  318. package/dist/production/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
  319. package/dist/production/accessorPropagation/useEntity.js.map +1 -1
  320. package/dist/production/accessorPropagation/useEntityKey.js.map +1 -1
  321. package/dist/production/accessorPropagation/useEntityList.js.map +1 -1
  322. package/dist/production/accessorPropagation/useEntityListSubTree.js.map +1 -1
  323. package/dist/production/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
  324. package/dist/production/accessorPropagation/useEntitySubTree.js.map +1 -1
  325. package/dist/production/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
  326. package/dist/production/accessorPropagation/useEnvironment.js.map +1 -1
  327. package/dist/production/accessorPropagation/useField.js.map +1 -1
  328. package/dist/production/accessorPropagation/useGetEntityByKey.js.map +1 -1
  329. package/dist/production/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
  330. package/dist/production/accessorPropagation/useGetEntitySubTree.js.map +1 -1
  331. package/dist/production/accessorPropagation/useGetTreeFilters.js.map +1 -1
  332. package/dist/production/accessorPropagation/useHasEntity.js.map +1 -1
  333. package/dist/production/accessorPropagation/usePersist.js.map +1 -1
  334. package/dist/production/accessorPropagation/useTreeRootId.js.map +1 -1
  335. package/dist/production/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
  336. package/dist/production/accessorSorting/addEntityAtIndex.js.map +1 -1
  337. package/dist/production/accessorSorting/errors.js.map +1 -1
  338. package/dist/production/accessorSorting/moveEntity.js.map +1 -1
  339. package/dist/production/accessorSorting/repairEntitiesOrder.js.map +1 -1
  340. package/dist/production/accessorSorting/sortEntities.js.map +1 -1
  341. package/dist/production/accessorSorting/useSortedEntities.js.map +1 -1
  342. package/dist/production/accessorTree/AccessorTree.js.map +1 -1
  343. package/dist/production/accessorTree/DirtinessContext.js.map +1 -1
  344. package/dist/production/accessorTree/MutationStateContext.js.map +1 -1
  345. package/dist/production/accessorTree/NormalizedPersistedData.js.map +1 -1
  346. package/dist/production/accessorTree/RuntimeId.js.map +1 -1
  347. package/dist/production/accessorTree/accessorTreeStateReducer.js.map +1 -1
  348. package/dist/production/accessorTree/metadataToRequestError.js.map +1 -1
  349. package/dist/production/accessorTree/useDataBinding.js.map +1 -1
  350. package/dist/production/accessorTree/useDirtinessState.js.map +1 -1
  351. package/dist/production/accessorTree/useMutationState.js.map +1 -1
  352. package/dist/production/accessors/EntityAccessor.js.map +1 -1
  353. package/dist/production/accessors/EntityListAccessor.js.map +1 -1
  354. package/dist/production/accessors/ErrorAccessor.js.map +1 -1
  355. package/dist/production/accessors/FieldAccessor.js.map +1 -1
  356. package/dist/production/accessors/TreeRootAccessor.js.map +1 -1
  357. package/dist/production/bindingTypes.js.map +1 -1
  358. package/dist/production/core/AccessorErrorManager.js.map +1 -1
  359. package/dist/production/core/Config.js.map +1 -1
  360. package/dist/production/core/DataBinding.js +22 -11
  361. package/dist/production/core/DataBinding.js.map +1 -1
  362. package/dist/production/core/DirtinessTracker.js.map +1 -1
  363. package/dist/production/core/ErrorsPreprocessor.js.map +1 -1
  364. package/dist/production/core/EventManager.js.map +1 -1
  365. package/dist/production/core/IncrementalMarkerBuilder.js.map +1 -1
  366. package/dist/production/core/MarkerComparator.js +1 -1
  367. package/dist/production/core/MarkerComparator.js.map +1 -1
  368. package/dist/production/core/MarkerMerger.js +1 -4
  369. package/dist/production/core/MarkerMerger.js.map +1 -1
  370. package/dist/production/core/MarkerTreeGenerator.js.map +1 -1
  371. package/dist/production/core/MutationGenerator.js.map +1 -1
  372. package/dist/production/core/QueryGenerator.js.map +1 -1
  373. package/dist/production/core/RealmKeyGenerator.js.map +1 -1
  374. package/dist/production/core/RequestResponseNormalizer.js.map +1 -1
  375. package/dist/production/core/StateInitializer.js +1 -3
  376. package/dist/production/core/StateInitializer.js.map +1 -1
  377. package/dist/production/core/TreeAugmenter.js.map +1 -1
  378. package/dist/production/core/TreeFilterGenerator.js.map +1 -1
  379. package/dist/production/core/TreeParameterMerger.js.map +1 -1
  380. package/dist/production/core/TreeStore.js.map +1 -1
  381. package/dist/production/core/VariableInputTransformer.js +4 -1
  382. package/dist/production/core/VariableInputTransformer.js.map +1 -1
  383. package/dist/production/core/exceptions/ErrorLocator.js.map +1 -1
  384. package/dist/production/core/exceptions/LocalizedBindingError.js.map +1 -1
  385. package/dist/production/core/exceptions/MarkerSugarer.js.map +1 -1
  386. package/dist/production/core/exceptions/TreeParameterSugarer.js.map +1 -1
  387. package/dist/production/core/factories/createBatchUpdatesOptions.js.map +1 -1
  388. package/dist/production/core/operations/EntityOperations.js +1 -1
  389. package/dist/production/core/operations/EntityOperations.js.map +1 -1
  390. package/dist/production/core/operations/FieldOperations.js.map +1 -1
  391. package/dist/production/core/operations/ListOperations.js.map +1 -1
  392. package/dist/production/core/operations/OperationsHelpers.js.map +1 -1
  393. package/dist/production/core/requestAliases/MutationAlias.js.map +1 -1
  394. package/dist/production/core/requestAliases/mutationOperationSubTreeType.js.map +1 -1
  395. package/dist/production/core/requestAliases/mutationOperationType.js.map +1 -1
  396. package/dist/production/core/schema/Schema.js +3 -0
  397. package/dist/production/core/schema/Schema.js.map +1 -1
  398. package/dist/production/core/schema/SchemaLoader.js.map +1 -1
  399. package/dist/production/core/schema/SchemaPreprocessor.js.map +1 -1
  400. package/dist/production/core/state/StateIterator.js.map +1 -1
  401. package/dist/production/core/state/getEntityMarker.js.map +1 -1
  402. package/dist/production/core/utils/getCombinedSignal.js.map +1 -1
  403. package/dist/production/coreComponents/Component.js.map +1 -1
  404. package/dist/production/coreComponents/DataBindingProvider.js.map +1 -1
  405. package/dist/production/coreComponents/Entity.js.map +1 -1
  406. package/dist/production/coreComponents/EntityList.js.map +1 -1
  407. package/dist/production/coreComponents/EntityListSubTree.js +4 -12
  408. package/dist/production/coreComponents/EntityListSubTree.js.map +1 -1
  409. package/dist/production/coreComponents/EntitySubTree.js +4 -22
  410. package/dist/production/coreComponents/EntitySubTree.js.map +1 -1
  411. package/dist/production/coreComponents/Field.js +5 -1
  412. package/dist/production/coreComponents/Field.js.map +1 -1
  413. package/dist/production/coreComponents/HasMany.js +3 -5
  414. package/dist/production/coreComponents/HasMany.js.map +1 -1
  415. package/dist/production/coreComponents/HasOne.js +3 -5
  416. package/dist/production/coreComponents/HasOne.js.map +1 -1
  417. package/dist/production/coreComponents/ParentEntity.js.map +1 -1
  418. package/dist/production/dao/Environment.js +147 -94
  419. package/dist/production/dao/Environment.js.map +1 -1
  420. package/dist/production/dao/TreeNodeEnvironmentFactory.js +159 -0
  421. package/dist/production/dao/TreeNodeEnvironmentFactory.js.map +1 -0
  422. package/dist/production/dao/VariableFieldValue.js.map +1 -1
  423. package/dist/production/entityEvents/useDerivedField.js.map +1 -1
  424. package/dist/production/entityEvents/useEntityBeforePersist.js.map +1 -1
  425. package/dist/production/entityEvents/useEntityBeforeUpdate.js.map +1 -1
  426. package/dist/production/entityEvents/useEntityEvent.js.map +1 -1
  427. package/dist/production/entityEvents/useEntityPersistError.js.map +1 -1
  428. package/dist/production/entityEvents/useEntityPersistSuccess.js.map +1 -1
  429. package/dist/production/entityEvents/useOnConnectionUpdate.js.map +1 -1
  430. package/dist/production/fieldHelpers/helpers/FieldHelper.js.map +1 -1
  431. package/dist/production/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -1
  432. package/dist/production/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
  433. package/dist/production/helperComponents/DeferredSubTrees.js.map +1 -1
  434. package/dist/production/helperComponents/EntityView.js.map +1 -1
  435. package/dist/production/helperComponents/FieldView.js.map +1 -1
  436. package/dist/production/helperComponents/StaticRender.js.map +1 -1
  437. package/dist/production/helperComponents/SugaredField.js.map +1 -1
  438. package/dist/production/index.js +1 -1
  439. package/dist/production/markers/EntityFieldMarkersContainer.js.map +1 -1
  440. package/dist/production/markers/EntityFieldsWithHoistablesMarker.js.map +1 -1
  441. package/dist/production/markers/EntityListSubTreeMarker.js.map +1 -1
  442. package/dist/production/markers/EntitySubTreeMarker.js.map +1 -1
  443. package/dist/production/markers/FieldMarker.js.map +1 -1
  444. package/dist/production/markers/HasManyRelationMarker.js.map +1 -1
  445. package/dist/production/markers/HasOneRelationMarker.js.map +1 -1
  446. package/dist/production/markers/MarkerTreeRoot.js.map +1 -1
  447. package/dist/production/markers/ParentEntityMarker.js.map +1 -1
  448. package/dist/production/markers/PlaceholderGenerator.js.map +1 -1
  449. package/dist/production/queryLanguage/CacheStore.js.map +1 -1
  450. package/dist/production/queryLanguage/MarkerFactory.js +4 -3
  451. package/dist/production/queryLanguage/MarkerFactory.js.map +1 -1
  452. package/dist/production/queryLanguage/Parser.js +24 -7
  453. package/dist/production/queryLanguage/Parser.js.map +1 -1
  454. package/dist/production/queryLanguage/QueryLanguage.js.map +1 -1
  455. package/dist/production/queryLanguage/QueryLanguageError.js.map +1 -1
  456. package/dist/production/queryLanguage/tokenList.js +5 -0
  457. package/dist/production/queryLanguage/tokenList.js.map +1 -1
  458. package/dist/production/structures/BijectiveIndexedMap.js.map +1 -1
  459. package/dist/production/structures/LRUCache.js.map +1 -1
  460. package/dist/production/structures/WeakIdCache.js.map +1 -1
  461. package/dist/production/treeParameterHelpers/wrapFilterInHasOnes.js.map +1 -1
  462. package/dist/production/treeParameters/EntityCreationParameters.js.map +1 -1
  463. package/dist/production/treeParameters/EntityListPreferences.js.map +1 -1
  464. package/dist/production/treeParameters/EventListenersStore.js.map +1 -1
  465. package/dist/production/treeParameters/LeafField.js.map +1 -1
  466. package/dist/production/treeParameters/QualifiedEntityParameters.js.map +1 -1
  467. package/dist/production/treeParameters/Relation.js.map +1 -1
  468. package/dist/production/utils/Hashing.js.map +1 -1
  469. package/dist/production/utils/assert.js.map +1 -1
  470. package/dist/production/utils/assertNever.js +1 -1
  471. package/dist/production/utils/assertNever.js.map +1 -1
  472. package/dist/production/utils/generateEnumerabilityPreventingEntropy.js.map +1 -1
  473. package/dist/production/utils/isEmptyObject.js.map +1 -1
  474. package/dist/production/utils/ucfirst.js.map +1 -1
  475. package/dist/types/accessorTree/MutationRequestResponse.d.ts +4 -0
  476. package/dist/types/accessorTree/MutationRequestResponse.d.ts.map +1 -1
  477. package/dist/types/accessorTree/QueryRequestResponse.d.ts +4 -0
  478. package/dist/types/accessorTree/QueryRequestResponse.d.ts.map +1 -1
  479. package/dist/types/accessorTree/RequestError.d.ts +9 -1
  480. package/dist/types/accessorTree/RequestError.d.ts.map +1 -1
  481. package/dist/types/core/DataBinding.d.ts +1 -0
  482. package/dist/types/core/DataBinding.d.ts.map +1 -1
  483. package/dist/types/core/MarkerMerger.d.ts.map +1 -1
  484. package/dist/types/core/StateInitializer.d.ts.map +1 -1
  485. package/dist/types/core/VariableInputTransformer.d.ts.map +1 -1
  486. package/dist/types/core/schema/Schema.d.ts +2 -0
  487. package/dist/types/core/schema/Schema.d.ts.map +1 -1
  488. package/dist/types/core/schema/index.d.ts +0 -1
  489. package/dist/types/core/schema/index.d.ts.map +1 -1
  490. package/dist/types/coreComponents/EntityListSubTree.d.ts +1 -1
  491. package/dist/types/coreComponents/EntityListSubTree.d.ts.map +1 -1
  492. package/dist/types/coreComponents/EntitySubTree.d.ts +1 -1
  493. package/dist/types/coreComponents/EntitySubTree.d.ts.map +1 -1
  494. package/dist/types/coreComponents/Field.d.ts.map +1 -1
  495. package/dist/types/coreComponents/HasMany.d.ts +1 -1
  496. package/dist/types/coreComponents/HasMany.d.ts.map +1 -1
  497. package/dist/types/coreComponents/HasOne.d.ts +1 -1
  498. package/dist/types/coreComponents/HasOne.d.ts.map +1 -1
  499. package/dist/types/dao/Environment.d.ts +82 -43
  500. package/dist/types/dao/Environment.d.ts.map +1 -1
  501. package/dist/types/dao/TreeNodeEnvironmentFactory.d.ts +19 -0
  502. package/dist/types/dao/TreeNodeEnvironmentFactory.d.ts.map +1 -0
  503. package/dist/types/queryLanguage/MarkerFactory.d.ts.map +1 -1
  504. package/dist/types/queryLanguage/Parser.d.ts +1 -0
  505. package/dist/types/queryLanguage/Parser.d.ts.map +1 -1
  506. package/dist/types/queryLanguage/tokenList.d.ts +1 -0
  507. package/dist/types/queryLanguage/tokenList.d.ts.map +1 -1
  508. package/dist/types/tsconfig.tsbuildinfo +1 -1
  509. package/package.json +13 -10
  510. package/src/accessorTree/MutationRequestResponse.ts +1 -0
  511. package/src/accessorTree/QueryRequestResponse.ts +1 -0
  512. package/src/accessorTree/RequestError.ts +7 -1
  513. package/src/core/DataBinding.ts +27 -28
  514. package/src/core/MarkerMerger.ts +1 -4
  515. package/src/core/StateInitializer.ts +1 -3
  516. package/src/core/VariableInputTransformer.ts +7 -4
  517. package/src/core/schema/Schema.ts +5 -0
  518. package/src/core/schema/index.ts +0 -1
  519. package/src/coreComponents/EntityListSubTree.tsx +5 -16
  520. package/src/coreComponents/EntitySubTree.tsx +17 -32
  521. package/src/coreComponents/Field.tsx +4 -0
  522. package/src/coreComponents/HasMany.tsx +4 -6
  523. package/src/coreComponents/HasOne.tsx +6 -7
  524. package/src/dao/Environment.ts +221 -126
  525. package/src/dao/TreeNodeEnvironmentFactory.ts +228 -0
  526. package/src/queryLanguage/MarkerFactory.ts +5 -3
  527. package/src/queryLanguage/Parser.ts +36 -12
  528. package/src/queryLanguage/tokenList.ts +6 -0
  529. package/src/tsconfig.json +1 -1
  530. package/src/utils/assertNever.ts +1 -1
  531. package/dist/development/core/schema/SchemaValidator.js +0 -118
  532. package/dist/development/core/schema/SchemaValidator.js.map +0 -1
  533. package/dist/types/core/schema/SchemaValidator.d.ts +0 -14
  534. package/dist/types/core/schema/SchemaValidator.d.ts.map +0 -1
  535. package/src/core/schema/SchemaValidator.ts +0 -238
@@ -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.value)\n\t\ttreeStore.entityStore.set(newId.value, 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":";;;;wBAU+B;AAAA,SAChB,4BAAmC;UAC1C,IAAI,aACT;AAAA;AAAA,SAIY,iCACb,WACA,iBAC0C;UACpC,qBAAqB,gBAAgB;UACrC,iBAAiB,UAAU,iBAAiB,IAAI;QAElD,mBAAmB,QAAW;YAC3B,IAAI,aAAa,6CAA6C;AAAA;WAmB9D;AAAA;AAAA,SAGM,eACb,WACA,cACA,kBACA,QACA,OACC;UACK,aAAa,OAAO;cAEhB,YAAY,OAAO,WAAW;cAC9B,YAAY,IAAI,MAAM,OAAO;QAEnC,UAAU;eACH,SAAS,OAAO,OAAO,UAAU;WACtC,cAAc,WAAW,cAAc,kBAAkB,OAAO;UAEjE,EAAE,YAAY,OAAO,OAAO,MAAM;;;;WAKhC,kBAAkB;WAClB,KAAK;AAAA;AAAA,SAGC,cACb,WACA,cACA,kBACA,OACA,OACC;UACK,YAAY,MAAM;UAClB,cAAc,MAAM;UACpB,QAAQ,UAAU;UAElB,iBAAiB,MAAM;UAEvB,YAAY,iBAAiB,sBAAsB,OAAO,UAAU;UACpE,cAAc,kBAAkB,YAAY,OAAO;UAEnD,WAAW;UACX,SAAS;cAIL,KAAK;cACL,OAAO,OAAO;cACd,OAAO,IAAI,aAAa;QAE9B,MAAM,SAAS,eAAe;YAC3B,eAAe,MAAM,SAAS,IAAI;UACpC,cAAc,SAAS,SAAS;qBACtB,QAAQ,MAAM;qBACd,oBAAoB,cAAc,aAAa;AAAA;WAGxD,iCAAiC;AAAA;QAGnC,UAAU,OAAO,SAAS,GAAG;gBACtB,gBAAgB;AAAA;cAGjB,iBAAiB,OAAO;cACxB,iBAAiB,IAAI,aAAa;QAExC,eAAe,SAAS,cAAc;YACnC,OAAO,eAAe;WACvB,SAAS,UAAU,MAAM,OAAO,MAAM;AAAA,eACjC,eAAe,SAAS,UAAU;mBAC/B,0BAA0B,eAAe,QAAQ,eAAe,OAAO;AAAA;UAE/E,SAAS,eAAe;QAC1B,QAAQ;mBACE,oBAAoB,QAAQ,aAAa;AAAA;QAEnD,MAAM,SAAS,eAAe;mBACpB,oBAAoB,OAAO,aAAa;AAAA;AAAA;AAAA,SAIzC,iCAAiC,OAAyB;UAYjE,YAAY,MAAM;QACpB,WAAW;UACV,MAAM,UAAU,QAAQ;kBACjB,OAAO,EAAE,MAAM;AAAA;gBAEhB,aAAa;AAAA;AAAA;AAAA;;"}
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.value)\n\t\ttreeStore.entityStore.set(newId.value, 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,SAChB,4BAAmC;AAC1C,UAAA,IAAI,aACT,+FACD;AAAA,EACD;AAAA,SAEc,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,SAEc,eACb,WACA,cACA,kBACA,QACA,OACC;AACD,UAAM,aAAa,OAAO;AAEhB,cAAA,YAAY,OAAO,WAAW,KAAK;AAC7C,cAAU,YAAY,IAAI,MAAM,OAAO,MAAM;AAE7C,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,SAEc,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,SAEc,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":"MutationAlias.js","sources":["../../../../src/core/requestAliases/MutationAlias.ts"],"sourcesContent":["import type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { PlaceholderName, TreeRootId } from '../../treeParameters'\nimport { mutationOperationSubTreeType } from './mutationOperationSubTreeType'\nimport type { mutationOperationType } from './mutationOperationType'\nimport type { TopLevelMutationOperation } from './TopLevelMutationOperation'\n\nconst mutationAliasRegex = /^(?:(u)|(t)([^t]+)t)(.+)__([cud])([sl])(.+)$/\n\nconst uuidToAliasRegex = /-/g\nconst uuidToAliasReplacement = '_'\n\nconst aliasToUuidRegex = /_/g\nconst aliasToUuidReplacement = '-'\n\n// This is just a random character we use to make sure the alias doesn't start with a number as UUIDs often do.\nconst standaloneUuidPrefix = uuidToAliasReplacement\n\nexport class MutationAlias {\n\tpublic static encodeTopLevel(operation: TopLevelMutationOperation): string {\n\t\tconst treeRootId = operation.treeRootId === undefined ? 'u' : `t${operation.treeRootId.replace('-', '_')}t`\n\t\tconst entityId = operation.entityId.replace(uuidToAliasRegex, uuidToAliasReplacement)\n\n\t\tconst alias = `${treeRootId}${operation.subTreePlaceholder}__${operation.type}${operation.subTreeType}${entityId}`\n\n\t\tif (import.meta.env.DEV) {\n\t\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\t\tif (!matches) {\n\t\t\t\tthrow new BindingError()\n\t\t\t}\n\t\t}\n\n\t\treturn alias\n\t}\n\n\tpublic static decodeTopLevel(alias: string): TopLevelMutationOperation | undefined {\n\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\tif (!matches) {\n\t\t\treturn undefined\n\t\t}\n\t\tconst treeRootId: TreeRootId | undefined = matches[1] === 'u' ? undefined : matches[3]\n\t\tconst subTreePlaceholder: PlaceholderName = matches[4]\n\t\tconst type = matches[5] as typeof mutationOperationType[keyof typeof mutationOperationType]\n\t\tconst subTreeType =\n\t\t\tmatches[6] === 's' ? mutationOperationSubTreeType.singleEntity : mutationOperationSubTreeType.entityList\n\t\tconst entityId = matches[7].replace(aliasToUuidRegex, aliasToUuidReplacement)\n\n\t\treturn {\n\t\t\ttreeRootId,\n\t\t\tsubTreePlaceholder,\n\t\t\ttype,\n\t\t\tsubTreeType,\n\t\t\tentityId,\n\t\t}\n\t}\n\n\tpublic static encodeEntityId(entityId: RuntimeId): string {\n\t\treturn `${standaloneUuidPrefix}${entityId.value.replace(uuidToAliasRegex, uuidToAliasReplacement)}`\n\t}\n\n\tpublic static decodeEntityId(alias: string): RuntimeId['value'] {\n\t\treturn `${alias.substring(standaloneUuidPrefix.length).replace(aliasToUuidRegex, aliasToUuidReplacement)}`\n\t}\n}\n"],"names":[],"mappings":";AAOA,MAAM,qBAAqB;AAE3B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAE/B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAG/B,MAAM,uBAAuB;oBAEF;AAAA,SACZ,eAAe,WAA8C;UACpE,aAAa,UAAU,eAAe,SAAY,MAAM,IAAI,UAAU,WAAW,QAAQ,KAAK;UAC9F,WAAW,UAAU,SAAS,QAAQ,kBAAkB;UAExD,QAAQ,GAAG,aAAa,UAAU,uBAAuB,UAAU,OAAO,UAAU,cAAc;WAUjG;AAAA;AAAA,SAGM,eAAe,OAAsD;UAC5E,UAAU,MAAM,MAAM;QAExB,CAAC,SAAS;aACN;AAAA;UAEF,aAAqC,QAAQ,OAAO,MAAM,SAAY,QAAQ;UAC9E,qBAAsC,QAAQ;UAC9C,OAAO,QAAQ;UACf,cACL,QAAQ,OAAO,MAAM,6BAA6B,eAAe,6BAA6B;UACzF,WAAW,QAAQ,GAAG,QAAQ,kBAAkB;WAE/C;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA,SAIY,eAAe,UAA6B;WAClD,GAAG,uBAAuB,SAAS,MAAM,QAAQ,kBAAkB;AAAA;AAAA,SAG7D,eAAe,OAAmC;WACxD,GAAG,MAAM,UAAU,qBAAqB,QAAQ,QAAQ,kBAAkB;AAAA;AAAA;;"}
1
+ {"version":3,"file":"MutationAlias.js","sources":["../../../../src/core/requestAliases/MutationAlias.ts"],"sourcesContent":["import type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { PlaceholderName, TreeRootId } from '../../treeParameters'\nimport { mutationOperationSubTreeType } from './mutationOperationSubTreeType'\nimport type { mutationOperationType } from './mutationOperationType'\nimport type { TopLevelMutationOperation } from './TopLevelMutationOperation'\n\nconst mutationAliasRegex = /^(?:(u)|(t)([^t]+)t)(.+)__([cud])([sl])(.+)$/\n\nconst uuidToAliasRegex = /-/g\nconst uuidToAliasReplacement = '_'\n\nconst aliasToUuidRegex = /_/g\nconst aliasToUuidReplacement = '-'\n\n// This is just a random character we use to make sure the alias doesn't start with a number as UUIDs often do.\nconst standaloneUuidPrefix = uuidToAliasReplacement\n\nexport class MutationAlias {\n\tpublic static encodeTopLevel(operation: TopLevelMutationOperation): string {\n\t\tconst treeRootId = operation.treeRootId === undefined ? 'u' : `t${operation.treeRootId.replace('-', '_')}t`\n\t\tconst entityId = operation.entityId.replace(uuidToAliasRegex, uuidToAliasReplacement)\n\n\t\tconst alias = `${treeRootId}${operation.subTreePlaceholder}__${operation.type}${operation.subTreeType}${entityId}`\n\n\t\tif (import.meta.env.DEV) {\n\t\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\t\tif (!matches) {\n\t\t\t\tthrow new BindingError()\n\t\t\t}\n\t\t}\n\n\t\treturn alias\n\t}\n\n\tpublic static decodeTopLevel(alias: string): TopLevelMutationOperation | undefined {\n\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\tif (!matches) {\n\t\t\treturn undefined\n\t\t}\n\t\tconst treeRootId: TreeRootId | undefined = matches[1] === 'u' ? undefined : matches[3]\n\t\tconst subTreePlaceholder: PlaceholderName = matches[4]\n\t\tconst type = matches[5] as typeof mutationOperationType[keyof typeof mutationOperationType]\n\t\tconst subTreeType =\n\t\t\tmatches[6] === 's' ? mutationOperationSubTreeType.singleEntity : mutationOperationSubTreeType.entityList\n\t\tconst entityId = matches[7].replace(aliasToUuidRegex, aliasToUuidReplacement)\n\n\t\treturn {\n\t\t\ttreeRootId,\n\t\t\tsubTreePlaceholder,\n\t\t\ttype,\n\t\t\tsubTreeType,\n\t\t\tentityId,\n\t\t}\n\t}\n\n\tpublic static encodeEntityId(entityId: RuntimeId): string {\n\t\treturn `${standaloneUuidPrefix}${entityId.value.replace(uuidToAliasRegex, uuidToAliasReplacement)}`\n\t}\n\n\tpublic static decodeEntityId(alias: string): RuntimeId['value'] {\n\t\treturn `${alias.substring(standaloneUuidPrefix.length).replace(aliasToUuidRegex, aliasToUuidReplacement)}`\n\t}\n}\n"],"names":[],"mappings":";AAOA,MAAM,qBAAqB;AAE3B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAE/B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAG/B,MAAM,uBAAuB;AAEtB,MAAM,cAAc;AAAA,SACZ,eAAe,WAA8C;AACpE,UAAA,aAAa,UAAU,eAAe,SAAY,MAAM,IAAI,UAAU,WAAW,QAAQ,KAAK,GAAG;AACvG,UAAM,WAAW,UAAU,SAAS,QAAQ,kBAAkB,sBAAsB;AAE9E,UAAA,QAAQ,GAAG,aAAa,UAAU,uBAAuB,UAAU,OAAO,UAAU,cAAc;AAUjG,WAAA;AAAA,EACR;AAAA,SAEc,eAAe,OAAsD;AAC5E,UAAA,UAAU,MAAM,MAAM,kBAAkB;AAE9C,QAAI,CAAC,SAAS;AACN,aAAA;AAAA,IACR;AACA,UAAM,aAAqC,QAAQ,OAAO,MAAM,SAAY,QAAQ;AACpF,UAAM,qBAAsC,QAAQ;AACpD,UAAM,OAAO,QAAQ;AACrB,UAAM,cACL,QAAQ,OAAO,MAAM,6BAA6B,eAAe,6BAA6B;AAC/F,UAAM,WAAW,QAAQ,GAAG,QAAQ,kBAAkB,sBAAsB;AAErE,WAAA;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEF;AAAA,SAEc,eAAe,UAA6B;AACzD,WAAO,GAAG,uBAAuB,SAAS,MAAM,QAAQ,kBAAkB,sBAAsB;AAAA,EACjG;AAAA,SAEc,eAAe,OAAmC;AACxD,WAAA,GAAG,MAAM,UAAU,qBAAqB,MAAM,EAAE,QAAQ,kBAAkB,sBAAsB;AAAA,EACxG;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"mutationOperationSubTreeType.js","sources":["../../../../src/core/requestAliases/mutationOperationSubTreeType.ts"],"sourcesContent":["export const mutationOperationSubTreeType = {\n\tsingleEntity: 's',\n\tentityList: 'l',\n} as const\n"],"names":[],"mappings":"MAAa,+BAA+B;AAAA,EAC3C,cAAc;AAAA,EACd,YAAY;AAAA;;"}
1
+ {"version":3,"file":"mutationOperationSubTreeType.js","sources":["../../../../src/core/requestAliases/mutationOperationSubTreeType.ts"],"sourcesContent":["export const mutationOperationSubTreeType = {\n\tsingleEntity: 's',\n\tentityList: 'l',\n} as const\n"],"names":[],"mappings":"AAAO,MAAM,+BAA+B;AAAA,EAC3C,cAAc;AAAA,EACd,YAAY;AACb;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"mutationOperationType.js","sources":["../../../../src/core/requestAliases/mutationOperationType.ts"],"sourcesContent":["export const mutationOperationType = {\n\tcreate: 'c',\n\tupdate: 'u',\n\tdelete: 'd',\n} as const\n"],"names":[],"mappings":"MAAa,wBAAwB;AAAA,EACpC,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA;;"}
1
+ {"version":3,"file":"mutationOperationType.js","sources":["../../../../src/core/requestAliases/mutationOperationType.ts"],"sourcesContent":["export const mutationOperationType = {\n\tcreate: 'c',\n\tupdate: 'u',\n\tdelete: 'd',\n} as const\n"],"names":[],"mappings":"AAAO,MAAM,wBAAwB;AAAA,EACpC,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AACT;;"}
@@ -2,6 +2,9 @@ class Schema {
2
2
  constructor(store) {
3
3
  this.store = store;
4
4
  }
5
+ getEntity(entityName) {
6
+ return this.store.entities.get(entityName);
7
+ }
5
8
  getEntityField(entityName, field) {
6
9
  return this.store.entities.get(entityName)?.fields.get(field);
7
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Schema.js","sources":["../../../../src/core/schema/Schema.ts"],"sourcesContent":["import type { EntityName, FieldName } from '../../treeParameters'\nimport type { SchemaField } from './SchemaField'\nimport type { SchemaStore } from './SchemaStore'\n\nexport class Schema {\n\tpublic constructor(public readonly store: SchemaStore) {}\n\n\tpublic getEntityField(entityName: EntityName, field: FieldName): SchemaField | undefined {\n\t\treturn this.store.entities.get(entityName)?.fields.get(field)\n\t}\n}\n"],"names":[],"mappings":"aAIoB;AAAA,EACZ,YAA4B,OAAoB;;;EAEhD,eAAe,YAAwB,OAA2C;WACjF,KAAK,MAAM,SAAS,IAAI,aAAa,OAAO,IAAI;AAAA;AAAA;;"}
1
+ {"version":3,"file":"Schema.js","sources":["../../../../src/core/schema/Schema.ts"],"sourcesContent":["import type { EntityName, FieldName } from '../../treeParameters'\nimport type { SchemaField } from './SchemaField'\nimport type { SchemaStore } from './SchemaStore'\nimport { SchemaEntity } from './SchemaEntity'\n\nexport class Schema {\n\tpublic constructor(public readonly store: SchemaStore) {}\n\n\tpublic getEntity(entityName: EntityName): SchemaEntity | undefined {\n\t\treturn this.store.entities.get(entityName)\n\t}\n\n\tpublic getEntityField(entityName: EntityName, field: FieldName): SchemaField | undefined {\n\t\treturn this.store.entities.get(entityName)?.fields.get(field)\n\t}\n}\n"],"names":[],"mappings":"AAKO,MAAM,OAAO;AAAA,EACZ,YAA4B,OAAoB;AAApB,SAAA,QAAA;AAAA,EAAqB;AAAA,EAEjD,UAAU,YAAkD;AAClE,WAAO,KAAK,MAAM,SAAS,IAAI,UAAU;AAAA,EAC1C;AAAA,EAEO,eAAe,YAAwB,OAA2C;AACjF,WAAA,KAAK,MAAM,SAAS,IAAI,UAAU,GAAG,OAAO,IAAI,KAAK;AAAA,EAC7D;AACD;;"}
@@ -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 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\tmaxAttempts: number,\n\t\toptions?: GraphQlClientRequestOptions,\n\t): Promise<Schema> {\n\t\treturn new Promise<Schema>(async (resolve, reject) => {\n\t\t\tfor (let attemptNumber = 0; attemptNumber < Math.max(1, maxAttempts); attemptNumber++) {\n\t\t\t\ttry {\n\t\t\t\t\tconst raw: { data: { schema: RawSchema } } = await client.sendRequest(this.schemaQuery, options)\n\t\t\t\t\tconst schema = new Schema(SchemaPreprocessor.processRawSchema(raw.data.schema))\n\t\t\t\t\treturn resolve(schema)\n\t\t\t\t} catch {}\n\t\t\t}\n\t\t\treject()\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;mBAK0B;AAAA,eAwCL,WACnB,QACA,aACA,SACkB;WACX,IAAI,QAAgB,OAAO,SAAS,WAAW;eAC5C,gBAAgB,GAAG,gBAAgB,KAAK,IAAI,GAAG,cAAc,iBAAiB;YAClF;gBACG,MAAuC,MAAM,OAAO,YAAY,KAAK,aAAa;gBAClF,SAAS,IAAI,OAAO,mBAAmB,iBAAiB,IAAI,KAAK;iBAChE,QAAQ;AAAA;;;;;;;AAjDK,4BAAA,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 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\tmaxAttempts: number,\n\t\toptions?: GraphQlClientRequestOptions,\n\t): Promise<Schema> {\n\t\treturn new Promise<Schema>(async (resolve, reject) => {\n\t\t\tfor (let attemptNumber = 0; attemptNumber < Math.max(1, maxAttempts); attemptNumber++) {\n\t\t\t\ttry {\n\t\t\t\t\tconst raw: { data: { schema: RawSchema } } = await client.sendRequest(this.schemaQuery, options)\n\t\t\t\t\tconst schema = new Schema(SchemaPreprocessor.processRawSchema(raw.data.schema))\n\t\t\t\t\treturn resolve(schema)\n\t\t\t\t} catch {}\n\t\t\t}\n\t\t\treject()\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAKO,MAAM,aAAa;AAAA,eAwCL,WACnB,QACA,aACA,SACkB;AAClB,WAAO,IAAI,QAAgB,OAAO,SAAS,WAAW;AAC5C,eAAA,gBAAgB,GAAG,gBAAgB,KAAK,IAAI,GAAG,WAAW,GAAG,iBAAiB;AAClF,YAAA;AACH,gBAAM,MAAuC,MAAM,OAAO,YAAY,KAAK,aAAa,OAAO;AACzF,gBAAA,SAAS,IAAI,OAAO,mBAAmB,iBAAiB,IAAI,KAAK,MAAM,CAAC;AAC9E,iBAAO,QAAQ,MAAM;AAAA,QAAA,QACpB;AAAA,QAAO;AAAA,MACV;AACO;IAAA,CACP;AAAA,EACF;AACD;AAvDyB,cADlB,cACkB,eACvB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaPreprocessor.js","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,\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":"yBAQgC;AAAA,SACjB,iBAAiB,WAAmC;WAC1D;AAAA,MACN,OAAO,KAAK,gBAAgB,UAAU;AAAA,MACtC,UAAU,KAAK,mBAAmB,UAAU;AAAA;AAAA;AAAA,SAI/B,gBAAgB,UAAwC;UAChE,4BAAyB;eAEpB,EAAE,MAAM,YAAY,UAAU;YAClC,IAAI,MAAM,IAAI,IAAI;AAAA;WAGlB;AAAA;AAAA,SAGO,mBAAmB,aAAgD;UAC3E,+BAA+B;eAE1B,UAAU,aAAa;eACxB,IAAI,OAAO,MAAM;AAAA,QACzB,sBAAsB,OAAO;AAAA,QAC7B,QAAQ,KAAK,iBAAiB,OAAO;AAAA,QACrC,MAAM,OAAO;AAAA,QACb,QAAQ,OAAO;AAAA;AAAA;WAIV;AAAA;AAAA,SAGO,iBAAiB,WAA0C;UACnE,6BAA2B;eAEtB,SAAS,WAAW;aACvB,IAAI,MAAM,MAAM;AAAA;WAGjB;AAAA;AAAA;;"}
1
+ {"version":3,"file":"SchemaPreprocessor.js","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,\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,SACjB,iBAAiB,WAAmC;AAC1D,WAAA;AAAA,MACN,OAAO,KAAK,gBAAgB,UAAU,KAAK;AAAA,MAC3C,UAAU,KAAK,mBAAmB,UAAU,QAAQ;AAAA,IAAA;AAAA,EAEtD;AAAA,SAEe,gBAAgB,UAAwC;AAChE,UAAA,4BAAyB;AAEpB,eAAA,EAAE,MAAM,YAAY,UAAU;AACxC,YAAM,IAAI,MAAM,IAAI,IAAI,MAAM,CAAC;AAAA,IAChC;AAEO,WAAA;AAAA,EACR;AAAA,SAEe,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;AAAA,MAAA,CACf;AAAA,IACF;AAEO,WAAA;AAAA,EACR;AAAA,SAEe,iBAAiB,WAA0C;AACnE,UAAA,6BAA2B;AAEjC,eAAW,SAAS,WAAW;AACvB,aAAA,IAAI,MAAM,MAAM,KAAK;AAAA,IAC7B;AAEO,WAAA;AAAA,EACR;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"StateIterator.js","sources":["../../../../src/core/state/StateIterator.ts"],"sourcesContent":["import { FieldMarker, HasManyRelationMarker, HasOneRelationMarker } from '../../markers'\nimport type { FieldValue, PlaceholderName } from '../../treeParameters'\nimport { assertNever } from '../../utils'\nimport type { TreeStore } from '../TreeStore'\nimport type { EntityListState } from './EntityListState'\nimport type { EntityRealmState, EntityRealmStateStub } from './EntityRealmState'\nimport type { FieldState } from './FieldState'\nimport { getEntityMarker } from './getEntityMarker'\nimport type { RootStateNode, StateINode, StateNode } from './StateNode'\n\nexport class StateIterator {\n\tpublic static *eachSiblingRealm(\n\t\tstate: EntityRealmState,\n\t\trelevantPlaceholder?: PlaceholderName,\n\t): IterableIterator<EntityRealmState> {\n\t\tfor (let [realmKey, realm] of state.entity.realms) {\n\t\t\tif (realm.type === 'entityRealmStub') {\n\t\t\t\tif (relevantPlaceholder === undefined || getEntityMarker(realm).fields.placeholders.has(relevantPlaceholder)) {\n\t\t\t\t\trealm.getAccessor()\n\t\t\t\t\trealm = state.entity.realms.get(realmKey) as EntityRealmState\n\t\t\t\t} else {\n\t\t\t\t\t// This realm is irrelevant. No need to force-initialize it.\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tyield realm\n\t\t}\n\t}\n\n\t// Note that this only yields siblings with the same placeholderName!\n\tpublic static *eachSiblingRealmChild<Value extends FieldValue, S extends EntityListState | FieldState<Value>>(\n\t\ttreeStore: TreeStore,\n\t\tstate: S & StateNode<Value>,\n\t): IterableIterator<S> {\n\t\tif (state.type === 'entityList' && state.blueprint.parent === undefined) {\n\t\t\t// Top-level entity list\n\t\t\tfor (const [, rootStates] of treeStore.subTreeStatesByRoot) {\n\t\t\t\tconst rootList = rootStates.get(state.blueprint.marker.placeholderName)\n\t\t\t\tif (rootList?.type === 'entityList') {\n\t\t\t\t\tyield rootList as S\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tlet closestEntityRealm: EntityRealmState\n\t\tlet placeholderName: PlaceholderName\n\n\t\tif (state.type === 'field') {\n\t\t\tclosestEntityRealm = state.parent\n\t\t\tplaceholderName = state.placeholderName\n\t\t} else if (state.type === 'entityList') {\n\t\t\tclosestEntityRealm = state.blueprint.parent! // The parent-less case is handled above. Hence the assertion.\n\t\t\tplaceholderName = state.blueprint.marker.placeholderName\n\t\t} else {\n\t\t\treturn assertNever(state)\n\t\t}\n\n\t\tfor (const realm of this.eachSiblingRealm(closestEntityRealm, placeholderName)) {\n\t\t\tconst child = realm.children.get(placeholderName)\n\t\t\tif (child === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (child.type === state.type) {\n\t\t\t\tyield child as S\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static *depthFirstAllNodes(root: StateNode): IterableIterator<StateNode> {\n\t\tswitch (root.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList':\n\t\t\t\tfor (const childState of root.children.values()) {\n\t\t\t\t\tswitch (childState.type) {\n\t\t\t\t\t\tcase 'field':\n\t\t\t\t\t\tcase 'entityRealm':\n\t\t\t\t\t\tcase 'entityList':\n\t\t\t\t\t\t\tyield* this.depthFirstAllNodes(childState)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase 'entityRealmStub':\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn assertNever(childState)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'field':\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\treturn assertNever(root)\n\t\t}\n\t\tyield root\n\t}\n\n\tpublic static *depthFirstINodes(\n\t\troot: StateINode,\n\t\tmatch?: (iNode: StateINode) => boolean,\n\t): IterableIterator<StateINode> {\n\t\tswitch (root.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList':\n\t\t\t\tfor (const childState of root.children.values()) {\n\t\t\t\t\tif (childState.type === 'entityRealm' || childState.type === 'entityList') {\n\t\t\t\t\t\tyield* this.depthFirstINodes(childState, match)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\treturn assertNever(root)\n\t\t}\n\t\tif (match === undefined || match(root)) {\n\t\t\tyield root\n\t\t}\n\t}\n\n\tpublic static *eachRootState(treeStore: TreeStore): IterableIterator<[PlaceholderName, RootStateNode]> {\n\t\tfor (const rootStates of treeStore.subTreeStatesByRoot.values()) {\n\t\t\tyield* rootStates.entries()\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;oBAU2B;AAAA,UACX,iBACd,OACA,qBACqC;aAC5B,CAAC,UAAU,UAAU,MAAM,OAAO,QAAQ;UAC9C,MAAM,SAAS,mBAAmB;YACjC,wBAAwB,UAAa,gBAAgB,OAAO,OAAO,aAAa,IAAI,sBAAsB;gBACvG;kBACE,MAAM,OAAO,OAAO,IAAI;AAAA,eAC1B;;;;YAKF;AAAA;AAAA;AAAA,UAKO,sBACd,WACA,OACsB;QAClB,MAAM,SAAS,gBAAgB,MAAM,UAAU,WAAW,QAAW;iBAE7D,GAAG,eAAe,UAAU,qBAAqB;cACrD,WAAW,WAAW,IAAI,MAAM,UAAU,OAAO;YACnD,UAAU,SAAS,cAAc;gBAC9B;AAAA;AAAA;;;QAML;QACA;QAEA,MAAM,SAAS,SAAS;2BACN,MAAM;wBACT,MAAM;AAAA,eACd,MAAM,SAAS,cAAc;2BAClB,MAAM,UAAU;wBACnB,MAAM,UAAU,OAAO;AAAA,WACnC;aACC;AAAA;eAGG,SAAS,KAAK,iBAAiB,oBAAoB,kBAAkB;YACzE,QAAQ,MAAM,SAAS,IAAI;UAC7B,UAAU,QAAW;;;UAGrB,MAAM,SAAS,MAAM,MAAM;cACxB;AAAA;AAAA;AAAA;AAAA,UAKM,mBAAmB,MAA8C;YACvE,KAAK;AAAA,WACP;AAAA,WACA;mBACO,cAAc,KAAK,SAAS,UAAU;kBACxC,WAAW;AAAA,iBACb;AAAA,iBACA;AAAA,iBACA;qBACG,KAAK,mBAAmB;;iBAE3B;;;qBAGG;AAAA;AAAA;;WAIN;;;eAGG;AAAA;UAEH;AAAA;AAAA,UAGQ,iBACd,MACA,OAC+B;YACvB,KAAK;AAAA,WACP;AAAA,WACA;mBACO,cAAc,KAAK,SAAS,UAAU;cAC5C,WAAW,SAAS,iBAAiB,WAAW,SAAS,cAAc;mBACnE,KAAK,iBAAiB,YAAY;AAAA;AAAA;;;eAKpC;AAAA;QAEL,UAAU,UAAa,MAAM,OAAO;YACjC;AAAA;AAAA;AAAA,UAIO,cAAc,WAA0E;eAC3F,cAAc,UAAU,oBAAoB,UAAU;aACzD,WAAW;AAAA;AAAA;AAAA;;"}
1
+ {"version":3,"file":"StateIterator.js","sources":["../../../../src/core/state/StateIterator.ts"],"sourcesContent":["import { FieldMarker, HasManyRelationMarker, HasOneRelationMarker } from '../../markers'\nimport type { FieldValue, PlaceholderName } from '../../treeParameters'\nimport { assertNever } from '../../utils'\nimport type { TreeStore } from '../TreeStore'\nimport type { EntityListState } from './EntityListState'\nimport type { EntityRealmState, EntityRealmStateStub } from './EntityRealmState'\nimport type { FieldState } from './FieldState'\nimport { getEntityMarker } from './getEntityMarker'\nimport type { RootStateNode, StateINode, StateNode } from './StateNode'\n\nexport class StateIterator {\n\tpublic static *eachSiblingRealm(\n\t\tstate: EntityRealmState,\n\t\trelevantPlaceholder?: PlaceholderName,\n\t): IterableIterator<EntityRealmState> {\n\t\tfor (let [realmKey, realm] of state.entity.realms) {\n\t\t\tif (realm.type === 'entityRealmStub') {\n\t\t\t\tif (relevantPlaceholder === undefined || getEntityMarker(realm).fields.placeholders.has(relevantPlaceholder)) {\n\t\t\t\t\trealm.getAccessor()\n\t\t\t\t\trealm = state.entity.realms.get(realmKey) as EntityRealmState\n\t\t\t\t} else {\n\t\t\t\t\t// This realm is irrelevant. No need to force-initialize it.\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tyield realm\n\t\t}\n\t}\n\n\t// Note that this only yields siblings with the same placeholderName!\n\tpublic static *eachSiblingRealmChild<Value extends FieldValue, S extends EntityListState | FieldState<Value>>(\n\t\ttreeStore: TreeStore,\n\t\tstate: S & StateNode<Value>,\n\t): IterableIterator<S> {\n\t\tif (state.type === 'entityList' && state.blueprint.parent === undefined) {\n\t\t\t// Top-level entity list\n\t\t\tfor (const [, rootStates] of treeStore.subTreeStatesByRoot) {\n\t\t\t\tconst rootList = rootStates.get(state.blueprint.marker.placeholderName)\n\t\t\t\tif (rootList?.type === 'entityList') {\n\t\t\t\t\tyield rootList as S\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tlet closestEntityRealm: EntityRealmState\n\t\tlet placeholderName: PlaceholderName\n\n\t\tif (state.type === 'field') {\n\t\t\tclosestEntityRealm = state.parent\n\t\t\tplaceholderName = state.placeholderName\n\t\t} else if (state.type === 'entityList') {\n\t\t\tclosestEntityRealm = state.blueprint.parent! // The parent-less case is handled above. Hence the assertion.\n\t\t\tplaceholderName = state.blueprint.marker.placeholderName\n\t\t} else {\n\t\t\treturn assertNever(state)\n\t\t}\n\n\t\tfor (const realm of this.eachSiblingRealm(closestEntityRealm, placeholderName)) {\n\t\t\tconst child = realm.children.get(placeholderName)\n\t\t\tif (child === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (child.type === state.type) {\n\t\t\t\tyield child as S\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static *depthFirstAllNodes(root: StateNode): IterableIterator<StateNode> {\n\t\tswitch (root.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList':\n\t\t\t\tfor (const childState of root.children.values()) {\n\t\t\t\t\tswitch (childState.type) {\n\t\t\t\t\t\tcase 'field':\n\t\t\t\t\t\tcase 'entityRealm':\n\t\t\t\t\t\tcase 'entityList':\n\t\t\t\t\t\t\tyield* this.depthFirstAllNodes(childState)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase 'entityRealmStub':\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn assertNever(childState)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'field':\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\treturn assertNever(root)\n\t\t}\n\t\tyield root\n\t}\n\n\tpublic static *depthFirstINodes(\n\t\troot: StateINode,\n\t\tmatch?: (iNode: StateINode) => boolean,\n\t): IterableIterator<StateINode> {\n\t\tswitch (root.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList':\n\t\t\t\tfor (const childState of root.children.values()) {\n\t\t\t\t\tif (childState.type === 'entityRealm' || childState.type === 'entityList') {\n\t\t\t\t\t\tyield* this.depthFirstINodes(childState, match)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\treturn assertNever(root)\n\t\t}\n\t\tif (match === undefined || match(root)) {\n\t\t\tyield root\n\t\t}\n\t}\n\n\tpublic static *eachRootState(treeStore: TreeStore): IterableIterator<[PlaceholderName, RootStateNode]> {\n\t\tfor (const rootStates of treeStore.subTreeStatesByRoot.values()) {\n\t\t\tyield* rootStates.entries()\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAUO,MAAM,cAAc;AAAA,UACX,iBACd,OACA,qBACqC;AACrC,aAAS,CAAC,UAAU,UAAU,MAAM,OAAO,QAAQ;AAC9C,UAAA,MAAM,SAAS,mBAAmB;AACjC,YAAA,wBAAwB,UAAa,gBAAgB,KAAK,EAAE,OAAO,aAAa,IAAI,mBAAmB,GAAG;AAC7G,gBAAM,YAAY;AAClB,kBAAQ,MAAM,OAAO,OAAO,IAAI,QAAQ;AAAA,QAAA,OAClC;AAEN;AAAA,QACD;AAAA,MACD;AACM,YAAA;AAAA,IACP;AAAA,EACD;AAAA,UAGe,sBACd,WACA,OACsB;AACtB,QAAI,MAAM,SAAS,gBAAgB,MAAM,UAAU,WAAW,QAAW;AAExE,iBAAW,CAAG,EAAA,eAAe,UAAU,qBAAqB;AAC3D,cAAM,WAAW,WAAW,IAAI,MAAM,UAAU,OAAO,eAAe;AAClE,YAAA,UAAU,SAAS,cAAc;AAC9B,gBAAA;AAAA,QACP;AAAA,MACD;AACA;AAAA,IACD;AAEI,QAAA;AACA,QAAA;AAEA,QAAA,MAAM,SAAS,SAAS;AAC3B,2BAAqB,MAAM;AAC3B,wBAAkB,MAAM;AAAA,IAAA,WACd,MAAM,SAAS,cAAc;AACvC,2BAAqB,MAAM,UAAU;AACnB,wBAAA,MAAM,UAAU,OAAO;AAAA,IAAA,OACnC;AACN,aAAO,YAAiB;AAAA,IACzB;AAEA,eAAW,SAAS,KAAK,iBAAiB,oBAAoB,eAAe,GAAG;AAC/E,YAAM,QAAQ,MAAM,SAAS,IAAI,eAAe;AAChD,UAAI,UAAU,QAAW;AACxB;AAAA,MACD;AACI,UAAA,MAAM,SAAS,MAAM,MAAM;AACxB,cAAA;AAAA,MACP;AAAA,IACD;AAAA,EACD;AAAA,UAEe,mBAAmB,MAA8C;AAC/E,YAAQ,KAAK;AAAA,WACP;AAAA,WACA;AACJ,mBAAW,cAAc,KAAK,SAAS,OAAA,GAAU;AAChD,kBAAQ,WAAW;AAAA,iBACb;AAAA,iBACA;AAAA,iBACA;AACG,qBAAA,KAAK,mBAAmB,UAAU;AACzC;AAAA,iBACI;AACJ;AAAA;AAEA,qBAAO,YAAsB;AAAA;AAAA,QAEhC;AACA;AAAA,WACI;AACJ;AAAA;AAEA,eAAO,YAAgB;AAAA;AAEnB,UAAA;AAAA,EACP;AAAA,UAEe,iBACd,MACA,OAC+B;AAC/B,YAAQ,KAAK;AAAA,WACP;AAAA,WACA;AACJ,mBAAW,cAAc,KAAK,SAAS,OAAA,GAAU;AAChD,cAAI,WAAW,SAAS,iBAAiB,WAAW,SAAS,cAAc;AACnE,mBAAA,KAAK,iBAAiB,YAAY,KAAK;AAAA,UAC/C;AAAA,QACD;AACA;AAAA;AAEA,eAAO,YAAgB;AAAA;AAEzB,QAAI,UAAU,UAAa,MAAM,IAAI,GAAG;AACjC,YAAA;AAAA,IACP;AAAA,EACD;AAAA,UAEe,cAAc,WAA0E;AACtG,eAAW,cAAc,UAAU,oBAAoB,OAAA,GAAU;AAChE,aAAO,WAAW;IACnB;AAAA,EACD;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"getEntityMarker.js","sources":["../../../../src/core/state/getEntityMarker.ts"],"sourcesContent":["import type { EntityRealmState, EntityRealmStateStub } from './EntityRealmState'\n\nexport const getEntityMarker = (realm: EntityRealmState | EntityRealmStateStub) =>\n\trealm.blueprint.type === 'listEntity' ? realm.blueprint.parent.blueprint.marker : realm.blueprint.marker\n"],"names":[],"mappings":"MAEa,kBAAkB,CAAC,UAC/B,MAAM,UAAU,SAAS,eAAe,MAAM,UAAU,OAAO,UAAU,SAAS,MAAM,UAAU;;"}
1
+ {"version":3,"file":"getEntityMarker.js","sources":["../../../../src/core/state/getEntityMarker.ts"],"sourcesContent":["import type { EntityRealmState, EntityRealmStateStub } from './EntityRealmState'\n\nexport const getEntityMarker = (realm: EntityRealmState | EntityRealmStateStub) =>\n\trealm.blueprint.type === 'listEntity' ? realm.blueprint.parent.blueprint.marker : realm.blueprint.marker\n"],"names":[],"mappings":"AAEO,MAAM,kBAAkB,CAAC,UAC/B,MAAM,UAAU,SAAS,eAAe,MAAM,UAAU,OAAO,UAAU,SAAS,MAAM,UAAU;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"getCombinedSignal.js","sources":["../../../../src/core/utils/getCombinedSignal.ts"],"sourcesContent":["// Returns a signal that aborts when all present signals are aborted.\nexport const getCombinedSignal = (components: Iterable<AbortSignal | undefined>): AbortSignal => {\n\tlet abortedCount = 0\n\tlet signalCount = 0\n\n\tconst controller = new AbortController()\n\tconst refresh = () => {\n\t\tif (signalCount === 0) {\n\t\t\treturn\n\t\t}\n\t\tif (abortedCount >= signalCount) {\n\t\t\tcontroller.abort()\n\t\t}\n\t}\n\n\tfor (const component of components) {\n\t\tif (!component) {\n\t\t\tcontinue\n\t\t}\n\n\t\tsignalCount++\n\n\t\tif (component.aborted) {\n\t\t\tabortedCount++\n\t\t} else {\n\t\t\tcomponent.addEventListener('abort', () => {\n\t\t\t\tabortedCount++\n\t\t\t\trefresh()\n\t\t\t})\n\t\t}\n\t}\n\n\trefresh()\n\n\treturn controller.signal\n}\n"],"names":[],"mappings":"MACa,oBAAoB,CAAC,eAA+D;MAC5F,eAAe;MACf,cAAc;QAEZ,aAAa,IAAI;QACjB,UAAU,MAAM;QACjB,gBAAgB,GAAG;;;QAGnB,gBAAgB,aAAa;iBACrB;AAAA;AAAA;aAIF,aAAa,YAAY;QAC/B,CAAC,WAAW;;;;QAMZ,UAAU,SAAS;;WAEhB;gBACI,iBAAiB,SAAS,MAAM;;;;;;;SASrC,WAAW;AAAA;;"}
1
+ {"version":3,"file":"getCombinedSignal.js","sources":["../../../../src/core/utils/getCombinedSignal.ts"],"sourcesContent":["// Returns a signal that aborts when all present signals are aborted.\nexport const getCombinedSignal = (components: Iterable<AbortSignal | undefined>): AbortSignal => {\n\tlet abortedCount = 0\n\tlet signalCount = 0\n\n\tconst controller = new AbortController()\n\tconst refresh = () => {\n\t\tif (signalCount === 0) {\n\t\t\treturn\n\t\t}\n\t\tif (abortedCount >= signalCount) {\n\t\t\tcontroller.abort()\n\t\t}\n\t}\n\n\tfor (const component of components) {\n\t\tif (!component) {\n\t\t\tcontinue\n\t\t}\n\n\t\tsignalCount++\n\n\t\tif (component.aborted) {\n\t\t\tabortedCount++\n\t\t} else {\n\t\t\tcomponent.addEventListener('abort', () => {\n\t\t\t\tabortedCount++\n\t\t\t\trefresh()\n\t\t\t})\n\t\t}\n\t}\n\n\trefresh()\n\n\treturn controller.signal\n}\n"],"names":[],"mappings":"AACa,MAAA,oBAAoB,CAAC,eAA+D;AAChG,MAAI,eAAe;AACnB,MAAI,cAAc;AAEZ,QAAA,aAAa,IAAI;AACvB,QAAM,UAAU,MAAM;AACrB,QAAI,gBAAgB,GAAG;AACtB;AAAA,IACD;AACA,QAAI,gBAAgB,aAAa;AAChC,iBAAW,MAAM;AAAA,IAClB;AAAA,EAAA;AAGD,aAAW,aAAa,YAAY;AACnC,QAAI,CAAC,WAAW;AACf;AAAA,IACD;AAEA;AAEA,QAAI,UAAU,SAAS;AACtB;AAAA,IAAA,OACM;AACI,gBAAA,iBAAiB,SAAS,MAAM;AACzC;AACQ;MAAA,CACR;AAAA,IACF;AAAA,EACD;AAEQ;AAER,SAAO,WAAW;AACnB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Component.js","sources":["../../../src/coreComponents/Component.tsx"],"sourcesContent":["import { FunctionComponent, memo, NamedExoticComponent, ReactElement } from 'react'\nimport type { Environment } from '../dao'\nimport { assertNever } from '../utils'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from './MarkerProvider'\n\nfunction Component<Props extends {}>(\n\tstatelessRender: FunctionComponent<Props>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: FunctionComponent<Props>,\n\tstaticRender: (\n\t\tprops: StaticRenderProviderProps<Props, NonStaticPropNames>,\n\t\tenvironment: Environment,\n\t) => ReactElement | null,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: FunctionComponent<Props>,\n\tmarkerProvisions: MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\trender: FunctionComponent<Props>,\n\tdecider?:\n\t\t| string\n\t\t| ((props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactElement | null)\n\t\t| MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n) {\n\tif (decider === undefined || typeof decider === 'string') {\n\t\trender.displayName = decider\n\t\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props> = memo<Props>(render)\n\t\taugmentedRender.staticRender = render as StaticRenderProvider<Props>['staticRender']\n\t\taugmentedRender.displayName = decider\n\n\t\treturn augmentedRender\n\t}\n\n\trender.displayName = displayName\n\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props, NonStaticPropNames> = memo<Props>(render)\n\taugmentedRender.displayName = displayName\n\n\tif (typeof decider === 'function') {\n\t\taugmentedRender.staticRender = decider\n\n\t\treturn augmentedRender\n\t}\n\tif (typeof decider === 'object') {\n\t\tfor (const provisionName in decider) {\n\t\t\tconst methodName = provisionName as keyof MarkerProvider<Props, NonStaticPropNames>\n\t\t\t;(augmentedRender[methodName] as MarkerProvider<Props, NonStaticPropNames>[typeof methodName]) =\n\t\t\t\tdecider[methodName]\n\t\t}\n\n\t\treturn augmentedRender\n\t}\n\tassertNever(decider)\n}\n\nexport { Component }\n"],"names":[],"mappings":";;AAsBA,mBACC,QACA,SAIA,aACC;MACG,YAAY,UAAa,OAAO,YAAY,UAAU;WAClD,cAAc;UACf,mBAAuE,KAAY;qBACzE,eAAe;qBACf,cAAc;WAEvB;AAAA;SAGD,cAAc;QACf,kBAA2F,KAAY;kBAC7F,cAAc;MAE1B,OAAO,YAAY,YAAY;oBAClB,eAAe;WAExB;AAAA;MAEJ,OAAO,YAAY,UAAU;eACrB,iBAAiB,SAAS;YAC9B,aAAa;AACjB,sBAAgB,cACjB,QAAQ;AAAA;WAGH;AAAA;;;;"}
1
+ {"version":3,"file":"Component.js","sources":["../../../src/coreComponents/Component.tsx"],"sourcesContent":["import { FunctionComponent, memo, NamedExoticComponent, ReactElement } from 'react'\nimport type { Environment } from '../dao'\nimport { assertNever } from '../utils'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from './MarkerProvider'\n\nfunction Component<Props extends {}>(\n\tstatelessRender: FunctionComponent<Props>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: FunctionComponent<Props>,\n\tstaticRender: (\n\t\tprops: StaticRenderProviderProps<Props, NonStaticPropNames>,\n\t\tenvironment: Environment,\n\t) => ReactElement | null,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: FunctionComponent<Props>,\n\tmarkerProvisions: MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\trender: FunctionComponent<Props>,\n\tdecider?:\n\t\t| string\n\t\t| ((props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactElement | null)\n\t\t| MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n) {\n\tif (decider === undefined || typeof decider === 'string') {\n\t\trender.displayName = decider\n\t\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props> = memo<Props>(render)\n\t\taugmentedRender.staticRender = render as StaticRenderProvider<Props>['staticRender']\n\t\taugmentedRender.displayName = decider\n\n\t\treturn augmentedRender\n\t}\n\n\trender.displayName = displayName\n\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props, NonStaticPropNames> = memo<Props>(render)\n\taugmentedRender.displayName = displayName\n\n\tif (typeof decider === 'function') {\n\t\taugmentedRender.staticRender = decider\n\n\t\treturn augmentedRender\n\t}\n\tif (typeof decider === 'object') {\n\t\tfor (const provisionName in decider) {\n\t\t\tconst methodName = provisionName as keyof MarkerProvider<Props, NonStaticPropNames>\n\t\t\t;(augmentedRender[methodName] as MarkerProvider<Props, NonStaticPropNames>[typeof methodName]) =\n\t\t\t\tdecider[methodName]\n\t\t}\n\n\t\treturn augmentedRender\n\t}\n\tassertNever(decider)\n}\n\nexport { Component }\n"],"names":[],"mappings":";;AAsBA,mBACC,QACA,SAIA,aACC;AACD,MAAI,YAAY,UAAa,OAAO,YAAY,UAAU;AACzD,WAAO,cAAc;AACf,UAAA,mBAAuE,KAAY,MAAM;AAC/F,qBAAgB,eAAe;AAC/B,qBAAgB,cAAc;AAEvB,WAAA;AAAA,EACR;AAEA,SAAO,cAAc;AACf,QAAA,kBAA2F,KAAY,MAAM;AACnH,kBAAgB,cAAc;AAE1B,MAAA,OAAO,YAAY,YAAY;AAClC,oBAAgB,eAAe;AAExB,WAAA;AAAA,EACR;AACI,MAAA,OAAO,YAAY,UAAU;AAChC,eAAW,iBAAiB,SAAS;AACpC,YAAM,aAAa;AACjB,sBAAgB,cACjB,QAAQ;AAAA,IACV;AAEO,WAAA;AAAA,EACR;AACA,cAAmB;AACpB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DataBindingProvider.js","sources":["../../../src/coreComponents/DataBindingProvider.tsx"],"sourcesContent":["import { ComponentType, createElement, memo, ReactElement, ReactNode } from 'react'\nimport { AccessorTree, AccessorTreeState, useDataBinding } from '../accessorTree'\n\nexport interface DataBindingProviderBaseProps {\n\tchildren?: ReactNode\n\trefreshOnEnvironmentChange?: boolean\n\trefreshOnPersist?: boolean\n}\n\nexport interface DataBindingStateComponentProps {\n\taccessorTreeState: AccessorTreeState\n\tchildren?: ReactNode\n}\n\nexport type DataBindingProviderProps<StateProps> = DataBindingProviderBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tstateComponent: ComponentType<StateProps & DataBindingStateComponentProps>\n\t\t\t\tstateProps?: StateProps\n\t\t }\n\t)\n\nexport const DataBindingProvider = memo(function DataBindingProvider<StateProps extends DataBindingStateComponentProps>(\n\tprops: DataBindingProviderProps<StateProps>,\n) {\n\tconst accessorTreeState = useDataBinding({\n\t\tnodeTree: props.children,\n\t\trefreshOnEnvironmentChange: props.refreshOnEnvironmentChange,\n\t\trefreshOnPersist: props.refreshOnPersist ?? false,\n\t})\n\n\tconst children =\n\t\t'stateComponent' in props && props.stateComponent\n\t\t\t? createElement(\n\t\t\t\t\tprops.stateComponent,\n\t\t\t\t\t{\n\t\t\t\t\t\t...props.stateProps!,\n\t\t\t\t\t\taccessorTreeState: accessorTreeState,\n\t\t\t\t\t},\n\t\t\t\t\tprops.children,\n\t\t\t )\n\t\t\t: props.children\n\treturn <AccessorTree state={accessorTreeState}>{children}</AccessorTree>\n}) as <StateProps>(props: DataBindingProviderProps<StateProps>) => ReactElement\n"],"names":[],"mappings":";;;MAuBa,sBAAsB,KAAK,8BACvC,OACC;QACK,oBAAoB,eAAe;AAAA,IACxC,UAAU,MAAM;AAAA,IAChB,4BAA4B,MAAM;AAAA,IAClC,kBAAkB,MAAM,oBAAoB;AAAA;QAGvC,WACL,oBAAoB,SAAS,MAAM,iBAChC,cACA,MAAM,gBACN;AAAA,OACI,MAAM;AAAA,IACT;AAAA,KAED,MAAM,YAEN,MAAM;uCACF,cAAD;AAAA,IAAc,OAAO;AAAA,KAAoB;AAAA;;"}
1
+ {"version":3,"file":"DataBindingProvider.js","sources":["../../../src/coreComponents/DataBindingProvider.tsx"],"sourcesContent":["import { ComponentType, createElement, memo, ReactElement, ReactNode } from 'react'\nimport { AccessorTree, AccessorTreeState, useDataBinding } from '../accessorTree'\n\nexport interface DataBindingProviderBaseProps {\n\tchildren?: ReactNode\n\trefreshOnEnvironmentChange?: boolean\n\trefreshOnPersist?: boolean\n}\n\nexport interface DataBindingStateComponentProps {\n\taccessorTreeState: AccessorTreeState\n\tchildren?: ReactNode\n}\n\nexport type DataBindingProviderProps<StateProps> = DataBindingProviderBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tstateComponent: ComponentType<StateProps & DataBindingStateComponentProps>\n\t\t\t\tstateProps?: StateProps\n\t\t }\n\t)\n\nexport const DataBindingProvider = memo(function DataBindingProvider<StateProps extends DataBindingStateComponentProps>(\n\tprops: DataBindingProviderProps<StateProps>,\n) {\n\tconst accessorTreeState = useDataBinding({\n\t\tnodeTree: props.children,\n\t\trefreshOnEnvironmentChange: props.refreshOnEnvironmentChange,\n\t\trefreshOnPersist: props.refreshOnPersist ?? false,\n\t})\n\n\tconst children =\n\t\t'stateComponent' in props && props.stateComponent\n\t\t\t? createElement(\n\t\t\t\t\tprops.stateComponent,\n\t\t\t\t\t{\n\t\t\t\t\t\t...props.stateProps!,\n\t\t\t\t\t\taccessorTreeState: accessorTreeState,\n\t\t\t\t\t},\n\t\t\t\t\tprops.children,\n\t\t\t )\n\t\t\t: props.children\n\treturn <AccessorTree state={accessorTreeState}>{children}</AccessorTree>\n}) as <StateProps>(props: DataBindingProviderProps<StateProps>) => ReactElement\n"],"names":["_jsx"],"mappings":";;;AAuBa,MAAA,sBAAsB,KAAK,8BACvC,OACC;AACD,QAAM,oBAAoB,eAAe;AAAA,IACxC,UAAU,MAAM;AAAA,IAChB,4BAA4B,MAAM;AAAA,IAClC,kBAAkB,MAAM,oBAAoB;AAAA,EAAA,CAC5C;AAED,QAAM,WACL,oBAAoB,SAAS,MAAM,iBAChC,cACA,MAAM,gBACN;AAAA,OACI,MAAM;AAAA,IACT;AAAA,EAED,GAAA,MAAM,QACN,IACA,MAAM;AACV,SAAQA,8BAAA,cAAA;AAAA,IAAa,OAAO;AAAA,EAAA,GAAoB,QAAS;AAC1D,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Entity.js","sources":["../../../src/coreComponents/Entity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { AccessorProvider } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport { Component } from './Component'\n\nexport interface EntityBaseProps {\n\taccessor: EntityAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityProps = EntityBaseProps\n\nexport const Entity = Component(\n\t({ children, accessor }: EntityProps) => {\n\treturn (\n\t\t// HACK: the ?. is actually important, despite the typings.\n\t\t<AccessorProvider accessor={accessor} key={accessor?.key}>\n\t\t\t{children}\n\t\t</AccessorProvider>\n\t)\n\t},\n\t'Entity',\n)\n"],"names":[],"mappings":";;;MAYa,SAAS,UACrB,CAAC,EAAE,UAAU,eAA4B;uCAGvC,kBAAD;AAAA,IAAkB;AAAA,IAAoB,KAAK,UAAU;AAAA,KACnD;AAAA,GAIH;;"}
1
+ {"version":3,"file":"Entity.js","sources":["../../../src/coreComponents/Entity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { AccessorProvider } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport { Component } from './Component'\n\nexport interface EntityBaseProps {\n\taccessor: EntityAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityProps = EntityBaseProps\n\nexport const Entity = Component(\n\t({ children, accessor }: EntityProps) => {\n\treturn (\n\t\t// HACK: the ?. is actually important, despite the typings.\n\t\t<AccessorProvider accessor={accessor} key={accessor?.key}>\n\t\t\t{children}\n\t\t</AccessorProvider>\n\t)\n\t},\n\t'Entity',\n)\n"],"names":["_jsx"],"mappings":";;;AAYO,MAAM,SAAS,UACrB,CAAC,EAAE,UAAU,eAA4B;AACzC,SAEEA,8BAAA,kBAAA;AAAA,IAAiB;AAAA,IAAoB,KAAK,UAAU;AAAA,EAAA,GACnD,QACF;AAED,GACA,QACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityList.js","sources":["../../../src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '../accessors'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\n\nexport interface EntityListBaseProps {\n\taccessor: EntityListAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityListProps<ListProps> = EntityListBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const EntityList = Component(\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: props.accessor,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{Array.from(props.accessor, entity => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t</Entity>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</>\n\t\t)\n\t},\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: undefined as any,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn <>{props.children}</>\n\t},\n\t'EntityList',\n) as <ListProps>(props: EntityListProps<ListProps>) => ReactElement\n"],"names":[],"mappings":";;;MAmBa,aAAa,UACzB,CAAuB,UAAsC;MACxD,mBAAmB,SAAS,MAAM,eAAe;WAC7C,cAAc,MAAM,eAAe;AAAA,SACtC,MAAM;AAAA,MACT,UAAU,MAAM;AAAA,MAChB,UAAU,MAAM;AAAA;AAAA;uDAKf,MAAM,KAAK,MAAM,UAAU,YAAU;yCAEnC,QAAD;AAAA,MAAQ,KAAK,OAAO;AAAA,MAAK,UAAU;AAAA,OACjC,MAAM;AAAA;AAAA,GAOb,CAAuB,UAAsC;MACxD,mBAAmB,SAAS,MAAM,eAAe;WAC7C,cAAc,MAAM,eAAe;AAAA,SACtC,MAAM;AAAA,MACT,UAAU;AAAA,MACV,UAAU,MAAM;AAAA;AAAA;uDAGR,MAAM;AAAA,GAEjB;;"}
1
+ {"version":3,"file":"EntityList.js","sources":["../../../src/coreComponents/EntityList.tsx"],"sourcesContent":["import { ComponentType, createElement, ReactElement, ReactNode } from 'react'\nimport type { EntityListAccessor } from '../accessors'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\n\nexport interface EntityListBaseProps {\n\taccessor: EntityListAccessor\n\tchildren?: ReactNode\n}\n\nexport type EntityListProps<ListProps> = EntityListBaseProps &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const EntityList = Component(\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: props.accessor,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{Array.from(props.accessor, entity => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Entity key={entity.key} accessor={entity}>\n\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t</Entity>\n\t\t\t\t\t)\n\t\t\t\t})}\n\t\t\t</>\n\t\t)\n\t},\n\t<ListProps extends {}>(props: EntityListProps<ListProps>) => {\n\t\tif ('listComponent' in props && props.listComponent) {\n\t\t\treturn createElement(props.listComponent, {\n\t\t\t\t...props.listProps!,\n\t\t\t\taccessor: undefined as any,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\t\t}\n\t\treturn <>{props.children}</>\n\t},\n\t'EntityList',\n) as <ListProps>(props: EntityListProps<ListProps>) => ReactElement\n"],"names":["_jsx","_jsxFragment"],"mappings":";;;AAmBa,MAAA,aAAa,UACzB,CAAuB,UAAsC;AACxD,MAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,WAAA,cAAc,MAAM,eAAe;AAAA,SACtC,MAAM;AAAA,MACT,UAAU,MAAM;AAAA,MAChB,UAAU,MAAM;AAAA,IAAA,CAChB;AAAA,EACF;AACA,SAEGA,8BAAAC,UAAA,MAAA,MAAM,KAAK,MAAM,UAAU,CAAU,WAAA;AACrC,WACED,8BAAA,QAAA;AAAA,MAAO,KAAK,OAAO;AAAA,MAAK,UAAU;AAAA,IAAA,GACjC,MAAM,QACR;AAAA,EAED,CAAA,CACF;AAEF,GACA,CAAuB,UAAsC;AACxD,MAAA,mBAAmB,SAAS,MAAM,eAAe;AAC7C,WAAA,cAAc,MAAM,eAAe;AAAA,SACtC,MAAM;AAAA,MACT,UAAU;AAAA,MACV,UAAU,MAAM;AAAA,IAAA,CAChB;AAAA,EACF;AACO,SAAAA,8BAAAC,UAAA,MAAG,MAAM,QAAS;AAC1B,GACA,YACD;;"}
@@ -1,15 +1,14 @@
1
1
  import { createElement, useCallback } from "react";
2
- import { whereToFilter } from "@contember/client";
3
2
  import { useConstantValueInvariant } from "@contember/react-utils";
4
- import { PRIMARY_KEY_NAME, NIL_UUID } from "../bindingTypes.js";
3
+ import { PRIMARY_KEY_NAME } from "../bindingTypes.js";
5
4
  import { Component } from "./Component.js";
6
5
  import { EntityList } from "./EntityList.js";
7
6
  import { Field } from "./Field.js";
7
+ import { TreeNodeEnvironmentFactory } from "../dao/TreeNodeEnvironmentFactory.js";
8
8
  import { useGetEntityListSubTree } from "../accessorPropagation/useGetEntityListSubTree.js";
9
9
  import { useEntityListSubTreeParameters } from "../accessorPropagation/useEntityListSubTreeParameters.js";
10
10
  import { useAccessorUpdateSubscription } from "../accessorPropagation/useAccessorUpdateSubscription.js";
11
11
  import { MarkerFactory } from "../queryLanguage/MarkerFactory.js";
12
- import { Environment } from "../dao/Environment.js";
13
12
  const EntityListSubTree = Component((props) => {
14
13
  useConstantValueInvariant(props.isCreating, "EntityListSubTree: cannot update isCreating");
15
14
  const getSubTree = useGetEntityListSubTree();
@@ -34,15 +33,8 @@ const EntityListSubTree = Component((props) => {
34
33
  field: PRIMARY_KEY_NAME
35
34
  }), props.children),
36
35
  generateEnvironment: (props, oldEnvironment) => {
37
- const newEnvironment = props.variables === void 0 ? oldEnvironment : oldEnvironment.putDelta(Environment.generateDelta(oldEnvironment, props.variables));
38
- if (newEnvironment.hasName("rootWhere") || newEnvironment.hasName("rootWhereAsFilter")) {
39
- return newEnvironment;
40
- }
41
- const rootWhere = { id: NIL_UUID };
42
- return newEnvironment.putDelta({
43
- rootWhere,
44
- rootWhereAsFilter: whereToFilter(rootWhere)
45
- });
36
+ const environment = oldEnvironment.withVariables(props.variables);
37
+ return TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props);
46
38
  }
47
39
  }, "EntityListSubTree");
48
40
  export { EntityListSubTree };
@@ -1 +1 @@
1
- {"version":3,"file":"EntityListSubTree.js","sources":["../../../src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { whereToFilter } from '@contember/client'\nimport { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode, useCallback } from 'react'\nimport {\n\tuseAccessorUpdateSubscription,\n\tuseEntityListSubTreeParameters,\n\tuseGetEntityListSubTree,\n} from '../accessorPropagation'\nimport { NIL_UUID, PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '../treeParameters'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.DeltaFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n\t(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntityListSubTree()\n\t\tconst parameters = useEntityListSubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ?\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne\n\t\t// ) :\n\t\t// \tprops.children\n\t\t// )\n\t\treturn <EntityList {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntityListSubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntityListSubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={0 as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst newEnvironment =\n\t\t\t\tprops.variables === undefined\n\t\t\t\t\t? oldEnvironment\n\t\t\t\t\t: oldEnvironment.putDelta(Environment.generateDelta(oldEnvironment, props.variables))\n\n\t\t\tif (newEnvironment.hasName('rootWhere') || newEnvironment.hasName('rootWhereAsFilter')) {\n\t\t\t\treturn newEnvironment\n\t\t\t}\n\n\t\t\tconst rootWhere = { id: NIL_UUID } as const\n\t\t\treturn newEnvironment.putDelta({\n\t\t\t\trootWhere,\n\t\t\t\trootWhereAsFilter: whereToFilter(rootWhere),\n\t\t\t})\n\t\t},\n\t},\n\t'EntityListSubTree',\n) as <ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;;;;;MAiCa,oBAAoB,UAChC,CAAyB,UAA0D;4BACxD,MAAM,YAAY;QAEtC,aAAa;QACb,aAAa,+BAA+B;QAC5C,cAAc,YACnB,MAAM,WAAW,YAAY,MAAM,aACnC,CAAC,YAAY,YAAY,MAAM;QAE1B,WAAW,8BAA8B;uCAQvC,YAAD;AAAA,OAAgB;AAAA,IAAO;AAAA;AAAA,GAE/B;AAAA,EACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;QACjD,gBAAgB,SAAS,MAAM,YAAY;aACvC,cAAc,2CAA2C,OAAO,QAAQ;AAAA;WAEzE,cAAc,8BAA8B,OAAO,QAAQ;AAAA;AAAA,EAEnE,cAAc,yCACZ,YAAD;AAAA,OAAgB;AAAA,IAAO,UAAU;AAAA,mCAC/B,OAAD;AAAA,IAAO,OAAO;AAAA,MACb,MAAM;AAAA,EAGT,qBAAqB,CAAC,OAAO,mBAAmB;UACzC,iBACL,MAAM,cAAc,SACjB,iBACA,eAAe,SAAS,YAAY,cAAc,gBAAgB,MAAM;QAExE,eAAe,QAAQ,gBAAgB,eAAe,QAAQ,sBAAsB;aAChF;AAAA;UAGF,YAAY,EAAE,IAAI;WACjB,eAAe,SAAS;AAAA,MAC9B;AAAA,MACA,mBAAmB,cAAc;AAAA;AAAA;AAAA,GAIpC;;"}
1
+ {"version":3,"file":"EntityListSubTree.js","sources":["../../../src/coreComponents/EntityListSubTree.tsx"],"sourcesContent":["import { whereToFilter } from '@contember/client'\nimport { useConstantValueInvariant } from '@contember/react-utils'\nimport { ComponentType, ReactElement, ReactNode, useCallback } from 'react'\nimport {\n\tuseAccessorUpdateSubscription,\n\tuseEntityListSubTreeParameters,\n\tuseGetEntityListSubTree,\n} from '../accessorPropagation'\nimport { NIL_UUID, PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory, QueryLanguage } from '../queryLanguage'\nimport type { SugaredQualifiedEntityList, SugaredUnconstrainedQualifiedEntityList, TreeRootId } from '../treeParameters'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface EntityListSubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntityListSubTreeProps<ListProps, EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntityListSubTreeAdditionalProps &\n\t(SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList) &\n\t(\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const EntityListSubTree = Component(\n\t<ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntityListSubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntityListSubTree()\n\t\tconst parameters = useEntityListSubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ?\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne\n\t\t// ) :\n\t\t// \tprops.children\n\t\t// )\n\t\treturn <EntityList {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntityListSubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntityListSubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={0 as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityListSubtree(environment, props)\n\t\t},\n\t},\n\t'EntityListSubTree',\n) as <ListProps, EntityProps>(props: EntityListSubTreeProps<ListProps, EntityProps>) => ReactElement\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;AAkCa,MAAA,oBAAoB,UAChC,CAAyB,UAA0D;AACxD,4BAAA,MAAM,YAAY,6CAA6C;AAEzF,QAAM,aAAa;AACb,QAAA,aAAa,+BAA+B,KAAK;AACvD,QAAM,cAAc,YACnB,MAAM,WAAW,YAAY,MAAM,UAAU,GAC7C,CAAC,YAAY,YAAY,MAAM,UAAU,CAC1C;AACM,QAAA,WAAW,8BAA8B,WAAW;AAQ1D,SAAQA,8BAAA,YAAA;AAAA,OAAe;AAAA,IAAO;AAAA,EAAA,CAAoB;AACnD,GACA;AAAA,EACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,QAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,aAAO,cAAc,2CAA2C,OAAO,QAAQ,WAAW;AAAA,IAC3F;AACA,WAAO,cAAc,8BAA8B,OAAO,QAAQ,WAAW;AAAA,EAC9E;AAAA,EACA,cAAc,WACZA,8BAAA,YAAA;AAAA,OAAe;AAAA,IAAO,UAAU;AAAA,EAAA,GAC/BA,8BAAA,OAAA;AAAA,IAAM,OAAO;AAAA,EAAA,CAAkB,GAC/B,MAAM,QACR;AAAA,EAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,UAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,WAAA,2BAA2B,sCAAsC,aAAa,KAAK;AAAA,EAC3F;AACD,GACA,mBACD;;"}
@@ -1,16 +1,14 @@
1
1
  import { createElement, Fragment, useCallback } from "react";
2
- import { whereToFilter } from "@contember/client";
3
2
  import { useConstantValueInvariant } from "@contember/react-utils";
4
- import { PRIMARY_KEY_NAME, NIL_UUID } from "../bindingTypes.js";
3
+ import { PRIMARY_KEY_NAME } from "../bindingTypes.js";
5
4
  import { Component } from "./Component.js";
6
5
  import { Entity } from "./Entity.js";
7
6
  import { Field } from "./Field.js";
7
+ import { TreeNodeEnvironmentFactory } from "../dao/TreeNodeEnvironmentFactory.js";
8
8
  import { SetOrderFieldOnCreate } from "../accessorSorting/SetOrderFieldOnCreate.js";
9
9
  import { useGetEntitySubTree } from "../accessorPropagation/useGetEntitySubTree.js";
10
10
  import { useEntitySubTreeParameters } from "../accessorPropagation/useEntitySubTreeParameters.js";
11
11
  import { MarkerFactory } from "../queryLanguage/MarkerFactory.js";
12
- import { Environment } from "../dao/Environment.js";
13
- import { QueryLanguage } from "../queryLanguage/QueryLanguage.js";
14
12
  import { useAccessorUpdateSubscription } from "../accessorPropagation/useAccessorUpdateSubscription.js";
15
13
  const EntitySubTree = Component((props) => {
16
14
  useConstantValueInvariant(props.isCreating, "EntitySubTree: cannot update isCreating");
@@ -40,24 +38,8 @@ const EntitySubTree = Component((props) => {
40
38
  entity: props.entity
41
39
  })),
42
40
  generateEnvironment: (props, oldEnvironment) => {
43
- const newEnvironment = props.variables === void 0 ? oldEnvironment : oldEnvironment.putDelta(Environment.generateDelta(oldEnvironment, props.variables));
44
- if (newEnvironment.hasName("rootWhere") || newEnvironment.hasName("rootWhereAsFilter")) {
45
- return newEnvironment;
46
- }
47
- if (props.isCreating) {
48
- const rootWhere = { id: NIL_UUID };
49
- return newEnvironment.putDelta({
50
- rootWhere,
51
- rootWhereAsFilter: whereToFilter(rootWhere),
52
- rootShouldExists: "no"
53
- });
54
- }
55
- const qualifiedSingleEntity = QueryLanguage.desugarQualifiedSingleEntity(props, newEnvironment, { missingSetOnCreate: "fill" });
56
- return newEnvironment.putDelta({
57
- rootWhere: qualifiedSingleEntity.where,
58
- rootWhereAsFilter: whereToFilter(qualifiedSingleEntity.where),
59
- rootShouldExists: qualifiedSingleEntity.setOnCreate ? "maybe" : "yes"
60
- });
41
+ const environment = oldEnvironment.withVariables(props.variables);
42
+ return TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props);
61
43
  }
62
44
  }, "EntitySubTree");
63
45
  export { EntitySubTree };
@@ -1 +1 @@
1
- {"version":3,"file":"EntitySubTree.js","sources":["../../../src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { whereToFilter } from '@contember/client'\nimport { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback } from 'react'\nimport { useAccessorUpdateSubscription, useEntitySubTreeParameters, useGetEntitySubTree } from '../accessorPropagation'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\nimport { NIL_UUID, PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory, QueryLanguage } from '../queryLanguage'\nimport type {\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '../treeParameters'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\n\nexport interface EntitySubTreeAdditionalProps {\n\tvariables?: Environment.DeltaFactory\n}\n\nexport type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps\n\nexport type EntitySubTreeProps<EntityProps> = {\n\ttreeRootId?: TreeRootId\n\tchildren?: ReactNode\n} & EntitySubTreeAdditionalProps &\n\t(SugaredQualifiedSingleEntity | (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps))\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntitySubTree()\n\t\tconst parameters = useEntitySubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top-level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ? (\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne>\n\t\t// ) : (\n\t\t// \tprops.children\n\t\t// )}\n\t\treturn <Entity {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntitySubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntitySubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t<Entity {...props} accessor={0 as any}>\n\t\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t\t{props.children}\n\t\t\t\t</Entity>\n\t\t\t\t{props.isCreating && 'orderField' in props && (\n\t\t\t\t\t<SetOrderFieldOnCreate\n\t\t\t\t\t\torderField={props.orderField}\n\t\t\t\t\t\tnewOrderFieldValue={props.newOrderFieldValue}\n\t\t\t\t\t\tentity={props.entity}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst newEnvironment =\n\t\t\t\tprops.variables === undefined\n\t\t\t\t\t? oldEnvironment\n\t\t\t\t\t: oldEnvironment.putDelta(Environment.generateDelta(oldEnvironment, props.variables))\n\n\t\t\tif (newEnvironment.hasName('rootWhere') || newEnvironment.hasName('rootWhereAsFilter')) {\n\t\t\t\treturn newEnvironment\n\t\t\t}\n\n\t\t\tif (props.isCreating) {\n\t\t\t\tconst rootWhere = { id: NIL_UUID } as const\n\t\t\t\treturn newEnvironment.putDelta({\n\t\t\t\t\trootWhere,\n\t\t\t\t\trootWhereAsFilter: whereToFilter(rootWhere),\n\t\t\t\t\trootShouldExists: 'no',\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst qualifiedSingleEntity = QueryLanguage.desugarQualifiedSingleEntity(props, newEnvironment, { missingSetOnCreate: 'fill' })\n\t\t\treturn newEnvironment.putDelta({\n\t\t\t\trootWhere: qualifiedSingleEntity.where,\n\t\t\t\trootWhereAsFilter: whereToFilter(qualifiedSingleEntity.where),\n\t\t\t\trootShouldExists: qualifiedSingleEntity.setOnCreate ? 'maybe' : 'yes',\n\t\t\t})\n\t\t},\n\t},\n\t'EntitySubTree',\n) as <EntityProps>(pros: EntitySubTreeProps<EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;;;;;;;MA4Ba,gBAAgB,UAC5B,CAAyB,UAA2C;4BACzC,MAAM,YAAY;QAEtC,aAAa;QACb,aAAa,2BAA2B;QACxC,cAAc,YACnB,MAAM,WAAW,YAAY,MAAM,aACnC,CAAC,YAAY,YAAY,MAAM;QAE1B,WAAW,8BAA8B;uCAQvC,QAAD;AAAA,OAAY;AAAA,IAAO;AAAA;AAAA,GAE3B;AAAA,EACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;QACjD,gBAAgB,SAAS,MAAM,YAAY;aACvC,cAAc,uCAAuC,OAAO,QAAQ;AAAA;WAErE,cAAc,0BAA0B,OAAO,QAAQ;AAAA;AAAA,EAE/D,cAAc,uFAEX,QAAD;AAAA,OAAY;AAAA,IAAO,UAAU;AAAA,mCAC3B,OAAD;AAAA,IAAO,OAAO;AAAA,MACb,MAAM,WAEP,MAAM,cAAc,gBAAgB,uCACnC,uBAAD;AAAA,IACC,YAAY,MAAM;AAAA,IAClB,oBAAoB,MAAM;AAAA,IAC1B,QAAQ,MAAM;AAAA;AAAA,EAKlB,qBAAqB,CAAC,OAAO,mBAAmB;UACzC,iBACL,MAAM,cAAc,SACjB,iBACA,eAAe,SAAS,YAAY,cAAc,gBAAgB,MAAM;QAExE,eAAe,QAAQ,gBAAgB,eAAe,QAAQ,sBAAsB;aAChF;AAAA;QAGJ,MAAM,YAAY;YACf,YAAY,EAAE,IAAI;aACjB,eAAe,SAAS;AAAA,QAC9B;AAAA,QACA,mBAAmB,cAAc;AAAA,QACjC,kBAAkB;AAAA;AAAA;UAGd,wBAAwB,cAAc,6BAA6B,OAAO,gBAAgB,EAAE,oBAAoB;WAC/G,eAAe,SAAS;AAAA,MAC9B,WAAW,sBAAsB;AAAA,MACjC,mBAAmB,cAAc,sBAAsB;AAAA,MACvD,kBAAkB,sBAAsB,cAAc,UAAU;AAAA;AAAA;AAAA,GAInE;;"}
1
+ {"version":3,"file":"EntitySubTree.js","sources":["../../../src/coreComponents/EntitySubTree.tsx"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { ReactElement, ReactNode, useCallback } from 'react'\nimport { useAccessorUpdateSubscription, useEntitySubTreeParameters, useGetEntitySubTree } from '../accessorPropagation'\nimport { SetOrderFieldOnCreate, SetOrderFieldOnCreateOwnProps } from '../accessorSorting'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type {\n\tSugaredQualifiedSingleEntity,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n\tTreeRootId,\n} from '../treeParameters'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface EntitySubTreeAdditionalProps {\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport type EntitySubTreeAdditionalCreationProps = {} | SetOrderFieldOnCreateOwnProps\n\nexport type EntitySubTreeProps<EntityProps> =\n\t& {\n\t\ttreeRootId?: TreeRootId\n\t\tchildren?: ReactNode\n\t}\n\t& EntitySubTreeAdditionalProps\n\t& (\n\t\t| SugaredQualifiedSingleEntity\n\t\t| (SugaredUnconstrainedQualifiedSingleEntity & EntitySubTreeAdditionalCreationProps)\n\t)\n\nexport const EntitySubTree = Component(\n\t<EntityProps extends {}>(props: EntitySubTreeProps<EntityProps>) => {\n\t\tuseConstantValueInvariant(props.isCreating, 'EntitySubTree: cannot update isCreating')\n\n\t\tconst getSubTree = useGetEntitySubTree()\n\t\tconst parameters = useEntitySubTreeParameters(props)\n\t\tconst getAccessor = useCallback(\n\t\t\t() => getSubTree(parameters, props.treeRootId),\n\t\t\t[getSubTree, parameters, props.treeRootId],\n\t\t)\n\t\tconst accessor = useAccessorUpdateSubscription(getAccessor)\n\n\t\t// TODO revive top-level hasOneRelationPath\n\t\t// {parameters.value.hasOneRelationPath.length ? (\n\t\t// \t<HasOne field={parameters.value.hasOneRelationPath}>{props.children}</HasOne>\n\t\t// ) : (\n\t\t// \tprops.children\n\t\t// )}\n\t\treturn <Entity {...props} accessor={accessor} />\n\t},\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) => {\n\t\t\tif ('isCreating' in props && props.isCreating) {\n\t\t\t\treturn MarkerFactory.createUnconstrainedEntitySubTreeMarker(props, fields, environment)\n\t\t\t}\n\t\t\treturn MarkerFactory.createEntitySubTreeMarker(props, fields, environment)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<>\n\t\t\t\t<Entity {...props} accessor={0 as any}>\n\t\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t\t{props.children}\n\t\t\t\t</Entity>\n\t\t\t\t{props.isCreating && 'orderField' in props && (\n\t\t\t\t\t<SetOrderFieldOnCreate\n\t\t\t\t\t\torderField={props.orderField}\n\t\t\t\t\t\tnewOrderFieldValue={props.newOrderFieldValue}\n\t\t\t\t\t\tentity={props.entity}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</>\n\t\t),\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntitySubtree(environment, props)\n\t\t},\n\t},\n\t'EntitySubTree',\n) as <EntityProps>(pros: EntitySubTreeProps<EntityProps>) => ReactElement\n"],"names":["_jsx","_jsxFragment"],"mappings":";;;;;;;;;;;;AAkCa,MAAA,gBAAgB,UAC5B,CAAyB,UAA2C;AACzC,4BAAA,MAAM,YAAY,yCAAyC;AAErF,QAAM,aAAa;AACb,QAAA,aAAa,2BAA2B,KAAK;AACnD,QAAM,cAAc,YACnB,MAAM,WAAW,YAAY,MAAM,UAAU,GAC7C,CAAC,YAAY,YAAY,MAAM,UAAU,CAC1C;AACM,QAAA,WAAW,8BAA8B,WAAW;AAQ1D,SAAQA,8BAAA,QAAA;AAAA,OAAW;AAAA,IAAO;AAAA,EAAA,CAAoB;AAC/C,GACA;AAAA,EACC,sBAAsB,CAAC,OAAO,QAAQ,gBAAgB;AACjD,QAAA,gBAAgB,SAAS,MAAM,YAAY;AAC9C,aAAO,cAAc,uCAAuC,OAAO,QAAQ,WAAW;AAAA,IACvF;AACA,WAAO,cAAc,0BAA0B,OAAO,QAAQ,WAAW;AAAA,EAC1E;AAAA,EACA,cAAc,CACb,UAAAA,8BAAAC,UAAA,MACED,8BAAA,QAAA;AAAA,OAAW;AAAA,IAAO,UAAU;AAAA,EAAA,GAC3BA,8BAAA,OAAA;AAAA,IAAM,OAAO;AAAA,EAAA,CAAkB,GAC/B,MAAM,QACR,GACC,MAAM,cAAc,gBAAgB,SACnCA,8BAAA,uBAAA;AAAA,IACA,YAAY,MAAM;AAAA,IAClB,oBAAoB,MAAM;AAAA,IAC1B,QAAQ,MAAM;AAAA,EAAA,CACf,CAEF;AAAA,EAED,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,UAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,WAAA,2BAA2B,kCAAkC,aAAa,KAAK;AAAA,EACvF;AACD,GACA,eACD;;"}
@@ -1,6 +1,7 @@
1
1
  import { createElement, Fragment } from "react";
2
2
  import { GraphQlBuilder } from "@contember/client";
3
3
  import { Component } from "./Component.js";
4
+ import { TreeNodeEnvironmentFactory } from "../dao/TreeNodeEnvironmentFactory.js";
4
5
  import { useField } from "../accessorPropagation/useField.js";
5
6
  import { MarkerFactory } from "../queryLanguage/MarkerFactory.js";
6
7
  const Field = Component((props) => {
@@ -13,7 +14,10 @@ const Field = Component((props) => {
13
14
  }
14
15
  return /* @__PURE__ */ createElement(Fragment, null, field.value);
15
16
  }, {
16
- generateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment)
17
+ generateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),
18
+ generateEnvironment: (props, environment) => {
19
+ return TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props);
20
+ }
17
21
  }, "Field");
18
22
  export { Field };
19
23
  //# sourceMappingURL=Field.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sources":["../../../src/coreComponents/Field.tsx"],"sourcesContent":["import { GraphQlBuilder } from '@contember/client'\nimport type { ReactElement, ReactNode } from 'react'\nimport { useField } from '../accessorPropagation'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { FieldValue, SugaredRelativeSingleField } from '../treeParameters'\nimport { Component } from './Component'\n\nexport interface FieldBasicProps extends SugaredRelativeSingleField {}\n\nexport interface FieldRuntimeProps<Persisted extends FieldValue = FieldValue> {\n\tformat?: (value: Persisted | null) => ReactNode\n}\n\nexport interface FieldProps<Persisted extends FieldValue = FieldValue>\n\textends FieldBasicProps,\n\t\tFieldRuntimeProps<Persisted> {}\n\nexport const Field = Component(\n\t<Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => {\n\t\tconst field = useField<Persisted>(props)\n\n\t\tif (props.format !== undefined) {\n\t\t\treturn <>{props.format(field.value)}</>\n\t\t}\n\n\t\tif (\n\t\t\tfield.value instanceof GraphQlBuilder.GraphQlLiteral ||\n\t\t\tfield.value === null ||\n\t\t\ttypeof field.value === 'boolean'\n\t\t) {\n\t\t\treturn null\n\t\t}\n\t\treturn <>{field.value}</>\n\t},\n\t{\n\t\tgenerateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),\n\t},\n\t'Field',\n) as <Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => ReactElement\n"],"names":[],"mappings":";;;;;MAiBa,QAAQ,UACpB,CAA4C,UAAiC;QACtE,QAAQ,SAAoB;MAE9B,MAAM,WAAW,QAAW;yDACrB,MAAM,OAAO,MAAM;AAAA;MAI7B,MAAM,iBAAiB,eAAe,kBACtC,MAAM,UAAU,QAChB,OAAO,MAAM,UAAU,WACtB;WACM;AAAA;uDAEE,MAAM;AAAA,GAEjB;AAAA,EACC,oBAAoB,CAAC,OAAO,gBAAgB,cAAc,kBAAkB,OAAO;AAAA,GAEpF;;"}
1
+ {"version":3,"file":"Field.js","sources":["../../../src/coreComponents/Field.tsx"],"sourcesContent":["import { GraphQlBuilder } from '@contember/client'\nimport type { ReactElement, ReactNode } from 'react'\nimport { useField } from '../accessorPropagation'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { FieldValue, SugaredRelativeSingleField } from '../treeParameters'\nimport { Component } from './Component'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport interface FieldBasicProps extends SugaredRelativeSingleField {}\n\nexport interface FieldRuntimeProps<Persisted extends FieldValue = FieldValue> {\n\tformat?: (value: Persisted | null) => ReactNode\n}\n\nexport interface FieldProps<Persisted extends FieldValue = FieldValue>\n\textends FieldBasicProps,\n\t\tFieldRuntimeProps<Persisted> {}\n\nexport const Field = Component(\n\t<Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => {\n\t\tconst field = useField<Persisted>(props)\n\n\t\tif (props.format !== undefined) {\n\t\t\treturn <>{props.format(field.value)}</>\n\t\t}\n\n\t\tif (\n\t\t\tfield.value instanceof GraphQlBuilder.GraphQlLiteral ||\n\t\t\tfield.value === null ||\n\t\t\ttypeof field.value === 'boolean'\n\t\t) {\n\t\t\treturn null\n\t\t}\n\t\treturn <>{field.value}</>\n\t},\n\t{\n\t\tgenerateLeafMarker: (props, environment) => MarkerFactory.createFieldMarker(props, environment),\n\t\tgenerateEnvironment: (props, environment) => {\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForField(environment, props)\n\t\t},\n\t},\n\t'Field',\n) as <Persisted extends FieldValue = FieldValue>(props: FieldProps<Persisted>) => ReactElement\n"],"names":["_jsx","_jsxFragment"],"mappings":";;;;;;AAkBa,MAAA,QAAQ,UACpB,CAA4C,UAAiC;AACtE,QAAA,QAAQ,SAAoB,KAAK;AAEnC,MAAA,MAAM,WAAW,QAAW;AAC/B,WAAUA,8BAAAC,UAAA,MAAA,MAAM,OAAO,MAAM,KAAK,CAAE;AAAA,EACrC;AAGC,MAAA,MAAM,iBAAiB,eAAe,kBACtC,MAAM,UAAU,QAChB,OAAO,MAAM,UAAU,WACtB;AACM,WAAA;AAAA,EACR;AACO,SAAAD,8BAAAC,UAAA,MAAG,MAAM,KAAM;AACvB,GACA;AAAA,EACC,oBAAoB,CAAC,OAAO,gBAAgB,cAAc,kBAAkB,OAAO,WAAW;AAAA,EAC9F,qBAAqB,CAAC,OAAO,gBAAgB;AACrC,WAAA,2BAA2B,0BAA0B,aAAa,KAAK;AAAA,EAC/E;AACD,GACA,OACD;;"}
@@ -3,8 +3,8 @@ import { PRIMARY_KEY_NAME } from "../bindingTypes.js";
3
3
  import { Component } from "./Component.js";
4
4
  import { EntityList } from "./EntityList.js";
5
5
  import { Field } from "./Field.js";
6
+ import { TreeNodeEnvironmentFactory } from "../dao/TreeNodeEnvironmentFactory.js";
6
7
  import { useEntityList } from "../accessorPropagation/useEntityList.js";
7
- import { Environment } from "../dao/Environment.js";
8
8
  import { MarkerFactory } from "../queryLanguage/MarkerFactory.js";
9
9
  const HasMany = Component((props) => {
10
10
  const entityList = useEntityList(props);
@@ -14,10 +14,8 @@ const HasMany = Component((props) => {
14
14
  });
15
15
  }, {
16
16
  generateEnvironment: (props, oldEnvironment) => {
17
- if (props.variables === void 0) {
18
- return oldEnvironment;
19
- }
20
- return oldEnvironment.putDelta(Environment.generateDelta(oldEnvironment, props.variables));
17
+ const environment = oldEnvironment.withVariables(props.variables);
18
+ return TreeNodeEnvironmentFactory.createEnvironmentForEntityList(environment, props);
21
19
  },
22
20
  staticRender: (props) => /* @__PURE__ */ createElement(EntityList, {
23
21
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"HasMany.js","sources":["../../../src/coreComponents/HasMany.tsx"],"sourcesContent":["import type { ComponentType, ReactElement, ReactNode } from 'react'\nimport { useEntityList } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredRelativeEntityList } from '../treeParameters'\nimport { Component } from './Component'\nimport type { EntityBaseProps } from './Entity'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\n\nexport type HasManyProps<ListProps = never, EntityProps = never> = SugaredRelativeEntityList & {\n\tchildren?: ReactNode\n\tvariables?: Environment.DeltaFactory\n} & (\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const HasMany = Component(\n\t<ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => {\n\t\tconst entityList = useEntityList(props)\n\n\t\treturn <EntityList {...props} accessor={entityList} />\n\t},\n\t{\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tif (props.variables === undefined) {\n\t\t\t\treturn oldEnvironment\n\t\t\t}\n\t\t\treturn oldEnvironment.putDelta(Environment.generateDelta(oldEnvironment, props.variables))\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={undefined as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createRelativeEntityListFields(props, environment, fields),\n\t},\n\t'HasMany',\n) as <ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;MAsBa,UAAU,UACtB,CAAyB,UAAgD;QAClE,aAAa,cAAc;uCAEzB,YAAD;AAAA,OAAgB;AAAA,IAAO,UAAU;AAAA;AAAA,GAEzC;AAAA,EACC,qBAAqB,CAAC,OAAO,mBAAmB;QAC3C,MAAM,cAAc,QAAW;aAC3B;AAAA;WAED,eAAe,SAAS,YAAY,cAAc,gBAAgB,MAAM;AAAA;AAAA,EAEhF,cAAc,yCACZ,YAAD;AAAA,OAAgB;AAAA,IAAO,UAAU;AAAA,mCAC/B,OAAD;AAAA,IAAO,OAAO;AAAA,MACb,MAAM;AAAA,EAGT,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,+BAA+B,OAAO,aAAa;AAAA,GAEnE;;"}
1
+ {"version":3,"file":"HasMany.js","sources":["../../../src/coreComponents/HasMany.tsx"],"sourcesContent":["import type { ComponentType, ReactElement, ReactNode } from 'react'\nimport { useEntityList } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredRelativeEntityList } from '../treeParameters'\nimport { Component } from './Component'\nimport { EntityList, EntityListBaseProps } from './EntityList'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport type HasManyProps<ListProps = never, EntityProps = never> = SugaredRelativeEntityList & {\n\tchildren?: ReactNode\n\tvariables?: Environment.ValuesMapWithFactory\n} & (\n\t\t| {}\n\t\t| {\n\t\t\t\tlistComponent: ComponentType<ListProps & EntityListBaseProps>\n\t\t\t\tlistProps?: ListProps\n\t\t }\n\t)\n\nexport const HasMany = Component(\n\t<ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => {\n\t\tconst entityList = useEntityList(props)\n\n\t\treturn <EntityList {...props} accessor={entityList} />\n\t},\n\t{\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntityList(environment, props)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<EntityList {...props} accessor={undefined as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</EntityList>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createRelativeEntityListFields(props, environment, fields),\n\t},\n\t'HasMany',\n) as <ListProps, EntityProps>(props: HasManyProps<ListProps, EntityProps>) => ReactElement\n"],"names":["_jsx"],"mappings":";;;;;;;;AAsBa,MAAA,UAAU,UACtB,CAAyB,UAAgD;AAClE,QAAA,aAAa,cAAc,KAAK;AAEtC,SAAQA,8BAAA,YAAA;AAAA,OAAe;AAAA,IAAO,UAAU;AAAA,EAAA,CAAY;AACrD,GACA;AAAA,EACC,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,UAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,WAAA,2BAA2B,+BAA+B,aAAa,KAAK;AAAA,EACpF;AAAA,EACA,cAAc,WACZA,8BAAA,YAAA;AAAA,OAAe;AAAA,IAAO,UAAU;AAAA,EAAA,GAC/BA,8BAAA,OAAA;AAAA,IAAM,OAAO;AAAA,EAAA,CAAkB,GAC/B,MAAM,QACR;AAAA,EAED,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,+BAA+B,OAAO,aAAa,MAAM;AACzE,GACA,SACD;;"}
@@ -3,8 +3,8 @@ import { PRIMARY_KEY_NAME } from "../bindingTypes.js";
3
3
  import { Component } from "./Component.js";
4
4
  import { Entity } from "./Entity.js";
5
5
  import { Field } from "./Field.js";
6
+ import { TreeNodeEnvironmentFactory } from "../dao/TreeNodeEnvironmentFactory.js";
6
7
  import { useEntity } from "../accessorPropagation/useEntity.js";
7
- import { Environment } from "../dao/Environment.js";
8
8
  import { MarkerFactory } from "../queryLanguage/MarkerFactory.js";
9
9
  const HasOne = Component((props) => {
10
10
  const entity = useEntity(props);
@@ -14,10 +14,8 @@ const HasOne = Component((props) => {
14
14
  });
15
15
  }, {
16
16
  generateEnvironment: (props, oldEnvironment) => {
17
- if (props.variables === void 0) {
18
- return oldEnvironment;
19
- }
20
- return oldEnvironment.putDelta(Environment.generateDelta(oldEnvironment, props.variables));
17
+ const environment = oldEnvironment.withVariables(props.variables);
18
+ return TreeNodeEnvironmentFactory.createEnvironmentForEntity(environment, props);
21
19
  },
22
20
  staticRender: (props) => /* @__PURE__ */ createElement(Entity, {
23
21
  ...props,
@@ -1 +1 @@
1
- {"version":3,"file":"HasOne.js","sources":["../../../src/coreComponents/HasOne.tsx"],"sourcesContent":["import type { ComponentType, ReactElement, ReactNode } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredRelativeSingleEntity } from '../treeParameters'\nimport { Component } from './Component'\nimport { Entity, EntityBaseProps } from './Entity'\nimport { Field } from './Field'\n\nexport type HasOneProps<EntityProps = never> = SugaredRelativeSingleEntity & {\n\tchildren?: ReactNode\n\tvariables?: Environment.DeltaFactory\n}\n\nexport const HasOne = Component(\n\t<EntityProps extends {}>(props: HasOneProps<EntityProps>) => {\n\t\tconst entity = useEntity(props)\n\n\t\treturn <Entity {...props} accessor={entity} />\n\t},\n\t{\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tif (props.variables === undefined) {\n\t\t\t\treturn oldEnvironment\n\t\t\t}\n\t\t\treturn oldEnvironment.putDelta(Environment.generateDelta(oldEnvironment, props.variables))\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<Entity {...props} accessor={undefined as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</Entity>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createRelativeSingleEntityFields(props, environment, fields),\n\t},\n\t'HasOne',\n) as <EntityProps extends {}>(props: HasOneProps<EntityProps>) => ReactElement\n"],"names":[],"mappings":";;;;;;;;MAea,SAAS,UACrB,CAAyB,UAAoC;QACtD,SAAS,UAAU;uCAEjB,QAAD;AAAA,OAAY;AAAA,IAAO,UAAU;AAAA;AAAA,GAErC;AAAA,EACC,qBAAqB,CAAC,OAAO,mBAAmB;QAC3C,MAAM,cAAc,QAAW;aAC3B;AAAA;WAED,eAAe,SAAS,YAAY,cAAc,gBAAgB,MAAM;AAAA;AAAA,EAEhF,cAAc,yCACZ,QAAD;AAAA,OAAY;AAAA,IAAO,UAAU;AAAA,mCAC3B,OAAD;AAAA,IAAO,OAAO;AAAA,MACb,MAAM;AAAA,EAGT,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,iCAAiC,OAAO,aAAa;AAAA,GAErE;;"}
1
+ {"version":3,"file":"HasOne.js","sources":["../../../src/coreComponents/HasOne.tsx"],"sourcesContent":["import type { ReactElement, ReactNode } from 'react'\nimport { useEntity } from '../accessorPropagation'\nimport { PRIMARY_KEY_NAME } from '../bindingTypes'\nimport { Environment } from '../dao'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredRelativeSingleEntity } from '../treeParameters'\nimport { Component } from './Component'\nimport { Entity } from './Entity'\nimport { Field } from './Field'\nimport { TreeNodeEnvironmentFactory } from '../dao/TreeNodeEnvironmentFactory'\n\nexport type HasOneProps<EntityProps = never> = SugaredRelativeSingleEntity & {\n\tchildren?: ReactNode\n\tvariables?: Environment.ValuesMapWithFactory\n}\n\nexport const HasOne = Component(\n\t<EntityProps extends {}>(props: HasOneProps<EntityProps>) => {\n\t\tconst entity = useEntity(props)\n\n\t\treturn <Entity {...props} accessor={entity} />\n\t},\n\t{\n\t\tgenerateEnvironment: (props, oldEnvironment) => {\n\t\t\tconst environment = oldEnvironment.withVariables(props.variables)\n\t\t\treturn TreeNodeEnvironmentFactory.createEnvironmentForEntity(environment, props)\n\t\t},\n\t\tstaticRender: props => (\n\t\t\t<Entity {...props} accessor={undefined as any}>\n\t\t\t\t<Field field={PRIMARY_KEY_NAME} />\n\t\t\t\t{props.children}\n\t\t\t</Entity>\n\t\t),\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createRelativeSingleEntityFields(props, environment, fields),\n\t},\n\t'HasOne',\n) as <EntityProps extends {}>(props: HasOneProps<EntityProps>) => ReactElement\n"],"names":["_jsx"],"mappings":";;;;;;;;AAgBa,MAAA,SAAS,UACrB,CAAyB,UAAoC;AACtD,QAAA,SAAS,UAAU,KAAK;AAE9B,SAAQA,8BAAA,QAAA;AAAA,OAAW;AAAA,IAAO,UAAU;AAAA,EAAA,CAAQ;AAC7C,GACA;AAAA,EACC,qBAAqB,CAAC,OAAO,mBAAmB;AAC/C,UAAM,cAAc,eAAe,cAAc,MAAM,SAAS;AACzD,WAAA,2BAA2B,2BAA2B,aAAa,KAAK;AAAA,EAChF;AAAA,EACA,cAAc,WACZA,8BAAA,QAAA;AAAA,OAAW;AAAA,IAAO,UAAU;AAAA,EAAA,GAC3BA,8BAAA,OAAA;AAAA,IAAM,OAAO;AAAA,EAAA,CAAkB,GAC/B,MAAM,QACR;AAAA,EAED,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,iCAAiC,OAAO,aAAa,MAAM;AAC3E,GACA,QACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ParentEntity.js","sources":["../../../src/coreComponents/ParentEntity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredParentEntityParameters } from '../treeParameters'\nimport { Component } from './Component'\n\nexport interface ParentEntityProps extends SugaredParentEntityParameters {\n\tchildren?: ReactNode\n}\n\nexport const ParentEntity = Component<ParentEntityProps>(\n\tprops => <>{props.children}</>,\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createParentEntityMarker(props, fields, environment),\n\t},\n\t'ParentEntity',\n)\n"],"names":[],"mappings":";;;MASa,eAAe,UAC3B,yDAAY,MAAM,WAClB;AAAA,EACC,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,yBAAyB,OAAO,QAAQ;AAAA,GAExD;;"}
1
+ {"version":3,"file":"ParentEntity.js","sources":["../../../src/coreComponents/ParentEntity.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { MarkerFactory } from '../queryLanguage'\nimport type { SugaredParentEntityParameters } from '../treeParameters'\nimport { Component } from './Component'\n\nexport interface ParentEntityProps extends SugaredParentEntityParameters {\n\tchildren?: ReactNode\n}\n\nexport const ParentEntity = Component<ParentEntityProps>(\n\tprops => <>{props.children}</>,\n\t{\n\t\tgenerateBranchMarker: (props, fields, environment) =>\n\t\t\tMarkerFactory.createParentEntityMarker(props, fields, environment),\n\t},\n\t'ParentEntity',\n)\n"],"names":["_jsx","_jsxFragment"],"mappings":";;;AASO,MAAM,eAAe,UAC3B,CAAA,UAAYA,8BAAAC,UAAA,MAAA,MAAM,QAAS,GAC3B;AAAA,EACC,sBAAsB,CAAC,OAAO,QAAQ,gBACrC,cAAc,yBAAyB,OAAO,QAAQ,WAAW;AACnE,GACA,cACD;;"}