@contember/binding 1.1.0-alpha.9 → 1.1.0-beta.2

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 (764) hide show
  1. package/dist/development/BindingError.js +4 -1
  2. package/dist/development/BindingError.js.map +1 -1
  3. package/dist/development/accessorPropagation/AccessorProvider.js +20 -7
  4. package/dist/development/accessorPropagation/AccessorProvider.js.map +1 -1
  5. package/dist/development/accessorPropagation/BindingOperationsContext.js +7 -2
  6. package/dist/development/accessorPropagation/BindingOperationsContext.js.map +1 -1
  7. package/dist/development/accessorPropagation/BindingOperationsProvider.js +13 -5
  8. package/dist/development/accessorPropagation/BindingOperationsProvider.js.map +1 -1
  9. package/dist/development/accessorPropagation/EntityKeyContext.js +3 -1
  10. package/dist/development/accessorPropagation/EntityKeyContext.js.map +1 -1
  11. package/dist/development/accessorPropagation/EntityKeyProvider.js +13 -5
  12. package/dist/development/accessorPropagation/EntityKeyProvider.js.map +1 -1
  13. package/dist/development/accessorPropagation/EnvironmentContext.js +66 -2
  14. package/dist/development/accessorPropagation/EnvironmentContext.js.map +1 -1
  15. package/dist/development/accessorPropagation/TreeRootIdContext.js +3 -1
  16. package/dist/development/accessorPropagation/TreeRootIdContext.js.map +1 -1
  17. package/dist/development/accessorPropagation/TreeRootIdProvider.js +13 -5
  18. package/dist/development/accessorPropagation/TreeRootIdProvider.js.map +1 -1
  19. package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js +3 -1
  20. package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
  21. package/dist/development/accessorPropagation/useBindingOperations.js +3 -1
  22. package/dist/development/accessorPropagation/useBindingOperations.js.map +1 -1
  23. package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js +26 -18
  24. package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
  25. package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js +14 -6
  26. package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
  27. package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js +14 -6
  28. package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
  29. package/dist/development/accessorPropagation/useEntity.js +7 -2
  30. package/dist/development/accessorPropagation/useEntity.js.map +1 -1
  31. package/dist/development/accessorPropagation/useEntityKey.js +6 -2
  32. package/dist/development/accessorPropagation/useEntityKey.js.map +1 -1
  33. package/dist/development/accessorPropagation/useEntityList.js +11 -3
  34. package/dist/development/accessorPropagation/useEntityList.js.map +1 -1
  35. package/dist/development/accessorPropagation/useEntityListSubTree.js +7 -2
  36. package/dist/development/accessorPropagation/useEntityListSubTree.js.map +1 -1
  37. package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js +50 -30
  38. package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
  39. package/dist/development/accessorPropagation/useEntitySubTree.js +7 -2
  40. package/dist/development/accessorPropagation/useEntitySubTree.js.map +1 -1
  41. package/dist/development/accessorPropagation/useEntitySubTreeParameters.js +27 -16
  42. package/dist/development/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
  43. package/dist/development/accessorPropagation/useEnvironment.js +3 -1
  44. package/dist/development/accessorPropagation/useEnvironment.js.map +1 -1
  45. package/dist/development/accessorPropagation/useExtendTree.js +7 -2
  46. package/dist/development/accessorPropagation/useExtendTree.js.map +1 -1
  47. package/dist/development/accessorPropagation/useField.js +11 -3
  48. package/dist/development/accessorPropagation/useField.js.map +1 -1
  49. package/dist/development/accessorPropagation/useGetEntityByKey.js +3 -1
  50. package/dist/development/accessorPropagation/useGetEntityByKey.js.map +1 -1
  51. package/dist/development/accessorPropagation/useGetEntityListSubTree.js +7 -2
  52. package/dist/development/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
  53. package/dist/development/accessorPropagation/useGetEntitySubTree.js +7 -2
  54. package/dist/development/accessorPropagation/useGetEntitySubTree.js.map +1 -1
  55. package/dist/development/accessorPropagation/useGetTreeFilters.js +3 -1
  56. package/dist/development/accessorPropagation/useGetTreeFilters.js.map +1 -1
  57. package/dist/development/accessorPropagation/useHasEntity.js +3 -1
  58. package/dist/development/accessorPropagation/useHasEntity.js.map +1 -1
  59. package/dist/development/accessorPropagation/usePersist.js +3 -1
  60. package/dist/development/accessorPropagation/usePersist.js.map +1 -1
  61. package/dist/development/accessorPropagation/useTreeRootId.js +3 -1
  62. package/dist/development/accessorPropagation/useTreeRootId.js.map +1 -1
  63. package/dist/development/accessorSorting/SetOrderFieldOnCreate.js +84 -44
  64. package/dist/development/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
  65. package/dist/development/accessorSorting/addEntityAtIndex.js +3 -1
  66. package/dist/development/accessorSorting/addEntityAtIndex.js.map +1 -1
  67. package/dist/development/accessorSorting/errors.js +6 -2
  68. package/dist/development/accessorSorting/errors.js.map +1 -1
  69. package/dist/development/accessorSorting/moveEntity.js +4 -1
  70. package/dist/development/accessorSorting/moveEntity.js.map +1 -1
  71. package/dist/development/accessorSorting/repairEntitiesOrder.js +3 -1
  72. package/dist/development/accessorSorting/repairEntitiesOrder.js.map +1 -1
  73. package/dist/development/accessorSorting/sortEntities.js +3 -1
  74. package/dist/development/accessorSorting/sortEntities.js.map +1 -1
  75. package/dist/development/accessorSorting/useSortedEntities.js +61 -23
  76. package/dist/development/accessorSorting/useSortedEntities.js.map +1 -1
  77. package/dist/development/accessorTree/AccessorTree.js +50 -22
  78. package/dist/development/accessorTree/AccessorTree.js.map +1 -1
  79. package/dist/development/accessorTree/AccessorTreeStateContext.js +3 -1
  80. package/dist/development/accessorTree/AccessorTreeStateContext.js.map +1 -1
  81. package/dist/development/accessorTree/DirtinessContext.js +3 -1
  82. package/dist/development/accessorTree/DirtinessContext.js.map +1 -1
  83. package/dist/development/accessorTree/MutationStateContext.js +3 -1
  84. package/dist/development/accessorTree/MutationStateContext.js.map +1 -1
  85. package/dist/development/accessorTree/NormalizedPersistedData.js +3 -1
  86. package/dist/development/accessorTree/NormalizedPersistedData.js.map +1 -1
  87. package/dist/development/accessorTree/RuntimeId.js +8 -2
  88. package/dist/development/accessorTree/RuntimeId.js.map +1 -1
  89. package/dist/development/accessorTree/accessorTreeStateReducer.js +10 -5
  90. package/dist/development/accessorTree/accessorTreeStateReducer.js.map +1 -1
  91. package/dist/development/accessorTree/metadataToRequestError.js +3 -1
  92. package/dist/development/accessorTree/metadataToRequestError.js.map +1 -1
  93. package/dist/development/accessorTree/useAccessorTreeState.js +3 -1
  94. package/dist/development/accessorTree/useAccessorTreeState.js.map +1 -1
  95. package/dist/development/accessorTree/useDataBinding.js +63 -53
  96. package/dist/development/accessorTree/useDataBinding.js.map +1 -1
  97. package/dist/development/accessorTree/useDirtinessState.js +3 -1
  98. package/dist/development/accessorTree/useDirtinessState.js.map +1 -1
  99. package/dist/development/accessorTree/useMutationState.js +3 -1
  100. package/dist/development/accessorTree/useMutationState.js.map +1 -1
  101. package/dist/development/accessors/EntityAccessor.js +35 -14
  102. package/dist/development/accessors/EntityAccessor.js.map +1 -1
  103. package/dist/development/accessors/EntityListAccessor.js +13 -11
  104. package/dist/development/accessors/EntityListAccessor.js.map +1 -1
  105. package/dist/development/accessors/ErrorAccessor.js +3 -1
  106. package/dist/development/accessors/ErrorAccessor.js.map +1 -1
  107. package/dist/development/accessors/FieldAccessor.js +9 -7
  108. package/dist/development/accessors/FieldAccessor.js.map +1 -1
  109. package/dist/development/accessors/TreeRootAccessor.js +3 -1
  110. package/dist/development/accessors/TreeRootAccessor.js.map +1 -1
  111. package/dist/development/bindingTypes.js +5 -1
  112. package/dist/development/bindingTypes.js.map +1 -1
  113. package/dist/development/core/AccessorErrorManager.js +3 -1
  114. package/dist/development/core/AccessorErrorManager.js.map +1 -1
  115. package/dist/development/core/Config.js +4 -4
  116. package/dist/development/core/Config.js.map +1 -1
  117. package/dist/development/core/DataBinding.js +146 -148
  118. package/dist/development/core/DataBinding.js.map +1 -1
  119. package/dist/development/core/DirtinessTracker.js +3 -1
  120. package/dist/development/core/DirtinessTracker.js.map +1 -1
  121. package/dist/development/core/ErrorsPreprocessor.js +12 -4
  122. package/dist/development/core/ErrorsPreprocessor.js.map +1 -1
  123. package/dist/development/core/EventManager.js +22 -8
  124. package/dist/development/core/EventManager.js.map +1 -1
  125. package/dist/development/core/IncrementalMarkerBuilder.js +36 -8
  126. package/dist/development/core/IncrementalMarkerBuilder.js.map +1 -1
  127. package/dist/development/core/MarkerComparator.js +7 -2
  128. package/dist/development/core/MarkerComparator.js.map +1 -1
  129. package/dist/development/core/MarkerMerger.js +60 -17
  130. package/dist/development/core/MarkerMerger.js.map +1 -1
  131. package/dist/development/core/MarkerTreeGenerator.js +11 -3
  132. package/dist/development/core/MarkerTreeGenerator.js.map +1 -1
  133. package/dist/development/core/MutationGenerator.js +127 -28
  134. package/dist/development/core/MutationGenerator.js.map +1 -1
  135. package/dist/development/core/QueryGenerator.js +40 -9
  136. package/dist/development/core/QueryGenerator.js.map +1 -1
  137. package/dist/development/core/RealmKeyGenerator.js +12 -3
  138. package/dist/development/core/RealmKeyGenerator.js.map +1 -1
  139. package/dist/development/core/RequestResponseNormalizer.js +3 -1
  140. package/dist/development/core/RequestResponseNormalizer.js.map +1 -1
  141. package/dist/development/core/StateInitializer.js +91 -34
  142. package/dist/development/core/StateInitializer.js.map +1 -1
  143. package/dist/development/core/TreeAugmenter.js +26 -5
  144. package/dist/development/core/TreeAugmenter.js.map +1 -1
  145. package/dist/development/core/TreeFilterGenerator.js +8 -2
  146. package/dist/development/core/TreeFilterGenerator.js.map +1 -1
  147. package/dist/development/core/TreeParameterMerger.js +25 -7
  148. package/dist/development/core/TreeParameterMerger.js.map +1 -1
  149. package/dist/development/core/TreeStore.js +23 -18
  150. package/dist/development/core/TreeStore.js.map +1 -1
  151. package/dist/development/core/VariableInputTransformer.js +3 -1
  152. package/dist/development/core/VariableInputTransformer.js.map +1 -1
  153. package/dist/development/core/exceptions/ErrorLocator.js +11 -3
  154. package/dist/development/core/exceptions/ErrorLocator.js.map +1 -1
  155. package/dist/development/core/exceptions/LocalizedBindingError.js +3 -1
  156. package/dist/development/core/exceptions/LocalizedBindingError.js.map +1 -1
  157. package/dist/development/core/exceptions/MarkerSugarer.js +8 -2
  158. package/dist/development/core/exceptions/MarkerSugarer.js.map +1 -1
  159. package/dist/development/core/exceptions/TreeParameterSugarer.js +3 -1
  160. package/dist/development/core/exceptions/TreeParameterSugarer.js.map +1 -1
  161. package/dist/development/core/factories/createBatchUpdatesOptions.js +3 -1
  162. package/dist/development/core/factories/createBatchUpdatesOptions.js.map +1 -1
  163. package/dist/development/core/operations/EntityOperations.js +47 -16
  164. package/dist/development/core/operations/EntityOperations.js.map +1 -1
  165. package/dist/development/core/operations/FieldOperations.js +22 -8
  166. package/dist/development/core/operations/FieldOperations.js.map +1 -1
  167. package/dist/development/core/operations/ListOperations.js +22 -9
  168. package/dist/development/core/operations/ListOperations.js.map +1 -1
  169. package/dist/development/core/operations/OperationsHelpers.js +6 -2
  170. package/dist/development/core/operations/OperationsHelpers.js.map +1 -1
  171. package/dist/development/core/requestAliases/MutationAlias.js +3 -1
  172. package/dist/development/core/requestAliases/MutationAlias.js.map +1 -1
  173. package/dist/development/core/schema/Schema.js +30 -4
  174. package/dist/development/core/schema/Schema.js.map +1 -1
  175. package/dist/development/core/schema/SchemaLoader.js +15 -13
  176. package/dist/development/core/schema/SchemaLoader.js.map +1 -1
  177. package/dist/development/core/schema/SchemaPreprocessor.js +3 -1
  178. package/dist/development/core/schema/SchemaPreprocessor.js.map +1 -1
  179. package/dist/development/core/state/StateIterator.js +3 -1
  180. package/dist/development/core/state/StateIterator.js.map +1 -1
  181. package/dist/development/core/state/getEntityMarker.js +3 -1
  182. package/dist/development/core/state/getEntityMarker.js.map +1 -1
  183. package/dist/development/core/utils/getCombinedSignal.js +3 -1
  184. package/dist/development/core/utils/getCombinedSignal.js.map +1 -1
  185. package/dist/development/coreComponents/Component.js +8 -3
  186. package/dist/development/coreComponents/Component.js.map +1 -1
  187. package/dist/development/coreComponents/DataBindingProvider.js +14 -9
  188. package/dist/development/coreComponents/DataBindingProvider.js.map +1 -1
  189. package/dist/development/coreComponents/Entity.js +16 -6
  190. package/dist/development/coreComponents/Entity.js.map +1 -1
  191. package/dist/development/coreComponents/EntityList.js +21 -9
  192. package/dist/development/coreComponents/EntityList.js.map +1 -1
  193. package/dist/development/coreComponents/EntityListSubTree.js +26 -9
  194. package/dist/development/coreComponents/EntityListSubTree.js.map +1 -1
  195. package/dist/development/coreComponents/EntitySubTree.js +37 -14
  196. package/dist/development/coreComponents/EntitySubTree.js.map +1 -1
  197. package/dist/development/coreComponents/Field.js +10 -4
  198. package/dist/development/coreComponents/Field.js.map +1 -1
  199. package/dist/development/coreComponents/HasMany.js +25 -9
  200. package/dist/development/coreComponents/HasMany.js.map +1 -1
  201. package/dist/development/coreComponents/HasOne.js +26 -10
  202. package/dist/development/coreComponents/HasOne.js.map +1 -1
  203. package/dist/development/coreComponents/ParentEntity.js +7 -3
  204. package/dist/development/coreComponents/ParentEntity.js.map +1 -1
  205. package/dist/development/dao/Environment.js +26 -2
  206. package/dist/development/dao/Environment.js.map +1 -1
  207. package/dist/development/dao/TreeNodeEnvironmentFactory.js +14 -14
  208. package/dist/development/dao/TreeNodeEnvironmentFactory.js.map +1 -1
  209. package/dist/development/dao/VariableFieldValue.js +3 -1
  210. package/dist/development/dao/VariableFieldValue.js.map +1 -1
  211. package/dist/development/entityEvents/useDerivedField.js +25 -17
  212. package/dist/development/entityEvents/useDerivedField.js.map +1 -1
  213. package/dist/development/entityEvents/useEntityBeforePersist.js +3 -1
  214. package/dist/development/entityEvents/useEntityBeforePersist.js.map +1 -1
  215. package/dist/development/entityEvents/useEntityBeforeUpdate.js +3 -1
  216. package/dist/development/entityEvents/useEntityBeforeUpdate.js.map +1 -1
  217. package/dist/development/entityEvents/useEntityEvent.js +16 -8
  218. package/dist/development/entityEvents/useEntityEvent.js.map +1 -1
  219. package/dist/development/entityEvents/useEntityPersistError.js +3 -1
  220. package/dist/development/entityEvents/useEntityPersistError.js.map +1 -1
  221. package/dist/development/entityEvents/useEntityPersistSuccess.js +3 -1
  222. package/dist/development/entityEvents/useEntityPersistSuccess.js.map +1 -1
  223. package/dist/development/entityEvents/useOnConnectionUpdate.js +3 -1
  224. package/dist/development/entityEvents/useOnConnectionUpdate.js.map +1 -1
  225. package/dist/development/fieldHelpers/helpers/FieldHelper.js +3 -1
  226. package/dist/development/fieldHelpers/helpers/FieldHelper.js.map +1 -1
  227. package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.js +3 -1
  228. package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -1
  229. package/dist/development/fieldHelpers/helpers/UuidFieldHelper.js +3 -1
  230. package/dist/development/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
  231. package/dist/development/helperComponents/DeferredSubTrees.js +46 -13
  232. package/dist/development/helperComponents/DeferredSubTrees.js.map +1 -1
  233. package/dist/development/helperComponents/EntityView.js +7 -3
  234. package/dist/development/helperComponents/EntityView.js.map +1 -1
  235. package/dist/development/helperComponents/FieldView.js +22 -8
  236. package/dist/development/helperComponents/FieldView.js.map +1 -1
  237. package/dist/development/helperComponents/If.js +57 -19
  238. package/dist/development/helperComponents/If.js.map +1 -1
  239. package/dist/development/helperComponents/StaticRender.js +9 -3
  240. package/dist/development/helperComponents/StaticRender.js.map +1 -1
  241. package/dist/development/helperComponents/SugaredField.js +17 -6
  242. package/dist/development/helperComponents/SugaredField.js.map +1 -1
  243. package/dist/development/helperComponents/helpers/FilterEvaluator.js +3 -4
  244. package/dist/development/helperComponents/helpers/FilterEvaluator.js.map +1 -1
  245. package/dist/development/helperComponents/helpers/FilterFieldsCollector.js +3 -4
  246. package/dist/development/helperComponents/helpers/FilterFieldsCollector.js.map +1 -1
  247. package/dist/development/helperComponents/helpers/evaluateCondition.js +3 -1
  248. package/dist/development/helperComponents/helpers/evaluateCondition.js.map +1 -1
  249. package/dist/development/index.js +225 -104
  250. package/dist/development/index.js.map +1 -1
  251. package/dist/development/markers/EntityFieldMarkersContainer.js +3 -1
  252. package/dist/development/markers/EntityFieldMarkersContainer.js.map +1 -1
  253. package/dist/development/markers/EntityFieldsWithHoistablesMarker.js +3 -1
  254. package/dist/development/markers/EntityFieldsWithHoistablesMarker.js.map +1 -1
  255. package/dist/development/markers/EntityListSubTreeMarker.js +3 -1
  256. package/dist/development/markers/EntityListSubTreeMarker.js.map +1 -1
  257. package/dist/development/markers/EntitySubTreeMarker.js +3 -1
  258. package/dist/development/markers/EntitySubTreeMarker.js.map +1 -1
  259. package/dist/development/markers/FieldMarker.js +3 -1
  260. package/dist/development/markers/FieldMarker.js.map +1 -1
  261. package/dist/development/markers/HasManyRelationMarker.js +3 -1
  262. package/dist/development/markers/HasManyRelationMarker.js.map +1 -1
  263. package/dist/development/markers/HasOneRelationMarker.js +3 -1
  264. package/dist/development/markers/HasOneRelationMarker.js.map +1 -1
  265. package/dist/development/markers/MarkerTreeRoot.js +3 -1
  266. package/dist/development/markers/MarkerTreeRoot.js.map +1 -1
  267. package/dist/development/markers/ParentEntityMarker.js +3 -1
  268. package/dist/development/markers/ParentEntityMarker.js.map +1 -1
  269. package/dist/development/markers/PlaceholderGenerator.js +3 -1
  270. package/dist/development/markers/PlaceholderGenerator.js.map +1 -1
  271. package/dist/development/queryLanguage/CacheStore.js +3 -1
  272. package/dist/development/queryLanguage/CacheStore.js.map +1 -1
  273. package/dist/development/queryLanguage/MarkerFactory.js +117 -25
  274. package/dist/development/queryLanguage/MarkerFactory.js.map +1 -1
  275. package/dist/development/queryLanguage/Parser.js +114 -79
  276. package/dist/development/queryLanguage/Parser.js.map +1 -1
  277. package/dist/development/queryLanguage/QueryLanguage.js +73 -20
  278. package/dist/development/queryLanguage/QueryLanguage.js.map +1 -1
  279. package/dist/development/queryLanguage/QueryLanguageError.js +3 -1
  280. package/dist/development/queryLanguage/QueryLanguageError.js.map +1 -1
  281. package/dist/development/queryLanguage/tokenList.js +5 -1
  282. package/dist/development/queryLanguage/tokenList.js.map +1 -1
  283. package/dist/development/structures/BijectiveIndexedMap.js +3 -1
  284. package/dist/development/structures/BijectiveIndexedMap.js.map +1 -1
  285. package/dist/development/structures/LRUCache.js +3 -1
  286. package/dist/development/structures/LRUCache.js.map +1 -1
  287. package/dist/development/structures/WeakIdCache.js +3 -1
  288. package/dist/development/structures/WeakIdCache.js.map +1 -1
  289. package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.js +3 -1
  290. package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.js.map +1 -1
  291. package/dist/development/treeParameters/EntityCreationParameters.js +3 -1
  292. package/dist/development/treeParameters/EntityCreationParameters.js.map +1 -1
  293. package/dist/development/treeParameters/EntityListPreferences.js +3 -1
  294. package/dist/development/treeParameters/EntityListPreferences.js.map +1 -1
  295. package/dist/development/treeParameters/EventListenersStore.js +3 -1
  296. package/dist/development/treeParameters/EventListenersStore.js.map +1 -1
  297. package/dist/development/treeParameters/LeafField.js +3 -1
  298. package/dist/development/treeParameters/LeafField.js.map +1 -1
  299. package/dist/development/treeParameters/QualifiedEntityParameters.js +3 -1
  300. package/dist/development/treeParameters/QualifiedEntityParameters.js.map +1 -1
  301. package/dist/development/treeParameters/Relation.js +3 -1
  302. package/dist/development/treeParameters/Relation.js.map +1 -1
  303. package/dist/development/utils/Hashing.js +3 -1
  304. package/dist/development/utils/Hashing.js.map +1 -1
  305. package/dist/development/utils/assert.js +3 -1
  306. package/dist/development/utils/assert.js.map +1 -1
  307. package/dist/development/utils/assertNever.js +6 -2
  308. package/dist/development/utils/assertNever.js.map +1 -1
  309. package/dist/development/utils/generateEnumerabilityPreventingEntropy.js +3 -1
  310. package/dist/development/utils/generateEnumerabilityPreventingEntropy.js.map +1 -1
  311. package/dist/development/utils/isEmptyObject.js +3 -1
  312. package/dist/development/utils/isEmptyObject.js.map +1 -1
  313. package/dist/development/utils/ucfirst.js +3 -1
  314. package/dist/development/utils/ucfirst.js.map +1 -1
  315. package/dist/production/BindingError.js +4 -1
  316. package/dist/production/BindingError.js.map +1 -1
  317. package/dist/production/accessorPropagation/AccessorProvider.js +11 -7
  318. package/dist/production/accessorPropagation/AccessorProvider.js.map +1 -1
  319. package/dist/production/accessorPropagation/BindingOperationsContext.js +7 -2
  320. package/dist/production/accessorPropagation/BindingOperationsContext.js.map +1 -1
  321. package/dist/production/accessorPropagation/BindingOperationsProvider.js +8 -5
  322. package/dist/production/accessorPropagation/BindingOperationsProvider.js.map +1 -1
  323. package/dist/production/accessorPropagation/EntityKeyContext.js +3 -1
  324. package/dist/production/accessorPropagation/EntityKeyContext.js.map +1 -1
  325. package/dist/production/accessorPropagation/EntityKeyProvider.js +8 -5
  326. package/dist/production/accessorPropagation/EntityKeyProvider.js.map +1 -1
  327. package/dist/production/accessorPropagation/EnvironmentContext.js +53 -2
  328. package/dist/production/accessorPropagation/EnvironmentContext.js.map +1 -1
  329. package/dist/production/accessorPropagation/TreeRootIdContext.js +3 -1
  330. package/dist/production/accessorPropagation/TreeRootIdContext.js.map +1 -1
  331. package/dist/production/accessorPropagation/TreeRootIdProvider.js +8 -5
  332. package/dist/production/accessorPropagation/TreeRootIdProvider.js.map +1 -1
  333. package/dist/production/accessorPropagation/useAccessorUpdateSubscription.js +3 -1
  334. package/dist/production/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
  335. package/dist/production/accessorPropagation/useBindingOperations.js +3 -1
  336. package/dist/production/accessorPropagation/useBindingOperations.js.map +1 -1
  337. package/dist/production/accessorPropagation/useDesugaredRelativeEntityList.js +26 -18
  338. package/dist/production/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
  339. package/dist/production/accessorPropagation/useDesugaredRelativeSingleEntity.js +14 -6
  340. package/dist/production/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
  341. package/dist/production/accessorPropagation/useDesugaredRelativeSingleField.js +14 -6
  342. package/dist/production/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
  343. package/dist/production/accessorPropagation/useEntity.js +7 -2
  344. package/dist/production/accessorPropagation/useEntity.js.map +1 -1
  345. package/dist/production/accessorPropagation/useEntityKey.js +6 -2
  346. package/dist/production/accessorPropagation/useEntityKey.js.map +1 -1
  347. package/dist/production/accessorPropagation/useEntityList.js +11 -3
  348. package/dist/production/accessorPropagation/useEntityList.js.map +1 -1
  349. package/dist/production/accessorPropagation/useEntityListSubTree.js +7 -2
  350. package/dist/production/accessorPropagation/useEntityListSubTree.js.map +1 -1
  351. package/dist/production/accessorPropagation/useEntityListSubTreeParameters.js +50 -30
  352. package/dist/production/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
  353. package/dist/production/accessorPropagation/useEntitySubTree.js +7 -2
  354. package/dist/production/accessorPropagation/useEntitySubTree.js.map +1 -1
  355. package/dist/production/accessorPropagation/useEntitySubTreeParameters.js +27 -16
  356. package/dist/production/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
  357. package/dist/production/accessorPropagation/useEnvironment.js +3 -1
  358. package/dist/production/accessorPropagation/useEnvironment.js.map +1 -1
  359. package/dist/production/accessorPropagation/useExtendTree.js +7 -2
  360. package/dist/production/accessorPropagation/useExtendTree.js.map +1 -1
  361. package/dist/production/accessorPropagation/useField.js +11 -3
  362. package/dist/production/accessorPropagation/useField.js.map +1 -1
  363. package/dist/production/accessorPropagation/useGetEntityByKey.js +3 -1
  364. package/dist/production/accessorPropagation/useGetEntityByKey.js.map +1 -1
  365. package/dist/production/accessorPropagation/useGetEntityListSubTree.js +7 -2
  366. package/dist/production/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
  367. package/dist/production/accessorPropagation/useGetEntitySubTree.js +7 -2
  368. package/dist/production/accessorPropagation/useGetEntitySubTree.js.map +1 -1
  369. package/dist/production/accessorPropagation/useGetTreeFilters.js +3 -1
  370. package/dist/production/accessorPropagation/useGetTreeFilters.js.map +1 -1
  371. package/dist/production/accessorPropagation/useHasEntity.js +3 -1
  372. package/dist/production/accessorPropagation/useHasEntity.js.map +1 -1
  373. package/dist/production/accessorPropagation/usePersist.js +3 -1
  374. package/dist/production/accessorPropagation/usePersist.js.map +1 -1
  375. package/dist/production/accessorPropagation/useTreeRootId.js +3 -1
  376. package/dist/production/accessorPropagation/useTreeRootId.js.map +1 -1
  377. package/dist/production/accessorSorting/SetOrderFieldOnCreate.js +55 -44
  378. package/dist/production/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
  379. package/dist/production/accessorSorting/addEntityAtIndex.js +3 -1
  380. package/dist/production/accessorSorting/addEntityAtIndex.js.map +1 -1
  381. package/dist/production/accessorSorting/errors.js +6 -2
  382. package/dist/production/accessorSorting/errors.js.map +1 -1
  383. package/dist/production/accessorSorting/moveEntity.js +4 -1
  384. package/dist/production/accessorSorting/moveEntity.js.map +1 -1
  385. package/dist/production/accessorSorting/repairEntitiesOrder.js +3 -1
  386. package/dist/production/accessorSorting/repairEntitiesOrder.js.map +1 -1
  387. package/dist/production/accessorSorting/sortEntities.js +3 -1
  388. package/dist/production/accessorSorting/sortEntities.js.map +1 -1
  389. package/dist/production/accessorSorting/useSortedEntities.js +61 -23
  390. package/dist/production/accessorSorting/useSortedEntities.js.map +1 -1
  391. package/dist/production/accessorTree/AccessorTree.js +29 -22
  392. package/dist/production/accessorTree/AccessorTree.js.map +1 -1
  393. package/dist/production/accessorTree/AccessorTreeStateContext.js +3 -1
  394. package/dist/production/accessorTree/AccessorTreeStateContext.js.map +1 -1
  395. package/dist/production/accessorTree/DirtinessContext.js +3 -1
  396. package/dist/production/accessorTree/DirtinessContext.js.map +1 -1
  397. package/dist/production/accessorTree/MutationStateContext.js +3 -1
  398. package/dist/production/accessorTree/MutationStateContext.js.map +1 -1
  399. package/dist/production/accessorTree/NormalizedPersistedData.js +3 -1
  400. package/dist/production/accessorTree/NormalizedPersistedData.js.map +1 -1
  401. package/dist/production/accessorTree/RuntimeId.js +8 -2
  402. package/dist/production/accessorTree/RuntimeId.js.map +1 -1
  403. package/dist/production/accessorTree/accessorTreeStateReducer.js +10 -5
  404. package/dist/production/accessorTree/accessorTreeStateReducer.js.map +1 -1
  405. package/dist/production/accessorTree/metadataToRequestError.js +3 -1
  406. package/dist/production/accessorTree/metadataToRequestError.js.map +1 -1
  407. package/dist/production/accessorTree/useAccessorTreeState.js +3 -1
  408. package/dist/production/accessorTree/useAccessorTreeState.js.map +1 -1
  409. package/dist/production/accessorTree/useDataBinding.js +63 -53
  410. package/dist/production/accessorTree/useDataBinding.js.map +1 -1
  411. package/dist/production/accessorTree/useDirtinessState.js +3 -1
  412. package/dist/production/accessorTree/useDirtinessState.js.map +1 -1
  413. package/dist/production/accessorTree/useMutationState.js +3 -1
  414. package/dist/production/accessorTree/useMutationState.js.map +1 -1
  415. package/dist/production/accessors/EntityAccessor.js +35 -14
  416. package/dist/production/accessors/EntityAccessor.js.map +1 -1
  417. package/dist/production/accessors/EntityListAccessor.js +13 -11
  418. package/dist/production/accessors/EntityListAccessor.js.map +1 -1
  419. package/dist/production/accessors/ErrorAccessor.js +3 -1
  420. package/dist/production/accessors/ErrorAccessor.js.map +1 -1
  421. package/dist/production/accessors/FieldAccessor.js +9 -7
  422. package/dist/production/accessors/FieldAccessor.js.map +1 -1
  423. package/dist/production/accessors/TreeRootAccessor.js +3 -1
  424. package/dist/production/accessors/TreeRootAccessor.js.map +1 -1
  425. package/dist/production/bindingTypes.js +5 -1
  426. package/dist/production/bindingTypes.js.map +1 -1
  427. package/dist/production/core/AccessorErrorManager.js +3 -1
  428. package/dist/production/core/AccessorErrorManager.js.map +1 -1
  429. package/dist/production/core/Config.js +4 -4
  430. package/dist/production/core/Config.js.map +1 -1
  431. package/dist/production/core/DataBinding.js +146 -148
  432. package/dist/production/core/DataBinding.js.map +1 -1
  433. package/dist/production/core/DirtinessTracker.js +3 -1
  434. package/dist/production/core/DirtinessTracker.js.map +1 -1
  435. package/dist/production/core/ErrorsPreprocessor.js +12 -4
  436. package/dist/production/core/ErrorsPreprocessor.js.map +1 -1
  437. package/dist/production/core/EventManager.js +10 -4
  438. package/dist/production/core/EventManager.js.map +1 -1
  439. package/dist/production/core/IncrementalMarkerBuilder.js +36 -8
  440. package/dist/production/core/IncrementalMarkerBuilder.js.map +1 -1
  441. package/dist/production/core/MarkerComparator.js +7 -2
  442. package/dist/production/core/MarkerComparator.js.map +1 -1
  443. package/dist/production/core/MarkerMerger.js +60 -17
  444. package/dist/production/core/MarkerMerger.js.map +1 -1
  445. package/dist/production/core/MarkerTreeGenerator.js +11 -3
  446. package/dist/production/core/MarkerTreeGenerator.js.map +1 -1
  447. package/dist/production/core/MutationGenerator.js +127 -28
  448. package/dist/production/core/MutationGenerator.js.map +1 -1
  449. package/dist/production/core/QueryGenerator.js +40 -9
  450. package/dist/production/core/QueryGenerator.js.map +1 -1
  451. package/dist/production/core/RealmKeyGenerator.js +12 -3
  452. package/dist/production/core/RealmKeyGenerator.js.map +1 -1
  453. package/dist/production/core/RequestResponseNormalizer.js +3 -1
  454. package/dist/production/core/RequestResponseNormalizer.js.map +1 -1
  455. package/dist/production/core/StateInitializer.js +91 -34
  456. package/dist/production/core/StateInitializer.js.map +1 -1
  457. package/dist/production/core/TreeAugmenter.js +26 -5
  458. package/dist/production/core/TreeAugmenter.js.map +1 -1
  459. package/dist/production/core/TreeFilterGenerator.js +8 -2
  460. package/dist/production/core/TreeFilterGenerator.js.map +1 -1
  461. package/dist/production/core/TreeParameterMerger.js +25 -7
  462. package/dist/production/core/TreeParameterMerger.js.map +1 -1
  463. package/dist/production/core/TreeStore.js +23 -18
  464. package/dist/production/core/TreeStore.js.map +1 -1
  465. package/dist/production/core/VariableInputTransformer.js +3 -1
  466. package/dist/production/core/VariableInputTransformer.js.map +1 -1
  467. package/dist/production/core/exceptions/ErrorLocator.js +11 -3
  468. package/dist/production/core/exceptions/ErrorLocator.js.map +1 -1
  469. package/dist/production/core/exceptions/LocalizedBindingError.js +3 -1
  470. package/dist/production/core/exceptions/LocalizedBindingError.js.map +1 -1
  471. package/dist/production/core/exceptions/MarkerSugarer.js +8 -2
  472. package/dist/production/core/exceptions/MarkerSugarer.js.map +1 -1
  473. package/dist/production/core/exceptions/TreeParameterSugarer.js +3 -1
  474. package/dist/production/core/exceptions/TreeParameterSugarer.js.map +1 -1
  475. package/dist/production/core/factories/createBatchUpdatesOptions.js +3 -1
  476. package/dist/production/core/factories/createBatchUpdatesOptions.js.map +1 -1
  477. package/dist/production/core/operations/EntityOperations.js +47 -16
  478. package/dist/production/core/operations/EntityOperations.js.map +1 -1
  479. package/dist/production/core/operations/FieldOperations.js +11 -3
  480. package/dist/production/core/operations/FieldOperations.js.map +1 -1
  481. package/dist/production/core/operations/ListOperations.js +22 -9
  482. package/dist/production/core/operations/ListOperations.js.map +1 -1
  483. package/dist/production/core/operations/OperationsHelpers.js +6 -2
  484. package/dist/production/core/operations/OperationsHelpers.js.map +1 -1
  485. package/dist/production/core/requestAliases/MutationAlias.js +3 -1
  486. package/dist/production/core/requestAliases/MutationAlias.js.map +1 -1
  487. package/dist/production/core/schema/Schema.js +30 -4
  488. package/dist/production/core/schema/Schema.js.map +1 -1
  489. package/dist/production/core/schema/SchemaLoader.js +15 -13
  490. package/dist/production/core/schema/SchemaLoader.js.map +1 -1
  491. package/dist/production/core/schema/SchemaPreprocessor.js +3 -1
  492. package/dist/production/core/schema/SchemaPreprocessor.js.map +1 -1
  493. package/dist/production/core/state/StateIterator.js +3 -1
  494. package/dist/production/core/state/StateIterator.js.map +1 -1
  495. package/dist/production/core/state/getEntityMarker.js +3 -1
  496. package/dist/production/core/state/getEntityMarker.js.map +1 -1
  497. package/dist/production/core/utils/getCombinedSignal.js +3 -1
  498. package/dist/production/core/utils/getCombinedSignal.js.map +1 -1
  499. package/dist/production/coreComponents/Component.js +8 -3
  500. package/dist/production/coreComponents/Component.js.map +1 -1
  501. package/dist/production/coreComponents/DataBindingProvider.js +9 -9
  502. package/dist/production/coreComponents/DataBindingProvider.js.map +1 -1
  503. package/dist/production/coreComponents/Entity.js +11 -6
  504. package/dist/production/coreComponents/Entity.js.map +1 -1
  505. package/dist/production/coreComponents/EntityList.js +16 -9
  506. package/dist/production/coreComponents/EntityList.js.map +1 -1
  507. package/dist/production/coreComponents/EntityListSubTree.js +12 -8
  508. package/dist/production/coreComponents/EntityListSubTree.js.map +1 -1
  509. package/dist/production/coreComponents/EntitySubTree.js +19 -13
  510. package/dist/production/coreComponents/EntitySubTree.js.map +1 -1
  511. package/dist/production/coreComponents/Field.js +10 -4
  512. package/dist/production/coreComponents/Field.js.map +1 -1
  513. package/dist/production/coreComponents/HasMany.js +11 -8
  514. package/dist/production/coreComponents/HasMany.js.map +1 -1
  515. package/dist/production/coreComponents/HasOne.js +12 -9
  516. package/dist/production/coreComponents/HasOne.js.map +1 -1
  517. package/dist/production/coreComponents/ParentEntity.js +7 -3
  518. package/dist/production/coreComponents/ParentEntity.js.map +1 -1
  519. package/dist/production/dao/Environment.js +26 -2
  520. package/dist/production/dao/Environment.js.map +1 -1
  521. package/dist/production/dao/TreeNodeEnvironmentFactory.js +14 -14
  522. package/dist/production/dao/TreeNodeEnvironmentFactory.js.map +1 -1
  523. package/dist/production/dao/VariableFieldValue.js +3 -1
  524. package/dist/production/dao/VariableFieldValue.js.map +1 -1
  525. package/dist/production/entityEvents/useDerivedField.js +25 -17
  526. package/dist/production/entityEvents/useDerivedField.js.map +1 -1
  527. package/dist/production/entityEvents/useEntityBeforePersist.js +3 -1
  528. package/dist/production/entityEvents/useEntityBeforePersist.js.map +1 -1
  529. package/dist/production/entityEvents/useEntityBeforeUpdate.js +3 -1
  530. package/dist/production/entityEvents/useEntityBeforeUpdate.js.map +1 -1
  531. package/dist/production/entityEvents/useEntityEvent.js +16 -8
  532. package/dist/production/entityEvents/useEntityEvent.js.map +1 -1
  533. package/dist/production/entityEvents/useEntityPersistError.js +3 -1
  534. package/dist/production/entityEvents/useEntityPersistError.js.map +1 -1
  535. package/dist/production/entityEvents/useEntityPersistSuccess.js +3 -1
  536. package/dist/production/entityEvents/useEntityPersistSuccess.js.map +1 -1
  537. package/dist/production/entityEvents/useOnConnectionUpdate.js +3 -1
  538. package/dist/production/entityEvents/useOnConnectionUpdate.js.map +1 -1
  539. package/dist/production/fieldHelpers/helpers/FieldHelper.js +3 -1
  540. package/dist/production/fieldHelpers/helpers/FieldHelper.js.map +1 -1
  541. package/dist/production/fieldHelpers/helpers/TemporalFieldHelper.js +3 -1
  542. package/dist/production/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -1
  543. package/dist/production/fieldHelpers/helpers/UuidFieldHelper.js +3 -1
  544. package/dist/production/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
  545. package/dist/production/helperComponents/DeferredSubTrees.js +37 -13
  546. package/dist/production/helperComponents/DeferredSubTrees.js.map +1 -1
  547. package/dist/production/helperComponents/EntityView.js +7 -3
  548. package/dist/production/helperComponents/EntityView.js.map +1 -1
  549. package/dist/production/helperComponents/FieldView.js +17 -8
  550. package/dist/production/helperComponents/FieldView.js.map +1 -1
  551. package/dist/production/helperComponents/If.js +44 -19
  552. package/dist/production/helperComponents/If.js.map +1 -1
  553. package/dist/production/helperComponents/StaticRender.js +9 -3
  554. package/dist/production/helperComponents/StaticRender.js.map +1 -1
  555. package/dist/production/helperComponents/SugaredField.js +6 -4
  556. package/dist/production/helperComponents/SugaredField.js.map +1 -1
  557. package/dist/production/helperComponents/helpers/FilterEvaluator.js +3 -4
  558. package/dist/production/helperComponents/helpers/FilterEvaluator.js.map +1 -1
  559. package/dist/production/helperComponents/helpers/FilterFieldsCollector.js +3 -4
  560. package/dist/production/helperComponents/helpers/FilterFieldsCollector.js.map +1 -1
  561. package/dist/production/helperComponents/helpers/evaluateCondition.js +3 -1
  562. package/dist/production/helperComponents/helpers/evaluateCondition.js.map +1 -1
  563. package/dist/production/index.js +225 -104
  564. package/dist/production/index.js.map +1 -1
  565. package/dist/production/markers/EntityFieldMarkersContainer.js +3 -1
  566. package/dist/production/markers/EntityFieldMarkersContainer.js.map +1 -1
  567. package/dist/production/markers/EntityFieldsWithHoistablesMarker.js +3 -1
  568. package/dist/production/markers/EntityFieldsWithHoistablesMarker.js.map +1 -1
  569. package/dist/production/markers/EntityListSubTreeMarker.js +3 -1
  570. package/dist/production/markers/EntityListSubTreeMarker.js.map +1 -1
  571. package/dist/production/markers/EntitySubTreeMarker.js +3 -1
  572. package/dist/production/markers/EntitySubTreeMarker.js.map +1 -1
  573. package/dist/production/markers/FieldMarker.js +3 -1
  574. package/dist/production/markers/FieldMarker.js.map +1 -1
  575. package/dist/production/markers/HasManyRelationMarker.js +3 -1
  576. package/dist/production/markers/HasManyRelationMarker.js.map +1 -1
  577. package/dist/production/markers/HasOneRelationMarker.js +3 -1
  578. package/dist/production/markers/HasOneRelationMarker.js.map +1 -1
  579. package/dist/production/markers/MarkerTreeRoot.js +3 -1
  580. package/dist/production/markers/MarkerTreeRoot.js.map +1 -1
  581. package/dist/production/markers/ParentEntityMarker.js +3 -1
  582. package/dist/production/markers/ParentEntityMarker.js.map +1 -1
  583. package/dist/production/markers/PlaceholderGenerator.js +3 -1
  584. package/dist/production/markers/PlaceholderGenerator.js.map +1 -1
  585. package/dist/production/queryLanguage/CacheStore.js +3 -1
  586. package/dist/production/queryLanguage/CacheStore.js.map +1 -1
  587. package/dist/production/queryLanguage/MarkerFactory.js +117 -25
  588. package/dist/production/queryLanguage/MarkerFactory.js.map +1 -1
  589. package/dist/production/queryLanguage/Parser.js +114 -79
  590. package/dist/production/queryLanguage/Parser.js.map +1 -1
  591. package/dist/production/queryLanguage/QueryLanguage.js +73 -20
  592. package/dist/production/queryLanguage/QueryLanguage.js.map +1 -1
  593. package/dist/production/queryLanguage/QueryLanguageError.js +3 -1
  594. package/dist/production/queryLanguage/QueryLanguageError.js.map +1 -1
  595. package/dist/production/queryLanguage/tokenList.js +5 -1
  596. package/dist/production/queryLanguage/tokenList.js.map +1 -1
  597. package/dist/production/structures/BijectiveIndexedMap.js +3 -1
  598. package/dist/production/structures/BijectiveIndexedMap.js.map +1 -1
  599. package/dist/production/structures/LRUCache.js +3 -1
  600. package/dist/production/structures/LRUCache.js.map +1 -1
  601. package/dist/production/structures/WeakIdCache.js +3 -1
  602. package/dist/production/structures/WeakIdCache.js.map +1 -1
  603. package/dist/production/treeParameterHelpers/wrapFilterInHasOnes.js +3 -1
  604. package/dist/production/treeParameterHelpers/wrapFilterInHasOnes.js.map +1 -1
  605. package/dist/production/treeParameters/EntityCreationParameters.js +3 -1
  606. package/dist/production/treeParameters/EntityCreationParameters.js.map +1 -1
  607. package/dist/production/treeParameters/EntityListPreferences.js +3 -1
  608. package/dist/production/treeParameters/EntityListPreferences.js.map +1 -1
  609. package/dist/production/treeParameters/EventListenersStore.js +3 -1
  610. package/dist/production/treeParameters/EventListenersStore.js.map +1 -1
  611. package/dist/production/treeParameters/LeafField.js +3 -1
  612. package/dist/production/treeParameters/LeafField.js.map +1 -1
  613. package/dist/production/treeParameters/QualifiedEntityParameters.js +3 -1
  614. package/dist/production/treeParameters/QualifiedEntityParameters.js.map +1 -1
  615. package/dist/production/treeParameters/Relation.js +3 -1
  616. package/dist/production/treeParameters/Relation.js.map +1 -1
  617. package/dist/production/utils/Hashing.js +3 -1
  618. package/dist/production/utils/Hashing.js.map +1 -1
  619. package/dist/production/utils/assert.js +3 -1
  620. package/dist/production/utils/assert.js.map +1 -1
  621. package/dist/production/utils/assertNever.js +6 -2
  622. package/dist/production/utils/assertNever.js.map +1 -1
  623. package/dist/production/utils/generateEnumerabilityPreventingEntropy.js +3 -1
  624. package/dist/production/utils/generateEnumerabilityPreventingEntropy.js.map +1 -1
  625. package/dist/production/utils/isEmptyObject.js +3 -1
  626. package/dist/production/utils/isEmptyObject.js.map +1 -1
  627. package/dist/production/utils/ucfirst.js +3 -1
  628. package/dist/production/utils/ucfirst.js.map +1 -1
  629. package/dist/types/accessorPropagation/BindingOperationsContext.d.ts +1 -1
  630. package/dist/types/accessorPropagation/BindingOperationsContext.d.ts.map +1 -1
  631. package/dist/types/accessorPropagation/EntityKeyContext.d.ts +1 -1
  632. package/dist/types/accessorPropagation/EntityKeyContext.d.ts.map +1 -1
  633. package/dist/types/accessorPropagation/EnvironmentContext.d.ts +13 -2
  634. package/dist/types/accessorPropagation/EnvironmentContext.d.ts.map +1 -1
  635. package/dist/types/accessorPropagation/TreeRootIdContext.d.ts +1 -1
  636. package/dist/types/accessorPropagation/TreeRootIdContext.d.ts.map +1 -1
  637. package/dist/types/accessorPropagation/useEntityListSubTree.d.ts +2 -1
  638. package/dist/types/accessorPropagation/useEntityListSubTree.d.ts.map +1 -1
  639. package/dist/types/accessorPropagation/useEntitySubTree.d.ts +2 -1
  640. package/dist/types/accessorPropagation/useEntitySubTree.d.ts.map +1 -1
  641. package/dist/types/accessorPropagation/useExtendTree.d.ts +1 -1
  642. package/dist/types/accessorPropagation/useExtendTree.d.ts.map +1 -1
  643. package/dist/types/accessorPropagation/useGetEntityListSubTree.d.ts +2 -1
  644. package/dist/types/accessorPropagation/useGetEntityListSubTree.d.ts.map +1 -1
  645. package/dist/types/accessorPropagation/useGetEntitySubTree.d.ts +2 -1
  646. package/dist/types/accessorPropagation/useGetEntitySubTree.d.ts.map +1 -1
  647. package/dist/types/accessorSorting/SetOrderFieldOnCreate.d.ts +1 -1
  648. package/dist/types/accessorSorting/SetOrderFieldOnCreate.d.ts.map +1 -1
  649. package/dist/types/accessorSorting/addEntityAtIndex.d.ts +1 -1
  650. package/dist/types/accessorSorting/addEntityAtIndex.d.ts.map +1 -1
  651. package/dist/types/accessorTree/AccessorTree.d.ts.map +1 -1
  652. package/dist/types/accessorTree/AccessorTreeState.d.ts +7 -3
  653. package/dist/types/accessorTree/AccessorTreeState.d.ts.map +1 -1
  654. package/dist/types/accessorTree/AccessorTreeStateAction.d.ts +2 -0
  655. package/dist/types/accessorTree/AccessorTreeStateAction.d.ts.map +1 -1
  656. package/dist/types/accessorTree/AccessorTreeStateContext.d.ts +1 -1
  657. package/dist/types/accessorTree/AccessorTreeStateContext.d.ts.map +1 -1
  658. package/dist/types/accessorTree/AccessorTreeStateOptions.d.ts +2 -2
  659. package/dist/types/accessorTree/AccessorTreeStateOptions.d.ts.map +1 -1
  660. package/dist/types/accessorTree/DirtinessContext.d.ts +1 -1
  661. package/dist/types/accessorTree/DirtinessContext.d.ts.map +1 -1
  662. package/dist/types/accessorTree/MutationRequestResponse.d.ts +5 -5
  663. package/dist/types/accessorTree/MutationRequestResponse.d.ts.map +1 -1
  664. package/dist/types/accessorTree/MutationStateContext.d.ts +1 -1
  665. package/dist/types/accessorTree/MutationStateContext.d.ts.map +1 -1
  666. package/dist/types/accessorTree/PersistResult.d.ts +1 -4
  667. package/dist/types/accessorTree/PersistResult.d.ts.map +1 -1
  668. package/dist/types/accessorTree/accessorTreeStateReducer.d.ts.map +1 -1
  669. package/dist/types/accessorTree/useDataBinding.d.ts +1 -1
  670. package/dist/types/accessorTree/useDataBinding.d.ts.map +1 -1
  671. package/dist/types/accessors/BindingConfig.d.ts +0 -2
  672. package/dist/types/accessors/BindingConfig.d.ts.map +1 -1
  673. package/dist/types/accessors/EntityAccessor.d.ts +4 -2
  674. package/dist/types/accessors/EntityAccessor.d.ts.map +1 -1
  675. package/dist/types/accessors/EntityListAccessor.d.ts +2 -2
  676. package/dist/types/accessors/EntityListAccessor.d.ts.map +1 -1
  677. package/dist/types/accessors/FieldAccessor.d.ts +2 -2
  678. package/dist/types/accessors/FieldAccessor.d.ts.map +1 -1
  679. package/dist/types/accessors/PersistErrorOptions.d.ts +0 -2
  680. package/dist/types/accessors/PersistErrorOptions.d.ts.map +1 -1
  681. package/dist/types/core/Config.d.ts.map +1 -1
  682. package/dist/types/core/DataBinding.d.ts +11 -4
  683. package/dist/types/core/DataBinding.d.ts.map +1 -1
  684. package/dist/types/core/MarkerMerger.d.ts.map +1 -1
  685. package/dist/types/core/MutationGenerator.d.ts.map +1 -1
  686. package/dist/types/core/StateInitializer.d.ts.map +1 -1
  687. package/dist/types/core/TreeAugmenter.d.ts +2 -1
  688. package/dist/types/core/TreeAugmenter.d.ts.map +1 -1
  689. package/dist/types/core/TreeStore.d.ts +2 -3
  690. package/dist/types/core/TreeStore.d.ts.map +1 -1
  691. package/dist/types/core/index.d.ts +1 -0
  692. package/dist/types/core/index.d.ts.map +1 -1
  693. package/dist/types/core/schema/Schema.d.ts +13 -3
  694. package/dist/types/core/schema/Schema.d.ts.map +1 -1
  695. package/dist/types/core/schema/SchemaColumn.d.ts +1 -1
  696. package/dist/types/core/schema/SchemaColumn.d.ts.map +1 -1
  697. package/dist/types/core/schema/SchemaLoader.d.ts +2 -1
  698. package/dist/types/core/schema/SchemaLoader.d.ts.map +1 -1
  699. package/dist/types/core/schema/SchemaRelation.d.ts +1 -1
  700. package/dist/types/core/schema/SchemaRelation.d.ts.map +1 -1
  701. package/dist/types/coreComponents/Component.d.ts +9 -4
  702. package/dist/types/coreComponents/Component.d.ts.map +1 -1
  703. package/dist/types/coreComponents/DataBindingProvider.d.ts +2 -6
  704. package/dist/types/coreComponents/DataBindingProvider.d.ts.map +1 -1
  705. package/dist/types/coreComponents/Entity.d.ts +1 -1
  706. package/dist/types/coreComponents/Entity.d.ts.map +1 -1
  707. package/dist/types/coreComponents/EntityListSubTree.d.ts.map +1 -1
  708. package/dist/types/coreComponents/ParentEntity.d.ts +1 -1
  709. package/dist/types/coreComponents/ParentEntity.d.ts.map +1 -1
  710. package/dist/types/dao/Environment.d.ts +10 -2
  711. package/dist/types/dao/Environment.d.ts.map +1 -1
  712. package/dist/types/dao/TreeNodeEnvironmentFactory.d.ts.map +1 -1
  713. package/dist/types/fieldHelpers/helpers/TemporalFieldHelper.d.ts +1 -1
  714. package/dist/types/fieldHelpers/helpers/TemporalFieldHelper.d.ts.map +1 -1
  715. package/dist/types/fieldHelpers/helpers/UuidFieldHelper.d.ts +1 -1
  716. package/dist/types/fieldHelpers/helpers/UuidFieldHelper.d.ts.map +1 -1
  717. package/dist/types/helperComponents/DeferredSubTrees.d.ts +1 -1
  718. package/dist/types/helperComponents/DeferredSubTrees.d.ts.map +1 -1
  719. package/dist/types/helperComponents/If.d.ts +1 -1
  720. package/dist/types/helperComponents/If.d.ts.map +1 -1
  721. package/dist/types/helperComponents/StaticRender.d.ts +1 -1
  722. package/dist/types/helperComponents/StaticRender.d.ts.map +1 -1
  723. package/dist/types/helperComponents/helpers/FilterEvaluator.d.ts.map +1 -1
  724. package/dist/types/helperComponents/helpers/FilterFieldsCollector.d.ts.map +1 -1
  725. package/dist/types/tsconfig.tsbuildinfo +1 -1
  726. package/package.json +9 -9
  727. package/src/accessorPropagation/EnvironmentContext.tsx +44 -0
  728. package/src/accessorTree/AccessorTree.tsx +12 -18
  729. package/src/accessorTree/AccessorTreeState.ts +11 -4
  730. package/src/accessorTree/AccessorTreeStateAction.ts +3 -1
  731. package/src/accessorTree/AccessorTreeStateOptions.ts +2 -2
  732. package/src/accessorTree/MutationRequestResponse.ts +9 -3
  733. package/src/accessorTree/PersistResult.ts +1 -5
  734. package/src/accessorTree/accessorTreeStateReducer.ts +6 -3
  735. package/src/accessorTree/useDataBinding.ts +65 -59
  736. package/src/accessors/BindingConfig.ts +0 -2
  737. package/src/accessors/EntityAccessor.ts +20 -7
  738. package/src/accessors/EntityListAccessor.ts +9 -9
  739. package/src/accessors/FieldAccessor.ts +5 -5
  740. package/src/accessors/PersistErrorOptions.ts +0 -2
  741. package/src/core/Config.ts +0 -2
  742. package/src/core/DataBinding.ts +136 -162
  743. package/src/core/MarkerMerger.ts +7 -5
  744. package/src/core/MutationGenerator.ts +8 -4
  745. package/src/core/StateInitializer.ts +3 -12
  746. package/src/core/TreeAugmenter.ts +4 -1
  747. package/src/core/TreeStore.ts +4 -17
  748. package/src/core/factories/createBatchUpdatesOptions.ts +1 -1
  749. package/src/core/index.ts +1 -0
  750. package/src/core/operations/EntityOperations.ts +1 -1
  751. package/src/core/schema/Schema.ts +38 -4
  752. package/src/core/schema/SchemaColumn.ts +1 -1
  753. package/src/core/schema/SchemaLoader.ts +13 -11
  754. package/src/core/schema/SchemaRelation.ts +1 -1
  755. package/src/coreComponents/Component.tsx +20 -7
  756. package/src/coreComponents/DataBindingProvider.tsx +4 -11
  757. package/src/coreComponents/EntityListSubTree.tsx +2 -3
  758. package/src/dao/Environment.ts +34 -3
  759. package/src/dao/TreeNodeEnvironmentFactory.ts +6 -11
  760. package/src/helperComponents/DeferredSubTrees.tsx +2 -1
  761. package/src/helperComponents/helpers/FilterEvaluator.ts +1 -3
  762. package/src/helperComponents/helpers/FilterFieldsCollector.ts +0 -3
  763. package/src/typings/react-fix.d.ts +12 -0
  764. package/src/accessorPropagation/EnvironmentContext.ts +0 -5
