@contember/binding 1.0.0-rc.22 → 1.0.0-rc.25

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 (456) hide show
  1. package/dist/development/BindingError.js +0 -1
  2. package/dist/development/BindingError.js.map +1 -1
  3. package/dist/development/accessorPropagation/AccessorProvider.js +3 -5
  4. package/dist/development/accessorPropagation/AccessorProvider.js.map +1 -1
  5. package/dist/development/accessorPropagation/BindingOperationsContext.js +2 -4
  6. package/dist/development/accessorPropagation/BindingOperationsContext.js.map +1 -1
  7. package/dist/development/accessorPropagation/BindingOperationsProvider.js +2 -4
  8. package/dist/development/accessorPropagation/BindingOperationsProvider.js.map +1 -1
  9. package/dist/development/accessorPropagation/EntityKeyContext.js +1 -3
  10. package/dist/development/accessorPropagation/EntityKeyContext.js.map +1 -1
  11. package/dist/development/accessorPropagation/EntityKeyProvider.js +2 -4
  12. package/dist/development/accessorPropagation/EntityKeyProvider.js.map +1 -1
  13. package/dist/development/accessorPropagation/EnvironmentContext.js +2 -4
  14. package/dist/development/accessorPropagation/EnvironmentContext.js.map +1 -1
  15. package/dist/development/accessorPropagation/TreeRootIdContext.js +1 -3
  16. package/dist/development/accessorPropagation/TreeRootIdContext.js.map +1 -1
  17. package/dist/development/accessorPropagation/TreeRootIdProvider.js +2 -4
  18. package/dist/development/accessorPropagation/TreeRootIdProvider.js.map +1 -1
  19. package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js +2 -4
  20. package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
  21. package/dist/development/accessorPropagation/useBindingOperations.js +2 -4
  22. package/dist/development/accessorPropagation/useBindingOperations.js.map +1 -1
  23. package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js +3 -5
  24. package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
  25. package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js +3 -5
  26. package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
  27. package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js +3 -5
  28. package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
  29. package/dist/development/accessorPropagation/useEntity.js +7 -9
  30. package/dist/development/accessorPropagation/useEntity.js.map +1 -1
  31. package/dist/development/accessorPropagation/useEntityKey.js +3 -5
  32. package/dist/development/accessorPropagation/useEntityKey.js.map +1 -1
  33. package/dist/development/accessorPropagation/useEntityList.js +7 -9
  34. package/dist/development/accessorPropagation/useEntityList.js.map +1 -1
  35. package/dist/development/accessorPropagation/useEntityListSubTree.js +4 -6
  36. package/dist/development/accessorPropagation/useEntityListSubTree.js.map +1 -1
  37. package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js +2 -4
  38. package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
  39. package/dist/development/accessorPropagation/useEntitySubTree.js +4 -6
  40. package/dist/development/accessorPropagation/useEntitySubTree.js.map +1 -1
  41. package/dist/development/accessorPropagation/useEntitySubTreeParameters.js +2 -4
  42. package/dist/development/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
  43. package/dist/development/accessorPropagation/useEnvironment.js +2 -4
  44. package/dist/development/accessorPropagation/useEnvironment.js.map +1 -1
  45. package/dist/development/accessorPropagation/useField.js +7 -9
  46. package/dist/development/accessorPropagation/useField.js.map +1 -1
  47. package/dist/development/accessorPropagation/useGetEntityByKey.js +1 -3
  48. package/dist/development/accessorPropagation/useGetEntityByKey.js.map +1 -1
  49. package/dist/development/accessorPropagation/useGetEntityListSubTree.js +4 -6
  50. package/dist/development/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
  51. package/dist/development/accessorPropagation/useGetEntitySubTree.js +4 -6
  52. package/dist/development/accessorPropagation/useGetEntitySubTree.js.map +1 -1
  53. package/dist/development/accessorPropagation/useGetTreeFilters.js +1 -3
  54. package/dist/development/accessorPropagation/useGetTreeFilters.js.map +1 -1
  55. package/dist/development/accessorPropagation/useHasEntity.js +2 -4
  56. package/dist/development/accessorPropagation/useHasEntity.js.map +1 -1
  57. package/dist/development/accessorPropagation/usePersist.js +1 -3
  58. package/dist/development/accessorPropagation/usePersist.js.map +1 -1
  59. package/dist/development/accessorPropagation/useTreeRootId.js +2 -4
  60. package/dist/development/accessorPropagation/useTreeRootId.js.map +1 -1
  61. package/dist/development/accessorSorting/SetOrderFieldOnCreate.js +9 -11
  62. package/dist/development/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
  63. package/dist/development/accessorSorting/addEntityAtIndex.js +2 -4
  64. package/dist/development/accessorSorting/addEntityAtIndex.js.map +1 -1
  65. package/dist/development/accessorSorting/errors.js +1 -3
  66. package/dist/development/accessorSorting/errors.js.map +1 -1
  67. package/dist/development/accessorSorting/moveEntity.js +1 -3
  68. package/dist/development/accessorSorting/moveEntity.js.map +1 -1
  69. package/dist/development/accessorSorting/repairEntitiesOrder.js +0 -1
  70. package/dist/development/accessorSorting/repairEntitiesOrder.js.map +1 -1
  71. package/dist/development/accessorSorting/sortEntities.js +0 -1
  72. package/dist/development/accessorSorting/sortEntities.js.map +1 -1
  73. package/dist/development/accessorSorting/useSortedEntities.js +6 -8
  74. package/dist/development/accessorSorting/useSortedEntities.js.map +1 -1
  75. package/dist/development/accessorTree/AccessorTree.js +4 -6
  76. package/dist/development/accessorTree/AccessorTree.js.map +1 -1
  77. package/dist/development/accessorTree/DirtinessContext.js +1 -3
  78. package/dist/development/accessorTree/DirtinessContext.js.map +1 -1
  79. package/dist/development/accessorTree/MutationStateContext.js +1 -3
  80. package/dist/development/accessorTree/MutationStateContext.js.map +1 -1
  81. package/dist/development/accessorTree/NormalizedPersistedData.js +0 -1
  82. package/dist/development/accessorTree/NormalizedPersistedData.js.map +1 -1
  83. package/dist/development/accessorTree/RuntimeId.js +22 -17
  84. package/dist/development/accessorTree/RuntimeId.js.map +1 -1
  85. package/dist/development/accessorTree/accessorTreeStateReducer.js +0 -1
  86. package/dist/development/accessorTree/accessorTreeStateReducer.js.map +1 -1
  87. package/dist/development/accessorTree/metadataToRequestError.js +0 -1
  88. package/dist/development/accessorTree/metadataToRequestError.js.map +1 -1
  89. package/dist/development/accessorTree/useDataBinding.js +5 -7
  90. package/dist/development/accessorTree/useDataBinding.js.map +1 -1
  91. package/dist/development/accessorTree/useDirtinessState.js +2 -4
  92. package/dist/development/accessorTree/useDirtinessState.js.map +1 -1
  93. package/dist/development/accessorTree/useMutationState.js +2 -4
  94. package/dist/development/accessorTree/useMutationState.js.map +1 -1
  95. package/dist/development/accessors/EntityAccessor.js +5 -7
  96. package/dist/development/accessors/EntityAccessor.js.map +1 -1
  97. package/dist/development/accessors/EntityListAccessor.js +1 -3
  98. package/dist/development/accessors/EntityListAccessor.js.map +1 -1
  99. package/dist/development/accessors/ErrorAccessor.js +0 -1
  100. package/dist/development/accessors/ErrorAccessor.js.map +1 -1
  101. package/dist/development/accessors/FieldAccessor.js +3 -5
  102. package/dist/development/accessors/FieldAccessor.js.map +1 -1
  103. package/dist/development/accessors/TreeRootAccessor.js +0 -1
  104. package/dist/development/accessors/TreeRootAccessor.js.map +1 -1
  105. package/dist/development/bindingTypes.js +0 -1
  106. package/dist/development/bindingTypes.js.map +1 -1
  107. package/dist/development/core/AccessorErrorManager.js +15 -11
  108. package/dist/development/core/AccessorErrorManager.js.map +1 -1
  109. package/dist/development/core/Config.js +18 -12
  110. package/dist/development/core/Config.js.map +1 -1
  111. package/dist/development/core/DataBinding.js +53 -48
  112. package/dist/development/core/DataBinding.js.map +1 -1
  113. package/dist/development/core/DirtinessTracker.js +10 -3
  114. package/dist/development/core/DirtinessTracker.js.map +1 -1
  115. package/dist/development/core/ErrorsPreprocessor.js +3 -5
  116. package/dist/development/core/ErrorsPreprocessor.js.map +1 -1
  117. package/dist/development/core/EventManager.js +20 -16
  118. package/dist/development/core/EventManager.js.map +1 -1
  119. package/dist/development/core/IncrementalMarkerBuilder.js +14 -8
  120. package/dist/development/core/IncrementalMarkerBuilder.js.map +1 -1
  121. package/dist/development/core/MarkerComparator.js +6 -8
  122. package/dist/development/core/MarkerComparator.js.map +1 -1
  123. package/dist/development/core/MarkerMerger.js +17 -15
  124. package/dist/development/core/MarkerMerger.js.map +1 -1
  125. package/dist/development/core/MarkerTreeGenerator.js +18 -13
  126. package/dist/development/core/MarkerTreeGenerator.js.map +1 -1
  127. package/dist/development/core/MutationGenerator.js +13 -15
  128. package/dist/development/core/MutationGenerator.js.map +1 -1
  129. package/dist/development/core/QueryGenerator.js +9 -11
  130. package/dist/development/core/QueryGenerator.js.map +1 -1
  131. package/dist/development/core/RealmKeyGenerator.js +10 -6
  132. package/dist/development/core/RealmKeyGenerator.js.map +1 -1
  133. package/dist/development/core/RequestResponseNormalizer.js +7 -9
  134. package/dist/development/core/RequestResponseNormalizer.js.map +1 -1
  135. package/dist/development/core/StateInitializer.js +27 -23
  136. package/dist/development/core/StateInitializer.js.map +1 -1
  137. package/dist/development/core/TreeAugmenter.js +6 -8
  138. package/dist/development/core/TreeAugmenter.js.map +1 -1
  139. package/dist/development/core/TreeFilterGenerator.js +8 -8
  140. package/dist/development/core/TreeFilterGenerator.js.map +1 -1
  141. package/dist/development/core/TreeParameterMerger.js +2 -4
  142. package/dist/development/core/TreeParameterMerger.js.map +1 -1
  143. package/dist/development/core/TreeStore.js +19 -15
  144. package/dist/development/core/TreeStore.js.map +1 -1
  145. package/dist/development/core/VariableInputTransformer.js +2 -4
  146. package/dist/development/core/VariableInputTransformer.js.map +1 -1
  147. package/dist/development/core/exceptions/ErrorLocator.js +10 -6
  148. package/dist/development/core/exceptions/ErrorLocator.js.map +1 -1
  149. package/dist/development/core/exceptions/LocalizedBindingError.js +1 -3
  150. package/dist/development/core/exceptions/LocalizedBindingError.js.map +1 -1
  151. package/dist/development/core/exceptions/MarkerSugarer.js +7 -9
  152. package/dist/development/core/exceptions/MarkerSugarer.js.map +1 -1
  153. package/dist/development/core/exceptions/TreeParameterSugarer.js +0 -1
  154. package/dist/development/core/exceptions/TreeParameterSugarer.js.map +1 -1
  155. package/dist/development/core/factories/createBatchUpdatesOptions.js +1 -3
  156. package/dist/development/core/factories/createBatchUpdatesOptions.js.map +1 -1
  157. package/dist/development/core/operations/EntityOperations.js +13 -14
  158. package/dist/development/core/operations/EntityOperations.js.map +1 -1
  159. package/dist/development/core/operations/FieldOperations.js +10 -12
  160. package/dist/development/core/operations/FieldOperations.js.map +1 -1
  161. package/dist/development/core/operations/ListOperations.js +12 -14
  162. package/dist/development/core/operations/ListOperations.js.map +1 -1
  163. package/dist/development/core/operations/OperationsHelpers.js +4 -6
  164. package/dist/development/core/operations/OperationsHelpers.js.map +1 -1
  165. package/dist/development/core/requestAliases/MutationAlias.js +2 -4
  166. package/dist/development/core/requestAliases/MutationAlias.js.map +1 -1
  167. package/dist/development/core/requestAliases/mutationOperationSubTreeType.js +0 -1
  168. package/dist/development/core/requestAliases/mutationOperationSubTreeType.js.map +1 -1
  169. package/dist/development/core/requestAliases/mutationOperationType.js +0 -1
  170. package/dist/development/core/requestAliases/mutationOperationType.js.map +1 -1
  171. package/dist/development/core/schema/Schema.js +0 -1
  172. package/dist/development/core/schema/Schema.js.map +1 -1
  173. package/dist/development/core/schema/SchemaLoader.js +9 -5
  174. package/dist/development/core/schema/SchemaLoader.js.map +1 -1
  175. package/dist/development/core/schema/SchemaPreprocessor.js +0 -1
  176. package/dist/development/core/schema/SchemaPreprocessor.js.map +1 -1
  177. package/dist/development/core/schema/SchemaValidator.js +9 -11
  178. package/dist/development/core/schema/SchemaValidator.js.map +1 -1
  179. package/dist/development/core/state/StateIterator.js +2 -4
  180. package/dist/development/core/state/StateIterator.js.map +1 -1
  181. package/dist/development/core/state/getEntityMarker.js +0 -1
  182. package/dist/development/core/state/getEntityMarker.js.map +1 -1
  183. package/dist/development/core/utils/getCombinedSignal.js +0 -1
  184. package/dist/development/core/utils/getCombinedSignal.js.map +1 -1
  185. package/dist/development/coreComponents/Component.js +2 -4
  186. package/dist/development/coreComponents/Component.js.map +1 -1
  187. package/dist/development/coreComponents/DataBindingProvider.js +3 -5
  188. package/dist/development/coreComponents/DataBindingProvider.js.map +1 -1
  189. package/dist/development/coreComponents/Entity.js +3 -5
  190. package/dist/development/coreComponents/Entity.js.map +1 -1
  191. package/dist/development/coreComponents/EntityList.js +3 -5
  192. package/dist/development/coreComponents/EntityList.js.map +1 -1
  193. package/dist/development/coreComponents/EntityListSubTree.js +12 -14
  194. package/dist/development/coreComponents/EntityListSubTree.js.map +1 -1
  195. package/dist/development/coreComponents/EntitySubTree.js +14 -16
  196. package/dist/development/coreComponents/EntitySubTree.js.map +1 -1
  197. package/dist/development/coreComponents/Field.js +5 -7
  198. package/dist/development/coreComponents/Field.js.map +1 -1
  199. package/dist/development/coreComponents/HasMany.js +8 -10
  200. package/dist/development/coreComponents/HasMany.js.map +1 -1
  201. package/dist/development/coreComponents/HasOne.js +8 -10
  202. package/dist/development/coreComponents/HasOne.js.map +1 -1
  203. package/dist/development/coreComponents/ParentEntity.js +3 -5
  204. package/dist/development/coreComponents/ParentEntity.js.map +1 -1
  205. package/dist/development/dao/Environment.js +7 -2
  206. package/dist/development/dao/Environment.js.map +1 -1
  207. package/dist/development/dao/VariableFieldValue.js +0 -1
  208. package/dist/development/dao/VariableFieldValue.js.map +1 -1
  209. package/dist/development/entityEvents/useDerivedField.js +4 -6
  210. package/dist/development/entityEvents/useDerivedField.js.map +1 -1
  211. package/dist/development/entityEvents/useEntityBeforePersist.js +1 -3
  212. package/dist/development/entityEvents/useEntityBeforePersist.js.map +1 -1
  213. package/dist/development/entityEvents/useEntityBeforeUpdate.js +1 -3
  214. package/dist/development/entityEvents/useEntityBeforeUpdate.js.map +1 -1
  215. package/dist/development/entityEvents/useEntityEvent.js +3 -5
  216. package/dist/development/entityEvents/useEntityEvent.js.map +1 -1
  217. package/dist/development/entityEvents/useEntityPersistError.js +1 -3
  218. package/dist/development/entityEvents/useEntityPersistError.js.map +1 -1
  219. package/dist/development/entityEvents/useEntityPersistSuccess.js +1 -3
  220. package/dist/development/entityEvents/useEntityPersistSuccess.js.map +1 -1
  221. package/dist/development/entityEvents/useOnConnectionUpdate.js +1 -3
  222. package/dist/development/entityEvents/useOnConnectionUpdate.js.map +1 -1
  223. package/dist/development/fieldHelpers/helpers/FieldHelper.js +8 -4
  224. package/dist/development/fieldHelpers/helpers/FieldHelper.js.map +1 -1
  225. package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.js +1 -3
  226. package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -1
  227. package/dist/development/fieldHelpers/helpers/UuidFieldHelper.js +2 -4
  228. package/dist/development/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
  229. package/dist/development/helperComponents/DeferredSubTrees.js +9 -11
  230. package/dist/development/helperComponents/DeferredSubTrees.js.map +1 -1
  231. package/dist/development/helperComponents/EntityView.js +2 -4
  232. package/dist/development/helperComponents/EntityView.js.map +1 -1
  233. package/dist/development/helperComponents/FieldView.js +7 -9
  234. package/dist/development/helperComponents/FieldView.js.map +1 -1
  235. package/dist/development/helperComponents/StaticRender.js +2 -4
  236. package/dist/development/helperComponents/StaticRender.js.map +1 -1
  237. package/dist/development/helperComponents/SugaredField.js +3 -5
  238. package/dist/development/helperComponents/SugaredField.js.map +1 -1
  239. package/dist/development/index.js +101 -101
  240. package/dist/development/index.js.map +1 -1
  241. package/dist/development/markers/EntityFieldMarkersContainer.js +5 -7
  242. package/dist/development/markers/EntityFieldMarkersContainer.js.map +1 -1
  243. package/dist/development/markers/EntityFieldsWithHoistablesMarker.js +0 -1
  244. package/dist/development/markers/EntityFieldsWithHoistablesMarker.js.map +1 -1
  245. package/dist/development/markers/EntityListSubTreeMarker.js +8 -4
  246. package/dist/development/markers/EntityListSubTreeMarker.js.map +1 -1
  247. package/dist/development/markers/EntitySubTreeMarker.js +8 -4
  248. package/dist/development/markers/EntitySubTreeMarker.js.map +1 -1
  249. package/dist/development/markers/FieldMarker.js +8 -4
  250. package/dist/development/markers/FieldMarker.js.map +1 -1
  251. package/dist/development/markers/HasManyRelationMarker.js +9 -5
  252. package/dist/development/markers/HasManyRelationMarker.js.map +1 -1
  253. package/dist/development/markers/HasOneRelationMarker.js +8 -4
  254. package/dist/development/markers/HasOneRelationMarker.js.map +1 -1
  255. package/dist/development/markers/MarkerTreeRoot.js +0 -1
  256. package/dist/development/markers/MarkerTreeRoot.js.map +1 -1
  257. package/dist/development/markers/ParentEntityMarker.js +0 -1
  258. package/dist/development/markers/ParentEntityMarker.js.map +1 -1
  259. package/dist/development/markers/PlaceholderGenerator.js +1 -3
  260. package/dist/development/markers/PlaceholderGenerator.js.map +1 -1
  261. package/dist/development/queryLanguage/CacheStore.js +10 -4
  262. package/dist/development/queryLanguage/CacheStore.js.map +1 -1
  263. package/dist/development/queryLanguage/MarkerFactory.js +11 -13
  264. package/dist/development/queryLanguage/MarkerFactory.js.map +1 -1
  265. package/dist/development/queryLanguage/Parser.js +561 -556
  266. package/dist/development/queryLanguage/Parser.js.map +1 -1
  267. package/dist/development/queryLanguage/QueryLanguage.js +32 -27
  268. package/dist/development/queryLanguage/QueryLanguage.js.map +1 -1
  269. package/dist/development/queryLanguage/QueryLanguageError.js +0 -1
  270. package/dist/development/queryLanguage/QueryLanguageError.js.map +1 -1
  271. package/dist/development/queryLanguage/tokenList.js +1 -3
  272. package/dist/development/queryLanguage/tokenList.js.map +1 -1
  273. package/dist/development/structures/BijectiveIndexedMap.js +14 -9
  274. package/dist/development/structures/BijectiveIndexedMap.js.map +1 -1
  275. package/dist/development/structures/LRUCache.js +7 -2
  276. package/dist/development/structures/LRUCache.js.map +1 -1
  277. package/dist/development/structures/WeakIdCache.js +11 -4
  278. package/dist/development/structures/WeakIdCache.js.map +1 -1
  279. package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.js +1 -3
  280. package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.js.map +1 -1
  281. package/dist/development/treeParameters/EntityCreationParameters.js +0 -1
  282. package/dist/development/treeParameters/EntityCreationParameters.js.map +1 -1
  283. package/dist/development/treeParameters/EntityListPreferences.js +0 -1
  284. package/dist/development/treeParameters/EntityListPreferences.js.map +1 -1
  285. package/dist/development/treeParameters/EventListenersStore.js +0 -1
  286. package/dist/development/treeParameters/EventListenersStore.js.map +1 -1
  287. package/dist/development/treeParameters/LeafField.js +0 -1
  288. package/dist/development/treeParameters/LeafField.js.map +1 -1
  289. package/dist/development/treeParameters/QualifiedEntityParameters.js +0 -1
  290. package/dist/development/treeParameters/QualifiedEntityParameters.js.map +1 -1
  291. package/dist/development/treeParameters/Relation.js +0 -1
  292. package/dist/development/treeParameters/Relation.js.map +1 -1
  293. package/dist/development/utils/Hashing.js +0 -1
  294. package/dist/development/utils/Hashing.js.map +1 -1
  295. package/dist/development/utils/assert.js +1 -3
  296. package/dist/development/utils/assert.js.map +1 -1
  297. package/dist/development/utils/assertNever.js +1 -3
  298. package/dist/development/utils/assertNever.js.map +1 -1
  299. package/dist/development/utils/generateEnumerabilityPreventingEntropy.js +0 -1
  300. package/dist/development/utils/generateEnumerabilityPreventingEntropy.js.map +1 -1
  301. package/dist/development/utils/isEmptyObject.js +0 -1
  302. package/dist/development/utils/isEmptyObject.js.map +1 -1
  303. package/dist/development/utils/ucfirst.js +0 -1
  304. package/dist/development/utils/ucfirst.js.map +1 -1
  305. package/dist/production/BindingError.js.map +1 -1
  306. package/dist/production/accessorPropagation/AccessorProvider.js.map +1 -1
  307. package/dist/production/accessorPropagation/BindingOperationsContext.js.map +1 -1
  308. package/dist/production/accessorPropagation/BindingOperationsProvider.js.map +1 -1
  309. package/dist/production/accessorPropagation/EntityKeyContext.js.map +1 -1
  310. package/dist/production/accessorPropagation/EntityKeyProvider.js.map +1 -1
  311. package/dist/production/accessorPropagation/EnvironmentContext.js.map +1 -1
  312. package/dist/production/accessorPropagation/TreeRootIdContext.js.map +1 -1
  313. package/dist/production/accessorPropagation/TreeRootIdProvider.js.map +1 -1
  314. package/dist/production/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
  315. package/dist/production/accessorPropagation/useBindingOperations.js.map +1 -1
  316. package/dist/production/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
  317. package/dist/production/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
  318. package/dist/production/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
  319. package/dist/production/accessorPropagation/useEntity.js.map +1 -1
  320. package/dist/production/accessorPropagation/useEntityKey.js.map +1 -1
  321. package/dist/production/accessorPropagation/useEntityList.js.map +1 -1
  322. package/dist/production/accessorPropagation/useEntityListSubTree.js.map +1 -1
  323. package/dist/production/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
  324. package/dist/production/accessorPropagation/useEntitySubTree.js.map +1 -1
  325. package/dist/production/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
  326. package/dist/production/accessorPropagation/useEnvironment.js.map +1 -1
  327. package/dist/production/accessorPropagation/useField.js.map +1 -1
  328. package/dist/production/accessorPropagation/useGetEntityByKey.js.map +1 -1
  329. package/dist/production/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
  330. package/dist/production/accessorPropagation/useGetEntitySubTree.js.map +1 -1
  331. package/dist/production/accessorPropagation/useGetTreeFilters.js.map +1 -1
  332. package/dist/production/accessorPropagation/useHasEntity.js.map +1 -1
  333. package/dist/production/accessorPropagation/usePersist.js.map +1 -1
  334. package/dist/production/accessorPropagation/useTreeRootId.js.map +1 -1
  335. package/dist/production/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
  336. package/dist/production/accessorSorting/addEntityAtIndex.js.map +1 -1
  337. package/dist/production/accessorSorting/errors.js.map +1 -1
  338. package/dist/production/accessorSorting/moveEntity.js.map +1 -1
  339. package/dist/production/accessorSorting/repairEntitiesOrder.js.map +1 -1
  340. package/dist/production/accessorSorting/sortEntities.js.map +1 -1
  341. package/dist/production/accessorSorting/useSortedEntities.js.map +1 -1
  342. package/dist/production/accessorTree/AccessorTree.js.map +1 -1
  343. package/dist/production/accessorTree/DirtinessContext.js.map +1 -1
  344. package/dist/production/accessorTree/MutationStateContext.js.map +1 -1
  345. package/dist/production/accessorTree/NormalizedPersistedData.js.map +1 -1
  346. package/dist/production/accessorTree/RuntimeId.js.map +1 -1
  347. package/dist/production/accessorTree/accessorTreeStateReducer.js.map +1 -1
  348. package/dist/production/accessorTree/metadataToRequestError.js.map +1 -1
  349. package/dist/production/accessorTree/useDataBinding.js.map +1 -1
  350. package/dist/production/accessorTree/useDirtinessState.js.map +1 -1
  351. package/dist/production/accessorTree/useMutationState.js.map +1 -1
  352. package/dist/production/accessors/EntityAccessor.js.map +1 -1
  353. package/dist/production/accessors/EntityListAccessor.js.map +1 -1
  354. package/dist/production/accessors/ErrorAccessor.js.map +1 -1
  355. package/dist/production/accessors/FieldAccessor.js.map +1 -1
  356. package/dist/production/accessors/TreeRootAccessor.js.map +1 -1
  357. package/dist/production/bindingTypes.js.map +1 -1
  358. package/dist/production/core/AccessorErrorManager.js.map +1 -1
  359. package/dist/production/core/Config.js.map +1 -1
  360. package/dist/production/core/DataBinding.js.map +1 -1
  361. package/dist/production/core/DirtinessTracker.js.map +1 -1
  362. package/dist/production/core/ErrorsPreprocessor.js.map +1 -1
  363. package/dist/production/core/EventManager.js.map +1 -1
  364. package/dist/production/core/IncrementalMarkerBuilder.js.map +1 -1
  365. package/dist/production/core/MarkerComparator.js.map +1 -1
  366. package/dist/production/core/MarkerMerger.js.map +1 -1
  367. package/dist/production/core/MarkerTreeGenerator.js.map +1 -1
  368. package/dist/production/core/MutationGenerator.js.map +1 -1
  369. package/dist/production/core/QueryGenerator.js.map +1 -1
  370. package/dist/production/core/RealmKeyGenerator.js.map +1 -1
  371. package/dist/production/core/RequestResponseNormalizer.js.map +1 -1
  372. package/dist/production/core/StateInitializer.js.map +1 -1
  373. package/dist/production/core/TreeAugmenter.js.map +1 -1
  374. package/dist/production/core/TreeFilterGenerator.js.map +1 -1
  375. package/dist/production/core/TreeParameterMerger.js.map +1 -1
  376. package/dist/production/core/TreeStore.js.map +1 -1
  377. package/dist/production/core/VariableInputTransformer.js.map +1 -1
  378. package/dist/production/core/exceptions/ErrorLocator.js.map +1 -1
  379. package/dist/production/core/exceptions/LocalizedBindingError.js.map +1 -1
  380. package/dist/production/core/exceptions/MarkerSugarer.js.map +1 -1
  381. package/dist/production/core/exceptions/TreeParameterSugarer.js.map +1 -1
  382. package/dist/production/core/factories/createBatchUpdatesOptions.js.map +1 -1
  383. package/dist/production/core/operations/EntityOperations.js.map +1 -1
  384. package/dist/production/core/operations/FieldOperations.js.map +1 -1
  385. package/dist/production/core/operations/ListOperations.js.map +1 -1
  386. package/dist/production/core/operations/OperationsHelpers.js.map +1 -1
  387. package/dist/production/core/requestAliases/MutationAlias.js.map +1 -1
  388. package/dist/production/core/requestAliases/mutationOperationSubTreeType.js.map +1 -1
  389. package/dist/production/core/requestAliases/mutationOperationType.js.map +1 -1
  390. package/dist/production/core/schema/Schema.js.map +1 -1
  391. package/dist/production/core/schema/SchemaLoader.js.map +1 -1
  392. package/dist/production/core/schema/SchemaPreprocessor.js.map +1 -1
  393. package/dist/production/core/state/StateIterator.js.map +1 -1
  394. package/dist/production/core/state/getEntityMarker.js.map +1 -1
  395. package/dist/production/core/utils/getCombinedSignal.js.map +1 -1
  396. package/dist/production/coreComponents/Component.js.map +1 -1
  397. package/dist/production/coreComponents/DataBindingProvider.js.map +1 -1
  398. package/dist/production/coreComponents/Entity.js.map +1 -1
  399. package/dist/production/coreComponents/EntityList.js.map +1 -1
  400. package/dist/production/coreComponents/EntityListSubTree.js.map +1 -1
  401. package/dist/production/coreComponents/EntitySubTree.js.map +1 -1
  402. package/dist/production/coreComponents/Field.js.map +1 -1
  403. package/dist/production/coreComponents/HasMany.js.map +1 -1
  404. package/dist/production/coreComponents/HasOne.js.map +1 -1
  405. package/dist/production/coreComponents/ParentEntity.js.map +1 -1
  406. package/dist/production/dao/Environment.js.map +1 -1
  407. package/dist/production/dao/VariableFieldValue.js.map +1 -1
  408. package/dist/production/entityEvents/useDerivedField.js.map +1 -1
  409. package/dist/production/entityEvents/useEntityBeforePersist.js.map +1 -1
  410. package/dist/production/entityEvents/useEntityBeforeUpdate.js.map +1 -1
  411. package/dist/production/entityEvents/useEntityEvent.js.map +1 -1
  412. package/dist/production/entityEvents/useEntityPersistError.js.map +1 -1
  413. package/dist/production/entityEvents/useEntityPersistSuccess.js.map +1 -1
  414. package/dist/production/entityEvents/useOnConnectionUpdate.js.map +1 -1
  415. package/dist/production/fieldHelpers/helpers/FieldHelper.js.map +1 -1
  416. package/dist/production/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -1
  417. package/dist/production/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
  418. package/dist/production/helperComponents/DeferredSubTrees.js.map +1 -1
  419. package/dist/production/helperComponents/EntityView.js.map +1 -1
  420. package/dist/production/helperComponents/FieldView.js.map +1 -1
  421. package/dist/production/helperComponents/StaticRender.js.map +1 -1
  422. package/dist/production/helperComponents/SugaredField.js.map +1 -1
  423. package/dist/production/markers/EntityFieldMarkersContainer.js.map +1 -1
  424. package/dist/production/markers/EntityFieldsWithHoistablesMarker.js.map +1 -1
  425. package/dist/production/markers/EntityListSubTreeMarker.js.map +1 -1
  426. package/dist/production/markers/EntitySubTreeMarker.js.map +1 -1
  427. package/dist/production/markers/FieldMarker.js.map +1 -1
  428. package/dist/production/markers/HasManyRelationMarker.js.map +1 -1
  429. package/dist/production/markers/HasOneRelationMarker.js.map +1 -1
  430. package/dist/production/markers/MarkerTreeRoot.js.map +1 -1
  431. package/dist/production/markers/ParentEntityMarker.js.map +1 -1
  432. package/dist/production/markers/PlaceholderGenerator.js.map +1 -1
  433. package/dist/production/queryLanguage/CacheStore.js.map +1 -1
  434. package/dist/production/queryLanguage/MarkerFactory.js.map +1 -1
  435. package/dist/production/queryLanguage/Parser.js.map +1 -1
  436. package/dist/production/queryLanguage/QueryLanguage.js.map +1 -1
  437. package/dist/production/queryLanguage/QueryLanguageError.js.map +1 -1
  438. package/dist/production/queryLanguage/tokenList.js.map +1 -1
  439. package/dist/production/structures/BijectiveIndexedMap.js.map +1 -1
  440. package/dist/production/structures/LRUCache.js.map +1 -1
  441. package/dist/production/structures/WeakIdCache.js.map +1 -1
  442. package/dist/production/treeParameterHelpers/wrapFilterInHasOnes.js.map +1 -1
  443. package/dist/production/treeParameters/EntityCreationParameters.js.map +1 -1
  444. package/dist/production/treeParameters/EntityListPreferences.js.map +1 -1
  445. package/dist/production/treeParameters/EventListenersStore.js.map +1 -1
  446. package/dist/production/treeParameters/LeafField.js.map +1 -1
  447. package/dist/production/treeParameters/QualifiedEntityParameters.js.map +1 -1
  448. package/dist/production/treeParameters/Relation.js.map +1 -1
  449. package/dist/production/utils/Hashing.js.map +1 -1
  450. package/dist/production/utils/assert.js.map +1 -1
  451. package/dist/production/utils/assertNever.js.map +1 -1
  452. package/dist/production/utils/generateEnumerabilityPreventingEntropy.js.map +1 -1
  453. package/dist/production/utils/isEmptyObject.js.map +1 -1
  454. package/dist/production/utils/ucfirst.js.map +1 -1
  455. package/dist/types/tsconfig.tsbuildinfo +1 -1
  456. package/package.json +8 -6
@@ -1 +1 @@
1
- {"version":3,"file":"FieldOperations.js","sources":["../../../../src/core/operations/FieldOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport { ErrorAccessor, FieldAccessor } from '../../accessors'\nimport { ClientGeneratedUuid } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport { PRIMARY_KEY_NAME } from '../../bindingTypes'\nimport type { FieldValue } from '../../treeParameters'\nimport type { AccessorErrorManager } from '../AccessorErrorManager'\nimport { EventManager } from '../EventManager'\nimport { FieldState, getEntityMarker, StateIterator } from '../state'\nimport type { StateInitializer } from '../StateInitializer'\nimport type { TreeStore } from '../TreeStore'\nimport { OperationsHelpers } from './OperationsHelpers'\nimport { EventListenersStore } from '../../treeParameters'\n\nexport class FieldOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(fieldState: FieldState<any>, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(fieldState, error)\n\t}\n\n\tpublic clearErrors(fieldState: FieldState<any>): void {\n\t\treturn this.accessorErrorManager.clearErrorsByState(fieldState)\n\t}\n\n\tpublic addEventListener<\n\t\tType extends keyof FieldAccessor.FieldEventListenerMap,\n\t\tValue extends FieldValue = FieldValue,\n\t>(\n\t\tstate: FieldState<Value>,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\tif (!state.eventListeners) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic updateValue<Value extends FieldValue = FieldValue>(\n\t\tfieldState: FieldState<Value>,\n\t\tnewValue: Value | null,\n\t\t{ agent = FieldAccessor.userAgent }: FieldAccessor.UpdateOptions = {},\n\t) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst { placeholderName, parent } = fieldState\n\t\t\tif (placeholderName === PRIMARY_KEY_NAME) {\n\t\t\t\tconst entity = fieldState.parent.entity\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tif (newValue !== fieldState.value && (fieldState.touchLog !== undefined || entity.hasIdSetInStone)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field for the second time. This is prohibited.\\n` +\n\t\t\t\t\t\t\t\t`Once set, it is immutable.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof newValue !== 'string' || !uuidValidate(newValue)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Invalid value supplied for the '${PRIMARY_KEY_NAME}' field. ` +\n\t\t\t\t\t\t\t\t`Expecting a valid uuid but '${newValue}' was given.\\n` +\n\t\t\t\t\t\t\t\t`Hint: you may use 'FieldAccessor.asUuid.setToUuid()'.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (this.treeStore.entityStore.has(newValue)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field to '${newValue}' which is a valid uuid but is not unique. ` +\n\t\t\t\t\t\t\t\t`It is already in use by an existing entity.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (typeof newValue !== 'string') {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tOperationsHelpers.changeEntityId(\n\t\t\t\t\tthis.treeStore,\n\t\t\t\t\tthis.eventManager,\n\t\t\t\t\tthis.stateInitializer,\n\t\t\t\t\tentity,\n\t\t\t\t\tnew ClientGeneratedUuid(newValue),\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor (const field of StateIterator.eachSiblingRealmChild(this.treeStore, fieldState)) {\n\t\t\t\tif (newValue === field.value) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (field.touchLog === undefined) {\n\t\t\t\t\tfield.touchLog = new Set()\n\t\t\t\t}\n\t\t\t\tfield.touchLog.add(agent)\n\t\t\t\tfield.value = newValue\n\n\t\t\t\tconst resolvedValue =\n\t\t\t\t\tfield.fieldMarker.defaultValue === undefined\n\t\t\t\t\t\t? newValue\n\t\t\t\t\t\t: newValue === null\n\t\t\t\t\t\t? field.fieldMarker.defaultValue\n\t\t\t\t\t\t: newValue\n\t\t\t\tconst normalizedPersistedValue = field.persistedValue === undefined ? null : field.persistedValue\n\t\t\t\tconst hadUnpersistedChangesBefore = field.hasUnpersistedChanges\n\t\t\t\tconst hasUnpersistedChangesNow = resolvedValue !== normalizedPersistedValue\n\t\t\t\tfield.hasUnpersistedChanges = hasUnpersistedChangesNow\n\n\t\t\t\tconst shouldInfluenceUpdateCount =\n\t\t\t\t\t!getEntityMarker(parent).fields.hasAtLeastOneBearingField ||\n\t\t\t\t\t!field.fieldMarker.isNonbearing ||\n\t\t\t\t\tfield.persistedValue !== undefined\n\n\t\t\t\tlet changesDelta = EventManager.NO_CHANGES_DIFFERENCE\n\n\t\t\t\tif (shouldInfluenceUpdateCount) {\n\t\t\t\t\tif (!hadUnpersistedChangesBefore && hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta++\n\t\t\t\t\t} else if (hadUnpersistedChangesBefore && !hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta--\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(field, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n}\n"],"names":["uuidValidate"],"mappings":";;;;;;;;;;;sBAc6B;AAAA,EACrB,YACW,sBACA,cACA,kBACA,WAChB;AAJgB;AACA;AACA;AACA;AAAA;AAAA,EAGX,SAAS,YAA6B,OAAwC;AACpF,WAAO,KAAK,qBAAqB,SAAS,YAAY;AAAA;AAAA,EAGhD,YAAY,YAAmC;AACrD,WAAO,KAAK,qBAAqB,mBAAmB;AAAA;AAAA,EAG9C,iBAIN,OACA,OACA,UACa;AACb,QAAI,CAAC,MAAM,gBAAgB;AAC1B,YAAM,iBAAiB,IAAI;AAAA;AAE5B,WAAO,MAAM,eAAe,IAAI,OAAO;AAAA;AAAA,EAGjC,YACN,YACA,UACA,EAAE,QAAQ,cAAc,cAA2C,IAClE;AACD,SAAK,aAAa,cAAc,MAAM;AACrC,YAAM,EAAE,iBAAiB,WAAW;AACpC,UAAI,oBAAoB,kBAAkB;AACzC,cAAM,SAAS,WAAW,OAAO;AAEjC,QAAyB;AACxB,cAAI,aAAa,WAAW,qBAAqB,aAAa,UAAa,OAAO,kBAAkB;AACnG,kBAAM,IAAI,aACT,sBAAsB;AAAA;AAAA;AAIxB,cAAI,OAAO,aAAa,YAAY,CAACA,SAAa,WAAW;AAC5D,kBAAM,IAAI,aACT,mCAAmC,wDACH;AAAA;AAAA;AAIlC,cAAI,KAAK,UAAU,YAAY,IAAI,WAAW;AAC7C,kBAAM,IAAI,aACT,sBAAsB,+BAA+B;AAAA;AAAA;AAKxD,YAAI,OAAO,aAAa,UAAU;AACjC,gBAAM,IAAI;AAAA;AAEX,0BAAkB,eACjB,KAAK,WACL,KAAK,cACL,KAAK,kBACL,QACA,IAAI,oBAAoB;AAAA;AAG1B,iBAAW,SAAS,cAAc,sBAAsB,KAAK,WAAW,aAAa;AACpF,YAAI,aAAa,MAAM,OAAO;AAC7B;AAAA;AAED,YAAI,MAAM,aAAa,QAAW;AACjC,gBAAM,+BAAe;AAAA;AAEtB,cAAM,SAAS,IAAI;AACnB,cAAM,QAAQ;AAEd,cAAM,gBACL,MAAM,YAAY,iBAAiB,SAChC,WACA,aAAa,OACb,MAAM,YAAY,eAClB;AACJ,cAAM,2BAA2B,MAAM,mBAAmB,SAAY,OAAO,MAAM;AACnF,cAAM,8BAA8B,MAAM;AAC1C,cAAM,2BAA2B,kBAAkB;AACnD,cAAM,wBAAwB;AAE9B,cAAM,6BACL,CAAC,gBAAgB,QAAQ,OAAO,6BAChC,CAAC,MAAM,YAAY,gBACnB,MAAM,mBAAmB;AAE1B,YAAI,eAAe,aAAa;AAEhC,YAAI,4BAA4B;AAC/B,cAAI,CAAC,+BAA+B,0BAA0B;AAC7D;AAAA,qBACU,+BAA+B,CAAC,0BAA0B;AACpE;AAAA;AAAA;AAIF,aAAK,aAAa,oBAAoB,OAAO;AAAA;AAAA;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"FieldOperations.js","sources":["../../../../src/core/operations/FieldOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport { ErrorAccessor, FieldAccessor } from '../../accessors'\nimport { ClientGeneratedUuid } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport { PRIMARY_KEY_NAME } from '../../bindingTypes'\nimport type { FieldValue } from '../../treeParameters'\nimport type { AccessorErrorManager } from '../AccessorErrorManager'\nimport { EventManager } from '../EventManager'\nimport { FieldState, getEntityMarker, StateIterator } from '../state'\nimport type { StateInitializer } from '../StateInitializer'\nimport type { TreeStore } from '../TreeStore'\nimport { OperationsHelpers } from './OperationsHelpers'\nimport { EventListenersStore } from '../../treeParameters'\n\nexport class FieldOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(fieldState: FieldState<any>, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(fieldState, error)\n\t}\n\n\tpublic clearErrors(fieldState: FieldState<any>): void {\n\t\treturn this.accessorErrorManager.clearErrorsByState(fieldState)\n\t}\n\n\tpublic addEventListener<\n\t\tType extends keyof FieldAccessor.FieldEventListenerMap,\n\t\tValue extends FieldValue = FieldValue,\n\t>(\n\t\tstate: FieldState<Value>,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\tif (!state.eventListeners) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic updateValue<Value extends FieldValue = FieldValue>(\n\t\tfieldState: FieldState<Value>,\n\t\tnewValue: Value | null,\n\t\t{ agent = FieldAccessor.userAgent }: FieldAccessor.UpdateOptions = {},\n\t) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst { placeholderName, parent } = fieldState\n\t\t\tif (placeholderName === PRIMARY_KEY_NAME) {\n\t\t\t\tconst entity = fieldState.parent.entity\n\n\t\t\t\tif (import.meta.env.DEV) {\n\t\t\t\t\tif (newValue !== fieldState.value && (fieldState.touchLog !== undefined || entity.hasIdSetInStone)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field for the second time. This is prohibited.\\n` +\n\t\t\t\t\t\t\t\t`Once set, it is immutable.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (typeof newValue !== 'string' || !uuidValidate(newValue)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Invalid value supplied for the '${PRIMARY_KEY_NAME}' field. ` +\n\t\t\t\t\t\t\t\t`Expecting a valid uuid but '${newValue}' was given.\\n` +\n\t\t\t\t\t\t\t\t`Hint: you may use 'FieldAccessor.asUuid.setToUuid()'.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tif (this.treeStore.entityStore.has(newValue)) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Trying to set the '${PRIMARY_KEY_NAME}' field to '${newValue}' which is a valid uuid but is not unique. ` +\n\t\t\t\t\t\t\t\t`It is already in use by an existing entity.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (typeof newValue !== 'string') {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tOperationsHelpers.changeEntityId(\n\t\t\t\t\tthis.treeStore,\n\t\t\t\t\tthis.eventManager,\n\t\t\t\t\tthis.stateInitializer,\n\t\t\t\t\tentity,\n\t\t\t\t\tnew ClientGeneratedUuid(newValue),\n\t\t\t\t)\n\t\t\t}\n\t\t\tfor (const field of StateIterator.eachSiblingRealmChild(this.treeStore, fieldState)) {\n\t\t\t\tif (newValue === field.value) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (field.touchLog === undefined) {\n\t\t\t\t\tfield.touchLog = new Set()\n\t\t\t\t}\n\t\t\t\tfield.touchLog.add(agent)\n\t\t\t\tfield.value = newValue\n\n\t\t\t\tconst resolvedValue =\n\t\t\t\t\tfield.fieldMarker.defaultValue === undefined\n\t\t\t\t\t\t? newValue\n\t\t\t\t\t\t: newValue === null\n\t\t\t\t\t\t? field.fieldMarker.defaultValue\n\t\t\t\t\t\t: newValue\n\t\t\t\tconst normalizedPersistedValue = field.persistedValue === undefined ? null : field.persistedValue\n\t\t\t\tconst hadUnpersistedChangesBefore = field.hasUnpersistedChanges\n\t\t\t\tconst hasUnpersistedChangesNow = resolvedValue !== normalizedPersistedValue\n\t\t\t\tfield.hasUnpersistedChanges = hasUnpersistedChangesNow\n\n\t\t\t\tconst shouldInfluenceUpdateCount =\n\t\t\t\t\t!getEntityMarker(parent).fields.hasAtLeastOneBearingField ||\n\t\t\t\t\t!field.fieldMarker.isNonbearing ||\n\t\t\t\t\tfield.persistedValue !== undefined\n\n\t\t\t\tlet changesDelta = EventManager.NO_CHANGES_DIFFERENCE\n\n\t\t\t\tif (shouldInfluenceUpdateCount) {\n\t\t\t\t\tif (!hadUnpersistedChangesBefore && hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta++\n\t\t\t\t\t} else if (hadUnpersistedChangesBefore && !hasUnpersistedChangesNow) {\n\t\t\t\t\t\tchangesDelta--\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(field, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n}\n"],"names":["uuidValidate"],"mappings":";;;;;;;;;;AAcO,MAAM,gBAAgB;AAAA,EACrB,YACW,sBACA,cACA,kBACA,WAChB;AAJgB,SAAA,uBAAA;AACA,SAAA,eAAA;AACA,SAAA,mBAAA;AACA,SAAA,YAAA;AAAA,EACf;AAAA,EAEI,SAAS,YAA6B,OAAwC;AACpF,WAAO,KAAK,qBAAqB,SAAS,YAAY,KAAK;AAAA,EAC5D;AAAA,EAEO,YAAY,YAAmC;AAC9C,WAAA,KAAK,qBAAqB,mBAAmB,UAAU;AAAA,EAC/D;AAAA,EAEO,iBAIN,OACA,OACA,UACa;AACT,QAAA,CAAC,MAAM,gBAAgB;AACpB,YAAA,iBAAiB,IAAI;IAC5B;AACA,WAAO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AM,YAAY,gBACnB,MAAM,mBAAmB;AAE1B,YAAI,eAAe,aAAa;AAEhC,YAAI,4BAA4B;AAC3B,cAAA,CAAC,+BAA+B,0BAA0B;AAC7D;AAAA,UAAA,WACU,+BAA+B,CAAC,0BAA0B;AACpE;AAAA,UACD;AAAA,QACD;AAEK,aAAA,aAAa,oBAAoB,OAAO,YAAY;AAAA,MAC1D;AAAA,IAAA,CACA;AAAA,EACF;AACD;;"}
@@ -1,16 +1,15 @@
1
- import { validate } from 'uuid';
2
- import { BindingError } from '../../BindingError.js';
3
- import { EventManager } from '../EventManager.js';
4
- import { MarkerComparator } from '../MarkerComparator.js';
5
- import { RealmKeyGenerator } from '../RealmKeyGenerator.js';
6
- import { OperationsHelpers } from './OperationsHelpers.js';
7
- import { EventListenersStore } from '../../treeParameters/EventListenersStore.js';
8
- import { StateIterator } from '../state/StateIterator.js';
9
- import { ErrorLocator } from '../exceptions/ErrorLocator.js';
10
- import { getEntityMarker } from '../state/getEntityMarker.js';
11
- import { LocalizedBindingError } from '../exceptions/LocalizedBindingError.js';
12
- import { UnpersistedEntityDummyId } from '../../accessorTree/RuntimeId.js';
13
-
1
+ import { validate } from "uuid";
2
+ import { BindingError } from "../../BindingError.js";
3
+ import { EventManager } from "../EventManager.js";
4
+ import { MarkerComparator } from "../MarkerComparator.js";
5
+ import { RealmKeyGenerator } from "../RealmKeyGenerator.js";
6
+ import { OperationsHelpers } from "./OperationsHelpers.js";
7
+ import { EventListenersStore } from "../../treeParameters/EventListenersStore.js";
8
+ import { StateIterator } from "../state/StateIterator.js";
9
+ import { ErrorLocator } from "../exceptions/ErrorLocator.js";
10
+ import { getEntityMarker } from "../state/getEntityMarker.js";
11
+ import { LocalizedBindingError } from "../exceptions/LocalizedBindingError.js";
12
+ import { UnpersistedEntityDummyId } from "../../accessorTree/RuntimeId.js";
14
13
  class ListOperations {
15
14
  constructor(accessorErrorManager, batchUpdatesOptions, eventManager, stateInitializer, treeStore) {
16
15
  this.accessorErrorManager = accessorErrorManager;
@@ -143,6 +142,5 @@ The supplied value appears to be an entity *key*, not an *id*. List accessors ar
143
142
  return realm.getAccessor();
144
143
  }
145
144
  }
146
-
147
145
  export { ListOperations };
148
146
  //# sourceMappingURL=ListOperations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ListOperations.js","sources":["../../../../src/core/operations/ListOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '../../accessors'\nimport { RuntimeId, UnpersistedEntityDummyId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { AccessorErrorManager } from '../AccessorErrorManager'\nimport { EventManager } from '../EventManager'\nimport { ErrorLocator, LocalizedBindingError } from '../exceptions'\nimport { MarkerComparator } from '../MarkerComparator'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state'\nimport type { StateInitializer } from '../StateInitializer'\nimport type { TreeStore } from '../TreeStore'\nimport { OperationsHelpers } from './OperationsHelpers'\nimport { EventListenersStore } from '../../treeParameters'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.RuntimeEntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type ` +\n\t\t\t\t\t\t\t`'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n` +\n\t\t\t\t\t\t\t`Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are ` +\n\t\t\t\t\t\t\t\t`incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n` +\n\t\t\t\t\t\t\t\t`${error.message}\\n\\n` +\n\t\t\t\t\t\t\t\t(error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '') +\n\t\t\t\t\t\t\t\t`Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t}, stateToConnect)\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else {\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor, options: {noPersist?: boolean}) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Entity list doesn't include an entity with id '${disconnectedChildIdValue}' and so it cannot remove it.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tlistState.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tif (!options.noPersist) {\n\t\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t\t}\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined): RuntimeId {\n\t\treturn this.eventManager.syncOperation((): RuntimeId => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\treturn id\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: string) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = uuidValidate(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id)\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.` +\n\t\t\t\t\t(looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids ` +\n\t\t\t\t\t\t `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and ` +\n\t\t\t\t\t\t `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.getAccessor()\n\t}\n}\n"],"names":["uuidValidate"],"mappings":";;;;;;;;;;;;;qBAe4B;AAAA,EACpB,YACW,sBACA,qBACA,cACA,kBACA,WAChB;AALgB;AACA;AACA;AACA;AACA;AAAA;AAAA,EAGX,SAAS,WAA4B,OAAwC;AACnF,WAAO,KAAK,qBAAqB,SAAS,WAAW;AAAA;AAAA,EAG/C,iBACN,OACA,OACA,UACC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aAAa,oBAAoB,OAAO,aAAa;AAAA;AAE3D,aAAO;AAAA;AAAA;AAAA,EAIF,mBAAmB,OAAwB,IAAY;AAC7D,UAAM,QAAQ,MAAM,SAAS,IAAI;AACjC,QAAI,UAAU,QAAW;AACxB,YAAM,cAAcA,SAAa,OAAO,yBAAyB,eAAe;AAChF,UAAI,aAAa;AAChB,cAAM,IAAI,aAAa,kDAAkD;AAAA;AAE1E,YAAM,eAAe,KAAK,UAAU,iBAAiB,IAAI,OAAO,kBAAkB,uBAAuB;AACzG,YAAM,IAAI,aACT,kDAAkD,qDAE9C;AAAA,oQAGA;AAAA;AAGN,WAAO,MAAM;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"ListOperations.js","sources":["../../../../src/core/operations/ListOperations.ts"],"sourcesContent":["import { validate as uuidValidate } from 'uuid'\nimport type { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, ErrorAccessor } from '../../accessors'\nimport { RuntimeId, UnpersistedEntityDummyId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { AccessorErrorManager } from '../AccessorErrorManager'\nimport { EventManager } from '../EventManager'\nimport { ErrorLocator, LocalizedBindingError } from '../exceptions'\nimport { MarkerComparator } from '../MarkerComparator'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator'\nimport { EntityListState, getEntityMarker, StateIterator } from '../state'\nimport type { StateInitializer } from '../StateInitializer'\nimport type { TreeStore } from '../TreeStore'\nimport { OperationsHelpers } from './OperationsHelpers'\nimport { EventListenersStore } from '../../treeParameters'\n\nexport class ListOperations {\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly stateInitializer: StateInitializer,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {}\n\n\tpublic addError(listState: EntityListState, error: ErrorAccessor.Error): () => void {\n\t\treturn this.accessorErrorManager.addError(listState, error)\n\t}\n\n\tpublic addEventListener<Type extends keyof EntityListAccessor.RuntimeEntityListEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityListAccessor.RuntimeEntityListEventListenerMap[Type],\n\t) {\n\t\tif (state.eventListeners === undefined) {\n\t\t\tstate.eventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.eventListeners.add(event, listener)\n\t}\n\n\tpublic addChildEventListener<Type extends keyof EntityAccessor.EntityEventListenerMap>(\n\t\tstate: EntityListState,\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: EntityAccessor.EntityEventListenerMap[Type],\n\t) {\n\t\tif (state.childEventListeners === undefined) {\n\t\t\tstate.childEventListeners = new EventListenersStore()\n\t\t}\n\t\treturn state.childEventListeners.add(event, listener)\n\t}\n\n\tpublic batchUpdates(state: EntityListState, performUpdates: EntityListAccessor.BatchUpdatesHandler) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tperformUpdates(state.getAccessor, this.batchUpdatesOptions)\n\t\t})\n\t}\n\n\tpublic connectEntity(outerState: EntityListState, entityToConnect: EntityAccessor) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(outerState)\n\t\t\tconst stateToConnect = OperationsHelpers.resolveAndPrepareEntityToConnect(this.treeStore, entityToConnect)\n\t\t\tconst idToConnect = stateToConnect.entity.id\n\n\t\t\t// TODO disable this at the top-level.\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tif (state.entityName !== stateToConnect.entity.entityName) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`EntityListAccessor.connectEntity: Attempting to connect at an entity of type ` +\n\t\t\t\t\t\t\t`'${stateToConnect.entity.entityName}' but '${state.entityName}' is expected.\\n\\n` +\n\t\t\t\t\t\t\t`Entity located at: ${ErrorLocator.locateInternalState(outerState)}.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tMarkerComparator.assertEntityMarkersSubsetOf(\n\t\t\t\t\t\tstate.blueprint.marker.fields,\n\t\t\t\t\t\tgetEntityMarker(stateToConnect).fields,\n\t\t\t\t\t)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof LocalizedBindingError) {\n\t\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t\t`Entity list: cannot connect entity with key '${entityToConnect.key}' because its fields are ` +\n\t\t\t\t\t\t\t\t`incompatible with entities found on this list. Make sure both trees are equivalent.\\n\\n` +\n\t\t\t\t\t\t\t\t`${error.message}\\n\\n` +\n\t\t\t\t\t\t\t\t(error.markerPath.length > 1\n\t\t\t\t\t\t\t\t\t? `Incompatibility found at: ${ErrorLocator.locateMarkerPath(error.markerPath)}.\\n\\n`\n\t\t\t\t\t\t\t\t\t: '') +\n\t\t\t\t\t\t\t\t`Entity list located at: ${ErrorLocator.locateInternalState(state)}.`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tif (state.children.has(idToConnect.value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tthis.stateInitializer.initializeEntityRealm(idToConnect, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t}, stateToConnect)\n\n\t\t\t\tstate.plannedRemovals?.delete(idToConnect.value)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(idToConnect.value)) {\n\t\t\t\t\t// It was removed from the list but now we're adding it back.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t} else {\n\t\t\t\t\tchangesDelta++\n\t\t\t\t}\n\t\t\t\tif (stateToConnect.type === 'entityRealm') {\n\t\t\t\t\tchangesDelta += stateToConnect.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic disconnectEntity(listState: EntityListState, childEntity: EntityAccessor, options: {noPersist?: boolean}) {\n\t\tthis.eventManager.syncOperation(() => {\n\t\t\t// TODO disable this at the top-level.\n\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(listState)\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, listState)) {\n\t\t\t\tconst disconnectedChildIdValue = childEntity.id\n\t\t\t\tconst disconnectedChildRealm = state.children.get(disconnectedChildIdValue)\n\n\t\t\t\tif (disconnectedChildRealm === undefined) {\n\t\t\t\t\tthrow new BindingError(\n\t\t\t\t\t\t`Entity list doesn't include an entity with id '${disconnectedChildIdValue}' and so it cannot remove it.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\tthis.treeStore.disposeOfRealm(disconnectedChildRealm)\n\t\t\t\tlistState.children.delete(disconnectedChildIdValue)\n\n\t\t\t\tlet changesDelta = 0\n\n\t\t\t\tif (persistedEntityIds.has(disconnectedChildIdValue)) {\n\t\t\t\t\tchangesDelta++\n\n\t\t\t\t\tif (state.plannedRemovals === undefined) {\n\t\t\t\t\t\tstate.plannedRemovals = new Map()\n\t\t\t\t\t}\n\t\t\t\t\tif (!options.noPersist) {\n\t\t\t\t\t\tstate.plannedRemovals.set(disconnectedChildIdValue, 'disconnect')\n\t\t\t\t\t}\n\t\t\t\t} else if (disconnectedChildRealm.entity.id.existsOnServer) {\n\t\t\t\t\t// Disconnecting unpersisted entities doesn't constitute a change.\n\n\t\t\t\t\t// It wasn't on the list, then it was, and now we're removing it again.\n\t\t\t\t\tchangesDelta--\n\t\t\t\t}\n\n\t\t\t\tif (disconnectedChildRealm.type === 'entityRealm') {\n\t\t\t\t\t// Undoing whatever changes this child had caused.\n\t\t\t\t\tchangesDelta -= disconnectedChildRealm.unpersistedChangesCount\n\t\t\t\t}\n\n\t\t\t\tthis.eventManager.registerJustUpdated(state, changesDelta)\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic createNewEntity(outerState: EntityListState, initialize: EntityAccessor.BatchUpdatesHandler | undefined): RuntimeId {\n\t\treturn this.eventManager.syncOperation((): RuntimeId => {\n\t\t\t// All siblings need to have the same id.\n\t\t\tconst id = new UnpersistedEntityDummyId()\n\n\t\t\tfor (const state of StateIterator.eachSiblingRealmChild(this.treeStore, outerState)) {\n\t\t\t\tconst newEntity = this.stateInitializer.initializeEntityRealm(id, state.entityName, {\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: state,\n\t\t\t\t})\n\n\t\t\t\tthis.stateInitializer.runImmediateUserInitialization(newEntity, initialize)\n\n\t\t\t\t// The act of creating the entity doesn't constitute a change unless there's something inside to persist.\n\t\t\t\t// TODO forceCreate\n\t\t\t\t// TODO defaultValue\n\t\t\t\tthis.eventManager.registerJustUpdated(state, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\t\t\treturn id\n\t\t})\n\t}\n\n\tpublic getChildEntityById(state: EntityListState, id: string) {\n\t\tconst realm = state.children.get(id)\n\t\tif (realm === undefined) {\n\t\t\tconst isRuntimeId = uuidValidate(id) || UnpersistedEntityDummyId.matchesDummyId(id)\n\t\t\tif (isRuntimeId) {\n\t\t\t\tthrow new BindingError(`EntityList: cannot retrieve an entity with id '${id}' as it is not on the list.`)\n\t\t\t}\n\t\t\tconst looksLikeKey = this.treeStore.entityRealmStore.has(id) || RealmKeyGenerator.vaguelyAppearsToBeAKey(id)\n\t\t\tthrow new BindingError(\n\t\t\t\t`EntityList: cannot retrieve an entity with id '${id}' because it's not a valid id.` +\n\t\t\t\t\t(looksLikeKey\n\t\t\t\t\t\t? `\\nThe supplied value appears to be an entity *key*, not an *id*. List accessors are indexed by ids ` +\n\t\t\t\t\t\t `and you can use \\`EntityAccessor.id\\` to obtain one. Keys, on the other hand, are globally unique and ` +\n\t\t\t\t\t\t `you can use \\`getEntityByKey\\` to get its EntityAccessor.`\n\t\t\t\t\t\t: ''),\n\t\t\t)\n\t\t}\n\t\treturn realm.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Types.js';
3
- import { EventManager } from '../EventManager.js';
4
- import { RealmKeyGenerator } from '../RealmKeyGenerator.js';
5
-
1
+ import { BindingError } from "../../BindingError.js";
2
+ import { PRIMARY_KEY_NAME } from "../../bindingTypes.js";
3
+ import { EventManager } from "../EventManager.js";
4
+ import { RealmKeyGenerator } from "../RealmKeyGenerator.js";
6
5
  class OperationsHelpers {
7
6
  static rejectInvalidAccessorTree() {
8
7
  throw new BindingError(`The accessor tree does not correspond to the MarkerTree. This should absolutely never happen.`);
@@ -78,6 +77,5 @@ class OperationsHelpers {
78
77
  }
79
78
  }
80
79
  }
81
-
82
80
  export { OperationsHelpers };
83
81
  //# sourceMappingURL=OperationsHelpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OperationsHelpers.js","sources":["../../../../src/core/operations/OperationsHelpers.ts"],"sourcesContent":["import type { EntityAccessor } from '../../accessors'\nimport type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport { PRIMARY_KEY_NAME } from '../../bindingTypes'\nimport { EventManager } from '../EventManager'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator'\nimport type { EntityRealmState, EntityRealmStateStub, EntityState } from '../state'\nimport type { StateInitializer } from '../StateInitializer'\nimport type { TreeStore } from '../TreeStore'\n\nexport class OperationsHelpers {\n\tpublic static rejectInvalidAccessorTree(): never {\n\t\tthrow new BindingError(\n\t\t\t`The accessor tree does not correspond to the MarkerTree. This should absolutely never happen.`,\n\t\t)\n\t}\n\n\tpublic static resolveAndPrepareEntityToConnect(\n\t\ttreeStore: TreeStore,\n\t\tentityToConnect: EntityAccessor,\n\t): EntityRealmState | EntityRealmStateStub {\n\t\tconst entityToConnectKey = entityToConnect.key\n\t\tconst stateToConnect = treeStore.entityRealmStore.get(entityToConnectKey)\n\n\t\tif (stateToConnect === undefined) {\n\t\t\tthrow new BindingError(`Attempting to connect an entity with key '${entityToConnectKey}' but it doesn't exist.`)\n\t\t}\n\t\t// TODO This is commented out for now in order to at least somewhat mitigate the limitations of dealing with\n\t\t//\t\tinverse relations. However, once that has been addressed systemically, this code needs to be re-enabled.\n\t\t// if (!stateToConnect.entity.id.existsOnServer) {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Attempting to connect an entity with key '${stateToConnect.realmKey}' that ` +\n\t\t// \t\t\t`doesn't exist on server. That is currently impossible.`, // At least for now.\n\t\t// \t)\n\t\t// }\n\n\t\t// TODO\n\t\t// if (stateToConnect.entity.isScheduledForDeletion) {\n\t\t// \t// As far as the other realms are concerned, this entity is deleted. We don't want to just make it re-appear\n\t\t// \t// for them just because some other random relation decided to connect it.\n\t\t// \tstateToConnect.entity.realms.clear()\n\t\t// \tstateToConnect.entity.isScheduledForDeletion = false\n\t\t// }\n\n\t\treturn stateToConnect\n\t}\n\n\tpublic static changeEntityId(\n\t\ttreeStore: TreeStore,\n\t\teventManager: EventManager,\n\t\tstateInitializer: StateInitializer,\n\t\tentity: EntityState,\n\t\tnewId: RuntimeId,\n\t) {\n\t\tconst previousId = entity.id\n\n\t\ttreeStore.entityStore.delete(previousId.value)\n\t\ttreeStore.entityStore.set(newId.value, entity)\n\n\t\tlet counter = 0\n\t\tfor (const realm of entity.realms.values()) {\n\t\t\tthis.changeRealmId(treeStore, eventManager, stateInitializer, realm, newId)\n\n\t\t\tif (++counter === entity.realms.size) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tentity.hasIdSetInStone = true\n\t\tentity.id = newId\n\t}\n\n\tpublic static changeRealmId(\n\t\ttreeStore: TreeStore,\n\t\teventManager: EventManager,\n\t\tstateInitializer: StateInitializer,\n\t\trealm: EntityRealmState | EntityRealmStateStub,\n\t\tnewId: RuntimeId,\n\t) {\n\t\tconst oldEntity = realm.entity\n\t\tconst oldRealmKey = realm.realmKey\n\t\tconst oldId = oldEntity.id\n\n\t\tconst realmBlueprint = realm.blueprint\n\n\t\tconst newEntity = stateInitializer.initializeEntityState(newId, oldEntity.entityName)\n\t\tconst newRealmKey = RealmKeyGenerator.getRealmKey(newId, realmBlueprint)\n\n\t\trealm.realmKey = newRealmKey\n\t\trealm.entity = newEntity\n\n\t\t// This may still actually be necessary if we're going from a client to server generated uuid.\n\t\t// They both may have the same value but still be different.\n\t\tnewEntity.id = newId\n\t\toldEntity.realms.delete(oldRealmKey)\n\t\tnewEntity.realms.set(newRealmKey, realm)\n\n\t\tif (realm.type === 'entityRealm') {\n\t\t\tconst childIdState = realm.children.get(PRIMARY_KEY_NAME)\n\t\t\tif (childIdState?.type === 'field') {\n\t\t\t\tchildIdState.value = newId.value\n\t\t\t\teventManager.registerJustUpdated(childIdState, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\n\t\t\tthis.purgeStaleListenersAfterIdChange(realm)\n\t\t}\n\n\t\tif (oldEntity.realms.size === 0) {\n\t\t\ttreeStore.disposeOfEntity(oldEntity)\n\t\t}\n\n\t\ttreeStore.entityRealmStore.delete(oldRealmKey)\n\t\ttreeStore.entityRealmStore.set(newRealmKey, realm)\n\n\t\tif (realmBlueprint.type === 'listEntity') {\n\t\t\tconst list = realmBlueprint.parent\n\t\t\tlist.children.changeKey(oldId.value, newId.value) // 😎\n\t\t} else if (realmBlueprint.type === 'hasOne') {\n\t\t\teventManager.registerUpdatedConnection(realmBlueprint.parent, realmBlueprint.marker.placeholderName)\n\t\t}\n\t\tconst parent = realmBlueprint.parent\n\t\tif (parent) {\n\t\t\teventManager.registerJustUpdated(parent, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t}\n\t\tif (realm.type === 'entityRealm') {\n\t\t\teventManager.registerJustUpdated(realm, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t}\n\t}\n\n\tpublic static purgeStaleListenersAfterIdChange(realm: EntityRealmState) {\n\t\t// Version 1.\n\t\t// The listeners subscribed to a particular entity key so we no longer want to call these.\n\t\t// The only positionally associated listeners are in the blueprint so we re-initialize those.\n\t\t//realm.eventListeners = stateInitializer.initializeEntityEventListenerStore(realmBlueprint)\n\n\t\t// Version 2.\n\t\t// This is version two of this terrible hack. We want to preserve e.g. persistSuccess handlers.\n\n\t\t// Version 3.\n\t\t// The saga continues. We add a condition to exempt top-level realms. That way they can start\n\t\t// propagating changes from the top.\n\t\tconst listeners = realm.eventListeners\n\t\tif (listeners) {\n\t\t\tif (realm.blueprint.parent) {\n\t\t\t\tlisteners.delete({ type: 'update' })\n\t\t\t}\n\t\t\tlisteners.deleteByType('connectionUpdate')\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;;wBAU+B;AAAA,SAChB,4BAAmC;AAChD,UAAM,IAAI,aACT;AAAA;AAAA,SAIY,iCACb,WACA,iBAC0C;AAC1C,UAAM,qBAAqB,gBAAgB;AAC3C,UAAM,iBAAiB,UAAU,iBAAiB,IAAI;AAEtD,QAAI,mBAAmB,QAAW;AACjC,YAAM,IAAI,aAAa,6CAA6C;AAAA;AAmBrE,WAAO;AAAA;AAAA,SAGM,eACb,WACA,cACA,kBACA,QACA,OACC;AACD,UAAM,aAAa,OAAO;AAE1B,cAAU,YAAY,OAAO,WAAW;AACxC,cAAU,YAAY,IAAI,MAAM,OAAO;AAEvC,QAAI,UAAU;AACd,eAAW,SAAS,OAAO,OAAO,UAAU;AAC3C,WAAK,cAAc,WAAW,cAAc,kBAAkB,OAAO;AAErE,UAAI,EAAE,YAAY,OAAO,OAAO,MAAM;AACrC;AAAA;AAAA;AAIF,WAAO,kBAAkB;AACzB,WAAO,KAAK;AAAA;AAAA,SAGC,cACb,WACA,cACA,kBACA,OACA,OACC;AACD,UAAM,YAAY,MAAM;AACxB,UAAM,cAAc,MAAM;AAC1B,UAAM,QAAQ,UAAU;AAExB,UAAM,iBAAiB,MAAM;AAE7B,UAAM,YAAY,iBAAiB,sBAAsB,OAAO,UAAU;AAC1E,UAAM,cAAc,kBAAkB,YAAY,OAAO;AAEzD,UAAM,WAAW;AACjB,UAAM,SAAS;AAIf,cAAU,KAAK;AACf,cAAU,OAAO,OAAO;AACxB,cAAU,OAAO,IAAI,aAAa;AAElC,QAAI,MAAM,SAAS,eAAe;AACjC,YAAM,eAAe,MAAM,SAAS,IAAI;AACxC,UAAI,cAAc,SAAS,SAAS;AACnC,qBAAa,QAAQ,MAAM;AAC3B,qBAAa,oBAAoB,cAAc,aAAa;AAAA;AAG7D,WAAK,iCAAiC;AAAA;AAGvC,QAAI,UAAU,OAAO,SAAS,GAAG;AAChC,gBAAU,gBAAgB;AAAA;AAG3B,cAAU,iBAAiB,OAAO;AAClC,cAAU,iBAAiB,IAAI,aAAa;AAE5C,QAAI,eAAe,SAAS,cAAc;AACzC,YAAM,OAAO,eAAe;AAC5B,WAAK,SAAS,UAAU,MAAM,OAAO,MAAM;AAAA,eACjC,eAAe,SAAS,UAAU;AAC5C,mBAAa,0BAA0B,eAAe,QAAQ,eAAe,OAAO;AAAA;AAErF,UAAM,SAAS,eAAe;AAC9B,QAAI,QAAQ;AACX,mBAAa,oBAAoB,QAAQ,aAAa;AAAA;AAEvD,QAAI,MAAM,SAAS,eAAe;AACjC,mBAAa,oBAAoB,OAAO,aAAa;AAAA;AAAA;AAAA,SAIzC,iCAAiC,OAAyB;AAYvE,UAAM,YAAY,MAAM;AACxB,QAAI,WAAW;AACd,UAAI,MAAM,UAAU,QAAQ;AAC3B,kBAAU,OAAO,EAAE,MAAM;AAAA;AAE1B,gBAAU,aAAa;AAAA;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"OperationsHelpers.js","sources":["../../../../src/core/operations/OperationsHelpers.ts"],"sourcesContent":["import type { EntityAccessor } from '../../accessors'\nimport type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport { PRIMARY_KEY_NAME } from '../../bindingTypes'\nimport { EventManager } from '../EventManager'\nimport { RealmKeyGenerator } from '../RealmKeyGenerator'\nimport type { EntityRealmState, EntityRealmStateStub, EntityState } from '../state'\nimport type { StateInitializer } from '../StateInitializer'\nimport type { TreeStore } from '../TreeStore'\n\nexport class OperationsHelpers {\n\tpublic static rejectInvalidAccessorTree(): never {\n\t\tthrow new BindingError(\n\t\t\t`The accessor tree does not correspond to the MarkerTree. This should absolutely never happen.`,\n\t\t)\n\t}\n\n\tpublic static resolveAndPrepareEntityToConnect(\n\t\ttreeStore: TreeStore,\n\t\tentityToConnect: EntityAccessor,\n\t): EntityRealmState | EntityRealmStateStub {\n\t\tconst entityToConnectKey = entityToConnect.key\n\t\tconst stateToConnect = treeStore.entityRealmStore.get(entityToConnectKey)\n\n\t\tif (stateToConnect === undefined) {\n\t\t\tthrow new BindingError(`Attempting to connect an entity with key '${entityToConnectKey}' but it doesn't exist.`)\n\t\t}\n\t\t// TODO This is commented out for now in order to at least somewhat mitigate the limitations of dealing with\n\t\t//\t\tinverse relations. However, once that has been addressed systemically, this code needs to be re-enabled.\n\t\t// if (!stateToConnect.entity.id.existsOnServer) {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Attempting to connect an entity with key '${stateToConnect.realmKey}' that ` +\n\t\t// \t\t\t`doesn't exist on server. That is currently impossible.`, // At least for now.\n\t\t// \t)\n\t\t// }\n\n\t\t// TODO\n\t\t// if (stateToConnect.entity.isScheduledForDeletion) {\n\t\t// \t// As far as the other realms are concerned, this entity is deleted. We don't want to just make it re-appear\n\t\t// \t// for them just because some other random relation decided to connect it.\n\t\t// \tstateToConnect.entity.realms.clear()\n\t\t// \tstateToConnect.entity.isScheduledForDeletion = false\n\t\t// }\n\n\t\treturn stateToConnect\n\t}\n\n\tpublic static changeEntityId(\n\t\ttreeStore: TreeStore,\n\t\teventManager: EventManager,\n\t\tstateInitializer: StateInitializer,\n\t\tentity: EntityState,\n\t\tnewId: RuntimeId,\n\t) {\n\t\tconst previousId = entity.id\n\n\t\ttreeStore.entityStore.delete(previousId.value)\n\t\ttreeStore.entityStore.set(newId.value, entity)\n\n\t\tlet counter = 0\n\t\tfor (const realm of entity.realms.values()) {\n\t\t\tthis.changeRealmId(treeStore, eventManager, stateInitializer, realm, newId)\n\n\t\t\tif (++counter === entity.realms.size) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tentity.hasIdSetInStone = true\n\t\tentity.id = newId\n\t}\n\n\tpublic static changeRealmId(\n\t\ttreeStore: TreeStore,\n\t\teventManager: EventManager,\n\t\tstateInitializer: StateInitializer,\n\t\trealm: EntityRealmState | EntityRealmStateStub,\n\t\tnewId: RuntimeId,\n\t) {\n\t\tconst oldEntity = realm.entity\n\t\tconst oldRealmKey = realm.realmKey\n\t\tconst oldId = oldEntity.id\n\n\t\tconst realmBlueprint = realm.blueprint\n\n\t\tconst newEntity = stateInitializer.initializeEntityState(newId, oldEntity.entityName)\n\t\tconst newRealmKey = RealmKeyGenerator.getRealmKey(newId, realmBlueprint)\n\n\t\trealm.realmKey = newRealmKey\n\t\trealm.entity = newEntity\n\n\t\t// This may still actually be necessary if we're going from a client to server generated uuid.\n\t\t// They both may have the same value but still be different.\n\t\tnewEntity.id = newId\n\t\toldEntity.realms.delete(oldRealmKey)\n\t\tnewEntity.realms.set(newRealmKey, realm)\n\n\t\tif (realm.type === 'entityRealm') {\n\t\t\tconst childIdState = realm.children.get(PRIMARY_KEY_NAME)\n\t\t\tif (childIdState?.type === 'field') {\n\t\t\t\tchildIdState.value = newId.value\n\t\t\t\teventManager.registerJustUpdated(childIdState, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t\t}\n\n\t\t\tthis.purgeStaleListenersAfterIdChange(realm)\n\t\t}\n\n\t\tif (oldEntity.realms.size === 0) {\n\t\t\ttreeStore.disposeOfEntity(oldEntity)\n\t\t}\n\n\t\ttreeStore.entityRealmStore.delete(oldRealmKey)\n\t\ttreeStore.entityRealmStore.set(newRealmKey, realm)\n\n\t\tif (realmBlueprint.type === 'listEntity') {\n\t\t\tconst list = realmBlueprint.parent\n\t\t\tlist.children.changeKey(oldId.value, newId.value) // 😎\n\t\t} else if (realmBlueprint.type === 'hasOne') {\n\t\t\teventManager.registerUpdatedConnection(realmBlueprint.parent, realmBlueprint.marker.placeholderName)\n\t\t}\n\t\tconst parent = realmBlueprint.parent\n\t\tif (parent) {\n\t\t\teventManager.registerJustUpdated(parent, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t}\n\t\tif (realm.type === 'entityRealm') {\n\t\t\teventManager.registerJustUpdated(realm, EventManager.NO_CHANGES_DIFFERENCE)\n\t\t}\n\t}\n\n\tpublic static purgeStaleListenersAfterIdChange(realm: EntityRealmState) {\n\t\t// Version 1.\n\t\t// The listeners subscribed to a particular entity key so we no longer want to call these.\n\t\t// The only positionally associated listeners are in the blueprint so we re-initialize those.\n\t\t//realm.eventListeners = stateInitializer.initializeEntityEventListenerStore(realmBlueprint)\n\n\t\t// Version 2.\n\t\t// This is version two of this terrible hack. We want to preserve e.g. persistSuccess handlers.\n\n\t\t// Version 3.\n\t\t// The saga continues. We add a condition to exempt top-level realms. That way they can start\n\t\t// propagating changes from the top.\n\t\tconst listeners = realm.eventListeners\n\t\tif (listeners) {\n\t\t\tif (realm.blueprint.parent) {\n\t\t\t\tlisteners.delete({ type: 'update' })\n\t\t\t}\n\t\t\tlisteners.deleteByType('connectionUpdate')\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;;AAUO,MAAM,kBAAkB;AAAA,SAChB,4BAAmC;AAC1C,UAAA,IAAI,aACT,+FACD;AAAA,EACD;AAAA,SAEc,iCACb,WACA,iBAC0C;AAC1C,UAAM,qBAAqB,gBAAgB;AAC3C,UAAM,iBAAiB,UAAU,iBAAiB,IAAI,kBAAkB;AAExE,QAAI,mBAAmB,QAAW;AAC3B,YAAA,IAAI,aAAa,6CAA6C,2CAA2C;AAAA,IAChH;AAkBO,WAAA;AAAA,EACR;AAAA,SAEc,eACb,WACA,cACA,kBACA,QACA,OACC;AACD,UAAM,aAAa,OAAO;AAEhB,cAAA,YAAY,OAAO,WAAW,KAAK;AAC7C,cAAU,YAAY,IAAI,MAAM,OAAO,MAAM;AAE7C,QAAI,UAAU;AACd,eAAW,SAAS,OAAO,OAAO,OAAA,GAAU;AAC3C,WAAK,cAAc,WAAW,cAAc,kB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,aAAa,qBAAqB;AAAA,IAC3E;AAAA,EACD;AAAA,SAEc,iCAAiC,OAAyB;AAYvE,UAAM,YAAY,MAAM;AACxB,QAAI,WAAW;AACV,UAAA,MAAM,UAAU,QAAQ;AAC3B,kBAAU,OAAO,EAAE,MAAM,SAAU,CAAA;AAAA,MACpC;AACA,gBAAU,aAAa,kBAAkB;AAAA,IAC1C;AAAA,EACD;AACD;;"}
@@ -1,6 +1,5 @@
1
- import { BindingError } from '../../BindingError.js';
2
- import { mutationOperationSubTreeType } from './mutationOperationSubTreeType.js';
3
-
1
+ import { BindingError } from "../../BindingError.js";
2
+ import { mutationOperationSubTreeType } from "./mutationOperationSubTreeType.js";
4
3
  const mutationAliasRegex = /^(?:(u)|(t)([^t]+)t)(.+)__([cud])([sl])(.+)$/;
5
4
  const uuidToAliasRegex = /-/g;
6
5
  const uuidToAliasReplacement = "_";
@@ -45,6 +44,5 @@ class MutationAlias {
45
44
  return `${alias.substring(standaloneUuidPrefix.length).replace(aliasToUuidRegex, aliasToUuidReplacement)}`;
46
45
  }
47
46
  }
48
-
49
47
  export { MutationAlias };
50
48
  //# sourceMappingURL=MutationAlias.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MutationAlias.js","sources":["../../../../src/core/requestAliases/MutationAlias.ts"],"sourcesContent":["import type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { PlaceholderName, TreeRootId } from '../../treeParameters'\nimport { mutationOperationSubTreeType } from './mutationOperationSubTreeType'\nimport type { mutationOperationType } from './mutationOperationType'\nimport type { TopLevelMutationOperation } from './TopLevelMutationOperation'\n\nconst mutationAliasRegex = /^(?:(u)|(t)([^t]+)t)(.+)__([cud])([sl])(.+)$/\n\nconst uuidToAliasRegex = /-/g\nconst uuidToAliasReplacement = '_'\n\nconst aliasToUuidRegex = /_/g\nconst aliasToUuidReplacement = '-'\n\n// This is just a random character we use to make sure the alias doesn't start with a number as UUIDs often do.\nconst standaloneUuidPrefix = uuidToAliasReplacement\n\nexport class MutationAlias {\n\tpublic static encodeTopLevel(operation: TopLevelMutationOperation): string {\n\t\tconst treeRootId = operation.treeRootId === undefined ? 'u' : `t${operation.treeRootId.replace('-', '_')}t`\n\t\tconst entityId = operation.entityId.replace(uuidToAliasRegex, uuidToAliasReplacement)\n\n\t\tconst alias = `${treeRootId}${operation.subTreePlaceholder}__${operation.type}${operation.subTreeType}${entityId}`\n\n\t\tif (import.meta.env.DEV) {\n\t\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\t\tif (!matches) {\n\t\t\t\tthrow new BindingError()\n\t\t\t}\n\t\t}\n\n\t\treturn alias\n\t}\n\n\tpublic static decodeTopLevel(alias: string): TopLevelMutationOperation | undefined {\n\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\tif (!matches) {\n\t\t\treturn undefined\n\t\t}\n\t\tconst treeRootId: TreeRootId | undefined = matches[1] === 'u' ? undefined : matches[3]\n\t\tconst subTreePlaceholder: PlaceholderName = matches[4]\n\t\tconst type = matches[5] as typeof mutationOperationType[keyof typeof mutationOperationType]\n\t\tconst subTreeType =\n\t\t\tmatches[6] === 's' ? mutationOperationSubTreeType.singleEntity : mutationOperationSubTreeType.entityList\n\t\tconst entityId = matches[7].replace(aliasToUuidRegex, aliasToUuidReplacement)\n\n\t\treturn {\n\t\t\ttreeRootId,\n\t\t\tsubTreePlaceholder,\n\t\t\ttype,\n\t\t\tsubTreeType,\n\t\t\tentityId,\n\t\t}\n\t}\n\n\tpublic static encodeEntityId(entityId: RuntimeId): string {\n\t\treturn `${standaloneUuidPrefix}${entityId.value.replace(uuidToAliasRegex, uuidToAliasReplacement)}`\n\t}\n\n\tpublic static decodeEntityId(alias: string): RuntimeId['value'] {\n\t\treturn `${alias.substring(standaloneUuidPrefix.length).replace(aliasToUuidRegex, aliasToUuidReplacement)}`\n\t}\n}\n"],"names":[],"mappings":";;;AAOA,MAAM,qBAAqB;AAE3B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAE/B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAG/B,MAAM,uBAAuB;oBAEF;AAAA,SACZ,eAAe,WAA8C;AAC1E,UAAM,aAAa,UAAU,eAAe,SAAY,MAAM,IAAI,UAAU,WAAW,QAAQ,KAAK;AACpG,UAAM,WAAW,UAAU,SAAS,QAAQ,kBAAkB;AAE9D,UAAM,QAAQ,GAAG,aAAa,UAAU,uBAAuB,UAAU,OAAO,UAAU,cAAc;AAExG,IAAyB;AACxB,YAAM,UAAU,MAAM,MAAM;AAE5B,UAAI,CAAC,SAAS;AACb,cAAM,IAAI;AAAA;AAAA;AAIZ,WAAO;AAAA;AAAA,SAGM,eAAe,OAAsD;AAClF,UAAM,UAAU,MAAM,MAAM;AAE5B,QAAI,CAAC,SAAS;AACb,aAAO;AAAA;AAER,UAAM,aAAqC,QAAQ,OAAO,MAAM,SAAY,QAAQ;AACpF,UAAM,qBAAsC,QAAQ;AACpD,UAAM,OAAO,QAAQ;AACrB,UAAM,cACL,QAAQ,OAAO,MAAM,6BAA6B,eAAe,6BAA6B;AAC/F,UAAM,WAAW,QAAQ,GAAG,QAAQ,kBAAkB;AAEtD,WAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA;AAAA,SAIY,eAAe,UAA6B;AACzD,WAAO,GAAG,uBAAuB,SAAS,MAAM,QAAQ,kBAAkB;AAAA;AAAA,SAG7D,eAAe,OAAmC;AAC/D,WAAO,GAAG,MAAM,UAAU,qBAAqB,QAAQ,QAAQ,kBAAkB;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"MutationAlias.js","sources":["../../../../src/core/requestAliases/MutationAlias.ts"],"sourcesContent":["import type { RuntimeId } from '../../accessorTree'\nimport { BindingError } from '../../BindingError'\nimport type { PlaceholderName, TreeRootId } from '../../treeParameters'\nimport { mutationOperationSubTreeType } from './mutationOperationSubTreeType'\nimport type { mutationOperationType } from './mutationOperationType'\nimport type { TopLevelMutationOperation } from './TopLevelMutationOperation'\n\nconst mutationAliasRegex = /^(?:(u)|(t)([^t]+)t)(.+)__([cud])([sl])(.+)$/\n\nconst uuidToAliasRegex = /-/g\nconst uuidToAliasReplacement = '_'\n\nconst aliasToUuidRegex = /_/g\nconst aliasToUuidReplacement = '-'\n\n// This is just a random character we use to make sure the alias doesn't start with a number as UUIDs often do.\nconst standaloneUuidPrefix = uuidToAliasReplacement\n\nexport class MutationAlias {\n\tpublic static encodeTopLevel(operation: TopLevelMutationOperation): string {\n\t\tconst treeRootId = operation.treeRootId === undefined ? 'u' : `t${operation.treeRootId.replace('-', '_')}t`\n\t\tconst entityId = operation.entityId.replace(uuidToAliasRegex, uuidToAliasReplacement)\n\n\t\tconst alias = `${treeRootId}${operation.subTreePlaceholder}__${operation.type}${operation.subTreeType}${entityId}`\n\n\t\tif (import.meta.env.DEV) {\n\t\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\t\tif (!matches) {\n\t\t\t\tthrow new BindingError()\n\t\t\t}\n\t\t}\n\n\t\treturn alias\n\t}\n\n\tpublic static decodeTopLevel(alias: string): TopLevelMutationOperation | undefined {\n\t\tconst matches = alias.match(mutationAliasRegex)\n\n\t\tif (!matches) {\n\t\t\treturn undefined\n\t\t}\n\t\tconst treeRootId: TreeRootId | undefined = matches[1] === 'u' ? undefined : matches[3]\n\t\tconst subTreePlaceholder: PlaceholderName = matches[4]\n\t\tconst type = matches[5] as typeof mutationOperationType[keyof typeof mutationOperationType]\n\t\tconst subTreeType =\n\t\t\tmatches[6] === 's' ? mutationOperationSubTreeType.singleEntity : mutationOperationSubTreeType.entityList\n\t\tconst entityId = matches[7].replace(aliasToUuidRegex, aliasToUuidReplacement)\n\n\t\treturn {\n\t\t\ttreeRootId,\n\t\t\tsubTreePlaceholder,\n\t\t\ttype,\n\t\t\tsubTreeType,\n\t\t\tentityId,\n\t\t}\n\t}\n\n\tpublic static encodeEntityId(entityId: RuntimeId): string {\n\t\treturn `${standaloneUuidPrefix}${entityId.value.replace(uuidToAliasRegex, uuidToAliasReplacement)}`\n\t}\n\n\tpublic static decodeEntityId(alias: string): RuntimeId['value'] {\n\t\treturn `${alias.substring(standaloneUuidPrefix.length).replace(aliasToUuidRegex, aliasToUuidReplacement)}`\n\t}\n}\n"],"names":[],"mappings":";;AAOA,MAAM,qBAAqB;AAE3B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAE/B,MAAM,mBAAmB;AACzB,MAAM,yBAAyB;AAG/B,MAAM,uBAAuB;AAEtB,MAAM,cAAc;AAAA,SACZ,eAAe,WAA8C;AACpE,UAAA,aAAa,UAAU,eAAe,SAAY,MAAM,IAAI,UAAU,WAAW,QAAQ,KAAK,GAAG;AACvG,UAAM,WAAW,UAAU,SAAS,QAAQ,kBAAkB,sBAAsB;AAE9E,UAAA,QAAQ,GAAG,aAAa,UAAU,uBAAuB,UAAU,OAAO,UAAU,cAAc;AAE/E;AAClB,YAAA,UAAU,MAAM,MAAM,kBAAkB;AAE9C,UAAI,CAAC,SAAS;AACb,cAAM,IAAI,aAAa;AAAA,MACxB;AAAA,IACD;AAEO,WAAA;AAAA,EACR;AAAA,SAEc,eAAe,OAAsD;AAC5E,UAAA,UAAU,MAAM,MAAM,kBAAkB;AAE9C,QAAI,CAAC,SAAS;AACN,aAAA;AAAA,IACR;AACA,UAAM,aAAqC,QAAQ,OAAO,MAAM,SAAY,QAAQ;AACpF,UAAM,qBAAsC,QAAQ;AACpD,UAAM,OAAO,QAAQ;AACrB,UAAM,cACL,QAAQ,OAAO,MAAM,6BAA6B,eAAe,6BAA6B;AAC/F,UAAM,WAAW,QAAQ,GAAG,QAAQ,kBAAkB,sBAAsB;AAErE,WAAA;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEF;AAAA,SAEc,eAAe,UAA6B;AACzD,WAAO,GAAG,uBAAuB,SAAS,MAAM,QAAQ,kBAAkB,sBAAsB;AAAA,EACjG;AAAA,SAEc,eAAe,OAAmC;AACxD,WAAA,GAAG,MAAM,UAAU,qBAAqB,MAAM,EAAE,QAAQ,kBAAkB,sBAAsB;AAAA,EACxG;AACD;;"}
@@ -2,6 +2,5 @@ const mutationOperationSubTreeType = {
2
2
  singleEntity: "s",
3
3
  entityList: "l"
4
4
  };
5
-
6
5
  export { mutationOperationSubTreeType };
7
6
  //# sourceMappingURL=mutationOperationSubTreeType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mutationOperationSubTreeType.js","sources":["../../../../src/core/requestAliases/mutationOperationSubTreeType.ts"],"sourcesContent":["export const mutationOperationSubTreeType = {\n\tsingleEntity: 's',\n\tentityList: 'l',\n} as const\n"],"names":[],"mappings":"MAAa,+BAA+B;AAAA,EAC3C,cAAc;AAAA,EACd,YAAY;AAAA;;;;"}
1
+ {"version":3,"file":"mutationOperationSubTreeType.js","sources":["../../../../src/core/requestAliases/mutationOperationSubTreeType.ts"],"sourcesContent":["export const mutationOperationSubTreeType = {\n\tsingleEntity: 's',\n\tentityList: 'l',\n} as const\n"],"names":[],"mappings":"AAAO,MAAM,+BAA+B;AAAA,EAC3C,cAAc;AAAA,EACd,YAAY;AACb;;"}
@@ -3,6 +3,5 @@ const mutationOperationType = {
3
3
  update: "u",
4
4
  delete: "d"
5
5
  };
6
-
7
6
  export { mutationOperationType };
8
7
  //# sourceMappingURL=mutationOperationType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mutationOperationType.js","sources":["../../../../src/core/requestAliases/mutationOperationType.ts"],"sourcesContent":["export const mutationOperationType = {\n\tcreate: 'c',\n\tupdate: 'u',\n\tdelete: 'd',\n} as const\n"],"names":[],"mappings":"MAAa,wBAAwB;AAAA,EACpC,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA;;;;"}
1
+ {"version":3,"file":"mutationOperationType.js","sources":["../../../../src/core/requestAliases/mutationOperationType.ts"],"sourcesContent":["export const mutationOperationType = {\n\tcreate: 'c',\n\tupdate: 'u',\n\tdelete: 'd',\n} as const\n"],"names":[],"mappings":"AAAO,MAAM,wBAAwB;AAAA,EACpC,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AACT;;"}
@@ -6,6 +6,5 @@ class Schema {
6
6
  return this.store.entities.get(entityName)?.fields.get(field);
7
7
  }
8
8
  }
9
-
10
9
  export { Schema };
11
10
  //# sourceMappingURL=Schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Schema.js","sources":["../../../../src/core/schema/Schema.ts"],"sourcesContent":["import type { EntityName, FieldName } from '../../treeParameters'\nimport type { SchemaField } from './SchemaField'\nimport type { SchemaStore } from './SchemaStore'\n\nexport class Schema {\n\tpublic constructor(public readonly store: SchemaStore) {}\n\n\tpublic getEntityField(entityName: EntityName, field: FieldName): SchemaField | undefined {\n\t\treturn this.store.entities.get(entityName)?.fields.get(field)\n\t}\n}\n"],"names":[],"mappings":"aAIoB;AAAA,EACZ,YAA4B,OAAoB;AAApB;AAAA;AAAA,EAE5B,eAAe,YAAwB,OAA2C;AACxF,WAAO,KAAK,MAAM,SAAS,IAAI,aAAa,OAAO,IAAI;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"Schema.js","sources":["../../../../src/core/schema/Schema.ts"],"sourcesContent":["import type { EntityName, FieldName } from '../../treeParameters'\nimport type { SchemaField } from './SchemaField'\nimport type { SchemaStore } from './SchemaStore'\n\nexport class Schema {\n\tpublic constructor(public readonly store: SchemaStore) {}\n\n\tpublic getEntityField(entityName: EntityName, field: FieldName): SchemaField | undefined {\n\t\treturn this.store.entities.get(entityName)?.fields.get(field)\n\t}\n}\n"],"names":[],"mappings":"AAIO,MAAM,OAAO;AAAA,EACZ,YAA4B,OAAoB;AAApB,SAAA,QAAA;AAAA,EAAqB;AAAA,EAEjD,eAAe,YAAwB,OAA2C;AACjF,WAAA,KAAK,MAAM,SAAS,IAAI,UAAU,GAAG,OAAO,IAAI,KAAK;AAAA,EAC7D;AACD;;"}
@@ -1,8 +1,12 @@
1
- import { Schema } from './Schema.js';
2
- import { SchemaPreprocessor } from './SchemaPreprocessor.js';
3
-
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import { Schema } from "./Schema.js";
8
+ import { SchemaPreprocessor } from "./SchemaPreprocessor.js";
4
9
  class SchemaLoader {
5
- static schemaQuery = "query {\n schema {\n enums {\n name\n values\n }\n entities {\n name\n customPrimaryAllowed\n unique {\n fields\n }\n fields {\n __typename\n name\n type\n nullable\n ... on _Column {\n enumName\n defaultValue\n }\n ... on _Relation {\n side\n targetEntity\n ownedBy\n inversedBy\n onDelete\n orphanRemoval\n orderBy {\n path\n direction\n }\n }\n }\n }\n }\n}";
6
10
  static async loadSchema(client, maxAttempts, options) {
7
11
  return new Promise(async (resolve, reject) => {
8
12
  for (let attemptNumber = 0; attemptNumber < Math.max(1, maxAttempts); attemptNumber++) {
@@ -17,6 +21,6 @@ class SchemaLoader {
17
21
  });
18
22
  }
19
23
  }
20
-
24
+ __publicField(SchemaLoader, "schemaQuery", "query {\n schema {\n enums {\n name\n values\n }\n entities {\n name\n customPrimaryAllowed\n unique {\n fields\n }\n fields {\n __typename\n name\n type\n nullable\n ... on _Column {\n enumName\n defaultValue\n }\n ... on _Relation {\n side\n targetEntity\n ownedBy\n inversedBy\n onDelete\n orphanRemoval\n orderBy {\n path\n direction\n }\n }\n }\n }\n }\n}");
21
25
  export { SchemaLoader };
22
26
  //# sourceMappingURL=SchemaLoader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaLoader.js","sources":["../../../../src/core/schema/SchemaLoader.ts"],"sourcesContent":["import type { GraphQlClient, GraphQlClientRequestOptions } from '@contember/client'\nimport type { RawSchema } from './RawSchema'\nimport { Schema } from './Schema'\nimport { SchemaPreprocessor } from './SchemaPreprocessor'\n\nexport class SchemaLoader {\n\tprivate static readonly schemaQuery =\n\t\t'query {\\n' +\n\t\t' schema {\\n' +\n\t\t' enums {\\n' +\n\t\t' name\\n' +\n\t\t' values\\n' +\n\t\t' }\\n' +\n\t\t' entities {\\n' +\n\t\t' name\\n' +\n\t\t' customPrimaryAllowed\\n' +\n\t\t' unique {\\n' +\n\t\t' fields\\n' +\n\t\t' }\\n' +\n\t\t' fields {\\n' +\n\t\t' __typename\\n' +\n\t\t' name\\n' +\n\t\t' type\\n' +\n\t\t' nullable\\n' +\n\t\t' ... on _Column {\\n' +\n\t\t' enumName\\n' +\n\t\t' defaultValue\\n' +\n\t\t' }\\n' +\n\t\t' ... on _Relation {\\n' +\n\t\t' side\\n' +\n\t\t' targetEntity\\n' +\n\t\t' ownedBy\\n' +\n\t\t' inversedBy\\n' +\n\t\t' onDelete\\n' +\n\t\t' orphanRemoval\\n' +\n\t\t' orderBy {\\n' +\n\t\t' path\\n' +\n\t\t' direction\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t'}'\n\n\tpublic static async loadSchema(\n\t\tclient: GraphQlClient,\n\t\tmaxAttempts: number,\n\t\toptions?: GraphQlClientRequestOptions,\n\t): Promise<Schema> {\n\t\treturn new Promise<Schema>(async (resolve, reject) => {\n\t\t\tfor (let attemptNumber = 0; attemptNumber < Math.max(1, maxAttempts); attemptNumber++) {\n\t\t\t\ttry {\n\t\t\t\t\tconst raw: { data: { schema: RawSchema } } = await client.sendRequest(this.schemaQuery, options)\n\t\t\t\t\tconst schema = new Schema(SchemaPreprocessor.processRawSchema(raw.data.schema))\n\t\t\t\t\treturn resolve(schema)\n\t\t\t\t} catch {}\n\t\t\t}\n\t\t\treject()\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;mBAK0B;AAAA,SACD,cACvB;AAAA,eAsCmB,WACnB,QACA,aACA,SACkB;AAClB,WAAO,IAAI,QAAgB,OAAO,SAAS,WAAW;AACrD,eAAS,gBAAgB,GAAG,gBAAgB,KAAK,IAAI,GAAG,cAAc,iBAAiB;AACtF,YAAI;AACH,gBAAM,MAAuC,MAAM,OAAO,YAAY,KAAK,aAAa;AACxF,gBAAM,SAAS,IAAI,OAAO,mBAAmB,iBAAiB,IAAI,KAAK;AACvE,iBAAO,QAAQ;AAAA,gBACd;AAAA;AAAA;AAEH;AAAA;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"SchemaLoader.js","sources":["../../../../src/core/schema/SchemaLoader.ts"],"sourcesContent":["import type { GraphQlClient, GraphQlClientRequestOptions } from '@contember/client'\nimport type { RawSchema } from './RawSchema'\nimport { Schema } from './Schema'\nimport { SchemaPreprocessor } from './SchemaPreprocessor'\n\nexport class SchemaLoader {\n\tprivate static readonly schemaQuery =\n\t\t'query {\\n' +\n\t\t' schema {\\n' +\n\t\t' enums {\\n' +\n\t\t' name\\n' +\n\t\t' values\\n' +\n\t\t' }\\n' +\n\t\t' entities {\\n' +\n\t\t' name\\n' +\n\t\t' customPrimaryAllowed\\n' +\n\t\t' unique {\\n' +\n\t\t' fields\\n' +\n\t\t' }\\n' +\n\t\t' fields {\\n' +\n\t\t' __typename\\n' +\n\t\t' name\\n' +\n\t\t' type\\n' +\n\t\t' nullable\\n' +\n\t\t' ... on _Column {\\n' +\n\t\t' enumName\\n' +\n\t\t' defaultValue\\n' +\n\t\t' }\\n' +\n\t\t' ... on _Relation {\\n' +\n\t\t' side\\n' +\n\t\t' targetEntity\\n' +\n\t\t' ownedBy\\n' +\n\t\t' inversedBy\\n' +\n\t\t' onDelete\\n' +\n\t\t' orphanRemoval\\n' +\n\t\t' orderBy {\\n' +\n\t\t' path\\n' +\n\t\t' direction\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t' }\\n' +\n\t\t'}'\n\n\tpublic static async loadSchema(\n\t\tclient: GraphQlClient,\n\t\tmaxAttempts: number,\n\t\toptions?: GraphQlClientRequestOptions,\n\t): Promise<Schema> {\n\t\treturn new Promise<Schema>(async (resolve, reject) => {\n\t\t\tfor (let attemptNumber = 0; attemptNumber < Math.max(1, maxAttempts); attemptNumber++) {\n\t\t\t\ttry {\n\t\t\t\t\tconst raw: { data: { schema: RawSchema } } = await client.sendRequest(this.schemaQuery, options)\n\t\t\t\t\tconst schema = new Schema(SchemaPreprocessor.processRawSchema(raw.data.schema))\n\t\t\t\t\treturn resolve(schema)\n\t\t\t\t} catch {}\n\t\t\t}\n\t\t\treject()\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;AAKO,MAAM,aAAa;AAAA,eAwCL,WACnB,QACA,aACA,SACkB;AAClB,WAAO,IAAI,QAAgB,OAAO,SAAS,WAAW;AAC5C,eAAA,gBAAgB,GAAG,gBAAgB,KAAK,IAAI,GAAG,WAAW,GAAG,iBAAiB;AAClF,YAAA;AACH,gBAAM,MAAuC,MAAM,OAAO,YAAY,KAAK,aAAa,OAAO;AACzF,gBAAA,SAAS,IAAI,OAAO,mBAAmB,iBAAiB,IAAI,KAAK,MAAM,CAAC;AAC9E,iBAAO,QAAQ,MAAM;AAAA,QAAA,QACpB;AAAA,QAAO;AAAA,MACV;AACO;IAAA,CACP;AAAA,EACF;AACD;AAvDyB,cADlB,cACkB,eACvB;;"}
@@ -32,6 +32,5 @@ class SchemaPreprocessor {
32
32
  return fields;
33
33
  }
34
34
  }
35
-
36
35
  export { SchemaPreprocessor };
37
36
  //# sourceMappingURL=SchemaPreprocessor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaPreprocessor.js","sources":["../../../../src/core/schema/SchemaPreprocessor.ts"],"sourcesContent":["import type { RawSchema } from './RawSchema'\nimport type { RawSchemaEntity, RawSchemaFields } from './RawSchemaEntity'\nimport type { RawSchemaEnum } from './RawSchemaEnum'\nimport type { SchemaEntities } from './SchemaEntities'\nimport type { SchemaEnums } from './SchemaEnums'\nimport type { SchemaFields } from './SchemaFields'\nimport type { SchemaStore } from './SchemaStore'\n\nexport class SchemaPreprocessor {\n\tpublic static processRawSchema(rawSchema: RawSchema): SchemaStore {\n\t\treturn {\n\t\t\tenums: this.processRawEnums(rawSchema.enums),\n\t\t\tentities: this.processRawEntities(rawSchema.entities),\n\t\t}\n\t}\n\n\tprivate static processRawEnums(rawEnums: RawSchemaEnum[]): SchemaEnums {\n\t\tconst enums: SchemaEnums = new Map()\n\n\t\tfor (const { name, values } of rawEnums) {\n\t\t\tenums.set(name, new Set(values))\n\t\t}\n\n\t\treturn enums\n\t}\n\n\tprivate static processRawEntities(rawEntities: RawSchemaEntity[]): SchemaEntities {\n\t\tconst entities: SchemaEntities = new Map()\n\n\t\tfor (const entity of rawEntities) {\n\t\t\tentities.set(entity.name, {\n\t\t\t\tcustomPrimaryAllowed: entity.customPrimaryAllowed,\n\t\t\t\tfields: this.processRawFields(entity.fields),\n\t\t\t\tname: entity.name,\n\t\t\t\tunique: entity.unique,\n\t\t\t})\n\t\t}\n\n\t\treturn entities\n\t}\n\n\tprivate static processRawFields(rawFields: RawSchemaFields): SchemaFields {\n\t\tconst fields: SchemaFields = new Map()\n\n\t\tfor (const field of rawFields) {\n\t\t\tfields.set(field.name, field)\n\t\t}\n\n\t\treturn fields\n\t}\n}\n"],"names":[],"mappings":"yBAQgC;AAAA,SACjB,iBAAiB,WAAmC;AACjE,WAAO;AAAA,MACN,OAAO,KAAK,gBAAgB,UAAU;AAAA,MACtC,UAAU,KAAK,mBAAmB,UAAU;AAAA;AAAA;AAAA,SAI/B,gBAAgB,UAAwC;AACtE,UAAM,4BAAyB;AAE/B,eAAW,EAAE,MAAM,YAAY,UAAU;AACxC,YAAM,IAAI,MAAM,IAAI,IAAI;AAAA;AAGzB,WAAO;AAAA;AAAA,SAGO,mBAAmB,aAAgD;AACjF,UAAM,+BAA+B;AAErC,eAAW,UAAU,aAAa;AACjC,eAAS,IAAI,OAAO,MAAM;AAAA,QACzB,sBAAsB,OAAO;AAAA,QAC7B,QAAQ,KAAK,iBAAiB,OAAO;AAAA,QACrC,MAAM,OAAO;AAAA,QACb,QAAQ,OAAO;AAAA;AAAA;AAIjB,WAAO;AAAA;AAAA,SAGO,iBAAiB,WAA0C;AACzE,UAAM,6BAA2B;AAEjC,eAAW,SAAS,WAAW;AAC9B,aAAO,IAAI,MAAM,MAAM;AAAA;AAGxB,WAAO;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"SchemaPreprocessor.js","sources":["../../../../src/core/schema/SchemaPreprocessor.ts"],"sourcesContent":["import type { RawSchema } from './RawSchema'\nimport type { RawSchemaEntity, RawSchemaFields } from './RawSchemaEntity'\nimport type { RawSchemaEnum } from './RawSchemaEnum'\nimport type { SchemaEntities } from './SchemaEntities'\nimport type { SchemaEnums } from './SchemaEnums'\nimport type { SchemaFields } from './SchemaFields'\nimport type { SchemaStore } from './SchemaStore'\n\nexport class SchemaPreprocessor {\n\tpublic static processRawSchema(rawSchema: RawSchema): SchemaStore {\n\t\treturn {\n\t\t\tenums: this.processRawEnums(rawSchema.enums),\n\t\t\tentities: this.processRawEntities(rawSchema.entities),\n\t\t}\n\t}\n\n\tprivate static processRawEnums(rawEnums: RawSchemaEnum[]): SchemaEnums {\n\t\tconst enums: SchemaEnums = new Map()\n\n\t\tfor (const { name, values } of rawEnums) {\n\t\t\tenums.set(name, new Set(values))\n\t\t}\n\n\t\treturn enums\n\t}\n\n\tprivate static processRawEntities(rawEntities: RawSchemaEntity[]): SchemaEntities {\n\t\tconst entities: SchemaEntities = new Map()\n\n\t\tfor (const entity of rawEntities) {\n\t\t\tentities.set(entity.name, {\n\t\t\t\tcustomPrimaryAllowed: entity.customPrimaryAllowed,\n\t\t\t\tfields: this.processRawFields(entity.fields),\n\t\t\t\tname: entity.name,\n\t\t\t\tunique: entity.unique,\n\t\t\t})\n\t\t}\n\n\t\treturn entities\n\t}\n\n\tprivate static processRawFields(rawFields: RawSchemaFields): SchemaFields {\n\t\tconst fields: SchemaFields = new Map()\n\n\t\tfor (const field of rawFields) {\n\t\t\tfields.set(field.name, field)\n\t\t}\n\n\t\treturn fields\n\t}\n}\n"],"names":[],"mappings":"AAQO,MAAM,mBAAmB;AAAA,SACjB,iBAAiB,WAAmC;AAC1D,WAAA;AAAA,MACN,OAAO,KAAK,gBAAgB,UAAU,KAAK;AAAA,MAC3C,UAAU,KAAK,mBAAmB,UAAU,QAAQ;AAAA,IAAA;AAAA,EAEtD;AAAA,SAEe,gBAAgB,UAAwC;AAChE,UAAA,4BAAyB;AAEpB,eAAA,EAAE,MAAM,YAAY,UAAU;AACxC,YAAM,IAAI,MAAM,IAAI,IAAI,MAAM,CAAC;AAAA,IAChC;AAEO,WAAA;AAAA,EACR;AAAA,SAEe,mBAAmB,aAAgD;AAC3E,UAAA,+BAA+B;AAErC,eAAW,UAAU,aAAa;AACxB,eAAA,IAAI,OAAO,MAAM;AAAA,QACzB,sBAAsB,OAAO;AAAA,QAC7B,QAAQ,KAAK,iBAAiB,OAAO,MAAM;AAAA,QAC3C,MAAM,OAAO;AAAA,QACb,QAAQ,OAAO;AAAA,MAAA,CACf;AAAA,IACF;AAEO,WAAA;AAAA,EACR;AAAA,SAEe,iBAAiB,WAA0C;AACnE,UAAA,6BAA2B;AAEjC,eAAW,SAAS,WAAW;AACvB,aAAA,IAAI,MAAM,MAAM,KAAK;AAAA,IAC7B;AAEO,WAAA;AAAA,EACR;AACD;;"}
@@ -1,13 +1,12 @@
1
- import levenshtein from 'js-levenshtein';
2
- import { BindingError } from '../../BindingError.js';
3
- import { ErrorLocator } from '../exceptions/ErrorLocator.js';
4
- import { LocalizedBindingError } from '../exceptions/LocalizedBindingError.js';
5
- import { FieldMarker } from '../../markers/FieldMarker.js';
6
- import { HasOneRelationMarker } from '../../markers/HasOneRelationMarker.js';
7
- import { HasManyRelationMarker } from '../../markers/HasManyRelationMarker.js';
8
- import { assertNever } from '../../utils/assertNever.js';
9
- import { EntitySubTreeMarker } from '../../markers/EntitySubTreeMarker.js';
10
-
1
+ import levenshtein from "js-levenshtein";
2
+ import { BindingError } from "../../BindingError.js";
3
+ import { ErrorLocator } from "../exceptions/ErrorLocator.js";
4
+ import { LocalizedBindingError } from "../exceptions/LocalizedBindingError.js";
5
+ import { FieldMarker } from "../../markers/FieldMarker.js";
6
+ import { HasOneRelationMarker } from "../../markers/HasOneRelationMarker.js";
7
+ import { HasManyRelationMarker } from "../../markers/HasManyRelationMarker.js";
8
+ import { assertNever } from "../../utils/assertNever.js";
9
+ import { EntitySubTreeMarker } from "../../markers/EntitySubTreeMarker.js";
11
10
  class SchemaValidator {
12
11
  static assertTreeValid(schema, tree) {
13
12
  const errors = Array.from(tree.subTrees.values(), (subTree) => Array.from(this.getSubTreeErrors(schema, subTree))).flat();
@@ -113,6 +112,5 @@ class SchemaValidator {
113
112
  return bestAlternative;
114
113
  }
115
114
  }
116
-
117
115
  export { SchemaValidator };
118
116
  //# sourceMappingURL=SchemaValidator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaValidator.js","sources":["../../../../src/core/schema/SchemaValidator.ts"],"sourcesContent":["import levenshtein from 'js-levenshtein'\nimport { BindingError } from '../../BindingError'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '../../markers'\nimport type { Filter, UniqueWhere } from '../../treeParameters'\nimport { assertNever } from '../../utils'\nimport { ErrorLocator, LocalizedBindingError } from '../exceptions'\nimport type { Schema } from './Schema'\nimport type { SchemaEntity } from './SchemaEntity'\n\nexport class SchemaValidator {\n\tpublic static assertTreeValid(schema: Schema, tree: MarkerTreeRoot) {\n\t\tconst errors = Array.from(tree.subTrees.values(), subTree =>\n\t\t\tArray.from(this.getSubTreeErrors(schema, subTree)),\n\t\t).flat()\n\n\t\tif (errors.length) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`Invalid data tree:\\n` +\n\t\t\t\t\terrors\n\t\t\t\t\t\t.map(error => `\\t• ${error.message} (Error at ${ErrorLocator.locateMarkerPath(error.markerPath)})`)\n\t\t\t\t\t\t.join(`\\n`),\n\t\t\t)\n\t\t}\n\t}\n\n\tprivate static *getSubTreeErrors(\n\t\tschema: Schema,\n\t\tsubTree: EntitySubTreeMarker | EntityListSubTreeMarker,\n\t): Generator<LocalizedBindingError, void> {\n\t\tconst entityName = subTree.entityName\n\t\tconst entity = schema.store.entities.get(entityName)\n\n\t\tif (entity === undefined) {\n\t\t\tconst type = subTree instanceof EntitySubTreeMarker ? 'entity list' : 'entity'\n\t\t\tconst alternative = this.recommendAlternative(entityName, schema.store.entities.keys())\n\n\t\t\tyield new LocalizedBindingError(\n\t\t\t\t`Invalid ${type} sub tree: Entity '${entityName}' doesn't exist. ${\n\t\t\t\t\talternative ? `Did you mean '${alternative}'?` : ''\n\t\t\t\t}`,\n\t\t\t\t[subTree],\n\t\t\t)\n\n\t\t\treturn\n\t\t}\n\n\t\t// TODO check filter\n\t\t// TODO check where\n\t\t// TODO run custom validators\n\n\t\tyield* this.nestErrorsIn(subTree, this.getMarkersContainerErrors(schema, entity, subTree.fields))\n\t}\n\n\tprivate static *getMarkersContainerErrors(\n\t\tschema: Schema,\n\t\tcontainingEntity: SchemaEntity,\n\t\tmarkers: EntityFieldMarkersContainer,\n\t): Generator<LocalizedBindingError, void> {\n\t\tfor (const marker of markers.markers.values()) {\n\t\t\tif (marker instanceof FieldMarker) {\n\t\t\t\tyield* this.getFieldErrors(schema, containingEntity, marker)\n\t\t\t} else if (marker instanceof HasOneRelationMarker || marker instanceof HasManyRelationMarker) {\n\t\t\t\tyield* this.getRelationErrors(schema, containingEntity, marker)\n\t\t\t} else {\n\t\t\t\treturn assertNever(marker)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static *getRelationErrors(\n\t\tschema: Schema,\n\t\tcontainingEntity: SchemaEntity,\n\t\tmarker: HasOneRelationMarker | HasManyRelationMarker,\n\t): Generator<LocalizedBindingError, void> {\n\t\tconst relationName = marker.parameters.field\n\t\tconst relation = containingEntity.fields.get(relationName)\n\t\tconst type = marker instanceof HasOneRelationMarker ? 'one' : 'many'\n\n\t\tif (relation === undefined) {\n\t\t\tconst alternative = this.recommendAlternative(\n\t\t\t\trelationName,\n\t\t\t\tArray.from(containingEntity.fields)\n\t\t\t\t\t.filter(([, field]) => {\n\t\t\t\t\t\tif (field.__typename !== '_Relation') {\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (marker instanceof HasOneRelationMarker) {\n\t\t\t\t\t\t\treturn field.type === 'OneHasOne' || field.type === 'ManyHasOne'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (marker instanceof HasManyRelationMarker) {\n\t\t\t\t\t\t\treturn field.type === 'OneHasMany' || field.type === 'ManyHasMany'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn assertNever(marker)\n\t\t\t\t\t})\n\t\t\t\t\t.map(([fieldName]) => fieldName),\n\t\t\t)\n\n\t\t\tyield new LocalizedBindingError(\n\t\t\t\t`Invalid has-${type} relation '${relationName}' doesn't exist on entity '${containingEntity.name}'. ` +\n\t\t\t\t\t(alternative ? `Did you mean '${alternative}'?` : ''),\n\t\t\t\t[marker],\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tif (relation.__typename === '_Column') {\n\t\t\tyield new LocalizedBindingError(\n\t\t\t\t`Invalid has-${type} relation: the name '${relationName}' on entity '${containingEntity.name}' ` +\n\t\t\t\t\t`refers to an ordinary scalar field but is being used as a has-${type} relation.`,\n\t\t\t\t[marker],\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tif (\n\t\t\tmarker instanceof HasOneRelationMarker &&\n\t\t\tmarker.parameters.reducedBy === undefined &&\n\t\t\t(relation.type === 'OneHasMany' || relation.type === 'ManyHasMany')\n\t\t) {\n\t\t\tyield new LocalizedBindingError(\n\t\t\t\t`Invalid has-one relation: the name '${relationName}' on entity '${containingEntity.name}' ` +\n\t\t\t\t\t`refers to a *has-many* relation but is being used as a has-one.`,\n\t\t\t\t[marker],\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tif (\n\t\t\t(marker instanceof HasManyRelationMarker ||\n\t\t\t\t(marker instanceof HasOneRelationMarker && marker.parameters.reducedBy !== undefined)) &&\n\t\t\t(relation.type === 'OneHasOne' || relation.type === 'ManyHasOne')\n\t\t) {\n\t\t\tyield new LocalizedBindingError(\n\t\t\t\t`Invalid has-many relation: the name '${relationName}' on entity '${containingEntity.name}' ` +\n\t\t\t\t\t`refers to a *has-one* relation but is being used as a has-many.`,\n\t\t\t\t[marker],\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\t// TODO check filter\n\t\t// TODO check reducedBy\n\t\t// TODO check expected mutations\n\t\t// TODO run custom validators\n\n\t\tconst targetEntityName = relation.targetEntity\n\t\tconst targetEntity = schema.store.entities.get(targetEntityName)\n\n\t\tif (targetEntity === undefined) {\n\t\t\treturn // ?!? This really shouldn't ever happen.\n\t\t}\n\n\t\tyield* this.nestErrorsIn(marker, this.getMarkersContainerErrors(schema, targetEntity, marker.fields))\n\t}\n\n\tprivate static *getFieldErrors(\n\t\tschema: Schema,\n\t\tcontainingEntity: SchemaEntity,\n\t\tmarker: FieldMarker,\n\t): Generator<LocalizedBindingError, void> {\n\t\tconst fieldName = marker.fieldName\n\t\tconst field = containingEntity.fields.get(fieldName)\n\n\t\tif (field === undefined) {\n\t\t\tconst alternative = this.recommendAlternative(\n\t\t\t\tfieldName,\n\t\t\t\tArray.from(containingEntity.fields)\n\t\t\t\t\t.filter(([, field]) => field.__typename === '_Column')\n\t\t\t\t\t.map(([fieldName]) => fieldName),\n\t\t\t)\n\n\t\t\tyield new LocalizedBindingError(\n\t\t\t\t`Field '${fieldName}' doesn't exist on entity '${containingEntity.name}'. ` +\n\t\t\t\t\t(alternative ? `Did you mean '${alternative}'?` : ''),\n\t\t\t\t[marker],\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tif (field.__typename === '_Relation') {\n\t\t\tyield new LocalizedBindingError(\n\t\t\t\t`Invalid field: the name '${fieldName}' on entity '${containingEntity.name}' ` +\n\t\t\t\t\t`refers to a has-${\n\t\t\t\t\t\tfield.type === 'OneHasOne' || field.type === 'ManyHasOne' ? 'one' : 'many'\n\t\t\t\t\t} relation but is being used as a field.`,\n\t\t\t\t[marker],\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\t// TODO check that defaultValue matches the type\n\t\t// TODO run custom validators\n\t}\n\n\tprivate static *getUniqueWhereErrors(\n\t\tschema: Schema,\n\t\tcontainingEntity: SchemaEntity,\n\t\twhere: UniqueWhere,\n\t): Generator<LocalizedBindingError, void> {\n\t\t//\n\t}\n\n\tprivate static *getFilterErrors(\n\t\tschema: Schema,\n\t\tcontainingEntity: SchemaEntity,\n\t\tfilter: Filter,\n\t): Generator<LocalizedBindingError, void> {\n\t\t//\n\t}\n\n\tprivate static *nestErrorsIn(\n\t\tsource: HasOneRelationMarker | HasManyRelationMarker | EntityListSubTreeMarker | EntitySubTreeMarker,\n\t\tto: Generator<LocalizedBindingError, void>,\n\t): Generator<LocalizedBindingError, void> {\n\t\tfor (const error of to) {\n\t\t\tyield error.nestedIn(source)\n\t\t}\n\t}\n\n\tprivate 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":";;;;;;;;;;sBAiB6B;AAAA,SACd,gBAAgB,QAAgB,MAAsB;AACnE,UAAM,SAAS,MAAM,KAAK,KAAK,SAAS,UAAU,aACjD,MAAM,KAAK,KAAK,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Aa;AACrC,YAAM,IAAI,sBACT,4BAA4B,yBAAyB,iBAAiB,yBAEpE,MAAM,SAAS,eAAe,MAAM,SAAS,eAAe,QAAQ,iDAEtE,CAAC;AAEF;AAAA;AAAA;AAAA,UAOc,qBACf,QACA,kBACA,OACyC;AAAA;AAAA,UAI1B,gBACf,QACA,kBACA,QACyC;AAAA;AAAA,UAI1B,aACf,QACA,IACyC;AACzC,eAAW,SAAS,IAAI;AACvB,YAAM,MAAM,SAAS;AAAA;AAAA;AAAA,SAIR,qBAAqB,UAAkB,sBAA4D;AACjH,QAAI,kBAAsC;AAC1C,QAAI,0BAA0B,OAAO;AAErC,eAAW,eAAe,sBAAsB;AAC/C,YAAM,WAAW,YAAY,UAAU;AAEvC,UAAI,WAAW,yBAAyB;AACvC,0BAAkB;AAClB,kCAA0B;AAAA;AAAA;AAG5B,WAAO;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"SchemaValidator.js","sources":["../../../../src/core/schema/SchemaValidator.ts"],"sourcesContent":["import levenshtein from 'js-levenshtein'\nimport { BindingError } from '../../BindingError'\nimport {\n\tEntityFieldMarkersContainer,\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n\tMarkerTreeRoot,\n} from '../../markers'\nimport type { Filter, UniqueWhere } from '../../treeParameters'\nimport { assertNever } from '../../utils'\nimport { ErrorLocator, LocalizedBindingError } from '../exceptions'\nimport type { Schema } from './Schema'\nimport type { SchemaEntity } from './SchemaEntity'\n\nexport class SchemaValidator {\n\tpublic static assertTreeValid(schema: Schema, tree: MarkerTreeRoot) {\n\t\tconst errors = Array.from(tree.subTrees.values(), subTree =>\n\t\t\tArray.from(this.getSubTreeErrors(schema, subTree)),\n\t\t).flat()\n\n\t\tif (errors.length) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`Invalid data tree:\\n` +\n\t\t\t\t\terrors\n\t\t\t\t\t\t.map(error => `\\t• ${error.message} (Error at ${ErrorLocator.locateMarkerPath(error.markerPath)})`)\n\t\t\t\t\t\t.join(`\\n`),\n\t\t\t)\n\t\t}\n\t}\n\n\tprivate static *getSubTreeErrors(\n\t\tschema: Schema,\n\t\tsubTree: EntitySubTreeMarker | EntityListSubTreeMarker,\n\t): Generator<LocalizedBindingError, void> {\n\t\tconst entityName = subTree.entityName\n\t\tconst entity = schema.store.entities.get(entityName)\n\n\t\tif (entity === undefined) {\n\t\t\tconst type = subTree instanceof EntitySubTreeMarker ? 'entity list' : 'entity'\n\t\t\tconst alternative = this.recommendAlternative(entityName, schema.store.entities.keys())\n\n\t\t\tyield new LocalizedBindingError(\n\t\t\t\t`Invalid ${type} sub tree: Entity '${entityName}' doesn't exist. ${\n\t\t\t\t\talternative ? `Did you mean '${alternative}'?` : ''\n\t\t\t\t}`,\n\t\t\t\t[subTree],\n\t\t\t)\n\n\t\t\treturn\n\t\t}\n\n\t\t// TODO check filter\n\t\t// TODO check where\n\t\t// TODO run custom validators\n\n\t\tyield* this.nestErrorsIn(subTree, this.getMarkersContainerErrors(schema, entity, subTree.fields))\n\t}\n\n\tprivate static *getMarkersContainerErrors(\n\t\tschema: Schema,\n\t\tcontainingEntity: SchemaEntity,\n\t\tmarkers: EntityFieldMarkersContainer,\n\t): Generator<LocalizedBindingError, void> {\n\t\tfor (const marker of markers.markers.values()) {\n\t\t\tif (marker instanceof FieldMarker) {\n\t\t\t\tyield* this.getFieldErrors(schema, containingEntity, marker)\n\t\t\t} else if (marker instanceof HasOneRelationMarker || marker instanceof HasManyRelationMarker) {\n\t\t\t\tyield* this.getRelationErrors(schema, containingEntity, marker)\n\t\t\t} else {\n\t\t\t\treturn assertNever(marker)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static *getRelationErrors(\n\t\tschema: Schema,\n\t\tcontainingEntity: SchemaEntity,\n\t\tmarker: HasOneRelationMarker | HasManyRelationMarker,\n\t): Generator<LocalizedBindingError, void> {\n\t\tconst relationName = marker.parameters.field\n\t\tconst relation = containingEntity.fields.get(relationName)\n\t\tconst type = marker instanceof HasOneRelationMarker ? 'one' : 'many'\n\n\t\tif (relation === undefined) {\n\t\t\tconst alternative = this.recommendAlternative(\n\t\t\t\trelationName,\n\t\t\t\tArray.from(containingEntity.fields)\n\t\t\t\t\t.filter(([, field]) => {\n\t\t\t\t\t\tif (field.__typename !== '_Relation') {\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (marker instanceof HasOneRelationMarker) {\n\t\t\t\t\t\t\treturn field.type === 'OneHasOne' || field.type === 'ManyHasOne'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (marker instanceof HasManyRelationMarker) {\n\t\t\t\t\t\t\treturn field.type === 'OneHasMany' || field.type === 'ManyHasMany'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn assertNever(marker)\n\t\t\t\t\t})\n\t\t\t\t\t.map(([fieldName]) => fieldName),\n\t\t\t)\n\n\t\t\tyield new LocalizedBindingError(\n\t\t\t\t`Invalid has-${type} relation '${relationName}' doesn't exist on entity '${containingEntity.name}'. ` +\n\t\t\t\t\t(alternative ? `Did you mean '${alternative}'?` : ''),\n\t\t\t\t[marker],\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tif (relation.__typename === '_Column') {\n\t\t\tyield new LocalizedBindingError(\n\t\t\t\t`Invalid has-${type} relation: the name '${relationName}' on entity '${containingEntity.name}' ` +\n\t\t\t\t\t`refers to an ordinary scalar field but is being used as a has-${type} relation.`,\n\t\t\t\t[marker],\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tif (\n\t\t\tmarker instanceof HasOneRelationMarker &&\n\t\t\tmarker.parameters.reducedBy === undefined &&\n\t\t\t(relation.type === 'OneHasMany' || relation.type === 'ManyHasMany')\n\t\t) {\n\t\t\tyield new LocalizedBindingError(\n\t\t\t\t`Invalid has-one relation: the name '${relationName}' on entity '${containingEntity.name}' ` +\n\t\t\t\t\t`refers to a *has-many* relation but is being used as a has-one.`,\n\t\t\t\t[marker],\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tif (\n\t\t\t(marker instanceof HasManyRelationMarker ||\n\t\t\t\t(marker instanceof HasOneRelationMarker && marker.parameters.reducedBy !== undefined)) &&\n\t\t\t(relation.type === 'OneHasOne' || relation.type === 'ManyHasOne')\n\t\t) {\n\t\t\tyield new LocalizedBindingError(\n\t\t\t\t`Invalid has-many relation: the name '${relationName}' on entity '${containingEntity.name}' ` +\n\t\t\t\t\t`refers to a *has-one* relation but is being used as a has-many.`,\n\t\t\t\t[marker],\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\t// TODO check filter\n\t\t// TODO check reducedBy\n\t\t// TODO check expected mutations\n\t\t// TODO run custom validators\n\n\t\tconst targetEntityName = relation.targetEntity\n\t\tconst targetEntity = schema.store.entities.get(targetEntityName)\n\n\t\tif (targetEntity === undefined) {\n\t\t\treturn // ?!? This really shouldn't ever happen.\n\t\t}\n\n\t\tyield* this.nestErrorsIn(marker, this.getMarkersContainerErrors(schema, targetEntity, marker.fields))\n\t}\n\n\tprivate static *getFieldErrors(\n\t\tschema: Schema,\n\t\tcontainingEntity: SchemaEntity,\n\t\tmarker: FieldMarker,\n\t): Generator<LocalizedBindingError, void> {\n\t\tconst fieldName = marker.fieldName\n\t\tconst field = containingEntity.fields.get(fieldName)\n\n\t\tif (field === undefined) {\n\t\t\tconst alternative = this.recommendAlternative(\n\t\t\t\tfieldName,\n\t\t\t\tArray.from(containingEntity.fields)\n\t\t\t\t\t.filter(([, field]) => field.__typename === '_Column')\n\t\t\t\t\t.map(([fieldName]) => fieldName),\n\t\t\t)\n\n\t\t\tyield new LocalizedBindingError(\n\t\t\t\t`Field '${fieldName}' doesn't exist on entity '${containingEntity.name}'. ` +\n\t\t\t\t\t(alternative ? `Did you mean '${alternative}'?` : ''),\n\t\t\t\t[marker],\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tif (field.__typename === '_Relation') {\n\t\t\tyield new LocalizedBindingError(\n\t\t\t\t`Invalid field: the name '${fieldName}' on entity '${containingEntity.name}' ` +\n\t\t\t\t\t`refers to a has-${\n\t\t\t\t\t\tfield.type === 'OneHasOne' || field.type === 'ManyHasOne' ? 'one' : 'many'\n\t\t\t\t\t} relation but is being used as a field.`,\n\t\t\t\t[marker],\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\t// TODO check that defaultValue matches the type\n\t\t// TODO run custom validators\n\t}\n\n\tprivate static *getUniqueWhereErrors(\n\t\tschema: Schema,\n\t\tcontainingEntity: SchemaEntity,\n\t\twhere: UniqueWhere,\n\t): Generator<LocalizedBindingError, void> {\n\t\t//\n\t}\n\n\tprivate static *getFilterErrors(\n\t\tschema: Schema,\n\t\tcontainingEntity: SchemaEntity,\n\t\tfilter: Filter,\n\t): Generator<LocalizedBindingError, void> {\n\t\t//\n\t}\n\n\tprivate static *nestErrorsIn(\n\t\tsource: HasOneRelationMarker | HasManyRelationMarker | EntityListSubTreeMarker | EntitySubTreeMarker,\n\t\tto: Generator<LocalizedBindingError, void>,\n\t): Generator<LocalizedBindingError, void> {\n\t\tfor (const error of to) {\n\t\t\tyield error.nestedIn(source)\n\t\t}\n\t}\n\n\tprivate 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":";;;;;;;;;AAiBO,MAAM,gBAAgB;AAAA,SACd,gBAAgB,QAAgB,MAAsB;AACnE,UAAM,SAAS,MAAM,KAAK,KAAK,SAAS,OAAU,GAAA,CAAA,YACjD,MAAM,KAAK,KAAK,iBAAiB,QAAQ,O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Q,iBAAiB,OAAO,IAAI,SAAS;AAEnD,QAAI,UAAU,QAAW;AAClB,YAAA,cAAc,KAAK,qBACxB,WACA,MAAM,KAAK,iBAAiB,MAAM,EAChC,OAAO,CAAC,CAAG,EAAA,YAAW,OAAM,eAAe,SAAS,EACpD,IAAI,CAAC,CAAC,gBAAe,UAAS,CACjC;AAEA,YAAM,IAAI,sBACT,UAAU,uCAAuC,iBAAiB,YAClD,eAAA,iBAAiB,kBAAkB,KACnD,CAAC,MAAM,CACR;AACA;AAAA,IACD;AACI,QAAA,MAAM,eAAe,aAAa;AACrC,YAAM,IAAI,sBACT,4BAA4B,yBAAyB,iBAAiB,yBAEpE,MAAM,SAAS,eAAe,MAAM,SAAS,eAAe,QAAQ,iDAEtE,CAAC,MAAM,CACR;AACA;AAAA,IACD;AAAA,EAID;AAAA,UAEgB,qBACf,QACA,kBACA,OACyC;AAAA,EAE1C;AAAA,UAEgB,gBACf,QACA,kBACA,QACyC;AAAA,EAE1C;AAAA,UAEgB,aACf,QACA,IACyC;AACzC,eAAW,SAAS,IAAI;AACjB,YAAA,MAAM,SAAS,MAAM;AAAA,IAC5B;AAAA,EACD;AAAA,SAEe,qBAAqB,UAAkB,sBAA4D;AACjH,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,6 +1,5 @@
1
- import { getEntityMarker } from './getEntityMarker.js';
2
- import { assertNever } from '../../utils/assertNever.js';
3
-
1
+ import { getEntityMarker } from "./getEntityMarker.js";
2
+ import { assertNever } from "../../utils/assertNever.js";
4
3
  class StateIterator {
5
4
  static *eachSiblingRealm(state, relevantPlaceholder) {
6
5
  for (let [realmKey, realm] of state.entity.realms) {
@@ -94,6 +93,5 @@ class StateIterator {
94
93
  }
95
94
  }
96
95
  }
97
-
98
96
  export { StateIterator };
99
97
  //# sourceMappingURL=StateIterator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StateIterator.js","sources":["../../../../src/core/state/StateIterator.ts"],"sourcesContent":["import { FieldMarker, HasManyRelationMarker, HasOneRelationMarker } from '../../markers'\nimport type { FieldValue, PlaceholderName } from '../../treeParameters'\nimport { assertNever } from '../../utils'\nimport type { TreeStore } from '../TreeStore'\nimport type { EntityListState } from './EntityListState'\nimport type { EntityRealmState, EntityRealmStateStub } from './EntityRealmState'\nimport type { FieldState } from './FieldState'\nimport { getEntityMarker } from './getEntityMarker'\nimport type { RootStateNode, StateINode, StateNode } from './StateNode'\n\nexport class StateIterator {\n\tpublic static *eachSiblingRealm(\n\t\tstate: EntityRealmState,\n\t\trelevantPlaceholder?: PlaceholderName,\n\t): IterableIterator<EntityRealmState> {\n\t\tfor (let [realmKey, realm] of state.entity.realms) {\n\t\t\tif (realm.type === 'entityRealmStub') {\n\t\t\t\tif (relevantPlaceholder === undefined || getEntityMarker(realm).fields.placeholders.has(relevantPlaceholder)) {\n\t\t\t\t\trealm.getAccessor()\n\t\t\t\t\trealm = state.entity.realms.get(realmKey) as EntityRealmState\n\t\t\t\t} else {\n\t\t\t\t\t// This realm is irrelevant. No need to force-initialize it.\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tyield realm\n\t\t}\n\t}\n\n\t// Note that this only yields siblings with the same placeholderName!\n\tpublic static *eachSiblingRealmChild<Value extends FieldValue, S extends EntityListState | FieldState<Value>>(\n\t\ttreeStore: TreeStore,\n\t\tstate: S & StateNode<Value>,\n\t): IterableIterator<S> {\n\t\tif (state.type === 'entityList' && state.blueprint.parent === undefined) {\n\t\t\t// Top-level entity list\n\t\t\tfor (const [, rootStates] of treeStore.subTreeStatesByRoot) {\n\t\t\t\tconst rootList = rootStates.get(state.blueprint.marker.placeholderName)\n\t\t\t\tif (rootList?.type === 'entityList') {\n\t\t\t\t\tyield rootList as S\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tlet closestEntityRealm: EntityRealmState\n\t\tlet placeholderName: PlaceholderName\n\n\t\tif (state.type === 'field') {\n\t\t\tclosestEntityRealm = state.parent\n\t\t\tplaceholderName = state.placeholderName\n\t\t} else if (state.type === 'entityList') {\n\t\t\tclosestEntityRealm = state.blueprint.parent! // The parent-less case is handled above. Hence the assertion.\n\t\t\tplaceholderName = state.blueprint.marker.placeholderName\n\t\t} else {\n\t\t\treturn assertNever(state)\n\t\t}\n\n\t\tfor (const realm of this.eachSiblingRealm(closestEntityRealm, placeholderName)) {\n\t\t\tconst child = realm.children.get(placeholderName)\n\t\t\tif (child === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (child.type === state.type) {\n\t\t\t\tyield child as S\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static *depthFirstAllNodes(root: StateNode): IterableIterator<StateNode> {\n\t\tswitch (root.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList':\n\t\t\t\tfor (const childState of root.children.values()) {\n\t\t\t\t\tswitch (childState.type) {\n\t\t\t\t\t\tcase 'field':\n\t\t\t\t\t\tcase 'entityRealm':\n\t\t\t\t\t\tcase 'entityList':\n\t\t\t\t\t\t\tyield* this.depthFirstAllNodes(childState)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase 'entityRealmStub':\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn assertNever(childState)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'field':\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\treturn assertNever(root)\n\t\t}\n\t\tyield root\n\t}\n\n\tpublic static *depthFirstINodes(\n\t\troot: StateINode,\n\t\tmatch?: (iNode: StateINode) => boolean,\n\t): IterableIterator<StateINode> {\n\t\tswitch (root.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList':\n\t\t\t\tfor (const childState of root.children.values()) {\n\t\t\t\t\tif (childState.type === 'entityRealm' || childState.type === 'entityList') {\n\t\t\t\t\t\tyield* this.depthFirstINodes(childState, match)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\treturn assertNever(root)\n\t\t}\n\t\tif (match === undefined || match(root)) {\n\t\t\tyield root\n\t\t}\n\t}\n\n\tpublic static *eachRootState(treeStore: TreeStore): IterableIterator<[PlaceholderName, RootStateNode]> {\n\t\tfor (const rootStates of treeStore.subTreeStatesByRoot.values()) {\n\t\t\tyield* rootStates.entries()\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;;oBAU2B;AAAA,UACX,iBACd,OACA,qBACqC;AACrC,aAAS,CAAC,UAAU,UAAU,MAAM,OAAO,QAAQ;AAClD,UAAI,MAAM,SAAS,mBAAmB;AACrC,YAAI,wBAAwB,UAAa,gBAAgB,OAAO,OAAO,aAAa,IAAI,sBAAsB;AAC7G,gBAAM;AACN,kBAAQ,MAAM,OAAO,OAAO,IAAI;AAAA,eAC1B;AAEN;AAAA;AAAA;AAGF,YAAM;AAAA;AAAA;AAAA,UAKO,sBACd,WACA,OACsB;AACtB,QAAI,MAAM,SAAS,gBAAgB,MAAM,UAAU,WAAW,QAAW;AAExE,iBAAW,GAAG,eAAe,UAAU,qBAAqB;AAC3D,cAAM,WAAW,WAAW,IAAI,MAAM,UAAU,OAAO;AACvD,YAAI,UAAU,SAAS,cAAc;AACpC,gBAAM;AAAA;AAAA;AAGR;AAAA;AAGD,QAAI;AACJ,QAAI;AAEJ,QAAI,MAAM,SAAS,SAAS;AAC3B,2BAAqB,MAAM;AAC3B,wBAAkB,MAAM;AAAA,eACd,MAAM,SAAS,cAAc;AACvC,2BAAqB,MAAM,UAAU;AACrC,wBAAkB,MAAM,UAAU,OAAO;AAAA,WACnC;AACN,aAAO;AAAY;AAGpB,eAAW,SAAS,KAAK,iBAAiB,oBAAoB,kBAAkB;AAC/E,YAAM,QAAQ,MAAM,SAAS,IAAI;AACjC,UAAI,UAAU,QAAW;AACxB;AAAA;AAED,UAAI,MAAM,SAAS,MAAM,MAAM;AAC9B,cAAM;AAAA;AAAA;AAAA;AAAA,UAKM,mBAAmB,MAA8C;AAC/E,YAAQ,KAAK;AAAA,WACP;AAAA,WACA;AACJ,mBAAW,cAAc,KAAK,SAAS,UAAU;AAChD,kBAAQ,WAAW;AAAA,iBACb;AAAA,iBACA;AAAA,iBACA;AACJ,qBAAO,KAAK,mBAAmB;AAC/B;AAAA,iBACI;AACJ;AAAA;AAEA,qBAAO;AAAY;AAAA;AAGtB;AAAA,WACI;AACJ;AAAA;AAEA,eAAO;AAAY;AAErB,UAAM;AAAA;AAAA,UAGQ,iBACd,MACA,OAC+B;AAC/B,YAAQ,KAAK;AAAA,WACP;AAAA,WACA;AACJ,mBAAW,cAAc,KAAK,SAAS,UAAU;AAChD,cAAI,WAAW,SAAS,iBAAiB,WAAW,SAAS,cAAc;AAC1E,mBAAO,KAAK,iBAAiB,YAAY;AAAA;AAAA;AAG3C;AAAA;AAEA,eAAO;AAAY;AAErB,QAAI,UAAU,UAAa,MAAM,OAAO;AACvC,YAAM;AAAA;AAAA;AAAA,UAIO,cAAc,WAA0E;AACtG,eAAW,cAAc,UAAU,oBAAoB,UAAU;AAChE,aAAO,WAAW;AAAA;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"StateIterator.js","sources":["../../../../src/core/state/StateIterator.ts"],"sourcesContent":["import { FieldMarker, HasManyRelationMarker, HasOneRelationMarker } from '../../markers'\nimport type { FieldValue, PlaceholderName } from '../../treeParameters'\nimport { assertNever } from '../../utils'\nimport type { TreeStore } from '../TreeStore'\nimport type { EntityListState } from './EntityListState'\nimport type { EntityRealmState, EntityRealmStateStub } from './EntityRealmState'\nimport type { FieldState } from './FieldState'\nimport { getEntityMarker } from './getEntityMarker'\nimport type { RootStateNode, StateINode, StateNode } from './StateNode'\n\nexport class StateIterator {\n\tpublic static *eachSiblingRealm(\n\t\tstate: EntityRealmState,\n\t\trelevantPlaceholder?: PlaceholderName,\n\t): IterableIterator<EntityRealmState> {\n\t\tfor (let [realmKey, realm] of state.entity.realms) {\n\t\t\tif (realm.type === 'entityRealmStub') {\n\t\t\t\tif (relevantPlaceholder === undefined || getEntityMarker(realm).fields.placeholders.has(relevantPlaceholder)) {\n\t\t\t\t\trealm.getAccessor()\n\t\t\t\t\trealm = state.entity.realms.get(realmKey) as EntityRealmState\n\t\t\t\t} else {\n\t\t\t\t\t// This realm is irrelevant. No need to force-initialize it.\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tyield realm\n\t\t}\n\t}\n\n\t// Note that this only yields siblings with the same placeholderName!\n\tpublic static *eachSiblingRealmChild<Value extends FieldValue, S extends EntityListState | FieldState<Value>>(\n\t\ttreeStore: TreeStore,\n\t\tstate: S & StateNode<Value>,\n\t): IterableIterator<S> {\n\t\tif (state.type === 'entityList' && state.blueprint.parent === undefined) {\n\t\t\t// Top-level entity list\n\t\t\tfor (const [, rootStates] of treeStore.subTreeStatesByRoot) {\n\t\t\t\tconst rootList = rootStates.get(state.blueprint.marker.placeholderName)\n\t\t\t\tif (rootList?.type === 'entityList') {\n\t\t\t\t\tyield rootList as S\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tlet closestEntityRealm: EntityRealmState\n\t\tlet placeholderName: PlaceholderName\n\n\t\tif (state.type === 'field') {\n\t\t\tclosestEntityRealm = state.parent\n\t\t\tplaceholderName = state.placeholderName\n\t\t} else if (state.type === 'entityList') {\n\t\t\tclosestEntityRealm = state.blueprint.parent! // The parent-less case is handled above. Hence the assertion.\n\t\t\tplaceholderName = state.blueprint.marker.placeholderName\n\t\t} else {\n\t\t\treturn assertNever(state)\n\t\t}\n\n\t\tfor (const realm of this.eachSiblingRealm(closestEntityRealm, placeholderName)) {\n\t\t\tconst child = realm.children.get(placeholderName)\n\t\t\tif (child === undefined) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (child.type === state.type) {\n\t\t\t\tyield child as S\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static *depthFirstAllNodes(root: StateNode): IterableIterator<StateNode> {\n\t\tswitch (root.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList':\n\t\t\t\tfor (const childState of root.children.values()) {\n\t\t\t\t\tswitch (childState.type) {\n\t\t\t\t\t\tcase 'field':\n\t\t\t\t\t\tcase 'entityRealm':\n\t\t\t\t\t\tcase 'entityList':\n\t\t\t\t\t\t\tyield* this.depthFirstAllNodes(childState)\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase 'entityRealmStub':\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\treturn assertNever(childState)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'field':\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\treturn assertNever(root)\n\t\t}\n\t\tyield root\n\t}\n\n\tpublic static *depthFirstINodes(\n\t\troot: StateINode,\n\t\tmatch?: (iNode: StateINode) => boolean,\n\t): IterableIterator<StateINode> {\n\t\tswitch (root.type) {\n\t\t\tcase 'entityRealm':\n\t\t\tcase 'entityList':\n\t\t\t\tfor (const childState of root.children.values()) {\n\t\t\t\t\tif (childState.type === 'entityRealm' || childState.type === 'entityList') {\n\t\t\t\t\t\tyield* this.depthFirstINodes(childState, match)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\treturn assertNever(root)\n\t\t}\n\t\tif (match === undefined || match(root)) {\n\t\t\tyield root\n\t\t}\n\t}\n\n\tpublic static *eachRootState(treeStore: TreeStore): IterableIterator<[PlaceholderName, RootStateNode]> {\n\t\tfor (const rootStates of treeStore.subTreeStatesByRoot.values()) {\n\t\t\tyield* rootStates.entries()\n\t\t}\n\t}\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AAAA,iBACb;AAAA,iBACA;AAAA,iBACA;AACG,qBAAA,KAAK,mBAAmB,UAAU;AACzC;AAAA,iBACI;AACJ;AAAA;AAEA,qBAAO,YAAsB;AAAA;AAAA,QAEhC;AACA;AAAA,WACI;AACJ;AAAA;AAEA,eAAO,YAAgB;AAAA;AAEnB,UAAA;AAAA,EACP;AAAA,UAEe,iBACd,MACA,OAC+B;AAC/B,YAAQ,KAAK;AAAA,WACP;AAAA,WACA;AACJ,mBAAW,cAAc,KAAK,SAAS,OAAA,GAAU;AAChD,cAAI,WAAW,SAAS,iBAAiB,WAAW,SAAS,cAAc;AACnE,mBAAA,KAAK,iBAAiB,YAAY,KAAK;AAAA,UAC/C;AAAA,QACD;AACA;AAAA;AAEA,eAAO,YAAgB;AAAA;AAEzB,QAAI,UAAU,UAAa,MAAM,IAAI,GAAG;AACjC,YAAA;AAAA,IACP;AAAA,EACD;AAAA,UAEe,cAAc,WAA0E;AACtG,eAAW,cAAc,UAAU,oBAAoB,OAAA,GAAU;AAChE,aAAO,WAAW;IACnB;AAAA,EACD;AACD;;"}
@@ -1,4 +1,3 @@
1
1
  const getEntityMarker = (realm) => realm.blueprint.type === "listEntity" ? realm.blueprint.parent.blueprint.marker : realm.blueprint.marker;
2
-
3
2
  export { getEntityMarker };
4
3
  //# sourceMappingURL=getEntityMarker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getEntityMarker.js","sources":["../../../../src/core/state/getEntityMarker.ts"],"sourcesContent":["import type { EntityRealmState, EntityRealmStateStub } from './EntityRealmState'\n\nexport const getEntityMarker = (realm: EntityRealmState | EntityRealmStateStub) =>\n\trealm.blueprint.type === 'listEntity' ? realm.blueprint.parent.blueprint.marker : realm.blueprint.marker\n"],"names":[],"mappings":"MAEa,kBAAkB,CAAC,UAC/B,MAAM,UAAU,SAAS,eAAe,MAAM,UAAU,OAAO,UAAU,SAAS,MAAM,UAAU;;;;"}
1
+ {"version":3,"file":"getEntityMarker.js","sources":["../../../../src/core/state/getEntityMarker.ts"],"sourcesContent":["import type { EntityRealmState, EntityRealmStateStub } from './EntityRealmState'\n\nexport const getEntityMarker = (realm: EntityRealmState | EntityRealmStateStub) =>\n\trealm.blueprint.type === 'listEntity' ? realm.blueprint.parent.blueprint.marker : realm.blueprint.marker\n"],"names":[],"mappings":"AAEO,MAAM,kBAAkB,CAAC,UAC/B,MAAM,UAAU,SAAS,eAAe,MAAM,UAAU,OAAO,UAAU,SAAS,MAAM,UAAU;;"}
@@ -27,6 +27,5 @@ const getCombinedSignal = (components) => {
27
27
  refresh();
28
28
  return controller.signal;
29
29
  };
30
-
31
30
  export { getCombinedSignal };
32
31
  //# sourceMappingURL=getCombinedSignal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCombinedSignal.js","sources":["../../../../src/core/utils/getCombinedSignal.ts"],"sourcesContent":["// Returns a signal that aborts when all present signals are aborted.\nexport const getCombinedSignal = (components: Iterable<AbortSignal | undefined>): AbortSignal => {\n\tlet abortedCount = 0\n\tlet signalCount = 0\n\n\tconst controller = new AbortController()\n\tconst refresh = () => {\n\t\tif (signalCount === 0) {\n\t\t\treturn\n\t\t}\n\t\tif (abortedCount >= signalCount) {\n\t\t\tcontroller.abort()\n\t\t}\n\t}\n\n\tfor (const component of components) {\n\t\tif (!component) {\n\t\t\tcontinue\n\t\t}\n\n\t\tsignalCount++\n\n\t\tif (component.aborted) {\n\t\t\tabortedCount++\n\t\t} else {\n\t\t\tcomponent.addEventListener('abort', () => {\n\t\t\t\tabortedCount++\n\t\t\t\trefresh()\n\t\t\t})\n\t\t}\n\t}\n\n\trefresh()\n\n\treturn controller.signal\n}\n"],"names":[],"mappings":"MACa,oBAAoB,CAAC,eAA+D;AAChG,MAAI,eAAe;AACnB,MAAI,cAAc;AAElB,QAAM,aAAa,IAAI;AACvB,QAAM,UAAU,MAAM;AACrB,QAAI,gBAAgB,GAAG;AACtB;AAAA;AAED,QAAI,gBAAgB,aAAa;AAChC,iBAAW;AAAA;AAAA;AAIb,aAAW,aAAa,YAAY;AACnC,QAAI,CAAC,WAAW;AACf;AAAA;AAGD;AAEA,QAAI,UAAU,SAAS;AACtB;AAAA,WACM;AACN,gBAAU,iBAAiB,SAAS,MAAM;AACzC;AACA;AAAA;AAAA;AAAA;AAKH;AAEA,SAAO,WAAW;AAAA;;;;"}
1
+ {"version":3,"file":"getCombinedSignal.js","sources":["../../../../src/core/utils/getCombinedSignal.ts"],"sourcesContent":["// Returns a signal that aborts when all present signals are aborted.\nexport const getCombinedSignal = (components: Iterable<AbortSignal | undefined>): AbortSignal => {\n\tlet abortedCount = 0\n\tlet signalCount = 0\n\n\tconst controller = new AbortController()\n\tconst refresh = () => {\n\t\tif (signalCount === 0) {\n\t\t\treturn\n\t\t}\n\t\tif (abortedCount >= signalCount) {\n\t\t\tcontroller.abort()\n\t\t}\n\t}\n\n\tfor (const component of components) {\n\t\tif (!component) {\n\t\t\tcontinue\n\t\t}\n\n\t\tsignalCount++\n\n\t\tif (component.aborted) {\n\t\t\tabortedCount++\n\t\t} else {\n\t\t\tcomponent.addEventListener('abort', () => {\n\t\t\t\tabortedCount++\n\t\t\t\trefresh()\n\t\t\t})\n\t\t}\n\t}\n\n\trefresh()\n\n\treturn controller.signal\n}\n"],"names":[],"mappings":"AACa,MAAA,oBAAoB,CAAC,eAA+D;AAChG,MAAI,eAAe;AACnB,MAAI,cAAc;AAEZ,QAAA,aAAa,IAAI;AACvB,QAAM,UAAU,MAAM;AACrB,QAAI,gBAAgB,GAAG;AACtB;AAAA,IACD;AACA,QAAI,gBAAgB,aAAa;AAChC,iBAAW,MAAM;AAAA,IAClB;AAAA,EAAA;AAGD,aAAW,aAAa,YAAY;AACnC,QAAI,CAAC,WAAW;AACf;AAAA,IACD;AAEA;AAEA,QAAI,UAAU,SAAS;AACtB;AAAA,IAAA,OACM;AACI,gBAAA,iBAAiB,SAAS,MAAM;AACzC;AACQ;MAAA,CACR;AAAA,IACF;AAAA,EACD;AAEQ;AAER,SAAO,WAAW;AACnB;;"}
@@ -1,6 +1,5 @@
1
- import { memo } from 'react';
2
- import { assertNever } from '../utils/assertNever.js';
3
-
1
+ import { memo } from "react";
2
+ import { assertNever } from "../utils/assertNever.js";
4
3
  function Component(render, decider, displayName) {
5
4
  if (decider === void 0 || typeof decider === "string") {
6
5
  render.displayName = decider;
@@ -25,6 +24,5 @@ function Component(render, decider, displayName) {
25
24
  }
26
25
  assertNever();
27
26
  }
28
-
29
27
  export { Component };
30
28
  //# sourceMappingURL=Component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Component.js","sources":["../../../src/coreComponents/Component.tsx"],"sourcesContent":["import { FunctionComponent, memo, NamedExoticComponent, ReactElement } from 'react'\nimport type { Environment } from '../dao'\nimport { assertNever } from '../utils'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from './MarkerProvider'\n\nfunction Component<Props extends {}>(\n\tstatelessRender: FunctionComponent<Props>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: FunctionComponent<Props>,\n\tstaticRender: (\n\t\tprops: StaticRenderProviderProps<Props, NonStaticPropNames>,\n\t\tenvironment: Environment,\n\t) => ReactElement | null,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: FunctionComponent<Props>,\n\tmarkerProvisions: MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\trender: FunctionComponent<Props>,\n\tdecider?:\n\t\t| string\n\t\t| ((props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactElement | null)\n\t\t| MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n) {\n\tif (decider === undefined || typeof decider === 'string') {\n\t\trender.displayName = decider\n\t\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props> = memo<Props>(render)\n\t\taugmentedRender.staticRender = render as StaticRenderProvider<Props>['staticRender']\n\t\taugmentedRender.displayName = decider\n\n\t\treturn augmentedRender\n\t}\n\n\trender.displayName = displayName\n\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props, NonStaticPropNames> = memo<Props>(render)\n\taugmentedRender.displayName = displayName\n\n\tif (typeof decider === 'function') {\n\t\taugmentedRender.staticRender = decider\n\n\t\treturn augmentedRender\n\t}\n\tif (typeof decider === 'object') {\n\t\tfor (const provisionName in decider) {\n\t\t\tconst methodName = provisionName as keyof MarkerProvider<Props, NonStaticPropNames>\n\t\t\t;(augmentedRender[methodName] as MarkerProvider<Props, NonStaticPropNames>[typeof methodName]) =\n\t\t\t\tdecider[methodName]\n\t\t}\n\n\t\treturn augmentedRender\n\t}\n\tassertNever(decider)\n}\n\nexport { Component }\n"],"names":[],"mappings":";;;AAsBA,mBACC,QACA,SAIA,aACC;AACD,MAAI,YAAY,UAAa,OAAO,YAAY,UAAU;AACzD,WAAO,cAAc;AACrB,UAAM,mBAAuE,KAAY;AACzF,qBAAgB,eAAe;AAC/B,qBAAgB,cAAc;AAE9B,WAAO;AAAA;AAGR,SAAO,cAAc;AACrB,QAAM,kBAA2F,KAAY;AAC7G,kBAAgB,cAAc;AAE9B,MAAI,OAAO,YAAY,YAAY;AAClC,oBAAgB,eAAe;AAE/B,WAAO;AAAA;AAER,MAAI,OAAO,YAAY,UAAU;AAChC,eAAW,iBAAiB,SAAS;AACpC,YAAM,aAAa;AAClB,MAAC,gBAAgB,cACjB,QAAQ;AAAA;AAGV,WAAO;AAAA;AAER;AAAY;;;;"}
1
+ {"version":3,"file":"Component.js","sources":["../../../src/coreComponents/Component.tsx"],"sourcesContent":["import { FunctionComponent, memo, NamedExoticComponent, ReactElement } from 'react'\nimport type { Environment } from '../dao'\nimport { assertNever } from '../utils'\nimport type { MarkerProvider, StaticRenderProvider, StaticRenderProviderProps } from './MarkerProvider'\n\nfunction Component<Props extends {}>(\n\tstatelessRender: FunctionComponent<Props>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: FunctionComponent<Props>,\n\tstaticRender: (\n\t\tprops: StaticRenderProviderProps<Props, NonStaticPropNames>,\n\t\tenvironment: Environment,\n\t) => ReactElement | null,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\tstatefulRender: FunctionComponent<Props>,\n\tmarkerProvisions: MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n): NamedExoticComponent<Props>\nfunction Component<Props extends {}, NonStaticPropNames extends keyof Props = never>(\n\trender: FunctionComponent<Props>,\n\tdecider?:\n\t\t| string\n\t\t| ((props: StaticRenderProviderProps<Props, NonStaticPropNames>, environment: Environment) => ReactElement | null)\n\t\t| MarkerProvider<Props, NonStaticPropNames>,\n\tdisplayName?: string,\n) {\n\tif (decider === undefined || typeof decider === 'string') {\n\t\trender.displayName = decider\n\t\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props> = memo<Props>(render)\n\t\taugmentedRender.staticRender = render as StaticRenderProvider<Props>['staticRender']\n\t\taugmentedRender.displayName = decider\n\n\t\treturn augmentedRender\n\t}\n\n\trender.displayName = displayName\n\tconst augmentedRender: NamedExoticComponent<Props> & MarkerProvider<Props, NonStaticPropNames> = memo<Props>(render)\n\taugmentedRender.displayName = displayName\n\n\tif (typeof decider === 'function') {\n\t\taugmentedRender.staticRender = decider\n\n\t\treturn augmentedRender\n\t}\n\tif (typeof decider === 'object') {\n\t\tfor (const provisionName in decider) {\n\t\t\tconst methodName = provisionName as keyof MarkerProvider<Props, NonStaticPropNames>\n\t\t\t;(augmentedRender[methodName] as MarkerProvider<Props, NonStaticPropNames>[typeof methodName]) =\n\t\t\t\tdecider[methodName]\n\t\t}\n\n\t\treturn augmentedRender\n\t}\n\tassertNever(decider)\n}\n\nexport { Component }\n"],"names":[],"mappings":";;AAsBA,mBACC,QACA,SAIA,aACC;AACD,MAAI,YAAY,UAAa,OAAO,YAAY,UAAU;AACzD,WAAO,cAAc;AACf,UAAA,mBAAuE,KAAY,MAAM;AAC/F,qBAAgB,eAAe;AAC/B,qBAAgB,cAAc;AAEvB,WAAA;AAAA,EACR;AAEA,SAAO,cAAc;AACf,QAAA,kBAA2F,KAAY,MAAM;AACnH,kBAAgB,cAAc;AAE1B,MAAA,OAAO,YAAY,YAAY;AAClC,oBAAgB,eAAe;AAExB,WAAA;AAAA,EACR;AACI,MAAA,OAAO,YAAY,UAAU;AAChC,eAAW,iBAAiB,SAAS;AACpC,YAAM,aAAa;AACjB,sBAAgB,cACjB,QAAQ;AAAA,IACV;AAEO,WAAA;AAAA,EACR;AACA,cAAmB;AACpB;;"}
@@ -1,7 +1,6 @@
1
- import { memo, createElement } from 'react';
2
- import { useDataBinding } from '../accessorTree/useDataBinding.js';
3
- import { AccessorTree } from '../accessorTree/AccessorTree.js';
4
-
1
+ import { memo, createElement } from "react";
2
+ import { useDataBinding } from "../accessorTree/useDataBinding.js";
3
+ import { AccessorTree } from "../accessorTree/AccessorTree.js";
5
4
  const DataBindingProvider = memo(function DataBindingProvider2(props) {
6
5
  const accessorTreeState = useDataBinding({
7
6
  nodeTree: props.children,
@@ -16,6 +15,5 @@ const DataBindingProvider = memo(function DataBindingProvider2(props) {
16
15
  state: accessorTreeState
17
16
  }, children);
18
17
  });
19
-
20
18
  export { DataBindingProvider };
21
19
  //# sourceMappingURL=DataBindingProvider.js.map