@@ -1,14 +1,14 @@
1
- import { createElement } from "react";
2
1
  import { PRIMARY_KEY_NAME } from "../bindingTypes.js";
3
2
  import { Component } from "./Component.js";
4
3
  import { EntityList } from "./EntityList.js";
5
4
  import { Field } from "./Field.js";
6
5
  import { TreeNodeEnvironmentFactory } from "../dao/TreeNodeEnvironmentFactory.js";
6
+ import { jsxs, jsx } from "react/jsx-runtime";
7
7
  import { useEntityList } from "../accessorPropagation/useEntityList.js";
8
8
  import { MarkerFactory } from "../queryLanguage/MarkerFactory.js";
9
9
  const HasMany = Component((props) => {
10
10
  const entityList = useEntityList(props);
11
- return /* @__PURE__ */ createElement(EntityList, {
11
+ return /* @__PURE__ */ jsx(EntityList, {
12
12
  ...props,
13
13
  accessor: entityList
14
14
  });
@@ -17,13 +17,16 @@ const HasMany = Component((props) => {
17
17
  const environment = oldEnvironment.withVariables(props.variables);
18
18
  return TreeNodeEnvironmentFactory.createEnvironmentForEntityList(environment, props);
19
19
  },
20
- staticRender: (props) => /* @__PURE__ */ createElement(EntityList, {
20
+ staticRender: (props) => /* @__PURE__ */ jsxs(EntityList, {
21
21
  ...props,
22
- accessor: void 0
23
- }, /* @__PURE__ */ createElement(Field, {
24
- field: PRIMARY_KEY_NAME
25
- }), props.children),
22
+ accessor: void 0,
23
+ children: [/* @__PURE__ */ jsx(Field, {
24
+ field: PRIMARY_KEY_NAME
25
+ }), props.children]
26
+ }),
26
27
  generateBranchMarker: (props, fields, environment) => MarkerFactory.createRelativeEntityListFields(props, environment, fields)
27
28
  }, "HasMany");
28
- export { HasMany };
29
+ export {
30
+ HasMany
31
+ };
29
32
  //# sourceMappingURL=HasMany.js.map
@@ -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 { 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;;"}
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":["HasMany","Component","props","entityList","useEntityList","generateEnvironment","oldEnvironment","environment","withVariables","variables","TreeNodeEnvironmentFactory","createEnvironmentForEntityList","staticRender","_jsxs","undefined","_jsx","PRIMARY_KEY_NAME","children","generateBranchMarker","fields","MarkerFactory","createRelativeEntityListFields"],"mappings":";;;;;;;;AAsBaA,MAAAA,UAAUC,UACtB,CAAyBC,UAAgD;AAClEC,QAAAA,aAAaC,cAAcF,KAAK;AAEtC,6BAAQ,YAAU;AAAA,IAAA,GAAKA;AAAAA,IAAO,UAAUC;AAAAA,EAAAA,CAAc;AACvD,GACA;AAAA,EACCE,qBAAqB,CAACH,OAAOI,mBAAmB;AAC/C,UAAMC,cAAcD,eAAeE,cAAcN,MAAMO,SAAS;AACzDC,WAAAA,2BAA2BC,+BAA+BJ,aAAaL,KAAK;AAAA,EACpF;AAAA,EACAU,cAAcV,CACb,UAAAW,qBAAC,YAAU;AAAA,IAAA,GAAKX;AAAAA,IAAO,UAAUY;AAAAA,IAAiB,UAAA,CACjDC,oBAAC,OAAK;AAAA,MAAC,OAAOC;AAAAA,IAAAA,CAAoB,GACjCd,MAAMe,QAAQ;AAAA,EAAA,CAEhB;AAAA,EACDC,sBAAsB,CAAChB,OAAOiB,QAAQZ,gBACrCa,cAAcC,+BAA+BnB,OAAOK,aAAaY,MAAM;AACzE,GACA,SAAS;"}
@@ -1,14 +1,14 @@
1
- import { createElement } from "react";
2
1
  import { PRIMARY_KEY_NAME } from "../bindingTypes.js";
3
2
  import { Component } from "./Component.js";
4
3
  import { Entity } from "./Entity.js";
5
4
  import { Field } from "./Field.js";
6
5
  import { TreeNodeEnvironmentFactory } from "../dao/TreeNodeEnvironmentFactory.js";
7
- import { useEntity } from "../accessorPropagation/useEntity.js";
6
+ import { jsxs, jsx } from "react/jsx-runtime";
8
7
  import { MarkerFactory } from "../queryLanguage/MarkerFactory.js";
8
+ import { useEntity } from "../accessorPropagation/useEntity.js";
9
9
  const HasOne = Component((props) => {
10
10
  const entity = useEntity(props);
11
- return /* @__PURE__ */ createElement(Entity, {
11
+ return /* @__PURE__ */ jsx(Entity, {
12
12
  ...props,
13
13
  accessor: entity
14
14
  });
@@ -17,13 +17,16 @@ const HasOne = Component((props) => {
17
17
  const environment = oldEnvironment.withVariables(props.variables);
18
18
  return TreeNodeEnvironmentFactory.createEnvironmentForEntity(environment, props);
19
19
  },
20
- staticRender: (props) => /* @__PURE__ */ createElement(Entity, {
20
+ staticRender: (props) => /* @__PURE__ */ jsxs(Entity, {
21
21
  ...props,
22
- accessor: void 0
23
- }, /* @__PURE__ */ createElement(Field, {
24
- field: PRIMARY_KEY_NAME
25
- }), props.children),
22
+ accessor: void 0,
23
+ children: [/* @__PURE__ */ jsx(Field, {
24
+ field: PRIMARY_KEY_NAME
25
+ }), props.children]
26
+ }),
26
27
  generateBranchMarker: (props, fields, environment) => MarkerFactory.createRelativeSingleEntityFields(props, environment, fields)
27
28
  }, "HasOne");
28
- export { HasOne };
29
+ export {
30
+ HasOne
31
+ };
29
32
  //# sourceMappingURL=HasOne.js.map
@@ -1 +1 @@
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
+ {"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":["HasOne","Component","props","entity","useEntity","generateEnvironment","oldEnvironment","environment","withVariables","variables","TreeNodeEnvironmentFactory","createEnvironmentForEntity","staticRender","_jsxs","undefined","_jsx","PRIMARY_KEY_NAME","children","generateBranchMarker","fields","MarkerFactory","createRelativeSingleEntityFields"],"mappings":";;;;;;;;AAgBaA,MAAAA,SAASC,UACrB,CAAyBC,UAAoC;AACtDC,QAAAA,SAASC,UAAUF,KAAK;AAE9B,6BAAQ,QAAM;AAAA,IAAA,GAAKA;AAAAA,IAAO,UAAUC;AAAAA,EAAAA,CAAU;AAC/C,GACA;AAAA,EACCE,qBAAqB,CAACH,OAAOI,mBAAmB;AAC/C,UAAMC,cAAcD,eAAeE,cAAcN,MAAMO,SAAS;AACzDC,WAAAA,2BAA2BC,2BAA2BJ,aAAaL,KAAK;AAAA,EAChF;AAAA,EACAU,cAAcV,CACb,UAAAW,qBAAC,QAAM;AAAA,IAAA,GAAKX;AAAAA,IAAO,UAAUY;AAAAA,IAAiB,UAAA,CAC7CC,oBAAC,OAAK;AAAA,MAAC,OAAOC;AAAAA,IAAAA,CAAoB,GACjCd,MAAMe,QAAQ;AAAA,EAAA,CAEhB;AAAA,EACDC,sBAAsB,CAAChB,OAAOiB,QAAQZ,gBACrCa,cAAcC,iCAAiCnB,OAAOK,aAAaY,MAAM;AAC3E,GACA,QAAQ;"}
@@ -1,8 +1,12 @@
1
- import { createElement, Fragment } from "react";
2
1
  import { Component } from "./Component.js";
2
+ import { jsx, Fragment } from "react/jsx-runtime";
3
3
  import { MarkerFactory } from "../queryLanguage/MarkerFactory.js";
4
- const ParentEntity = Component((props) => /* @__PURE__ */ createElement(Fragment, null, props.children), {
4
+ const ParentEntity = Component((props) => /* @__PURE__ */ jsx(Fragment, {
5
+ children: props.children
6
+ }), {
5
7
  generateBranchMarker: (props, fields, environment) => MarkerFactory.createParentEntityMarker(props, fields, environment)
6
8
  }, "ParentEntity");
7
- export { ParentEntity };
9
+ export {
10
+ ParentEntity
11
+ };
8
12
  //# sourceMappingURL=ParentEntity.js.map
@@ -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":["_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;;"}
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":["ParentEntity","Component","props","_jsx","_Fragment","children","generateBranchMarker","fields","environment","MarkerFactory","createParentEntityMarker"],"mappings":";;;AASO,MAAMA,eAAeC,UAC3BC,CAAS,UAAAC,oBAAAC,UAAA;AAAA,EAAA,UAAGF,MAAMG;AAAQ,CAAA,GAC1B;AAAA,EACCC,sBAAsB,CAACJ,OAAOK,QAAQC,gBACrCC,cAAcC,yBAAyBR,OAAOK,QAAQC,WAAW;AACnE,GACA,cAAc;"}
@@ -8,7 +8,8 @@ class Environment {
8
8
  return new Environment({
9
9
  dimensions: {},
10
10
  variables: {},
11
- parameters: {}
11
+ parameters: {},
12
+ extensions: /* @__PURE__ */ new Map()
12
13
  });
13
14
  }
14
15
  getSubTree() {
@@ -153,6 +154,16 @@ class Environment {
153
154
  }
154
155
  return this.options.parent;
155
156
  }
157
+ withExtension(extension, state) {
158
+ return new Environment({
159
+ ...this.options,
160
+ extensions: new Map([...this.options.extensions, [extension, state]])
161
+ });
162
+ }
163
+ getExtension(extension) {
164
+ const state = this.options.extensions.get(extension);
165
+ return extension.create(state, this);
166
+ }
156
167
  merge(other) {
157
168
  if (other === this) {
158
169
  return this;
@@ -166,6 +177,9 @@ class Environment {
166
177
  if (this.options.dimensions !== other.options.dimensions) {
167
178
  throw new BindingError(`Cannot merge two environments with different dimensions.`);
168
179
  }
180
+ if (this.options.extensions !== other.options.extensions) {
181
+ throw new BindingError(`Cannot merge two environments with different extensions.`);
182
+ }
169
183
  if (equal(this.options.variables, other.options.variables) && this.options.parent === other.options.parent) {
170
184
  return this;
171
185
  }
@@ -182,5 +196,15 @@ class Environment {
182
196
  });
183
197
  }
184
198
  }
185
- export { Environment };
199
+ ((Environment2) => {
200
+ Environment2.createExtension = (create, otherMethods) => {
201
+ return {
202
+ create,
203
+ ...otherMethods
204
+ };
205
+ };
206
+ })(Environment || (Environment = {}));
207
+ export {
208
+ Environment
209
+ };
186
210
  //# sourceMappingURL=Environment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Environment.js","sources":["../../../src/dao/Environment.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { BindingError } from '../BindingError'\nimport type { Filter } from '../treeParameters'\nimport equal from 'fast-deep-equal/es6'\nimport { Schema, SchemaColumn, SchemaEntity, SchemaRelation } from '../core/schema'\n\nclass Environment {\n\tprivate constructor(\n\t\tprivate readonly options: Environment.Options,\n\t) {\n\t}\n\n\tpublic static create() {\n\t\treturn new Environment({\n\t\t\tdimensions: {},\n\t\t\tvariables: {},\n\t\t\tparameters: {},\n\t\t})\n\t}\n\n\tpublic getSubTree(): Environment.SubTreeNode {\n\t\tfor (let env: Environment = this; env.options.node; env = env.getParent()) {\n\t\t\tconst node = env.options.node\n\t\t\tif (node.type === 'subtree-entity' || node.type === 'subtree-entity-list') {\n\t\t\t\treturn node\n\t\t\t}\n\t\t}\n\t\tthrow new BindingError('Not in a SubTree')\n\t}\n\n\tpublic getSubTreeNode(): Environment.AnyNode {\n\t\tif (!this.options.node) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\treturn this.options.node\n\t}\n\n\tpublic withSubTree(SubTree: Environment.SubTreeNode) {\n\t\tconst { parent, ...options } = this.options\n\t\treturn new Environment({\n\t\t\t...options,\n\t\t\tnode: SubTree,\n\t\t})\n\t}\n\n\tpublic withSubTreeChild(node: Environment.InnerNode) {\n\t\tif (!this.options.node) {\n\t\t\tthrow new BindingError(`Cannot call withSubTreeChild without previous call of withSubTree`)\n\t\t}\n\t\tif (this.options.node.entity.fields.get(node.field.name) !== node.field) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\treturn new Environment({\n\t\t\t...this.options,\n\t\t\tnode,\n\t\t\tparent: this,\n\t\t})\n\t}\n\n\n\tpublic hasVariable(key: string): boolean {\n\t\treturn key in this.options.variables\n\t}\n\n\tpublic getVariable<V extends Environment.Value = Environment.Value>(key: string): V {\n\t\tif (!(key in this.options.variables)) {\n\t\t\tthrow new BindingError(`Variable ${key} not found`)\n\t\t}\n\t\treturn this.options.variables[key] as V\n\t}\n\n\tpublic getVariableOrElse<F, V extends Environment.Value = Environment.Value>(key: string, fallback: F): V | F {\n\t\treturn (this.options.variables[key] as V) ?? fallback\n\t}\n\n\t/** @deprecated use getVariable or getParameter */\n\tpublic getValue<V extends Environment.Value = Environment.Value>(key: string): V {\n\t\tconsole.warn('Environment.getValue() is deprecated, use Environment.getVariable() or Environment.getParameter() instead.')\n\t\treturn this.getVariableOrElse(key, undefined) ?? this.getParameterOrElse(key, undefined) as V\n\t}\n\n\t/** @deprecated use getVariableOrElse or getParameterOrElse */\n\tpublic getValueOrElse<F, V extends Environment.Value = Environment.Value>(key: string, fallback: F): V | F {\n\t\tconsole.warn('Environment.getValueOrElse() is deprecated, use Environment.getVariableOrElse() or Environment.getParameterOrElse() instead.')\n\t\treturn this.getVariableOrElse(key, undefined) ?? this.getParameterOrElse(key, fallback) as V | F\n\t}\n\n\t/** @deprecated */\n\tpublic hasName(key: string): boolean {\n\t\tconsole.warn('Environment.hasName() is deprecated, use Environment.hasVariable() or Environment.hasParameter() instead.')\n\t\treturn key in this.options.variables || key in this.options.parameters\n\t}\n\n\tpublic withVariables(variables: Environment.ValuesMapWithFactory | undefined): Environment {\n\t\tif (variables === undefined) {\n\t\t\treturn this\n\t\t}\n\t\tconst newVariables = { ...this.options.variables }\n\t\tfor (const [newName, newValue] of Object.entries(variables)) {\n\t\t\tif (newName === 'labelMiddleware') {\n\t\t\t\tthrow new BindingError('You cannot pass labelMiddleware to withVariables method. Use withLabelMiddleware instead.')\n\t\t\t}\n\t\t\tconst resolvedValue = typeof newValue === 'function' ? newValue(this) : newValue\n\t\t\tif (resolvedValue === undefined) {\n\t\t\t\tdelete newVariables[newName]\n\t\t\t} else {\n\t\t\t\tnewVariables[newName] = resolvedValue\n\t\t\t}\n\t\t}\n\t\treturn new Environment({\n\t\t\t...this.options,\n\t\t\tvariables: newVariables,\n\t\t\tparent: this,\n\t\t})\n\t}\n\n\tpublic getAllVariables() {\n\t\treturn this.options.variables\n\t}\n\n\tpublic hasParameter(key: string): boolean {\n\t\treturn key in this.options.parameters\n\t}\n\n\tpublic getParameter<F>(key: string): string | number {\n\t\tif (!(key in this.options.parameters)) {\n\t\t\tthrow new BindingError(`Parameter ${key} not found`)\n\t\t}\n\t\treturn this.options.parameters[key] as string | number\n\t}\n\n\tpublic getParameterOrElse<F>(key: string, fallback: F): string | number | F {\n\t\treturn this.options.parameters[key] ?? fallback\n\t}\n\n\tpublic getAllParameters() {\n\t\treturn this.options.parameters\n\t}\n\n\tpublic withParameters(parameters: Environment.Parameters): Environment {\n\t\treturn new Environment({ ...this.options, parameters })\n\t}\n\n\tpublic hasDimension(dimensionName: string): boolean {\n\t\treturn dimensionName in this.options.dimensions\n\t}\n\n\tpublic getDimension<F>(dimensionName: string): string[] {\n\t\tif (!(dimensionName in this.options.dimensions)) {\n\t\t\tthrow new BindingError(`Dimension ${dimensionName} does not exist.`)\n\t\t}\n\t\treturn this.options.dimensions[dimensionName]\n\t}\n\n\tpublic getDimensionOrElse<F>(dimensionName: string, fallback: F): string[] | F {\n\t\treturn this.options.dimensions[dimensionName] ?? fallback\n\t}\n\n\tpublic getAllDimensions(): Environment.SelectedDimensions {\n\t\treturn this.options.dimensions\n\t}\n\n\tpublic withDimensions(dimensions: Environment.SelectedDimensions): Environment {\n\t\tconst newDimensions = {\n\t\t\t...this.options.dimensions,\n\t\t\t...dimensions,\n\t\t}\n\t\tif (equal(newDimensions, this.options.dimensions)) {\n\t\t\treturn this\n\t\t}\n\t\treturn new Environment({ ...this.options, dimensions: newDimensions })\n\t}\n\n\tpublic getSchema(): Schema {\n\t\tif (!this.options.schema) {\n\t\t\tthrow new BindingError('Schema is not set')\n\t\t}\n\t\treturn this.options.schema\n\t}\n\n\tpublic withSchema(schema: Schema): Environment {\n\t\treturn new Environment({ ...this.options, schema })\n\t}\n\n\tpublic getParent(): Environment {\n\t\tif (!this.options.parent) {\n\t\t\tthrow new BindingError('There is no parent environment')\n\t\t}\n\t\treturn this.options.parent\n\t}\n\n\tpublic merge(other: Environment): Environment {\n\t\tif (other === this) {\n\t\t\treturn this\n\t\t}\n\t\tif (!equal(this.options.node, other.options.node)) {\n\t\t\tthrow new BindingError(`Cannot merge two environments with different tree position.`)\n\t\t}\n\t\tif (this.options.parameters !== other.options.parameters) {\n\t\t\tthrow new BindingError(`Cannot merge two environments with different parameters.`)\n\t\t}\n\t\tif (this.options.dimensions !== other.options.dimensions) {\n\t\t\tthrow new BindingError(`Cannot merge two environments with different dimensions.`)\n\t\t}\n\t\tif (equal(this.options.variables, other.options.variables) && this.options.parent === other.options.parent) {\n\t\t\treturn this\n\t\t}\n\t\tfor (const key in other.options.variables) {\n\t\t\tif (key in this.options.variables && !equal(this.options.variables[key], other.options.variables[key])) {\n\t\t\t\tthrow new BindingError(`Cannot merge two environments with different value of variable ${key}:\\n`\n\t\t\t\t\t+ JSON.stringify(this.options.variables[key]) + '\\n'\n\t\t\t\t\t+ JSON.stringify(other.options.variables[key]))\n\t\t\t}\n\t\t}\n\n\t\treturn new Environment({\n\t\t\t...this.options,\n\t\t\tparent: this.options.parent && other.options.parent ? this.options.parent.merge(other.options.parent) : undefined,\n\t\t\tvariables: { ...this.options.variables, ...other.options.variables },\n\t\t})\n\t}\n}\n\nnamespace Environment {\n\texport type Name = string\n\n\texport type Value = ReactNode\n\n\texport type ResolvedValue = Value | Filter\n\n\texport interface Options {\n\t\tnode?: AnyNode\n\t\tschema?: Schema\n\t\tdimensions: SelectedDimensions\n\t\tparameters: Parameters\n\t\tvariables: CustomVariables\n\t\tparent?: Environment\n\t}\n\n\texport type SubTreeNode =\n\t\t| SubTreeEntityNode\n\t\t| SubTreeEntityListNode\n\n\texport type InnerNode =\n\t\t| EntityNode\n\t\t| EntityListNode\n\t\t| ColumnNode\n\n\texport type AnyNode =\n\t\t| SubTreeNode\n\t\t| InnerNode\n\n\texport interface SubTreeEntityNode {\n\t\ttype: 'subtree-entity'\n\t\tentity: SchemaEntity\n\t\texpectedCardinality: 'zero' | 'one' | 'zero-or-one'\n\t\tfilter: Filter\n\t}\n\n\texport interface SubTreeEntityListNode {\n\t\ttype: 'subtree-entity-list'\n\t\tentity: SchemaEntity\n\t\texpectedCardinality: 'zero-to-many' | 'zero'\n\t\tfilter: Filter\n\t}\n\n\texport interface EntityNode {\n\t\ttype: 'entity'\n\t\tentity: SchemaEntity\n\t\tfield: SchemaRelation\n\t}\n\n\texport interface EntityListNode {\n\t\ttype: 'entity-list'\n\t\tentity: SchemaEntity\n\t\tfield: SchemaRelation\n\t}\n\n\texport interface ColumnNode {\n\t\ttype: 'column'\n\t\tentity: SchemaEntity\n\t\tfield: SchemaColumn\n\t}\n\n\texport interface SelectedDimensions {\n\t\t[key: string]: string[]\n\t}\n\n\texport type Parameters = {\n\t\t[K in string]?: string | number\n\t}\n\n\texport interface CustomVariables {\n\t\t[key: string]: Value\n\t}\n\n\texport interface ValuesMapWithFactory {\n\t\t[key: string]:\n\t\t\t| ((environment: Environment) => Value)\n\t\t\t| Value\n\t}\n\n\t/** @deprecated */\n\texport type DeltaFactory = ValuesMapWithFactory\n}\n\nexport { Environment }\n"],"names":[],"mappings":";;AAMA,MAAM,YAAY;AAAA,EACT,YACU,SAChB;AADgB,SAAA,UAAA;AAAA,EAElB;AAAA,SAEc,SAAS;AACtB,WAAO,IAAI,YAAY;AAAA,MACtB,YAAY,CAAC;AAAA,MACb,WAAW,CAAC;AAAA,MACZ,YAAY,CAAC;AAAA,IAAA,CACb;AAAA,EACF;AAAA,EAEO,aAAsC;AACnC,aAAA,MAAmB,MAAM,IAAI,QAAQ,MAAM,MAAM,IAAI,aAAa;AACpE,YAAA,OAAO,IAAI,QAAQ;AACzB,UAAI,KAAK,SAAS,oBAAoB,KAAK,SAAS,uBAAuB;AACnE,eAAA;AAAA,MACR;AAAA,IACD;AACM,UAAA,IAAI,aAAa,kBAAkB;AAAA,EAC1C;AAAA,EAEO,iBAAsC;AACxC,QAAA,CAAC,KAAK,QAAQ,MAAM;AACvB,YAAM,IAAI,aAAa;AAAA,IACxB;AACA,WAAO,KAAK,QAAQ;AAAA,EACrB;AAAA,EAEO,YAAY,SAAkC;AAC9C,UAAA,EAAE,WAAW,YAAY,KAAK;AACpC,WAAO,IAAI,YAAY;AAAA,SACnB;AAAA,MACH,MAAM;AAAA,IAAA,CACN;AAAA,EACF;AAAA,EAEO,iBAAiB,MAA6B;AAChD,QAAA,CAAC,KAAK,QAAQ,MAAM;AACjB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,UAAU,IAAI,IAAI,OAC9C,KAAK,UAAU,MAAM,QAAQ,UAAU,IAAI,CAAC;AAAA,MAChD;AAAA,IACD;AAEA,WAAO,IAAI,YAAY;AAAA,SACnB,KAAK;AAAA,MACR,QAAQ,KAAK,QAAQ,UAAU,MAAM,QAAQ,SAAS,KAAK,QAAQ,OAAO,MAAM,MAAM,QAAQ,MAAM,IAAI;AAAA,MACxG,WAAW,KAAK,KAAK,QAAQ,cAAc,MAAM,QAAQ,UAAU;AAAA,IAAA,CACnE;AAAA,EACF;AACD;;"}
1
+ {"version":3,"file":"Environment.js","sources":["../../../src/dao/Environment.ts"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { BindingError } from '../BindingError'\nimport type { Filter } from '../treeParameters'\nimport equal from 'fast-deep-equal/es6'\nimport { Schema, SchemaColumn, SchemaEntity, SchemaRelation } from '../core/schema'\nimport { GraphQlLiteral } from '@contember/client'\n\nclass Environment {\n\tprivate constructor(\n\t\tprivate readonly options: Environment.Options,\n\t) {\n\t}\n\n\tpublic static create() {\n\t\treturn new Environment({\n\t\t\tdimensions: {},\n\t\t\tvariables: {},\n\t\t\tparameters: {},\n\t\t\textensions: new Map(),\n\t\t})\n\t}\n\n\tpublic getSubTree(): Environment.SubTreeNode {\n\t\tfor (let env: Environment = this; env.options.node; env = env.getParent()) {\n\t\t\tconst node = env.options.node\n\t\t\tif (node.type === 'subtree-entity' || node.type === 'subtree-entity-list') {\n\t\t\t\treturn node\n\t\t\t}\n\t\t}\n\t\tthrow new BindingError('Not in a SubTree')\n\t}\n\n\tpublic getSubTreeNode(): Environment.AnyNode {\n\t\tif (!this.options.node) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\treturn this.options.node\n\t}\n\n\tpublic withSubTree(SubTree: Environment.SubTreeNode) {\n\t\tconst { parent, ...options } = this.options\n\t\treturn new Environment({\n\t\t\t...options,\n\t\t\tnode: SubTree,\n\t\t})\n\t}\n\n\tpublic withSubTreeChild(node: Environment.InnerNode) {\n\t\tif (!this.options.node) {\n\t\t\tthrow new BindingError(`Cannot call withSubTreeChild without previous call of withSubTree`)\n\t\t}\n\t\tif (this.options.node.entity.fields.get(node.field.name) !== node.field) {\n\t\t\tthrow new BindingError()\n\t\t}\n\t\treturn new Environment({\n\t\t\t...this.options,\n\t\t\tnode,\n\t\t\tparent: this,\n\t\t})\n\t}\n\n\n\tpublic hasVariable(key: string): boolean {\n\t\treturn key in this.options.variables\n\t}\n\n\tpublic getVariable<V extends Environment.Value = Environment.Value>(key: string): V {\n\t\tif (!(key in this.options.variables)) {\n\t\t\tthrow new BindingError(`Variable ${key} not found`)\n\t\t}\n\t\treturn this.options.variables[key] as V\n\t}\n\n\tpublic getVariableOrElse<F, V extends Environment.Value = Environment.Value>(key: string, fallback: F): V | F {\n\t\treturn (this.options.variables[key] as V) ?? fallback\n\t}\n\n\t/** @deprecated use getVariable or getParameter */\n\tpublic getValue<V extends Environment.Value = Environment.Value>(key: string): V {\n\t\tconsole.warn('Environment.getValue() is deprecated, use Environment.getVariable() or Environment.getParameter() instead.')\n\t\treturn this.getVariableOrElse(key, undefined) ?? this.getParameterOrElse(key, undefined) as V\n\t}\n\n\t/** @deprecated use getVariableOrElse or getParameterOrElse */\n\tpublic getValueOrElse<F, V extends Environment.Value = Environment.Value>(key: string, fallback: F): V | F {\n\t\tconsole.warn('Environment.getValueOrElse() is deprecated, use Environment.getVariableOrElse() or Environment.getParameterOrElse() instead.')\n\t\treturn this.getVariableOrElse(key, undefined) ?? this.getParameterOrElse(key, fallback) as any\n\t}\n\n\t/** @deprecated */\n\tpublic hasName(key: string): boolean {\n\t\tconsole.warn('Environment.hasName() is deprecated, use Environment.hasVariable() or Environment.hasParameter() instead.')\n\t\treturn key in this.options.variables || key in this.options.parameters\n\t}\n\n\tpublic withVariables(variables: Environment.ValuesMapWithFactory | undefined): Environment {\n\t\tif (variables === undefined) {\n\t\t\treturn this\n\t\t}\n\t\tconst newVariables = { ...this.options.variables }\n\t\tfor (const [newName, newValue] of Object.entries(variables)) {\n\t\t\tif (newName === 'labelMiddleware') {\n\t\t\t\tthrow new BindingError('You cannot pass labelMiddleware to withVariables method. Use withLabelMiddleware instead.')\n\t\t\t}\n\t\t\tconst resolvedValue = typeof newValue === 'function' ? newValue(this) : newValue\n\t\t\tif (resolvedValue === undefined) {\n\t\t\t\tdelete newVariables[newName]\n\t\t\t} else {\n\t\t\t\tnewVariables[newName] = resolvedValue\n\t\t\t}\n\t\t}\n\t\treturn new Environment({\n\t\t\t...this.options,\n\t\t\tvariables: newVariables,\n\t\t\tparent: this,\n\t\t})\n\t}\n\n\tpublic getAllVariables() {\n\t\treturn this.options.variables\n\t}\n\n\tpublic hasParameter(key: string): boolean {\n\t\treturn key in this.options.parameters\n\t}\n\n\tpublic getParameter<F>(key: string): string | number {\n\t\tif (!(key in this.options.parameters)) {\n\t\t\tthrow new BindingError(`Parameter ${key} not found`)\n\t\t}\n\t\treturn this.options.parameters[key] as string | number\n\t}\n\n\tpublic getParameterOrElse<F>(key: string, fallback: F): string | number | F {\n\t\treturn this.options.parameters[key] ?? fallback\n\t}\n\n\tpublic getAllParameters() {\n\t\treturn this.options.parameters\n\t}\n\n\tpublic withParameters(parameters: Environment.Parameters): Environment {\n\t\treturn new Environment({ ...this.options, parameters })\n\t}\n\n\tpublic hasDimension(dimensionName: string): boolean {\n\t\treturn dimensionName in this.options.dimensions\n\t}\n\n\tpublic getDimension<F>(dimensionName: string): string[] {\n\t\tif (!(dimensionName in this.options.dimensions)) {\n\t\t\tthrow new BindingError(`Dimension ${dimensionName} does not exist.`)\n\t\t}\n\t\treturn this.options.dimensions[dimensionName]\n\t}\n\n\tpublic getDimensionOrElse<F>(dimensionName: string, fallback: F): string[] | F {\n\t\treturn this.options.dimensions[dimensionName] ?? fallback\n\t}\n\n\tpublic getAllDimensions(): Environment.SelectedDimensions {\n\t\treturn this.options.dimensions\n\t}\n\n\tpublic withDimensions(dimensions: Environment.SelectedDimensions): Environment {\n\t\tconst newDimensions = {\n\t\t\t...this.options.dimensions,\n\t\t\t...dimensions,\n\t\t}\n\t\tif (equal(newDimensions, this.options.dimensions)) {\n\t\t\treturn this\n\t\t}\n\t\treturn new Environment({ ...this.options, dimensions: newDimensions })\n\t}\n\n\tpublic getSchema(): Schema {\n\t\tif (!this.options.schema) {\n\t\t\tthrow new BindingError('Schema is not set')\n\t\t}\n\t\treturn this.options.schema\n\t}\n\n\tpublic withSchema(schema: Schema): Environment {\n\t\treturn new Environment({ ...this.options, schema })\n\t}\n\n\tpublic getParent(): Environment {\n\t\tif (!this.options.parent) {\n\t\t\tthrow new BindingError('There is no parent environment')\n\t\t}\n\t\treturn this.options.parent\n\t}\n\n\tpublic withExtension<S, R>(extension: Environment.Extension<S, R>, state: S): Environment {\n\t\treturn new Environment({\n\t\t\t...this.options,\n\t\t\textensions: new Map([...this.options.extensions, [extension, state] as [Environment.Extension<unknown, unknown>, unknown]]),\n\t\t})\n\t}\n\n\tpublic getExtension<S, R>(extension: Environment.Extension<S, R>): R {\n\t\tconst state = this.options.extensions.get(extension as Environment.Extension<unknown, unknown>)\n\t\treturn extension.create(state as S, this)\n\t}\n\n\tpublic merge(other: Environment): Environment {\n\t\tif (other === this) {\n\t\t\treturn this\n\t\t}\n\t\tif (!equal(this.options.node, other.options.node)) {\n\t\t\tthrow new BindingError(`Cannot merge two environments with different tree position.`)\n\t\t}\n\t\tif (this.options.parameters !== other.options.parameters) {\n\t\t\tthrow new BindingError(`Cannot merge two environments with different parameters.`)\n\t\t}\n\t\tif (this.options.dimensions !== other.options.dimensions) {\n\t\t\tthrow new BindingError(`Cannot merge two environments with different dimensions.`)\n\t\t}\n\t\tif (this.options.extensions !== other.options.extensions) {\n\t\t\t// todo: deep compare?\n\t\t\tthrow new BindingError(`Cannot merge two environments with different extensions.`)\n\t\t}\n\n\t\tif (equal(this.options.variables, other.options.variables) && this.options.parent === other.options.parent) {\n\t\t\treturn this\n\t\t}\n\t\tfor (const key in other.options.variables) {\n\t\t\tif (key in this.options.variables && !equal(this.options.variables[key], other.options.variables[key])) {\n\t\t\t\tthrow new BindingError(`Cannot merge two environments with different value of variable ${key}:\\n`\n\t\t\t\t\t+ JSON.stringify(this.options.variables[key]) + '\\n'\n\t\t\t\t\t+ JSON.stringify(other.options.variables[key]))\n\t\t\t}\n\t\t}\n\n\t\treturn new Environment({\n\t\t\t...this.options,\n\t\t\tparent: this.options.parent && other.options.parent ? this.options.parent.merge(other.options.parent) : undefined,\n\t\t\tvariables: { ...this.options.variables, ...other.options.variables },\n\t\t})\n\t}\n}\n\nnamespace Environment {\n\texport type Name = string\n\n\texport type Value = ReactNode | GraphQlLiteral | Filter\n\n\texport type ResolvedValue = Value\n\n\texport interface Options {\n\t\tnode?: AnyNode\n\t\tschema?: Schema\n\t\tdimensions: SelectedDimensions\n\t\tparameters: Parameters\n\t\tvariables: CustomVariables\n\t\tparent?: Environment\n\t\textensions: Map<Extension<unknown, unknown>, unknown>\n\t}\n\n\texport type SubTreeNode =\n\t\t| SubTreeEntityNode\n\t\t| SubTreeEntityListNode\n\n\texport type InnerNode =\n\t\t| EntityNode\n\t\t| EntityListNode\n\t\t| ColumnNode\n\n\texport type AnyNode =\n\t\t| SubTreeNode\n\t\t| InnerNode\n\n\texport interface SubTreeEntityNode {\n\t\ttype: 'subtree-entity'\n\t\tentity: SchemaEntity\n\t\texpectedCardinality: 'zero' | 'one' | 'zero-or-one'\n\t\tfilter: Filter\n\t}\n\n\texport interface SubTreeEntityListNode {\n\t\ttype: 'subtree-entity-list'\n\t\tentity: SchemaEntity\n\t\texpectedCardinality: 'zero-to-many' | 'zero'\n\t\tfilter: Filter\n\t}\n\n\texport interface EntityNode {\n\t\ttype: 'entity'\n\t\tentity: SchemaEntity\n\t\tfield: SchemaRelation\n\t}\n\n\texport interface EntityListNode {\n\t\ttype: 'entity-list'\n\t\tentity: SchemaEntity\n\t\tfield: SchemaRelation\n\t}\n\n\texport interface ColumnNode {\n\t\ttype: 'column'\n\t\tentity: SchemaEntity\n\t\tfield: SchemaColumn\n\t}\n\n\texport interface SelectedDimensions {\n\t\t[key: string]: string[]\n\t}\n\n\texport type Parameters = {\n\t\t[K in string]?: string | number\n\t}\n\n\texport interface CustomVariables {\n\t\t[key: string]: Value\n\t}\n\n\texport interface ValuesMapWithFactory {\n\t\t[key: string]:\n\t\t\t| ((environment: Environment) => Value)\n\t\t\t| Value\n\t}\n\n\texport type Extension<State, Result> = {\n\t\tcreate: (state: State | undefined, environment: Environment) => Result\n\t}\n\n\texport const createExtension = <S, R>(create: Extension<S, R>['create'], otherMethods?: Omit<Extension<S, R>, 'create'>): Extension<S, R> => {\n\t\treturn {\n\t\t\tcreate,\n\t\t\t...otherMethods,\n\t\t}\n\t}\n\n\t/** @deprecated */\n\texport type DeltaFactory = ValuesMapWithFactory\n}\n\nexport { Environment }\n"],"names":["Environment"],"mappings":";;AAOA,MAAM,YAAY;AAAA,EACT,YACU,SAChB;AADgB,SAAA,UAAA;AAAA,EAElB;AAAA,EAEA,OAAc,SAAS;AACtB,WAAO,IAAI,YAAY;AAAA,MACtB,YAAY,CAAC;AAAA,MACb,WAAW,CAAC;AAAA,MACZ,YAAY,CAAC;AAAA,MACb,gCAAgB,IAAI;AAAA,IAAA,CACpB;AAAA,EACF;AAAA,EAEO,aAAsC;AACnC,aAAA,MAAmB,MAAM,IAAI,QAAQ,MAAM,MAAM,IAAI,aAAa;AACpE,YAAA,OAAO,IAAI,QAAQ;AACzB,UAAI,KAAK,SAAS,oBAAoB,KAAK,SAAS,uBAAuB;AACnE,eAAA;AAAA,MACR;AAAA,IACD;AACM,UAAA,IAAI,aAAa,kBAAkB;AAAA,EAC1C;AAAA,EAEO,iBAAsC;AACxC,QAAA,CAAC,KAAK,QAAQ,MAAM;AACvB,YAAM,IAAI,aAAa;AAAA,IACxB;AACA,WAAO,KAAK,QAAQ;AAAA,EACrB;AAAA,EAEO,YAAY,SAAkC;AACpD,UAAM,EAAE,WAAW,QAAQ,IAAI,KAAK;AACpC,WAAO,IAAI,YAAY;A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whereToFilter } from "@contember/client";
4
3
  import levenshtein from "js-levenshtein";
5
4
  import { QueryLanguage } from "../queryLanguage/QueryLanguage.js";
@@ -10,7 +9,7 @@ class TreeNodeEnvironmentFactory {
10
9
  let expectedCardinality;
11
10
  if (sugaredEntityList.isCreating) {
12
11
  entityList = QueryLanguage.desugarUnconstrainedQualifiedEntityList(sugaredEntityList, environment);
13
- rootWhere = { id: { eq: NIL_UUID } };
12
+ rootWhere = {};
14
13
  expectedCardinality = "zero";
15
14
  } else {
16
15
  entityList = QueryLanguage.desugarQualifiedEntityList(sugaredEntityList, environment);
@@ -30,7 +29,7 @@ class TreeNodeEnvironmentFactory {
30
29
  let rootWhere;
31
30
  let expectedCardinality;
32
31
  if (sugaredEntityList.isCreating) {
33
- rootWhere = { id: { eq: NIL_UUID } };
32
+ rootWhere = {};
34
33
  expectedCardinality = "zero";
35
34
  entity = QueryLanguage.desugarUnconstrainedQualifiedSingleEntity(sugaredEntityList, environment);
36
35
  } else {
@@ -52,9 +51,6 @@ class TreeNodeEnvironmentFactory {
52
51
  const hasManyField = relativeEntityList.hasManyRelation.field;
53
52
  const field = this.assertHasManyRelation(hasOneEnvironment, hasManyField);
54
53
  const targetEntity = environment.getSchema().getEntity(field.targetEntity);
55
- if (!targetEntity) {
56
- throw new BindingError("should not happen");
57
- }
58
54
  return hasOneEnvironment.withSubTreeChild({
59
55
  type: "entity-list",
60
56
  field,
@@ -79,9 +75,6 @@ class TreeNodeEnvironmentFactory {
79
75
  for (const pathItem of hasOneRelationPath) {
80
76
  const field = this.resolveHasOneRelation(environment, pathItem.field, !!pathItem.reducedBy);
81
77
  const targetEntity = environment.getSchema().getEntity(field.targetEntity);
82
- if (!targetEntity) {
83
- throw new BindingError("should not happen");
84
- }
85
78
  environment = environment.withSubTreeChild({
86
79
  type: "entity",
87
80
  field,
@@ -105,9 +98,9 @@ class TreeNodeEnvironmentFactory {
105
98
  }, relationDescription);
106
99
  }
107
100
  static resolveEntity(schema, entityName, type) {
108
- const entity = schema.getEntity(entityName);
101
+ const entity = schema.getEntityOrUndefined(entityName);
109
102
  if (!entity) {
110
- const alternative = this.recommendAlternative(entityName, schema.store.entities.keys());
103
+ const alternative = this.recommendAlternative(entityName, schema.getEntityNames());
111
104
  const didYouMean = alternative ? `Did you mean '${alternative}'?` : "";
112
105
  throw new BindingError(`Invalid ${type} sub tree: Entity '${entityName}' doesn't exist. ${didYouMean}`);
113
106
  }
@@ -121,13 +114,18 @@ class TreeNodeEnvironmentFactory {
121
114
  const entity = treeLocation.entity;
122
115
  const field = entity.fields.get(fieldName);
123
116
  if (!field) {
124
- const alternative = this.recommendAlternative(fieldName, Array.from(entity.fields).filter(([, field2]) => matcher(field2)).map(([fieldName2]) => fieldName2));
117
+ const alternative = this.recommendAlternative(
118
+ fieldName,
119
+ Array.from(entity.fields).filter(([, field2]) => matcher(field2)).map(([fieldName2]) => fieldName2)
120
+ );
125
121
  const didYouMean = alternative ? `Did you mean '${alternative}'?` : "";
126
122
  throw new BindingError(`Field '${fieldName}' doesn't exist on ${this.describeLocation(environment)}. ${didYouMean}`);
127
123
  }
128
124
  if (!matcher(field)) {
129
125
  const actual = field.__typename === "_Column" ? "an ordinary field" : `a ${field.type} relation`;
130
- throw new BindingError(`Invalid field: the name '${field.name}' on ${this.describeLocation(environment)} refers to ${actual} but is being used as a ${expectedDescription}.`);
126
+ throw new BindingError(
127
+ `Invalid field: the name '${field.name}' on ${this.describeLocation(environment)} refers to ${actual} but is being used as a ${expectedDescription}.`
128
+ );
131
129
  }
132
130
  return field;
133
131
  }
@@ -155,5 +153,7 @@ class TreeNodeEnvironmentFactory {
155
153
  return bestAlternative;
156
154
  }
157
155
  }
158
- export { TreeNodeEnvironmentFactory };
156
+ export {
157
+ TreeNodeEnvironmentFactory
158
+ };
159
159
  //# sourceMappingURL=TreeNodeEnvironmentFactory.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TreeNodeEnvironmentFactory.js","sources":["../../../src/dao/TreeNodeEnvironmentFactory.ts"],"sourcesContent":["import { Environment } from './Environment'\nimport {\n\tHasOneRelation,\n\tSugaredQualifiedEntityList,\n\tSugaredQualifiedSingleEntity,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n\tSugaredUnconstrainedQualifiedEntityList,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n} from '../treeParameters'\nimport { QueryLanguage } from '../queryLanguage'\nimport { BindingError } from '../BindingError'\nimport { NIL_UUID } from '../bindingTypes'\nimport { whereToFilter } from '@contember/client'\nimport { BaseRelation, Schema, SchemaColumn, SchemaEntity, SchemaField, SchemaRelation } from '../core/schema'\nimport levenshtein from 'js-levenshtein'\n\nexport class TreeNodeEnvironmentFactory {\n\n\tpublic static createEnvironmentForEntityListSubtree(\n\t\tenvironment: Environment,\n\t\tsugaredEntityList: SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t): Environment {\n\t\tlet entityList\n\t\tlet rootWhere\n\t\tlet expectedCardinality: Environment.SubTreeNode['expectedCardinality']\n\n\t\tif (sugaredEntityList.isCreating) {\n\t\t\tentityList = QueryLanguage.desugarUnconstrainedQualifiedEntityList(sugaredEntityList, environment)\n\t\t\trootWhere = { id: { eq: NIL_UUID } } as const\n\t\t\texpectedCardinality = 'zero'\n\n\t\t} else {\n\t\t\tentityList = QueryLanguage.desugarQualifiedEntityList(sugaredEntityList, environment)\n\t\t\trootWhere = entityList.filter ?? {}\n\t\t\texpectedCardinality = 'zero-to-many'\n\t\t}\n\n\t\tconst entitySchema = this.resolveEntity(environment.getSchema(), entityList.entityName, 'entity list')\n\n\t\treturn environment.withSubTree({\n\t\t\ttype: 'subtree-entity-list',\n\t\t\tentity: entitySchema,\n\t\t\texpectedCardinality,\n\t\t\tfilter: rootWhere,\n\t\t})\n\t}\n\n\tpublic static createEnvironmentForEntitySubtree(\n\t\tenvironment: Environment,\n\t\tsugaredEntityList: SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t): Environment {\n\t\tlet entity\n\t\tlet rootWhere\n\t\tlet expectedCardinality: Environment.SubTreeNode['expectedCardinality']\n\n\t\tif (sugaredEntityList.isCreating) {\n\t\t\trootWhere = { id: { eq: NIL_UUID } } as const\n\t\t\texpectedCardinality = 'zero'\n\t\t\tentity = QueryLanguage.desugarUnconstrainedQualifiedSingleEntity(sugaredEntityList, environment)\n\n\t\t} else {\n\t\t\tentity = QueryLanguage.desugarQualifiedSingleEntity(sugaredEntityList, environment, { missingSetOnCreate: 'fill' })\n\t\t\trootWhere = whereToFilter(entity.where)\n\t\t\texpectedCardinality = entity.setOnCreate ? 'zero-or-one' : 'one'\n\t\t}\n\n\t\tconst entitySchema = this.resolveEntity(environment.getSchema(), entity.entityName, 'entity')\n\n\t\treturn environment.withSubTree({\n\t\t\ttype: 'subtree-entity',\n\t\t\tentity: entitySchema,\n\t\t\texpectedCardinality: expectedCardinality,\n\t\t\tfilter: rootWhere,\n\t\t})\n\t}\n\n\tpublic static createEnvironmentForEntityList(\n\t\tenvironment: Environment,\n\t\tsugaredRelativeEntityList: SugaredRelativeEntityList,\n\t): Environment {\n\t\tconst relativeEntityList = QueryLanguage.desugarRelativeEntityList(sugaredRelativeEntityList, environment)\n\t\tconst hasOneEnvironment = this.traverseHasOnePath(environment, relativeEntityList.hasOneRelationPath)\n\t\tconst hasManyField = relativeEntityList.hasManyRelation.field\n\n\t\tconst field = this.assertHasManyRelation(hasOneEnvironment, hasManyField)\n\n\t\tconst targetEntity = environment.getSchema().getEntity(field.targetEntity)\n\t\tif (!targetEntity) {\n\t\t\tthrow new BindingError('should not happen')\n\t\t}\n\t\treturn hasOneEnvironment.withSubTreeChild({\n\t\t\ttype: 'entity-list',\n\t\t\tfield,\n\t\t\tentity: targetEntity,\n\t\t})\n\t}\n\n\tpublic static createEnvironmentForEntity(\n\t\tenvironment: Environment,\n\t\tsugaredRelativeSingleEntity: SugaredRelativeSingleEntity,\n\t) {\n\t\tconst relativeSingleEntity = QueryLanguage.desugarRelativeSingleEntity(sugaredRelativeSingleEntity, environment)\n\n\t\treturn this.traverseHasOnePath(environment, relativeSingleEntity.hasOneRelationPath)\n\t}\n\n\tpublic static createEnvironmentForField(\n\t\tenvironment: Environment,\n\t\tsugaredRelativeSingleField: SugaredRelativeSingleField,\n\t) {\n\t\tconst relativeSingleField = QueryLanguage.desugarRelativeSingleField(sugaredRelativeSingleField, environment)\n\t\tconst hasOneEnvironment = this.traverseHasOnePath(environment, relativeSingleField.hasOneRelationPath)\n\n\t\tconst field = this.resolveColumn(hasOneEnvironment, relativeSingleField.field)\n\n\t\treturn hasOneEnvironment.withSubTreeChild({\n\t\t\ttype: 'column',\n\t\t\tentity: environment.getSubTreeNode().entity,\n\t\t\tfield,\n\t\t})\n\t}\n\n\tprivate static traverseHasOnePath(\n\t\tenvironment: Environment,\n\t\thasOneRelationPath: HasOneRelation[],\n\t): Environment {\n\t\tfor (const pathItem of hasOneRelationPath) {\n\t\t\tconst field = this.resolveHasOneRelation(environment, pathItem.field, !!pathItem.reducedBy)\n\t\t\tconst targetEntity = environment.getSchema().getEntity(field.targetEntity)\n\t\t\tif (!targetEntity) {\n\t\t\t\tthrow new BindingError('should not happen')\n\t\t\t}\n\t\t\tenvironment = environment.withSubTreeChild({\n\t\t\t\ttype: 'entity',\n\t\t\t\tfield,\n\t\t\t\tentity: targetEntity,\n\t\t\t})\n\t\t}\n\t\treturn environment\n\t}\n\n\tprivate static resolveHasOneRelation(environment: Environment, field: string, isReduced: boolean): SchemaRelation {\n\t\tif (isReduced) {\n\t\t\treturn this.resolveRelation(environment, field, 'reduced has-one relation', ['ManyHasMany', 'OneHasMany'])\n\t\t}\n\t\treturn this.resolveRelation(environment, field, 'a has-one relation', ['ManyHasOne', 'OneHasOne'])\n\t}\n\n\tprivate static assertHasManyRelation(environment: Environment, field: string): SchemaRelation {\n\t\treturn this.resolveRelation(environment, field, 'a has-many relation', ['ManyHasMany', 'OneHasMany'])\n\t}\n\n\n\tprivate static resolveRelation(environment: Environment, field: string, relationDescription: string, expectedRelationType: BaseRelation['type'][]): SchemaRelation {\n\t\treturn this.resolveField(environment, field, (field): field is SchemaRelation => {\n\t\t\treturn field.__typename === '_Relation' && expectedRelationType.includes(field.type)\n\t\t}, relationDescription)\n\t}\n\n\tprivate static resolveEntity(schema: Schema, entityName: string, type: 'entity' | 'entity list'): SchemaEntity {\n\t\tconst entity = schema.getEntity(entityName)\n\t\tif (!entity) {\n\t\t\tconst alternative = this.recommendAlternative(entityName, schema.store.entities.keys())\n\t\t\tconst didYouMean = alternative ? `Did you mean '${alternative}'?` : ''\n\t\t\tthrow new BindingError(`Invalid ${type} sub tree: Entity '${entityName}' doesn't exist. ${didYouMean}`)\n\t\t}\n\t\treturn entity\n\t}\n\n\tprivate static resolveColumn(environment: Environment, fieldName: string): SchemaColumn {\n\t\treturn this.resolveField(environment, fieldName, (field): field is SchemaColumn => field.__typename === '_Column', 'an ordinary field')\n\t\t// TODO check that defaultValue matches the type\n\t\t// TODO run custom validators\n\t}\n\n\tprivate static resolveField<T extends SchemaField>(environment: Environment, fieldName: string, matcher: (field: SchemaField) => field is T, expectedDescription: string): T {\n\t\tconst treeLocation = environment.getSubTreeNode()\n\t\tconst entity = treeLocation.entity\n\t\tconst field = entity.fields.get(fieldName)\n\t\tif (!field) {\n\t\t\tconst alternative = this.recommendAlternative(\n\t\t\t\tfieldName,\n\t\t\t\tArray.from(entity.fields)\n\t\t\t\t\t.filter(([, field]) => matcher(field))\n\t\t\t\t\t.map(([fieldName]) => fieldName),\n\t\t\t)\n\t\t\tconst didYouMean = alternative ? `Did you mean '${alternative}'?` : ''\n\t\t\tthrow new BindingError(`Field '${fieldName}' doesn't exist on ${this.describeLocation(environment)}. ${didYouMean}`)\n\t\t}\n\t\tif (!matcher(field)) {\n\t\t\tconst actual = field.__typename === '_Column' ? 'an ordinary field' : `a ${field.type} relation`\n\t\t\tthrow new BindingError(\n\t\t\t\t`Invalid field: the name '${field.name}' on ${this.describeLocation(environment)} ` +\n\t\t\t\t`refers to ${actual} but is being used as a ${expectedDescription}.`,\n\t\t\t)\n\t\t}\n\t\treturn field\n\t}\n\n\tprivate static describeLocation(environment: Environment): string {\n\t\tconst path = []\n\t\tconst loc = environment.getSubTreeNode()\n\t\tfor (let env = environment;; env = env.getParent()) {\n\t\t\tconst node = env.getSubTreeNode()\n\t\t\tif (node.type === 'subtree-entity' || node.type === 'subtree-entity-list') {\n\t\t\t\treturn `entity '${loc.entity.name}' in path '${[node.entity.name, ...path.reverse()].join('.')}'`\n\t\t\t}\n\t\t\tpath.push(node.field.name)\n\t\t}\n\t}\n\n\tpublic static recommendAlternative(original: string, possibleAlternatives: Iterable<string>): string | undefined {\n\t\tlet bestAlternative: string | undefined = undefined\n\t\tlet bestAlternativeDistance = Number.MAX_SAFE_INTEGER\n\n\t\tfor (const alternative of possibleAlternatives) {\n\t\t\tconst distance = levenshtein(original, alternative)\n\n\t\t\tif (distance < bestAlternativeDistance) {\n\t\t\t\tbestAlternative = alternative\n\t\t\t\tbestAlternativeDistance = distance\n\t\t\t}\n\t\t}\n\t\treturn bestAlternative\n\t}\n}\n"],"names":[],"mappings":";;;;;AAkBO,MAAM,2BAA2B;AAAA,SAEzB,sCACb,aACA,mBACc;AACV,QAAA;AACA,QAAA;AACA,QAAA;AAEJ,QAAI,kBAAkB,YAAY;AACpB,mBAAA,cAAc,wCAAwC,mBAAmB,WAAW;AACjG,kBAAY,EAAE,IAAI,EAAE,IAAI,SAAW,EAAA;AACb,4BAAA;AAAA,IAAA,OAEhB;AACO,mBAAA,cAAc,2BAA2B,mBAAmB,WAAW;AACxE,kBAAA,WAAW,UAAU;AACX,4BAAA;AAAA,IACvB;AAEM,UAAA,eAAe,KAAK,cAAc,YAAY,aAAa,WAAW,YAAY,aAAa;AAErG,WAAO,YAAY,YAAY;AAAA,MAC9B,MAAM;AAAA,MACN,QAAQ;AAAA,MACR;AAAA,MACA,QAAQ;AAAA,IAAA,CACR;AAAA,EACF;AAAA,SAEc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GAAG;AAAA,MAC9F;AACK,WAAA,KAAK,KAAK,MAAM,IAAI;AAAA,IAC1B;AAAA,EACD;AAAA,SAEc,qBAAqB,UAAkB,sBAA4D;AAChH,QAAI,kBAAsC;AAC1C,QAAI,0BAA0B,OAAO;AAErC,eAAW,eAAe,sBAAsB;AACzC,YAAA,WAAW,YAAY,UAAU,WAAW;AAElD,UAAI,WAAW,yBAAyB;AACrB,0BAAA;AACQ,kCAAA;AAAA,MAC3B;AAAA,IACD;AACO,WAAA;AAAA,EACR;AACD;;"}
1
+ {"version":3,"file":"TreeNodeEnvironmentFactory.js","sources":["../../../src/dao/TreeNodeEnvironmentFactory.ts"],"sourcesContent":["import { Environment } from './Environment'\nimport {\n\tHasOneRelation,\n\tSugaredQualifiedEntityList,\n\tSugaredQualifiedSingleEntity,\n\tSugaredRelativeEntityList,\n\tSugaredRelativeSingleEntity,\n\tSugaredRelativeSingleField,\n\tSugaredUnconstrainedQualifiedEntityList,\n\tSugaredUnconstrainedQualifiedSingleEntity,\n} from '../treeParameters'\nimport { QueryLanguage } from '../queryLanguage'\nimport { BindingError } from '../BindingError'\nimport { whereToFilter } from '@contember/client'\nimport { BaseRelation, Schema, SchemaColumn, SchemaEntity, SchemaField, SchemaRelation } from '../core/schema'\nimport levenshtein from 'js-levenshtein'\n\nexport class TreeNodeEnvironmentFactory {\n\n\tpublic static createEnvironmentForEntityListSubtree(\n\t\tenvironment: Environment,\n\t\tsugaredEntityList: SugaredQualifiedEntityList | SugaredUnconstrainedQualifiedEntityList,\n\t): Environment {\n\t\tlet entityList\n\t\tlet rootWhere\n\t\tlet expectedCardinality: Environment.SubTreeNode['expectedCardinality']\n\n\t\tif (sugaredEntityList.isCreating) {\n\t\t\tentityList = QueryLanguage.desugarUnconstrainedQualifiedEntityList(sugaredEntityList, environment)\n\t\t\trootWhere = {} as const\n\t\t\texpectedCardinality = 'zero'\n\n\t\t} else {\n\t\t\tentityList = QueryLanguage.desugarQualifiedEntityList(sugaredEntityList, environment)\n\t\t\trootWhere = entityList.filter ?? {}\n\t\t\texpectedCardinality = 'zero-to-many'\n\t\t}\n\n\t\tconst entitySchema = this.resolveEntity(environment.getSchema(), entityList.entityName, 'entity list')\n\n\t\treturn environment.withSubTree({\n\t\t\ttype: 'subtree-entity-list',\n\t\t\tentity: entitySchema,\n\t\t\texpectedCardinality,\n\t\t\tfilter: rootWhere,\n\t\t})\n\t}\n\n\tpublic static createEnvironmentForEntitySubtree(\n\t\tenvironment: Environment,\n\t\tsugaredEntityList: SugaredQualifiedSingleEntity | SugaredUnconstrainedQualifiedSingleEntity,\n\t): Environment {\n\t\tlet entity\n\t\tlet rootWhere\n\t\tlet expectedCardinality: Environment.SubTreeNode['expectedCardinality']\n\n\t\tif (sugaredEntityList.isCreating) {\n\t\t\trootWhere = { } as const\n\t\t\texpectedCardinality = 'zero'\n\t\t\tentity = QueryLanguage.desugarUnconstrainedQualifiedSingleEntity(sugaredEntityList, environment)\n\n\t\t} else {\n\t\t\tentity = QueryLanguage.desugarQualifiedSingleEntity(sugaredEntityList, environment, { missingSetOnCreate: 'fill' })\n\t\t\trootWhere = whereToFilter(entity.where)\n\t\t\texpectedCardinality = entity.setOnCreate ? 'zero-or-one' : 'one'\n\t\t}\n\n\t\tconst entitySchema = this.resolveEntity(environment.getSchema(), entity.entityName, 'entity')\n\n\t\treturn environment.withSubTree({\n\t\t\ttype: 'subtree-entity',\n\t\t\tentity: entitySchema,\n\t\t\texpectedCardinality: expectedCardinality,\n\t\t\tfilter: rootWhere,\n\t\t})\n\t}\n\n\tpublic static createEnvironmentForEntityList(\n\t\tenvironment: Environment,\n\t\tsugaredRelativeEntityList: SugaredRelativeEntityList,\n\t): Environment {\n\t\tconst relativeEntityList = QueryLanguage.desugarRelativeEntityList(sugaredRelativeEntityList, environment)\n\t\tconst hasOneEnvironment = this.traverseHasOnePath(environment, relativeEntityList.hasOneRelationPath)\n\t\tconst hasManyField = relativeEntityList.hasManyRelation.field\n\n\t\tconst field = this.assertHasManyRelation(hasOneEnvironment, hasManyField)\n\n\t\tconst targetEntity = environment.getSchema().getEntity(field.targetEntity)\n\n\t\treturn hasOneEnvironment.withSubTreeChild({\n\t\t\ttype: 'entity-list',\n\t\t\tfield,\n\t\t\tentity: targetEntity,\n\t\t})\n\t}\n\n\tpublic static createEnvironmentForEntity(\n\t\tenvironment: Environment,\n\t\tsugaredRelativeSingleEntity: SugaredRelativeSingleEntity,\n\t) {\n\t\tconst relativeSingleEntity = QueryLanguage.desugarRelativeSingleEntity(sugaredRelativeSingleEntity, environment)\n\n\t\treturn this.traverseHasOnePath(environment, relativeSingleEntity.hasOneRelationPath)\n\t}\n\n\tpublic static createEnvironmentForField(\n\t\tenvironment: Environment,\n\t\tsugaredRelativeSingleField: SugaredRelativeSingleField,\n\t) {\n\t\tconst relativeSingleField = QueryLanguage.desugarRelativeSingleField(sugaredRelativeSingleField, environment)\n\t\tconst hasOneEnvironment = this.traverseHasOnePath(environment, relativeSingleField.hasOneRelationPath)\n\n\t\tconst field = this.resolveColumn(hasOneEnvironment, relativeSingleField.field)\n\n\t\treturn hasOneEnvironment.withSubTreeChild({\n\t\t\ttype: 'column',\n\t\t\tentity: environment.getSubTreeNode().entity,\n\t\t\tfield,\n\t\t})\n\t}\n\n\tprivate static traverseHasOnePath(\n\t\tenvironment: Environment,\n\t\thasOneRelationPath: HasOneRelation[],\n\t): Environment {\n\t\tfor (const pathItem of hasOneRelationPath) {\n\t\t\tconst field = this.resolveHasOneRelation(environment, pathItem.field, !!pathItem.reducedBy)\n\t\t\tconst targetEntity = environment.getSchema().getEntity(field.targetEntity)\n\n\t\t\tenvironment = environment.withSubTreeChild({\n\t\t\t\ttype: 'entity',\n\t\t\t\tfield,\n\t\t\t\tentity: targetEntity,\n\t\t\t})\n\t\t}\n\t\treturn environment\n\t}\n\n\tprivate static resolveHasOneRelation(environment: Environment, field: string, isReduced: boolean): SchemaRelation {\n\t\tif (isReduced) {\n\t\t\treturn this.resolveRelation(environment, field, 'reduced has-one relation', ['ManyHasMany', 'OneHasMany'])\n\t\t}\n\t\treturn this.resolveRelation(environment, field, 'a has-one relation', ['ManyHasOne', 'OneHasOne'])\n\t}\n\n\tprivate static assertHasManyRelation(environment: Environment, field: string): SchemaRelation {\n\t\treturn this.resolveRelation(environment, field, 'a has-many relation', ['ManyHasMany', 'OneHasMany'])\n\t}\n\n\n\tprivate static resolveRelation(environment: Environment, field: string, relationDescription: string, expectedRelationType: BaseRelation['type'][]): SchemaRelation {\n\t\treturn this.resolveField(environment, field, (field): field is SchemaRelation => {\n\t\t\treturn field.__typename === '_Relation' && expectedRelationType.includes(field.type)\n\t\t}, relationDescription)\n\t}\n\n\tprivate static resolveEntity(schema: Schema, entityName: string, type: 'entity' | 'entity list'): SchemaEntity {\n\t\tconst entity = schema.getEntityOrUndefined(entityName)\n\t\tif (!entity) {\n\t\t\tconst alternative = this.recommendAlternative(entityName, schema.getEntityNames())\n\t\t\tconst didYouMean = alternative ? `Did you mean '${alternative}'?` : ''\n\t\t\tthrow new BindingError(`Invalid ${type} sub tree: Entity '${entityName}' doesn't exist. ${didYouMean}`)\n\t\t}\n\t\treturn entity\n\t}\n\n\tprivate static resolveColumn(environment: Environment, fieldName: string): SchemaColumn {\n\t\treturn this.resolveField(environment, fieldName, (field): field is SchemaColumn => field.__typename === '_Column', 'an ordinary field')\n\t\t// TODO check that defaultValue matches the type\n\t\t// TODO run custom validators\n\t}\n\n\tprivate static resolveField<T extends SchemaField>(environment: Environment, fieldName: string, matcher: (field: SchemaField) => field is T, expectedDescription: string): T {\n\t\tconst treeLocation = environment.getSubTreeNode()\n\t\tconst entity = treeLocation.entity\n\t\tconst field = entity.fields.get(fieldName)\n\t\tif (!field) {\n\t\t\tconst alternative = this.recommendAlternative(\n\t\t\t\tfieldName,\n\t\t\t\tArray.from(entity.fields)\n\t\t\t\t\t.filter(([, field]) => matcher(field))\n\t\t\t\t\t.map(([fieldName]) => fieldName),\n\t\t\t)\n\t\t\tconst didYouMean = alternative ? `Did you mean '${alternative}'?` : ''\n\t\t\tthrow new BindingError(`Field '${fieldName}' doesn't exist on ${this.describeLocation(environment)}. ${didYouMean}`)\n\t\t}\n\t\tif (!matcher(field)) {\n\t\t\tconst actual = field.__typename === '_Column' ? 'an ordinary field' : `a ${field.type} relation`\n\t\t\tthrow new BindingError(\n\t\t\t\t`Invalid field: the name '${field.name}' on ${this.describeLocation(environment)} ` +\n\t\t\t\t`refers to ${actual} but is being used as a ${expectedDescription}.`,\n\t\t\t)\n\t\t}\n\t\treturn field\n\t}\n\n\tprivate static describeLocation(environment: Environment): string {\n\t\tconst path = []\n\t\tconst loc = environment.getSubTreeNode()\n\t\tfor (let env = environment;; env = env.getParent()) {\n\t\t\tconst node = env.getSubTreeNode()\n\t\t\tif (node.type === 'subtree-entity' || node.type === 'subtree-entity-list') {\n\t\t\t\treturn `entity '${loc.entity.name}' in path '${[node.entity.name, ...path.reverse()].join('.')}'`\n\t\t\t}\n\t\t\tpath.push(node.field.name)\n\t\t}\n\t}\n\n\tpublic static recommendAlternative(original: string, possibleAlternatives: Iterable<string>): string | undefined {\n\t\tlet bestAlternative: string | undefined = undefined\n\t\tlet bestAlternativeDistance = Number.MAX_SAFE_INTEGER\n\n\t\tfor (const alternative of possibleAlternatives) {\n\t\t\tconst distance = levenshtein(original, alternative)\n\n\t\t\tif (distance < bestAlternativeDistance) {\n\t\t\t\tbestAlternative = alternative\n\t\t\t\tbestAlternativeDistance = distance\n\t\t\t}\n\t\t}\n\t\treturn bestAlternative\n\t}\n}\n"],"names":["field","fieldName"],"mappings":";;;;AAiBO,MAAM,2BAA2B;AAAA,EAEvC,OAAc,sCACb,aACA,mBACc;AACV,QAAA;AACA,QAAA;AACA,QAAA;AAEJ,QAAI,kBAAkB,YAAY;AACpB,mBAAA,cAAc,wCAAwC,mBAAmB,WAAW;AACjG,kBAAY,CAAA;AACU,4BAAA;AAAA,IAAA,OAEhB;AACO,mBAAA,cAAc,2BAA2B,mBAAmB,WAAW;AACxE,kBAAA,WA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AO,IAAI;AACjB,UAAI,KAAK,SAAS,oBAAoB,KAAK,SAAS,uBAAuB;AAC1E,eAAO,WAAW,IAAI,OAAO,kBAAkB,CAAC,KAAK,OAAO,MAAM,GAAG,KAAK,QAAS,CAAA,EAAE,KAAK,GAAG;AAAA,MAC9F;AACK,WAAA,KAAK,KAAK,MAAM,IAAI;AAAA,IAC1B;AAAA,EACD;AAAA,EAEA,OAAc,qBAAqB,UAAkB,sBAA4D;AAChH,QAAI,kBAAsC;AAC1C,QAAI,0BAA0B,OAAO;AAErC,eAAW,eAAe,sBAAsB;AACzC,YAAA,WAAW,YAAY,UAAU,WAAW;AAElD,UAAI,WAAW,yBAAyB;AACrB,0BAAA;AACQ,kCAAA;AAAA,MAC3B;AAAA,IACD;AACO,WAAA;AAAA,EACR;AACD;"}
@@ -3,5 +3,7 @@ class VariableFieldValue {
3
3
  this.variableName = variableName;
4
4
  }
5
5
  }
6
- export { VariableFieldValue };
6
+ export {
7
+ VariableFieldValue
8
+ };
7
9
  //# sourceMappingURL=VariableFieldValue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"VariableFieldValue.js","sources":["../../../src/dao/VariableFieldValue.ts"],"sourcesContent":["export class VariableFieldValue {\n\tpublic constructor(public readonly variableName: string) {}\n}\n"],"names":[],"mappings":"AAAO,MAAM,mBAAmB;AAAA,EACxB,YAA4B,cAAsB;AAAtB,SAAA,eAAA;AAAA,EAAuB;AAC3D;;"}
1
+ {"version":3,"file":"VariableFieldValue.js","sources":["../../../src/dao/VariableFieldValue.ts"],"sourcesContent":["export class VariableFieldValue {\n\tpublic constructor(public readonly variableName: string) {}\n}\n"],"names":[],"mappings":"AAAO,MAAM,mBAAmB;AAAA,EACxB,YAA4B,cAAsB;AAAtB,SAAA,eAAA;AAAA,EAAuB;AAC3D;"}
@@ -12,23 +12,31 @@ const useDerivedField = (sourceField, derivedField, transform = identityFunction
12
12
  const desugaredDerived = useDesugaredRelativeSingleField(derivedField);
13
13
  const potentiallyStaleSourceAccessor = potentiallyStaleParent.getRelativeSingleField(desugaredSource);
14
14
  const stableGetSourceReference = potentiallyStaleSourceAccessor.getAccessor;
15
- const onBeforeUpdate = useCallback((sourceAccessor) => {
16
- stableGetEntityReference().batchUpdates((getAccessor) => {
17
- const derivedHostEntity = getAccessor().getRelativeSingleEntity(desugaredDerived);
18
- if (derivedHostEntity.existsOnServer) {
19
- return;
20
- }
21
- const derivedAccessor = getAccessor().getRelativeSingleField(desugaredDerived);
22
- if (derivedAccessor.isTouched) {
23
- return;
24
- }
25
- const transformedValue = transform(sourceAccessor.value);
26
- derivedAccessor.updateValue(transformedValue, {
27
- agent
15
+ const onBeforeUpdate = useCallback(
16
+ (sourceAccessor) => {
17
+ stableGetEntityReference().batchUpdates((getAccessor) => {
18
+ const derivedHostEntity = getAccessor().getRelativeSingleEntity(desugaredDerived);
19
+ if (derivedHostEntity.existsOnServer) {
20
+ return;
21
+ }
22
+ const derivedAccessor = getAccessor().getRelativeSingleField(desugaredDerived);
23
+ if (derivedAccessor.isTouched) {
24
+ return;
25
+ }
26
+ const transformedValue = transform(sourceAccessor.value);
27
+ derivedAccessor.updateValue(transformedValue, {
28
+ agent
29
+ });
28
30
  });
29
- });
30
- }, [stableGetEntityReference, desugaredDerived, transform, agent]);
31
- useEffect(() => stableGetSourceReference().addEventListener({ type: "beforeUpdate" }, onBeforeUpdate), [onBeforeUpdate, stableGetSourceReference]);
31
+ },
32
+ [stableGetEntityReference, desugaredDerived, transform, agent]
33
+ );
34
+ useEffect(
35
+ () => stableGetSourceReference().addEventListener({ type: "beforeUpdate" }, onBeforeUpdate),
36
+ [onBeforeUpdate, stableGetSourceReference]
37
+ );
38
+ };
39
+ export {
40
+ useDerivedField
32
41
  };
33
- export { useDerivedField };
34
42
  //# sourceMappingURL=useDerivedField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDerivedField.js","sources":["../../../src/entityEvents/useDerivedField.ts"],"sourcesContent":["import { useCallback, useEffect } from 'react'\nimport { useDesugaredRelativeSingleField, useEntityKey, useGetEntityByKey } from '../accessorPropagation'\nimport type { FieldAccessor } from '../accessors'\nimport type { FieldValue, SugaredRelativeSingleField } from '../treeParameters'\n\nconst identityFunction = <Value>(value: Value) => value\n\n// TODO this is fundamentally wrong. This shouldn't only happen on beforeUpdate, but also on initialize.\n// \twe need a useEffect equivalent.\n\n/**\n * Derived fields are meant for cases when the user is expected to primarily edit the `sourceField` whose optionally\n * transformed value is then copied to the `derivedField`. This happens after each update until either the `derivedField`\n * is touched or until it is persisted at which point the tie between the fields is automatically severed.\n * @deprecated This is fundamentally wrong and shouldn't be used for now.\n */\nexport const useDerivedField = <SourceValue extends FieldValue = FieldValue>(\n\tsourceField: string | SugaredRelativeSingleField,\n\tderivedField: string | SugaredRelativeSingleField,\n\ttransform: (sourceValue: SourceValue | null) => SourceValue | null = identityFunction,\n\tagent: string = 'derivedField',\n) => {\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst potentiallyStaleParent = getEntityByKey(entityKey)\n\tconst stableGetEntityReference = potentiallyStaleParent.getAccessor\n\n\tconst desugaredSource = useDesugaredRelativeSingleField(sourceField)\n\tconst desugaredDerived = useDesugaredRelativeSingleField(derivedField)\n\n\tconst potentiallyStaleSourceAccessor = potentiallyStaleParent.getRelativeSingleField<SourceValue>(desugaredSource)\n\tconst stableGetSourceReference = potentiallyStaleSourceAccessor.getAccessor\n\n\tconst onBeforeUpdate = useCallback<FieldAccessor.BeforeUpdateListener<SourceValue>>(\n\t\tsourceAccessor => {\n\t\t\tstableGetEntityReference().batchUpdates(getAccessor => {\n\t\t\t\t// This is tricky: we're deliberately getting the Entity, and not the field\n\t\t\t\tconst derivedHostEntity = getAccessor().getRelativeSingleEntity(desugaredDerived)\n\n\t\t\t\tif (derivedHostEntity.existsOnServer) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst derivedAccessor = getAccessor().getRelativeSingleField<SourceValue>(desugaredDerived)\n\n\t\t\t\tif (derivedAccessor.isTouched) {\n\t\t\t\t\t// Querying the user\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst transformedValue = transform(sourceAccessor.value)\n\t\t\t\tderivedAccessor.updateValue(transformedValue, {\n\t\t\t\t\tagent,\n\t\t\t\t})\n\t\t\t})\n\t\t},\n\t\t[stableGetEntityReference, desugaredDerived, transform, agent],\n\t)\n\n\tuseEffect(\n\t\t() => stableGetSourceReference().addEventListener({ type: 'beforeUpdate' }, onBeforeUpdate),\n\t\t[onBeforeUpdate, stableGetSourceReference],\n\t)\n}\n"],"names":[],"mappings":";;;;AAKA,MAAM,mBAAmB,CAAQ,UAAiB;AAW3C,MAAM,kBAAkB,CAC9B,aACA,cACA,YAAqE,kBACrE,QAAgB,mBACZ;AACJ,QAAM,YAAY;AAClB,QAAM,iBAAiB;AACjB,QAAA,yBAAyB,eAAe,SAAS;AACvD,QAAM,2BAA2B,uBAAuB;AAElD,QAAA,kBAAkB,gCAAgC,WAAW;AAC7D,QAAA,mBAAmB,gCAAgC,YAAY;AAE/D,QAAA,iCAAiC,uBAAuB,uBAAoC,eAAe;AACjH,QAAM,2BAA2B,+BAA+B;AAE1D,QAAA,iBAAiB,YACtB,CAAkB,mBAAA;AACQ,6BAAA,EAAE,aAAa,CAAe,gBAAA;AAEtD,YAAM,oBAAoB,YAAA,EAAc,wBAAwB,gBAAgB;AAEhF,UAAI,kBAAkB,gBAAgB;AACrC;AAAA,MACD;AAEA,YAAM,kBAAkB,YAAA,EAAc,uBAAoC,gBAAgB;AAE1F,UAAI,gBAAgB,WAAW;AAE9B;AAAA,MACD;AAEM,YAAA,mBAAmB,UAAU,eAAe,KAAK;AACvD,sBAAgB,YAAY,kBAAkB;AAAA,QAC7C;AAAA,MAAA,CACA;AAAA,IAAA,CACD;AAAA,KAEF,CAAC,0BAA0B,kBAAkB,WAAW,KAAK,CAC9D;AAEA,YACC,MAAM,2BAA2B,iBAAiB,EAAE,MAAM,eAAe,GAAG,cAAc,GAC1F,CAAC,gBAAgB,wBAAwB,CAC1C;AACD;;"}
1
+ {"version":3,"file":"useDerivedField.js","sources":["../../../src/entityEvents/useDerivedField.ts"],"sourcesContent":["import { useCallback, useEffect } from 'react'\nimport { useDesugaredRelativeSingleField, useEntityKey, useGetEntityByKey } from '../accessorPropagation'\nimport type { FieldAccessor } from '../accessors'\nimport type { FieldValue, SugaredRelativeSingleField } from '../treeParameters'\n\nconst identityFunction = <Value>(value: Value) => value\n\n// TODO this is fundamentally wrong. This shouldn't only happen on beforeUpdate, but also on initialize.\n// \twe need a useEffect equivalent.\n\n/**\n * Derived fields are meant for cases when the user is expected to primarily edit the `sourceField` whose optionally\n * transformed value is then copied to the `derivedField`. This happens after each update until either the `derivedField`\n * is touched or until it is persisted at which point the tie between the fields is automatically severed.\n * @deprecated This is fundamentally wrong and shouldn't be used for now.\n */\nexport const useDerivedField = <SourceValue extends FieldValue = FieldValue>(\n\tsourceField: string | SugaredRelativeSingleField,\n\tderivedField: string | SugaredRelativeSingleField,\n\ttransform: (sourceValue: SourceValue | null) => SourceValue | null = identityFunction,\n\tagent: string = 'derivedField',\n) => {\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst potentiallyStaleParent = getEntityByKey(entityKey)\n\tconst stableGetEntityReference = potentiallyStaleParent.getAccessor\n\n\tconst desugaredSource = useDesugaredRelativeSingleField(sourceField)\n\tconst desugaredDerived = useDesugaredRelativeSingleField(derivedField)\n\n\tconst potentiallyStaleSourceAccessor = potentiallyStaleParent.getRelativeSingleField<SourceValue>(desugaredSource)\n\tconst stableGetSourceReference = potentiallyStaleSourceAccessor.getAccessor\n\n\tconst onBeforeUpdate = useCallback<FieldAccessor.BeforeUpdateListener<SourceValue>>(\n\t\tsourceAccessor => {\n\t\t\tstableGetEntityReference().batchUpdates(getAccessor => {\n\t\t\t\t// This is tricky: we're deliberately getting the Entity, and not the field\n\t\t\t\tconst derivedHostEntity = getAccessor().getRelativeSingleEntity(desugaredDerived)\n\n\t\t\t\tif (derivedHostEntity.existsOnServer) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst derivedAccessor = getAccessor().getRelativeSingleField<SourceValue>(desugaredDerived)\n\n\t\t\t\tif (derivedAccessor.isTouched) {\n\t\t\t\t\t// Querying the user\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst transformedValue = transform(sourceAccessor.value)\n\t\t\t\tderivedAccessor.updateValue(transformedValue, {\n\t\t\t\t\tagent,\n\t\t\t\t})\n\t\t\t})\n\t\t},\n\t\t[stableGetEntityReference, desugaredDerived, transform, agent],\n\t)\n\n\tuseEffect(\n\t\t() => stableGetSourceReference().addEventListener({ type: 'beforeUpdate' }, onBeforeUpdate),\n\t\t[onBeforeUpdate, stableGetSourceReference],\n\t)\n}\n"],"names":[],"mappings":";;;;AAKA,MAAM,mBAAmB,CAAQ,UAAiB;AAW3C,MAAM,kBAAkB,CAC9B,aACA,cACA,YAAqE,kBACrE,QAAgB,mBACZ;AACJ,QAAM,YAAY;AAClB,QAAM,iBAAiB;AACjB,QAAA,yBAAyB,eAAe,SAAS;AACvD,QAAM,2BAA2B,uBAAuB;AAElD,QAAA,kBAAkB,gCAAgC,WAAW;AAC7D,QAAA,mBAAmB,gCAAgC,YAAY;AAE/D,QAAA,iCAAiC,uBAAuB,uBAAoC,eAAe;AACjH,QAAM,2BAA2B,+BAA+B;AAEhE,QAAM,iBAAiB;AAAA,IACtB,CAAkB,mBAAA;AACQ,+BAAA,EAAE,aAAa,CAAe,gBAAA;AAEtD,cAAM,oBAAoB,YAAA,EAAc,wBAAwB,gBAAgB;AAEhF,YAAI,kBAAkB,gBAAgB;AACrC;AAAA,QACD;AAEA,cAAM,kBAAkB,YAAA,EAAc,uBAAoC,gBAAgB;AAE1F,YAAI,gBAAgB,WAAW;AAE9B;AAAA,QACD;AAEM,cAAA,mBAAmB,UAAU,eAAe,KAAK;AACvD,wBAAgB,YAAY,kBAAkB;AAAA,UAC7C;AAAA,QAAA,CACA;AAAA,MAAA,CACD;AAAA,IACF;AAAA,IACA,CAAC,0BAA0B,kBAAkB,WAAW,KAAK;AAAA,EAAA;AAG9D;AAAA,IACC,MAAM,yBAA2B,EAAA,iBAAiB,EAAE,MAAM,kBAAkB,cAAc;AAAA,IAC1F,CAAC,gBAAgB,wBAAwB;AAAA,EAAA;AAE3C;"}
@@ -2,5 +2,7 @@ import { useEntityEvent } from "./useEntityEvent.js";
2
2
  const useEntityBeforePersist = (listener) => {
3
3
  useEntityEvent("beforePersist", listener);
4
4
  };
5
- export { useEntityBeforePersist };
5
+ export {
6
+ useEntityBeforePersist
7
+ };
6
8
  //# sourceMappingURL=useEntityBeforePersist.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityBeforePersist.js","sources":["../../../src/entityEvents/useEntityBeforePersist.ts"],"sourcesContent":["import type { EntityAccessor } from '../accessors'\nimport { useEntityEvent } from './useEntityEvent'\n\nexport const useEntityBeforePersist = (listener: EntityAccessor.EntityEventListenerMap['beforePersist']) => {\n\tuseEntityEvent('beforePersist', listener)\n}\n"],"names":[],"mappings":";AAGa,MAAA,yBAAyB,CAAC,aAAqE;AAC3G,iBAAe,iBAAiB,QAAQ;AACzC;;"}
1
+ {"version":3,"file":"useEntityBeforePersist.js","sources":["../../../src/entityEvents/useEntityBeforePersist.ts"],"sourcesContent":["import type { EntityAccessor } from '../accessors'\nimport { useEntityEvent } from './useEntityEvent'\n\nexport const useEntityBeforePersist = (listener: EntityAccessor.EntityEventListenerMap['beforePersist']) => {\n\tuseEntityEvent('beforePersist', listener)\n}\n"],"names":[],"mappings":";AAGa,MAAA,yBAAyB,CAAC,aAAqE;AAC3G,iBAAe,iBAAiB,QAAQ;AACzC;"}
@@ -2,5 +2,7 @@ import { useEntityEvent } from "./useEntityEvent.js";
2
2
  const useEntityBeforeUpdate = (listener) => {
3
3
  useEntityEvent("beforeUpdate", listener);
4
4
  };
5
- export { useEntityBeforeUpdate };
5
+ export {
6
+ useEntityBeforeUpdate
7
+ };
6
8
  //# sourceMappingURL=useEntityBeforeUpdate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityBeforeUpdate.js","sources":["../../../src/entityEvents/useEntityBeforeUpdate.ts"],"sourcesContent":["import type { EntityAccessor } from '../accessors'\nimport { useEntityEvent } from './useEntityEvent'\n\nexport const useEntityBeforeUpdate = (listener: EntityAccessor.EntityEventListenerMap['beforeUpdate']) => {\n\tuseEntityEvent('beforeUpdate', listener)\n}\n"],"names":[],"mappings":";AAGa,MAAA,wBAAwB,CAAC,aAAoE;AACzG,iBAAe,gBAAgB,QAAQ;AACxC;;"}
1
+ {"version":3,"file":"useEntityBeforeUpdate.js","sources":["../../../src/entityEvents/useEntityBeforeUpdate.ts"],"sourcesContent":["import type { EntityAccessor } from '../accessors'\nimport { useEntityEvent } from './useEntityEvent'\n\nexport const useEntityBeforeUpdate = (listener: EntityAccessor.EntityEventListenerMap['beforeUpdate']) => {\n\tuseEntityEvent('beforeUpdate', listener)\n}\n"],"names":[],"mappings":";AAGa,MAAA,wBAAwB,CAAC,aAAoE;AACzG,iBAAe,gBAAgB,QAAQ;AACxC;"}
@@ -9,16 +9,24 @@ function useEntityEvent(type, ...args) {
9
9
  useEffect(() => {
10
10
  const entityAccessor = stableGetEntityReference();
11
11
  if (type === "connectionUpdate") {
12
- return entityAccessor.addEventListener({
13
- type,
14
- key: args[0]
15
- }, args[1]);
12
+ return entityAccessor.addEventListener(
13
+ {
14
+ type,
15
+ key: args[0]
16
+ },
17
+ args[1]
18
+ );
16
19
  } else {
17
- return entityAccessor.addEventListener({
18
- type
19
- }, args[0]);
20
+ return entityAccessor.addEventListener(
21
+ {
22
+ type
23
+ },
24
+ args[0]
25
+ );
20
26
  }
21
27
  }, [...args, stableGetEntityReference]);
22
28
  }
23
- export { useEntityEvent };
29
+ export {
30
+ useEntityEvent
31
+ };
24
32
  //# sourceMappingURL=useEntityEvent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityEvent.js","sources":["../../../src/entityEvents/useEntityEvent.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { useEntityKey, useGetEntityByKey } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport type { FieldName } from '../treeParameters'\n\nexport function useEntityEvent(\n\ttype: 'beforePersist',\n\tlistener: EntityAccessor.EntityEventListenerMap['beforePersist'],\n): void\nexport function useEntityEvent(\n\ttype: 'beforeUpdate',\n\tlistener: EntityAccessor.EntityEventListenerMap['beforeUpdate'],\n): void\nexport function useEntityEvent(\n\ttype: 'connectionUpdate',\n\thasOneField: FieldName,\n\tlistener: EntityAccessor.EntityEventListenerMap['connectionUpdate'],\n): void\nexport function useEntityEvent(\n\ttype: 'persistError',\n\tlistener: EntityAccessor.EntityEventListenerMap['persistError'],\n): void\nexport function useEntityEvent(\n\ttype: 'persistSuccess',\n\tlistener: EntityAccessor.EntityEventListenerMap['persistSuccess'],\n): void\nexport function useEntityEvent(type: 'update', listener: EntityAccessor.EntityEventListenerMap['update']): void\nexport function useEntityEvent(type: keyof EntityAccessor.RuntimeEntityEventListenerMap, ...args: unknown[]): void {\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst potentiallyStaleParent = getEntityByKey(entityKey)\n\n\t// The identity of this function is guaranteed to be stable\n\tconst stableGetEntityReference = potentiallyStaleParent.getAccessor\n\n\tuseEffect(() => {\n\t\t// addEventListener returns an unsubscribe function, which we're deliberately re-returning from here.\n\t\tconst entityAccessor = stableGetEntityReference()\n\t\tif (type === 'connectionUpdate') {\n\t\t\treturn entityAccessor.addEventListener(\n\t\t\t\t{\n\t\t\t\t\ttype,\n\t\t\t\t\tkey: args[0] as string,\n\t\t\t\t},\n\t\t\t\targs[1] as any,\n\t\t\t)\n\t\t} else {\n\t\t\treturn entityAccessor.addEventListener(\n\t\t\t\t{\n\t\t\t\t\ttype,\n\t\t\t\t},\n\t\t\t\targs[0] as any,\n\t\t\t)\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [...args, stableGetEntityReference])\n}\n"],"names":[],"mappings":";;;AA2BO,wBAAwB,SAA6D,MAAuB;AAClH,QAAM,YAAY;AAClB,QAAM,iBAAiB;AACjB,QAAA,yBAAyB,eAAe,SAAS;AAGvD,QAAM,2BAA2B,uBAAuB;AAExD,YAAU,MAAM;AAEf,UAAM,iBAAiB;AACvB,QAAI,SAAS,oBAAoB;AAChC,aAAO,eAAe,iBACrB;AAAA,QACC;AAAA,QACA,KAAK,KAAK;AAAA,MAAA,GAEX,KAAK,EACN;AAAA,IAAA,OACM;AACN,aAAO,eAAe,iBACrB;AAAA,QACC;AAAA,MAAA,GAED,KAAK,EACN;AAAA,IACD;AAAA,EAEE,GAAA,CAAC,GAAG,MAAM,wBAAwB,CAAC;AACvC;;"}
1
+ {"version":3,"file":"useEntityEvent.js","sources":["../../../src/entityEvents/useEntityEvent.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { useEntityKey, useGetEntityByKey } from '../accessorPropagation'\nimport type { EntityAccessor } from '../accessors'\nimport type { FieldName } from '../treeParameters'\n\nexport function useEntityEvent(\n\ttype: 'beforePersist',\n\tlistener: EntityAccessor.EntityEventListenerMap['beforePersist'],\n): void\nexport function useEntityEvent(\n\ttype: 'beforeUpdate',\n\tlistener: EntityAccessor.EntityEventListenerMap['beforeUpdate'],\n): void\nexport function useEntityEvent(\n\ttype: 'connectionUpdate',\n\thasOneField: FieldName,\n\tlistener: EntityAccessor.EntityEventListenerMap['connectionUpdate'],\n): void\nexport function useEntityEvent(\n\ttype: 'persistError',\n\tlistener: EntityAccessor.EntityEventListenerMap['persistError'],\n): void\nexport function useEntityEvent(\n\ttype: 'persistSuccess',\n\tlistener: EntityAccessor.EntityEventListenerMap['persistSuccess'],\n): void\nexport function useEntityEvent(type: 'update', listener: EntityAccessor.EntityEventListenerMap['update']): void\nexport function useEntityEvent(type: keyof EntityAccessor.RuntimeEntityEventListenerMap, ...args: unknown[]): void {\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst potentiallyStaleParent = getEntityByKey(entityKey)\n\n\t// The identity of this function is guaranteed to be stable\n\tconst stableGetEntityReference = potentiallyStaleParent.getAccessor\n\n\tuseEffect(() => {\n\t\t// addEventListener returns an unsubscribe function, which we're deliberately re-returning from here.\n\t\tconst entityAccessor = stableGetEntityReference()\n\t\tif (type === 'connectionUpdate') {\n\t\t\treturn entityAccessor.addEventListener(\n\t\t\t\t{\n\t\t\t\t\ttype,\n\t\t\t\t\tkey: args[0] as string,\n\t\t\t\t},\n\t\t\t\targs[1] as any,\n\t\t\t)\n\t\t} else {\n\t\t\treturn entityAccessor.addEventListener(\n\t\t\t\t{\n\t\t\t\t\ttype,\n\t\t\t\t},\n\t\t\t\targs[0] as any,\n\t\t\t)\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [...args, stableGetEntityReference])\n}\n"],"names":[],"mappings":";;;AA2BgB,SAAA,eAAe,SAA6D,MAAuB;AAClH,QAAM,YAAY;AAClB,QAAM,iBAAiB;AACjB,QAAA,yBAAyB,eAAe,SAAS;AAGvD,QAAM,2BAA2B,uBAAuB;AAExD,YAAU,MAAM;AAEf,UAAM,iBAAiB;AACvB,QAAI,SAAS,oBAAoB;AAChC,aAAO,eAAe;AAAA,QACrB;AAAA,UACC;AAAA,UACA,KAAK,KAAK;AAAA,QACX;AAAA,QACA,KAAK;AAAA,MAAA;AAAA,IACN,OACM;AACN,aAAO,eAAe;AAAA,QACrB;AAAA,UACC;AAAA,QACD;AAAA,QACA,KAAK;AAAA,MAAA;AAAA,IAEP;AAAA,EAEE,GAAA,CAAC,GAAG,MAAM,wBAAwB,CAAC;AACvC;"}
@@ -2,5 +2,7 @@ import { useEntityEvent } from "./useEntityEvent.js";
2
2
  const useEntityPersistError = (listener) => {
3
3
  useEntityEvent("persistError", listener);
4
4
  };
5
- export { useEntityPersistError };
5
+ export {
6
+ useEntityPersistError
7
+ };
6
8
  //# sourceMappingURL=useEntityPersistError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityPersistError.js","sources":["../../../src/entityEvents/useEntityPersistError.ts"],"sourcesContent":["import type { EntityAccessor } from '../accessors'\nimport { useEntityEvent } from './useEntityEvent'\n\nexport const useEntityPersistError = (listener: EntityAccessor.EntityEventListenerMap['persistError']) => {\n\tuseEntityEvent('persistError', listener)\n}\n"],"names":[],"mappings":";AAGa,MAAA,wBAAwB,CAAC,aAAoE;AACzG,iBAAe,gBAAgB,QAAQ;AACxC;;"}
1
+ {"version":3,"file":"useEntityPersistError.js","sources":["../../../src/entityEvents/useEntityPersistError.ts"],"sourcesContent":["import type { EntityAccessor } from '../accessors'\nimport { useEntityEvent } from './useEntityEvent'\n\nexport const useEntityPersistError = (listener: EntityAccessor.EntityEventListenerMap['persistError']) => {\n\tuseEntityEvent('persistError', listener)\n}\n"],"names":[],"mappings":";AAGa,MAAA,wBAAwB,CAAC,aAAoE;AACzG,iBAAe,gBAAgB,QAAQ;AACxC;"}