@contember/binding 1.0.0-rc.2 → 1.0.0-rc.4

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 (802) hide show
  1. package/dist/development/accessors/FieldAccessor.js +2 -1
  2. package/dist/development/accessors/FieldAccessor.js.map +1 -1
  3. package/dist/development/core/StateInitializer.js +8 -1
  4. package/dist/development/core/StateInitializer.js.map +1 -1
  5. package/dist/production/accessors/FieldAccessor.js +2 -1
  6. package/dist/production/accessors/FieldAccessor.js.map +1 -1
  7. package/dist/production/core/StateInitializer.js +8 -1
  8. package/dist/production/core/StateInitializer.js.map +1 -1
  9. package/dist/types/BindingError.d.ts +4 -0
  10. package/dist/types/BindingError.d.ts.map +1 -0
  11. package/dist/types/accessorPropagation/AccessorProvider.d.ts +8 -0
  12. package/dist/types/accessorPropagation/AccessorProvider.d.ts.map +1 -0
  13. package/dist/types/accessorPropagation/BindingOperationsContext.d.ts +5 -0
  14. package/dist/types/accessorPropagation/BindingOperationsContext.d.ts.map +1 -0
  15. package/dist/types/accessorPropagation/BindingOperationsProvider.d.ts +8 -0
  16. package/dist/types/accessorPropagation/BindingOperationsProvider.d.ts.map +1 -0
  17. package/dist/types/accessorPropagation/EntityKeyContext.d.ts +3 -0
  18. package/dist/types/accessorPropagation/EntityKeyContext.d.ts.map +1 -0
  19. package/dist/types/accessorPropagation/EntityKeyProvider.d.ts +7 -0
  20. package/dist/types/accessorPropagation/EntityKeyProvider.d.ts.map +1 -0
  21. package/dist/types/accessorPropagation/EnvironmentContext.d.ts +4 -0
  22. package/dist/types/accessorPropagation/EnvironmentContext.d.ts.map +1 -0
  23. package/dist/types/accessorPropagation/TreeRootIdContext.d.ts +3 -0
  24. package/dist/types/accessorPropagation/TreeRootIdContext.d.ts.map +1 -0
  25. package/dist/types/accessorPropagation/TreeRootIdProvider.d.ts +8 -0
  26. package/dist/types/accessorPropagation/TreeRootIdProvider.d.ts.map +1 -0
  27. package/dist/types/accessorPropagation/index.d.ts +27 -0
  28. package/dist/types/accessorPropagation/index.d.ts.map +1 -0
  29. package/dist/types/accessorPropagation/useAccessorUpdateSubscription.d.ts +16 -0
  30. package/dist/types/accessorPropagation/useAccessorUpdateSubscription.d.ts.map +1 -0
  31. package/dist/types/accessorPropagation/useBindingOperations.d.ts +3 -0
  32. package/dist/types/accessorPropagation/useBindingOperations.d.ts.map +1 -0
  33. package/dist/types/accessorPropagation/useDesugaredRelativeEntityList.d.ts +11 -0
  34. package/dist/types/accessorPropagation/useDesugaredRelativeEntityList.d.ts.map +1 -0
  35. package/dist/types/accessorPropagation/useDesugaredRelativeSingleEntity.d.ts +11 -0
  36. package/dist/types/accessorPropagation/useDesugaredRelativeSingleEntity.d.ts.map +1 -0
  37. package/dist/types/accessorPropagation/useDesugaredRelativeSingleField.d.ts +11 -0
  38. package/dist/types/accessorPropagation/useDesugaredRelativeSingleField.d.ts.map +1 -0
  39. package/dist/types/accessorPropagation/useEntity.d.ts +7 -0
  40. package/dist/types/accessorPropagation/useEntity.d.ts.map +1 -0
  41. package/dist/types/accessorPropagation/useEntityKey.d.ts +2 -0
  42. package/dist/types/accessorPropagation/useEntityKey.d.ts.map +1 -0
  43. package/dist/types/accessorPropagation/useEntityList.d.ts +6 -0
  44. package/dist/types/accessorPropagation/useEntityList.d.ts.map +1 -0
  45. package/dist/types/accessorPropagation/useEntityListSubTree.d.ts +4 -0
  46. package/dist/types/accessorPropagation/useEntityListSubTree.d.ts.map +1 -0
  47. package/dist/types/accessorPropagation/useEntityListSubTreeParameters.d.ts +5 -0
  48. package/dist/types/accessorPropagation/useEntityListSubTreeParameters.d.ts.map +1 -0
  49. package/dist/types/accessorPropagation/useEntitySubTree.d.ts +4 -0
  50. package/dist/types/accessorPropagation/useEntitySubTree.d.ts.map +1 -0
  51. package/dist/types/accessorPropagation/useEntitySubTreeParameters.d.ts +5 -0
  52. package/dist/types/accessorPropagation/useEntitySubTreeParameters.d.ts.map +1 -0
  53. package/dist/types/accessorPropagation/useEnvironment.d.ts +3 -0
  54. package/dist/types/accessorPropagation/useEnvironment.d.ts.map +1 -0
  55. package/dist/types/accessorPropagation/useField.d.ts +6 -0
  56. package/dist/types/accessorPropagation/useField.d.ts.map +1 -0
  57. package/dist/types/accessorPropagation/useGetEntityByKey.d.ts +3 -0
  58. package/dist/types/accessorPropagation/useGetEntityByKey.d.ts.map +1 -0
  59. package/dist/types/accessorPropagation/useGetEntityListSubTree.d.ts +4 -0
  60. package/dist/types/accessorPropagation/useGetEntityListSubTree.d.ts.map +1 -0
  61. package/dist/types/accessorPropagation/useGetEntitySubTree.d.ts +4 -0
  62. package/dist/types/accessorPropagation/useGetEntitySubTree.d.ts.map +1 -0
  63. package/dist/types/accessorPropagation/useGetTreeFilters.d.ts +3 -0
  64. package/dist/types/accessorPropagation/useGetTreeFilters.d.ts.map +1 -0
  65. package/dist/types/accessorPropagation/useHasEntity.d.ts +2 -0
  66. package/dist/types/accessorPropagation/useHasEntity.d.ts.map +1 -0
  67. package/dist/types/accessorPropagation/usePersist.d.ts +3 -0
  68. package/dist/types/accessorPropagation/usePersist.d.ts.map +1 -0
  69. package/dist/types/accessorPropagation/useTreeRootId.d.ts +3 -0
  70. package/dist/types/accessorPropagation/useTreeRootId.d.ts.map +1 -0
  71. package/dist/types/accessorSorting/SetOrderFieldOnCreate.d.ts +10 -0
  72. package/dist/types/accessorSorting/SetOrderFieldOnCreate.d.ts.map +1 -0
  73. package/dist/types/accessorSorting/SortedEntities.d.ts +9 -0
  74. package/dist/types/accessorSorting/SortedEntities.d.ts.map +1 -0
  75. package/dist/types/accessorSorting/addEntityAtIndex.d.ts +4 -0
  76. package/dist/types/accessorSorting/addEntityAtIndex.d.ts.map +1 -0
  77. package/dist/types/accessorSorting/errors.d.ts +6 -0
  78. package/dist/types/accessorSorting/errors.d.ts.map +1 -0
  79. package/dist/types/accessorSorting/index.d.ts +8 -0
  80. package/dist/types/accessorSorting/index.d.ts.map +1 -0
  81. package/dist/types/accessorSorting/moveEntity.d.ts +5 -0
  82. package/dist/types/accessorSorting/moveEntity.d.ts.map +1 -0
  83. package/dist/types/accessorSorting/repairEntitiesOrder.d.ts +4 -0
  84. package/dist/types/accessorSorting/repairEntitiesOrder.d.ts.map +1 -0
  85. package/dist/types/accessorSorting/sortEntities.d.ts +4 -0
  86. package/dist/types/accessorSorting/sortEntities.d.ts.map +1 -0
  87. package/dist/types/accessorSorting/useSortedEntities.d.ts +5 -0
  88. package/dist/types/accessorSorting/useSortedEntities.d.ts.map +1 -0
  89. package/dist/types/accessorTree/AccessorTree.d.ts +11 -0
  90. package/dist/types/accessorTree/AccessorTree.d.ts.map +1 -0
  91. package/dist/types/accessorTree/AccessorTreeState.d.ts +15 -0
  92. package/dist/types/accessorTree/AccessorTreeState.d.ts.map +1 -0
  93. package/dist/types/accessorTree/AccessorTreeStateAction.d.ts +12 -0
  94. package/dist/types/accessorTree/AccessorTreeStateAction.d.ts.map +1 -0
  95. package/dist/types/accessorTree/AccessorTreeStateMetadata.d.ts +4 -0
  96. package/dist/types/accessorTree/AccessorTreeStateMetadata.d.ts.map +1 -0
  97. package/dist/types/accessorTree/AccessorTreeStateOptions.d.ts +7 -0
  98. package/dist/types/accessorTree/AccessorTreeStateOptions.d.ts.map +1 -0
  99. package/dist/types/accessorTree/DirtinessContext.d.ts +3 -0
  100. package/dist/types/accessorTree/DirtinessContext.d.ts.map +1 -0
  101. package/dist/types/accessorTree/MutationRequestResponse.d.ts +44 -0
  102. package/dist/types/accessorTree/MutationRequestResponse.d.ts.map +1 -0
  103. package/dist/types/accessorTree/MutationStateContext.d.ts +3 -0
  104. package/dist/types/accessorTree/MutationStateContext.d.ts.map +1 -0
  105. package/dist/types/accessorTree/NormalizedPersistedData.d.ts +13 -0
  106. package/dist/types/accessorTree/NormalizedPersistedData.d.ts.map +1 -0
  107. package/dist/types/accessorTree/PersistResult.d.ts +24 -0
  108. package/dist/types/accessorTree/PersistResult.d.ts.map +1 -0
  109. package/dist/types/accessorTree/QueryRequestResponse.d.ts +15 -0
  110. package/dist/types/accessorTree/QueryRequestResponse.d.ts.map +1 -0
  111. package/dist/types/accessorTree/RequestError.d.ts +13 -0
  112. package/dist/types/accessorTree/RequestError.d.ts.map +1 -0
  113. package/dist/types/accessorTree/RuntimeId.d.ts +25 -0
  114. package/dist/types/accessorTree/RuntimeId.d.ts.map +1 -0
  115. package/dist/types/accessorTree/accessorTreeStateReducer.d.ts +4 -0
  116. package/dist/types/accessorTree/accessorTreeStateReducer.d.ts.map +1 -0
  117. package/dist/types/accessorTree/index.d.ts +19 -0
  118. package/dist/types/accessorTree/index.d.ts.map +1 -0
  119. package/dist/types/accessorTree/metadataToRequestError.d.ts +4 -0
  120. package/dist/types/accessorTree/metadataToRequestError.d.ts.map +1 -0
  121. package/dist/types/accessorTree/useDataBinding.d.ts +4 -0
  122. package/dist/types/accessorTree/useDataBinding.d.ts.map +1 -0
  123. package/dist/types/accessorTree/useDirtinessState.d.ts +2 -0
  124. package/dist/types/accessorTree/useDirtinessState.d.ts.map +1 -0
  125. package/dist/types/accessorTree/useMutationState.d.ts +2 -0
  126. package/dist/types/accessorTree/useMutationState.d.ts.map +1 -0
  127. package/dist/types/accessors/AsyncBatchUpdatesOptions.d.ts +8 -0
  128. package/dist/types/accessors/AsyncBatchUpdatesOptions.d.ts.map +1 -0
  129. package/dist/types/accessors/BatchUpdatesOptions.d.ts +9 -0
  130. package/dist/types/accessors/BatchUpdatesOptions.d.ts.map +1 -0
  131. package/dist/types/accessors/BindingConfig.d.ts +8 -0
  132. package/dist/types/accessors/BindingConfig.d.ts.map +1 -0
  133. package/dist/types/accessors/BindingOperations.d.ts +12 -0
  134. package/dist/types/accessors/BindingOperations.d.ts.map +1 -0
  135. package/dist/types/accessors/EntityAccessor.d.ts +90 -0
  136. package/dist/types/accessors/EntityAccessor.d.ts.map +1 -0
  137. package/dist/types/accessors/EntityListAccessor.d.ts +84 -0
  138. package/dist/types/accessors/EntityListAccessor.d.ts.map +1 -0
  139. package/dist/types/accessors/ErrorAccessor.d.ts +26 -0
  140. package/dist/types/accessors/ErrorAccessor.d.ts.map +1 -0
  141. package/dist/types/accessors/Errorable.d.ts +5 -0
  142. package/dist/types/accessors/Errorable.d.ts.map +1 -0
  143. package/dist/types/accessors/ExtendTree.d.ts +9 -0
  144. package/dist/types/accessors/ExtendTree.d.ts.map +1 -0
  145. package/dist/types/accessors/FieldAccessor.d.ts +55 -0
  146. package/dist/types/accessors/FieldAccessor.d.ts.map +1 -0
  147. package/dist/types/accessors/GetEntityByKey.d.ts +3 -0
  148. package/dist/types/accessors/GetEntityByKey.d.ts.map +1 -0
  149. package/dist/types/accessors/GetEntityListSubTree.d.ts +5 -0
  150. package/dist/types/accessors/GetEntityListSubTree.d.ts.map +1 -0
  151. package/dist/types/accessors/GetEntitySubTree.d.ts +5 -0
  152. package/dist/types/accessors/GetEntitySubTree.d.ts.map +1 -0
  153. package/dist/types/accessors/Persist.d.ts +10 -0
  154. package/dist/types/accessors/Persist.d.ts.map +1 -0
  155. package/dist/types/accessors/PersistErrorOptions.d.ts +10 -0
  156. package/dist/types/accessors/PersistErrorOptions.d.ts.map +1 -0
  157. package/dist/types/accessors/PersistSuccessOptions.d.ts +5 -0
  158. package/dist/types/accessors/PersistSuccessOptions.d.ts.map +1 -0
  159. package/dist/types/accessors/TreeRootAccessor.d.ts +11 -0
  160. package/dist/types/accessors/TreeRootAccessor.d.ts.map +1 -0
  161. package/dist/types/accessors/index.d.ts +18 -0
  162. package/dist/types/accessors/index.d.ts.map +1 -0
  163. package/dist/types/bindingTypes.d.ts +4 -0
  164. package/dist/types/bindingTypes.d.ts.map +1 -0
  165. package/dist/types/core/AccessorErrorManager.d.ts +24 -0
  166. package/dist/types/core/AccessorErrorManager.d.ts.map +1 -0
  167. package/dist/types/core/Config.d.ts +9 -0
  168. package/dist/types/core/Config.d.ts.map +1 -0
  169. package/dist/types/core/DataBinding.d.ts +37 -0
  170. package/dist/types/core/DataBinding.d.ts.map +1 -0
  171. package/dist/types/core/DirtinessTracker.d.ts +12 -0
  172. package/dist/types/core/DirtinessTracker.d.ts.map +1 -0
  173. package/dist/types/core/ErrorsPreprocessor.d.ts +33 -0
  174. package/dist/types/core/ErrorsPreprocessor.d.ts.map +1 -0
  175. package/dist/types/core/EventManager.d.ts +56 -0
  176. package/dist/types/core/EventManager.d.ts.map +1 -0
  177. package/dist/types/core/IncrementalMarkerBuilder.d.ts +7 -0
  178. package/dist/types/core/IncrementalMarkerBuilder.d.ts.map +1 -0
  179. package/dist/types/core/MarkerComparator.d.ts +8 -0
  180. package/dist/types/core/MarkerComparator.d.ts.map +1 -0
  181. package/dist/types/core/MarkerMerger.d.ts +22 -0
  182. package/dist/types/core/MarkerMerger.d.ts.map +1 -0
  183. package/dist/types/core/MarkerTreeGenerator.d.ts +14 -0
  184. package/dist/types/core/MarkerTreeGenerator.d.ts.map +1 -0
  185. package/dist/types/core/MutationGenerator.d.ts +18 -0
  186. package/dist/types/core/MutationGenerator.d.ts.map +1 -0
  187. package/dist/types/core/QueryGenerator.d.ts +14 -0
  188. package/dist/types/core/QueryGenerator.d.ts.map +1 -0
  189. package/dist/types/core/RealmKeyGenerator.d.ts +11 -0
  190. package/dist/types/core/RealmKeyGenerator.d.ts.map +1 -0
  191. package/dist/types/core/RequestResponseNormalizer.d.ts +11 -0
  192. package/dist/types/core/RequestResponseNormalizer.d.ts.map +1 -0
  193. package/dist/types/core/StateInitializer.d.ts +38 -0
  194. package/dist/types/core/StateInitializer.d.ts.map +1 -0
  195. package/dist/types/core/TreeAugmenter.d.ts +20 -0
  196. package/dist/types/core/TreeAugmenter.d.ts.map +1 -0
  197. package/dist/types/core/TreeFilterGenerator.d.ts +13 -0
  198. package/dist/types/core/TreeFilterGenerator.d.ts.map +1 -0
  199. package/dist/types/core/TreeParameterMerger.d.ts +20 -0
  200. package/dist/types/core/TreeParameterMerger.d.ts.map +1 -0
  201. package/dist/types/core/TreeStore.d.ts +32 -0
  202. package/dist/types/core/TreeStore.d.ts.map +1 -0
  203. package/dist/types/core/UpdateMetadata.d.ts +4 -0
  204. package/dist/types/core/UpdateMetadata.d.ts.map +1 -0
  205. package/dist/types/core/VariableInputTransformer.d.ts +7 -0
  206. package/dist/types/core/VariableInputTransformer.d.ts.map +1 -0
  207. package/dist/types/core/exceptions/ErrorLocator.d.ts +8 -0
  208. package/dist/types/core/exceptions/ErrorLocator.d.ts.map +1 -0
  209. package/dist/types/core/exceptions/LocalizedBindingError.d.ts +9 -0
  210. package/dist/types/core/exceptions/LocalizedBindingError.d.ts.map +1 -0
  211. package/dist/types/core/exceptions/MarkerSugarer.d.ts +10 -0
  212. package/dist/types/core/exceptions/MarkerSugarer.d.ts.map +1 -0
  213. package/dist/types/core/exceptions/RawMarkerPath.d.ts +3 -0
  214. package/dist/types/core/exceptions/RawMarkerPath.d.ts.map +1 -0
  215. package/dist/types/core/exceptions/TreeParameterSugarer.d.ts +11 -0
  216. package/dist/types/core/exceptions/TreeParameterSugarer.d.ts.map +1 -0
  217. package/dist/types/core/exceptions/index.d.ts +6 -0
  218. package/dist/types/core/exceptions/index.d.ts.map +1 -0
  219. package/dist/types/core/factories/createBatchUpdatesOptions.d.ts +5 -0
  220. package/dist/types/core/factories/createBatchUpdatesOptions.d.ts.map +1 -0
  221. package/dist/types/core/factories/index.d.ts +2 -0
  222. package/dist/types/core/factories/index.d.ts.map +1 -0
  223. package/dist/types/core/index.d.ts +6 -0
  224. package/dist/types/core/index.d.ts.map +1 -0
  225. package/dist/types/core/operations/EntityOperations.d.ts +26 -0
  226. package/dist/types/core/operations/EntityOperations.d.ts.map +1 -0
  227. package/dist/types/core/operations/FieldOperations.d.ts +22 -0
  228. package/dist/types/core/operations/FieldOperations.d.ts.map +1 -0
  229. package/dist/types/core/operations/ListOperations.d.ts +32 -0
  230. package/dist/types/core/operations/ListOperations.d.ts.map +1 -0
  231. package/dist/types/core/operations/OperationsHelpers.d.ts +14 -0
  232. package/dist/types/core/operations/OperationsHelpers.d.ts.map +1 -0
  233. package/dist/types/core/operations/index.d.ts +4 -0
  234. package/dist/types/core/operations/index.d.ts.map +1 -0
  235. package/dist/types/core/requestAliases/MutationAlias.d.ts +9 -0
  236. package/dist/types/core/requestAliases/MutationAlias.d.ts.map +1 -0
  237. package/dist/types/core/requestAliases/TopLevelMutationOperation.d.ts +11 -0
  238. package/dist/types/core/requestAliases/TopLevelMutationOperation.d.ts.map +1 -0
  239. package/dist/types/core/requestAliases/index.d.ts +5 -0
  240. package/dist/types/core/requestAliases/index.d.ts.map +1 -0
  241. package/dist/types/core/requestAliases/mutationOperationSubTreeType.d.ts +5 -0
  242. package/dist/types/core/requestAliases/mutationOperationSubTreeType.d.ts.map +1 -0
  243. package/dist/types/core/requestAliases/mutationOperationType.d.ts +6 -0
  244. package/dist/types/core/requestAliases/mutationOperationType.d.ts.map +1 -0
  245. package/dist/types/core/schema/RawSchema.d.ts +7 -0
  246. package/dist/types/core/schema/RawSchema.d.ts.map +1 -0
  247. package/dist/types/core/schema/RawSchemaEntity.d.ts +12 -0
  248. package/dist/types/core/schema/RawSchemaEntity.d.ts.map +1 -0
  249. package/dist/types/core/schema/RawSchemaEnum.d.ts +6 -0
  250. package/dist/types/core/schema/RawSchemaEnum.d.ts.map +1 -0
  251. package/dist/types/core/schema/Schema.d.ts +9 -0
  252. package/dist/types/core/schema/Schema.d.ts.map +1 -0
  253. package/dist/types/core/schema/SchemaColumn.d.ts +12 -0
  254. package/dist/types/core/schema/SchemaColumn.d.ts.map +1 -0
  255. package/dist/types/core/schema/SchemaColumnType.d.ts +3 -0
  256. package/dist/types/core/schema/SchemaColumnType.d.ts.map +1 -0
  257. package/dist/types/core/schema/SchemaEntities.d.ts +4 -0
  258. package/dist/types/core/schema/SchemaEntities.d.ts.map +1 -0
  259. package/dist/types/core/schema/SchemaEntity.d.ts +10 -0
  260. package/dist/types/core/schema/SchemaEntity.d.ts.map +1 -0
  261. package/dist/types/core/schema/SchemaEnums.d.ts +4 -0
  262. package/dist/types/core/schema/SchemaEnums.d.ts.map +1 -0
  263. package/dist/types/core/schema/SchemaField.d.ts +4 -0
  264. package/dist/types/core/schema/SchemaField.d.ts.map +1 -0
  265. package/dist/types/core/schema/SchemaFields.d.ts +4 -0
  266. package/dist/types/core/schema/SchemaFields.d.ts.map +1 -0
  267. package/dist/types/core/schema/SchemaLoader.d.ts +7 -0
  268. package/dist/types/core/schema/SchemaLoader.d.ts.map +1 -0
  269. package/dist/types/core/schema/SchemaPreprocessor.d.ts +9 -0
  270. package/dist/types/core/schema/SchemaPreprocessor.d.ts.map +1 -0
  271. package/dist/types/core/schema/SchemaRelation.d.ts +24 -0
  272. package/dist/types/core/schema/SchemaRelation.d.ts.map +1 -0
  273. package/dist/types/core/schema/SchemaRelationOrderBy.d.ts +5 -0
  274. package/dist/types/core/schema/SchemaRelationOrderBy.d.ts.map +1 -0
  275. package/dist/types/core/schema/SchemaStore.d.ts +7 -0
  276. package/dist/types/core/schema/SchemaStore.d.ts.map +1 -0
  277. package/dist/types/core/schema/SchemaUniqueConstraint.d.ts +5 -0
  278. package/dist/types/core/schema/SchemaUniqueConstraint.d.ts.map +1 -0
  279. package/dist/types/core/schema/SchemaValidator.d.ts +14 -0
  280. package/dist/types/core/schema/SchemaValidator.d.ts.map +1 -0
  281. package/dist/types/core/schema/index.d.ts +15 -0
  282. package/dist/types/core/schema/index.d.ts.map +1 -0
  283. package/dist/types/core/state/EntityListState.d.ts +27 -0
  284. package/dist/types/core/state/EntityListState.d.ts.map +1 -0
  285. package/dist/types/core/state/EntityRealmState.d.ts +44 -0
  286. package/dist/types/core/state/EntityRealmState.d.ts.map +1 -0
  287. package/dist/types/core/state/EntityState.d.ts +12 -0
  288. package/dist/types/core/state/EntityState.d.ts.map +1 -0
  289. package/dist/types/core/state/FieldState.d.ts +19 -0
  290. package/dist/types/core/state/FieldState.d.ts.map +1 -0
  291. package/dist/types/core/state/StateIterator.d.ts +14 -0
  292. package/dist/types/core/state/StateIterator.d.ts.map +1 -0
  293. package/dist/types/core/state/StateNode.d.ts +8 -0
  294. package/dist/types/core/state/StateNode.d.ts.map +1 -0
  295. package/dist/types/core/state/getEntityMarker.d.ts +3 -0
  296. package/dist/types/core/state/getEntityMarker.d.ts.map +1 -0
  297. package/dist/types/core/state/index.d.ts +8 -0
  298. package/dist/types/core/state/index.d.ts.map +1 -0
  299. package/dist/types/core/utils/getCombinedSignal.d.ts +2 -0
  300. package/dist/types/core/utils/getCombinedSignal.d.ts.map +1 -0
  301. package/dist/types/core/utils/index.d.ts +2 -0
  302. package/dist/types/core/utils/index.d.ts.map +1 -0
  303. package/dist/types/coreComponents/Component.d.ts +8 -0
  304. package/dist/types/coreComponents/Component.d.ts.map +1 -0
  305. package/dist/types/coreComponents/DataBindingProvider.d.ts +17 -0
  306. package/dist/types/coreComponents/DataBindingProvider.d.ts.map +1 -0
  307. package/dist/types/coreComponents/Entity.d.ts +9 -0
  308. package/dist/types/coreComponents/Entity.d.ts.map +1 -0
  309. package/dist/types/coreComponents/EntityList.d.ts +12 -0
  310. package/dist/types/coreComponents/EntityList.d.ts.map +1 -0
  311. package/dist/types/coreComponents/EntityListSubTree.d.ts +16 -0
  312. package/dist/types/coreComponents/EntityListSubTree.d.ts.map +1 -0
  313. package/dist/types/coreComponents/EntitySubTree.d.ts +14 -0
  314. package/dist/types/coreComponents/EntitySubTree.d.ts.map +1 -0
  315. package/dist/types/coreComponents/Field.d.ts +11 -0
  316. package/dist/types/coreComponents/Field.d.ts.map +1 -0
  317. package/dist/types/coreComponents/HasMany.d.ts +13 -0
  318. package/dist/types/coreComponents/HasMany.d.ts.map +1 -0
  319. package/dist/types/coreComponents/HasOne.d.ts +9 -0
  320. package/dist/types/coreComponents/HasOne.d.ts.map +1 -0
  321. package/dist/types/coreComponents/MarkerProvider.d.ts +21 -0
  322. package/dist/types/coreComponents/MarkerProvider.d.ts.map +1 -0
  323. package/dist/types/coreComponents/ParentEntity.d.ts +7 -0
  324. package/dist/types/coreComponents/ParentEntity.d.ts.map +1 -0
  325. package/dist/types/coreComponents/index.d.ts +12 -0
  326. package/dist/types/coreComponents/index.d.ts.map +1 -0
  327. package/dist/types/dao/Environment.d.ts +55 -0
  328. package/dist/types/dao/Environment.d.ts.map +1 -0
  329. package/dist/types/dao/VariableFieldValue.d.ts +5 -0
  330. package/dist/types/dao/VariableFieldValue.d.ts.map +1 -0
  331. package/dist/types/dao/index.d.ts +3 -0
  332. package/dist/types/dao/index.d.ts.map +1 -0
  333. package/dist/types/entityEvents/index.d.ts +8 -0
  334. package/dist/types/entityEvents/index.d.ts.map +1 -0
  335. package/dist/types/entityEvents/useDerivedField.d.ts +9 -0
  336. package/dist/types/entityEvents/useDerivedField.d.ts.map +1 -0
  337. package/dist/types/entityEvents/useEntityBeforePersist.d.ts +3 -0
  338. package/dist/types/entityEvents/useEntityBeforePersist.d.ts.map +1 -0
  339. package/dist/types/entityEvents/useEntityBeforeUpdate.d.ts +3 -0
  340. package/dist/types/entityEvents/useEntityBeforeUpdate.d.ts.map +1 -0
  341. package/dist/types/entityEvents/useEntityEvent.d.ts +9 -0
  342. package/dist/types/entityEvents/useEntityEvent.d.ts.map +1 -0
  343. package/dist/types/entityEvents/useEntityPersistError.d.ts +3 -0
  344. package/dist/types/entityEvents/useEntityPersistError.d.ts.map +1 -0
  345. package/dist/types/entityEvents/useEntityPersistSuccess.d.ts +3 -0
  346. package/dist/types/entityEvents/useEntityPersistSuccess.d.ts.map +1 -0
  347. package/dist/types/entityEvents/useOnConnectionUpdate.d.ts +4 -0
  348. package/dist/types/entityEvents/useOnConnectionUpdate.d.ts.map +1 -0
  349. package/dist/types/fieldHelpers/helpers/FieldHelper.d.ts +7 -0
  350. package/dist/types/fieldHelpers/helpers/FieldHelper.d.ts.map +1 -0
  351. package/dist/types/fieldHelpers/helpers/TemporalFieldHelper.d.ts +10 -0
  352. package/dist/types/fieldHelpers/helpers/TemporalFieldHelper.d.ts.map +1 -0
  353. package/dist/types/fieldHelpers/helpers/UuidFieldHelper.d.ts +10 -0
  354. package/dist/types/fieldHelpers/helpers/UuidFieldHelper.d.ts.map +1 -0
  355. package/dist/types/fieldHelpers/helpers/index.d.ts +3 -0
  356. package/dist/types/fieldHelpers/helpers/index.d.ts.map +1 -0
  357. package/dist/types/fieldHelpers/index.d.ts +2 -0
  358. package/dist/types/fieldHelpers/index.d.ts.map +1 -0
  359. package/dist/types/helperComponents/DeferredSubTrees.d.ts +7 -0
  360. package/dist/types/helperComponents/DeferredSubTrees.d.ts.map +1 -0
  361. package/dist/types/helperComponents/EntityView.d.ts +9 -0
  362. package/dist/types/helperComponents/EntityView.d.ts.map +1 -0
  363. package/dist/types/helperComponents/FieldView.d.ts +46 -0
  364. package/dist/types/helperComponents/FieldView.d.ts.map +1 -0
  365. package/dist/types/helperComponents/StaticRender.d.ts +6 -0
  366. package/dist/types/helperComponents/StaticRender.d.ts.map +1 -0
  367. package/dist/types/helperComponents/SugaredField.d.ts +9 -0
  368. package/dist/types/helperComponents/SugaredField.d.ts.map +1 -0
  369. package/dist/types/helperComponents/index.d.ts +6 -0
  370. package/dist/types/helperComponents/index.d.ts.map +1 -0
  371. package/dist/types/index.d.ts +17 -0
  372. package/dist/types/index.d.ts.map +1 -0
  373. package/dist/types/markers/EntityFieldMarkers.d.ts +7 -0
  374. package/dist/types/markers/EntityFieldMarkers.d.ts.map +1 -0
  375. package/dist/types/markers/EntityFieldMarkersContainer.d.ts +13 -0
  376. package/dist/types/markers/EntityFieldMarkersContainer.d.ts.map +1 -0
  377. package/dist/types/markers/EntityFieldPlaceholders.d.ts +3 -0
  378. package/dist/types/markers/EntityFieldPlaceholders.d.ts.map +1 -0
  379. package/dist/types/markers/EntityFieldsWithHoistablesMarker.d.ts +10 -0
  380. package/dist/types/markers/EntityFieldsWithHoistablesMarker.d.ts.map +1 -0
  381. package/dist/types/markers/EntityListSubTreeMarker.d.ts +12 -0
  382. package/dist/types/markers/EntityListSubTreeMarker.d.ts.map +1 -0
  383. package/dist/types/markers/EntitySubTreeMarker.d.ts +12 -0
  384. package/dist/types/markers/EntitySubTreeMarker.d.ts.map +1 -0
  385. package/dist/types/markers/FieldMarker.d.ts +14 -0
  386. package/dist/types/markers/FieldMarker.d.ts.map +1 -0
  387. package/dist/types/markers/HasManyRelationMarker.d.ts +12 -0
  388. package/dist/types/markers/HasManyRelationMarker.d.ts.map +1 -0
  389. package/dist/types/markers/HasOneRelationMarker.d.ts +12 -0
  390. package/dist/types/markers/HasOneRelationMarker.d.ts.map +1 -0
  391. package/dist/types/markers/MarkerTreeRoot.d.ts +8 -0
  392. package/dist/types/markers/MarkerTreeRoot.d.ts.map +1 -0
  393. package/dist/types/markers/MeaningfulMarker.d.ts +7 -0
  394. package/dist/types/markers/MeaningfulMarker.d.ts.map +1 -0
  395. package/dist/types/markers/ParentEntityMarker.d.ts +8 -0
  396. package/dist/types/markers/ParentEntityMarker.d.ts.map +1 -0
  397. package/dist/types/markers/PlaceholderGenerator.d.ts +9 -0
  398. package/dist/types/markers/PlaceholderGenerator.d.ts.map +1 -0
  399. package/dist/types/markers/SubTreeMarkers.d.ts +5 -0
  400. package/dist/types/markers/SubTreeMarkers.d.ts.map +1 -0
  401. package/dist/types/markers/index.d.ts +15 -0
  402. package/dist/types/markers/index.d.ts.map +1 -0
  403. package/dist/types/queryLanguage/CacheStore.d.ts +9 -0
  404. package/dist/types/queryLanguage/CacheStore.d.ts.map +1 -0
  405. package/dist/types/queryLanguage/MarkerFactory.d.ts +21 -0
  406. package/dist/types/queryLanguage/MarkerFactory.d.ts.map +1 -0
  407. package/dist/types/queryLanguage/Parser.d.ts +81 -0
  408. package/dist/types/queryLanguage/Parser.d.ts.map +1 -0
  409. package/dist/types/queryLanguage/ParserResults.d.ts +63 -0
  410. package/dist/types/queryLanguage/ParserResults.d.ts.map +1 -0
  411. package/dist/types/queryLanguage/QueryLanguage.d.ts +44 -0
  412. package/dist/types/queryLanguage/QueryLanguage.d.ts.map +1 -0
  413. package/dist/types/queryLanguage/QueryLanguageError.d.ts +3 -0
  414. package/dist/types/queryLanguage/QueryLanguageError.d.ts.map +1 -0
  415. package/dist/types/queryLanguage/index.d.ts +6 -0
  416. package/dist/types/queryLanguage/index.d.ts.map +1 -0
  417. package/dist/types/queryLanguage/tokenList.d.ts +34 -0
  418. package/dist/types/queryLanguage/tokenList.d.ts.map +1 -0
  419. package/dist/types/structures/BijectiveIndexedMap.d.ts +24 -0
  420. package/dist/types/structures/BijectiveIndexedMap.d.ts.map +1 -0
  421. package/dist/types/structures/LRUCache.d.ts +9 -0
  422. package/dist/types/structures/LRUCache.d.ts.map +1 -0
  423. package/dist/types/structures/WeakIdCache.d.ts +9 -0
  424. package/dist/types/structures/WeakIdCache.d.ts.map +1 -0
  425. package/dist/types/structures/index.d.ts +4 -0
  426. package/dist/types/structures/index.d.ts.map +1 -0
  427. package/dist/types/treeParameterHelpers/index.d.ts +2 -0
  428. package/dist/types/treeParameterHelpers/index.d.ts.map +1 -0
  429. package/dist/types/treeParameterHelpers/wrapFilterInHasOnes.d.ts +3 -0
  430. package/dist/types/treeParameterHelpers/wrapFilterInHasOnes.d.ts.map +1 -0
  431. package/dist/types/treeParameters/AnyField.d.ts +8 -0
  432. package/dist/types/treeParameters/AnyField.d.ts.map +1 -0
  433. package/dist/types/treeParameters/EntityCreationParameters.d.ts +13 -0
  434. package/dist/types/treeParameters/EntityCreationParameters.d.ts.map +1 -0
  435. package/dist/types/treeParameters/EntityListEventListeners.d.ts +15 -0
  436. package/dist/types/treeParameters/EntityListEventListeners.d.ts.map +1 -0
  437. package/dist/types/treeParameters/EntityListParameters.d.ts +17 -0
  438. package/dist/types/treeParameters/EntityListParameters.d.ts.map +1 -0
  439. package/dist/types/treeParameters/EntityListPreferences.d.ts +8 -0
  440. package/dist/types/treeParameters/EntityListPreferences.d.ts.map +1 -0
  441. package/dist/types/treeParameters/EventListenersStore.d.ts +32 -0
  442. package/dist/types/treeParameters/EventListenersStore.d.ts.map +1 -0
  443. package/dist/types/treeParameters/FieldEventListeners.d.ts +13 -0
  444. package/dist/types/treeParameters/FieldEventListeners.d.ts.map +1 -0
  445. package/dist/types/treeParameters/HasManyRelation.d.ts +10 -0
  446. package/dist/types/treeParameters/HasManyRelation.d.ts.map +1 -0
  447. package/dist/types/treeParameters/HasOneRelation.d.ts +13 -0
  448. package/dist/types/treeParameters/HasOneRelation.d.ts.map +1 -0
  449. package/dist/types/treeParameters/LeafField.d.ts +14 -0
  450. package/dist/types/treeParameters/LeafField.d.ts.map +1 -0
  451. package/dist/types/treeParameters/ParentEntityParameters.d.ts +8 -0
  452. package/dist/types/treeParameters/ParentEntityParameters.d.ts.map +1 -0
  453. package/dist/types/treeParameters/QualifiedEntityList.d.ts +19 -0
  454. package/dist/types/treeParameters/QualifiedEntityList.d.ts.map +1 -0
  455. package/dist/types/treeParameters/QualifiedEntityParameters.d.ts +17 -0
  456. package/dist/types/treeParameters/QualifiedEntityParameters.d.ts.map +1 -0
  457. package/dist/types/treeParameters/QualifiedFieldList.d.ts +17 -0
  458. package/dist/types/treeParameters/QualifiedFieldList.d.ts.map +1 -0
  459. package/dist/types/treeParameters/QualifiedSingleEntity.d.ts +20 -0
  460. package/dist/types/treeParameters/QualifiedSingleEntity.d.ts.map +1 -0
  461. package/dist/types/treeParameters/QualifiedSingleEntityParameters.d.ts +8 -0
  462. package/dist/types/treeParameters/QualifiedSingleEntityParameters.d.ts.map +1 -0
  463. package/dist/types/treeParameters/Relation.d.ts +15 -0
  464. package/dist/types/treeParameters/Relation.d.ts.map +1 -0
  465. package/dist/types/treeParameters/RelativeEntityList.d.ts +19 -0
  466. package/dist/types/treeParameters/RelativeEntityList.d.ts.map +1 -0
  467. package/dist/types/treeParameters/RelativeSingleEntity.d.ts +13 -0
  468. package/dist/types/treeParameters/RelativeSingleEntity.d.ts.map +1 -0
  469. package/dist/types/treeParameters/RelativeSingleField.d.ts +15 -0
  470. package/dist/types/treeParameters/RelativeSingleField.d.ts.map +1 -0
  471. package/dist/types/treeParameters/SetOnCreate.d.ts +4 -0
  472. package/dist/types/treeParameters/SetOnCreate.d.ts.map +1 -0
  473. package/dist/types/treeParameters/SingleEntityEventListeners.d.ts +16 -0
  474. package/dist/types/treeParameters/SingleEntityEventListeners.d.ts.map +1 -0
  475. package/dist/types/treeParameters/SingleEntityParameters.d.ts +8 -0
  476. package/dist/types/treeParameters/SingleEntityParameters.d.ts.map +1 -0
  477. package/dist/types/treeParameters/UnconstrainedQualifiedEntityList.d.ts +19 -0
  478. package/dist/types/treeParameters/UnconstrainedQualifiedEntityList.d.ts.map +1 -0
  479. package/dist/types/treeParameters/UnconstrainedQualifiedSingleEntity.d.ts +18 -0
  480. package/dist/types/treeParameters/UnconstrainedQualifiedSingleEntity.d.ts.map +1 -0
  481. package/dist/types/treeParameters/index.d.ts +27 -0
  482. package/dist/types/treeParameters/index.d.ts.map +1 -0
  483. package/dist/types/treeParameters/primitives/Alias.d.ts +2 -0
  484. package/dist/types/treeParameters/primitives/Alias.d.ts.map +1 -0
  485. package/dist/types/treeParameters/primitives/EntityId.d.ts +2 -0
  486. package/dist/types/treeParameters/primitives/EntityId.d.ts.map +1 -0
  487. package/dist/types/treeParameters/primitives/EntityName.d.ts +2 -0
  488. package/dist/types/treeParameters/primitives/EntityName.d.ts.map +1 -0
  489. package/dist/types/treeParameters/primitives/EntityRealmKey.d.ts +2 -0
  490. package/dist/types/treeParameters/primitives/EntityRealmKey.d.ts.map +1 -0
  491. package/dist/types/treeParameters/primitives/ExpectedEntityCount.d.ts +2 -0
  492. package/dist/types/treeParameters/primitives/ExpectedEntityCount.d.ts.map +1 -0
  493. package/dist/types/treeParameters/primitives/ExpectedQualifiedEntityMutation.d.ts +2 -0
  494. package/dist/types/treeParameters/primitives/ExpectedQualifiedEntityMutation.d.ts.map +1 -0
  495. package/dist/types/treeParameters/primitives/ExpectedRelationMutation.d.ts +2 -0
  496. package/dist/types/treeParameters/primitives/ExpectedRelationMutation.d.ts.map +1 -0
  497. package/dist/types/treeParameters/primitives/FieldName.d.ts +2 -0
  498. package/dist/types/treeParameters/primitives/FieldName.d.ts.map +1 -0
  499. package/dist/types/treeParameters/primitives/FieldValue.d.ts +5 -0
  500. package/dist/types/treeParameters/primitives/FieldValue.d.ts.map +1 -0
  501. package/dist/types/treeParameters/primitives/Filter.d.ts +4 -0
  502. package/dist/types/treeParameters/primitives/Filter.d.ts.map +1 -0
  503. package/dist/types/treeParameters/primitives/Limit.d.ts +2 -0
  504. package/dist/types/treeParameters/primitives/Limit.d.ts.map +1 -0
  505. package/dist/types/treeParameters/primitives/Offset.d.ts +2 -0
  506. package/dist/types/treeParameters/primitives/Offset.d.ts.map +1 -0
  507. package/dist/types/treeParameters/primitives/OrderBy.d.ts +4 -0
  508. package/dist/types/treeParameters/primitives/OrderBy.d.ts.map +1 -0
  509. package/dist/types/treeParameters/primitives/PlaceholderName.d.ts +2 -0
  510. package/dist/types/treeParameters/primitives/PlaceholderName.d.ts.map +1 -0
  511. package/dist/types/treeParameters/primitives/RemovalType.d.ts +2 -0
  512. package/dist/types/treeParameters/primitives/RemovalType.d.ts.map +1 -0
  513. package/dist/types/treeParameters/primitives/Scalar.d.ts +2 -0
  514. package/dist/types/treeParameters/primitives/Scalar.d.ts.map +1 -0
  515. package/dist/types/treeParameters/primitives/TreeRootId.d.ts +2 -0
  516. package/dist/types/treeParameters/primitives/TreeRootId.d.ts.map +1 -0
  517. package/dist/types/treeParameters/primitives/UniqueWhere.d.ts +4 -0
  518. package/dist/types/treeParameters/primitives/UniqueWhere.d.ts.map +1 -0
  519. package/dist/types/treeParameters/primitives/index.d.ts +19 -0
  520. package/dist/types/treeParameters/primitives/index.d.ts.map +1 -0
  521. package/dist/types/tsconfig.tsbuildinfo +1 -0
  522. package/dist/types/utils/Hashing.d.ts +10 -0
  523. package/dist/types/utils/Hashing.d.ts.map +1 -0
  524. package/dist/types/utils/assert.d.ts +2 -0
  525. package/dist/types/utils/assert.d.ts.map +1 -0
  526. package/dist/types/utils/assertNever.d.ts +2 -0
  527. package/dist/types/utils/assertNever.d.ts.map +1 -0
  528. package/dist/types/utils/generateEnumerabilityPreventingEntropy.d.ts +2 -0
  529. package/dist/types/utils/generateEnumerabilityPreventingEntropy.d.ts.map +1 -0
  530. package/dist/types/utils/index.d.ts +7 -0
  531. package/dist/types/utils/index.d.ts.map +1 -0
  532. package/dist/types/utils/isEmptyObject.d.ts +2 -0
  533. package/dist/types/utils/isEmptyObject.d.ts.map +1 -0
  534. package/dist/types/utils/ucfirst.d.ts +2 -0
  535. package/dist/types/utils/ucfirst.d.ts.map +1 -0
  536. package/package.json +8 -9
  537. package/src/BindingError.ts +5 -0
  538. package/src/accessorPropagation/AccessorProvider.tsx +17 -0
  539. package/src/accessorPropagation/BindingOperationsContext.ts +32 -0
  540. package/src/accessorPropagation/BindingOperationsProvider.tsx +16 -0
  541. package/src/accessorPropagation/EntityKeyContext.ts +4 -0
  542. package/src/accessorPropagation/EntityKeyProvider.tsx +11 -0
  543. package/src/accessorPropagation/EnvironmentContext.ts +5 -0
  544. package/src/accessorPropagation/TreeRootIdContext.ts +5 -0
  545. package/src/accessorPropagation/TreeRootIdProvider.tsx +12 -0
  546. package/src/accessorPropagation/index.ts +29 -0
  547. package/src/accessorPropagation/useAccessorUpdateSubscription.ts +107 -0
  548. package/src/accessorPropagation/useBindingOperations.ts +5 -0
  549. package/src/accessorPropagation/useDesugaredRelativeEntityList.ts +70 -0
  550. package/src/accessorPropagation/useDesugaredRelativeSingleEntity.ts +58 -0
  551. package/src/accessorPropagation/useDesugaredRelativeSingleField.ts +58 -0
  552. package/src/accessorPropagation/useEntity.ts +56 -0
  553. package/src/accessorPropagation/useEntityKey.ts +15 -0
  554. package/src/accessorPropagation/useEntityList.ts +49 -0
  555. package/src/accessorPropagation/useEntityListSubTree.ts +20 -0
  556. package/src/accessorPropagation/useEntityListSubTreeParameters.ts +88 -0
  557. package/src/accessorPropagation/useEntitySubTree.ts +19 -0
  558. package/src/accessorPropagation/useEntitySubTreeParameters.ts +66 -0
  559. package/src/accessorPropagation/useEnvironment.ts +7 -0
  560. package/src/accessorPropagation/useField.ts +51 -0
  561. package/src/accessorPropagation/useGetEntityByKey.ts +4 -0
  562. package/src/accessorPropagation/useGetEntityListSubTree.ts +28 -0
  563. package/src/accessorPropagation/useGetEntitySubTree.ts +28 -0
  564. package/src/accessorPropagation/useGetTreeFilters.ts +4 -0
  565. package/src/accessorPropagation/useHasEntity.ts +6 -0
  566. package/src/accessorPropagation/usePersist.ts +4 -0
  567. package/src/accessorPropagation/useTreeRootId.ts +5 -0
  568. package/src/accessorSorting/SetOrderFieldOnCreate.tsx +92 -0
  569. package/src/accessorSorting/SortedEntities.ts +9 -0
  570. package/src/accessorSorting/addEntityAtIndex.ts +27 -0
  571. package/src/accessorSorting/errors.ts +18 -0
  572. package/src/accessorSorting/index.ts +9 -0
  573. package/src/accessorSorting/moveEntity.ts +66 -0
  574. package/src/accessorSorting/repairEntitiesOrder.ts +15 -0
  575. package/src/accessorSorting/sortEntities.ts +20 -0
  576. package/src/accessorSorting/useSortedEntities.ts +105 -0
  577. package/src/accessorTree/AccessorTree.tsx +34 -0
  578. package/src/accessorTree/AccessorTreeState.ts +18 -0
  579. package/src/accessorTree/AccessorTreeStateAction.ts +15 -0
  580. package/src/accessorTree/AccessorTreeStateMetadata.ts +3 -0
  581. package/src/accessorTree/AccessorTreeStateOptions.ts +7 -0
  582. package/src/accessorTree/DirtinessContext.ts +4 -0
  583. package/src/accessorTree/MutationRequestResponse.ts +55 -0
  584. package/src/accessorTree/MutationStateContext.ts +4 -0
  585. package/src/accessorTree/NormalizedPersistedData.ts +23 -0
  586. package/src/accessorTree/PersistResult.ts +30 -0
  587. package/src/accessorTree/QueryRequestResponse.ts +19 -0
  588. package/src/accessorTree/RequestError.ts +16 -0
  589. package/src/accessorTree/RuntimeId.ts +49 -0
  590. package/src/accessorTree/accessorTreeStateReducer.ts +27 -0
  591. package/src/accessorTree/index.ts +18 -0
  592. package/src/accessorTree/metadataToRequestError.ts +14 -0
  593. package/src/accessorTree/useDataBinding.ts +98 -0
  594. package/src/accessorTree/useDirtinessState.ts +4 -0
  595. package/src/accessorTree/useMutationState.ts +4 -0
  596. package/src/accessors/AsyncBatchUpdatesOptions.ts +8 -0
  597. package/src/accessors/BatchUpdatesOptions.ts +9 -0
  598. package/src/accessors/BindingConfig.ts +7 -0
  599. package/src/accessors/BindingOperations.ts +15 -0
  600. package/src/accessors/EntityAccessor.ts +259 -0
  601. package/src/accessors/EntityListAccessor.ts +173 -0
  602. package/src/accessors/ErrorAccessor.ts +39 -0
  603. package/src/accessors/Errorable.ts +5 -0
  604. package/src/accessors/ExtendTree.ts +10 -0
  605. package/src/accessors/FieldAccessor.ts +102 -0
  606. package/src/accessors/GetEntityByKey.ts +3 -0
  607. package/src/accessors/GetEntityListSubTree.ts +14 -0
  608. package/src/accessors/GetEntitySubTree.ts +14 -0
  609. package/src/accessors/Persist.ts +11 -0
  610. package/src/accessors/PersistErrorOptions.ts +12 -0
  611. package/src/accessors/PersistSuccessOptions.ts +5 -0
  612. package/src/accessors/TreeRootAccessor.ts +14 -0
  613. package/src/accessors/index.ts +17 -0
  614. package/src/ambient.d.ts +1 -0
  615. package/src/bindingTypes.ts +3 -0
  616. package/src/core/AccessorErrorManager.ts +231 -0
  617. package/src/core/Config.ts +29 -0
  618. package/src/core/DataBinding.ts +454 -0
  619. package/src/core/DirtinessTracker.ts +33 -0
  620. package/src/core/ErrorsPreprocessor.ts +240 -0
  621. package/src/core/EventManager.ts +580 -0
  622. package/src/core/IncrementalMarkerBuilder.ts +60 -0
  623. package/src/core/MarkerComparator.ts +102 -0
  624. package/src/core/MarkerMerger.ts +297 -0
  625. package/src/core/MarkerTreeGenerator.ts +121 -0
  626. package/src/core/MutationGenerator.ts +716 -0
  627. package/src/core/QueryGenerator.ts +173 -0
  628. package/src/core/RealmKeyGenerator.ts +54 -0
  629. package/src/core/RequestResponseNormalizer.ts +213 -0
  630. package/src/core/StateInitializer.ts +571 -0
  631. package/src/core/TreeAugmenter.ts +262 -0
  632. package/src/core/TreeFilterGenerator.ts +116 -0
  633. package/src/core/TreeParameterMerger.ts +374 -0
  634. package/src/core/TreeStore.ts +260 -0
  635. package/src/core/UpdateMetadata.ts +3 -0
  636. package/src/core/VariableInputTransformer.ts +23 -0
  637. package/src/core/exceptions/ErrorLocator.ts +58 -0
  638. package/src/core/exceptions/LocalizedBindingError.ts +20 -0
  639. package/src/core/exceptions/MarkerSugarer.ts +61 -0
  640. package/src/core/exceptions/RawMarkerPath.ts +3 -0
  641. package/src/core/exceptions/TreeParameterSugarer.ts +41 -0
  642. package/src/core/exceptions/index.ts +5 -0
  643. package/src/core/factories/createBatchUpdatesOptions.ts +38 -0
  644. package/src/core/factories/index.ts +1 -0
  645. package/src/core/index.ts +5 -0
  646. package/src/core/operations/EntityOperations.ts +310 -0
  647. package/src/core/operations/FieldOperations.ts +127 -0
  648. package/src/core/operations/ListOperations.ts +207 -0
  649. package/src/core/operations/OperationsHelpers.ts +150 -0
  650. package/src/core/operations/index.ts +3 -0
  651. package/src/core/requestAliases/MutationAlias.ts +66 -0
  652. package/src/core/requestAliases/TopLevelMutationOperation.ts +11 -0
  653. package/src/core/requestAliases/index.ts +4 -0
  654. package/src/core/requestAliases/mutationOperationSubTreeType.ts +4 -0
  655. package/src/core/requestAliases/mutationOperationType.ts +5 -0
  656. package/src/core/schema/RawSchema.ts +7 -0
  657. package/src/core/schema/RawSchemaEntity.ts +13 -0
  658. package/src/core/schema/RawSchemaEnum.ts +6 -0
  659. package/src/core/schema/Schema.ts +11 -0
  660. package/src/core/schema/SchemaColumn.ts +15 -0
  661. package/src/core/schema/SchemaColumnType.ts +3 -0
  662. package/src/core/schema/SchemaEntities.ts +4 -0
  663. package/src/core/schema/SchemaEntity.ts +10 -0
  664. package/src/core/schema/SchemaEnums.ts +3 -0
  665. package/src/core/schema/SchemaField.ts +4 -0
  666. package/src/core/schema/SchemaFields.ts +4 -0
  667. package/src/core/schema/SchemaLoader.ts +62 -0
  668. package/src/core/schema/SchemaPreprocessor.ts +51 -0
  669. package/src/core/schema/SchemaRelation.ts +29 -0
  670. package/src/core/schema/SchemaRelationOrderBy.ts +4 -0
  671. package/src/core/schema/SchemaStore.ts +8 -0
  672. package/src/core/schema/SchemaUniqueConstraint.ts +5 -0
  673. package/src/core/schema/SchemaValidator.ts +238 -0
  674. package/src/core/schema/index.ts +14 -0
  675. package/src/core/state/EntityListState.ts +37 -0
  676. package/src/core/state/EntityRealmState.ts +63 -0
  677. package/src/core/state/EntityState.ts +12 -0
  678. package/src/core/state/FieldState.ts +20 -0
  679. package/src/core/state/StateIterator.ts +122 -0
  680. package/src/core/state/StateNode.ts +8 -0
  681. package/src/core/state/getEntityMarker.ts +4 -0
  682. package/src/core/state/index.ts +7 -0
  683. package/src/core/utils/getCombinedSignal.ts +36 -0
  684. package/src/core/utils/index.ts +1 -0
  685. package/src/coreComponents/Component.tsx +61 -0
  686. package/src/coreComponents/DataBindingProvider.tsx +45 -0
  687. package/src/coreComponents/Entity.tsx +23 -0
  688. package/src/coreComponents/EntityList.tsx +52 -0
  689. package/src/coreComponents/EntityListSubTree.tsx +85 -0
  690. package/src/coreComponents/EntitySubTree.tsx +98 -0
  691. package/src/coreComponents/Field.tsx +39 -0
  692. package/src/coreComponents/HasMany.tsx +46 -0
  693. package/src/coreComponents/HasOne.tsx +39 -0
  694. package/src/coreComponents/MarkerProvider.ts +59 -0
  695. package/src/coreComponents/ParentEntity.tsx +17 -0
  696. package/src/coreComponents/index.ts +11 -0
  697. package/src/dao/Environment.ts +201 -0
  698. package/src/dao/VariableFieldValue.ts +3 -0
  699. package/src/dao/index.ts +2 -0
  700. package/src/entityEvents/index.ts +7 -0
  701. package/src/entityEvents/useDerivedField.ts +64 -0
  702. package/src/entityEvents/useEntityBeforePersist.ts +6 -0
  703. package/src/entityEvents/useEntityBeforeUpdate.ts +6 -0
  704. package/src/entityEvents/useEntityEvent.ts +57 -0
  705. package/src/entityEvents/useEntityPersistError.ts +6 -0
  706. package/src/entityEvents/useEntityPersistSuccess.ts +6 -0
  707. package/src/entityEvents/useOnConnectionUpdate.ts +10 -0
  708. package/src/fieldHelpers/helpers/FieldHelper.ts +10 -0
  709. package/src/fieldHelpers/helpers/TemporalFieldHelper.ts +21 -0
  710. package/src/fieldHelpers/helpers/UuidFieldHelper.ts +18 -0
  711. package/src/fieldHelpers/helpers/index.ts +2 -0
  712. package/src/fieldHelpers/index.ts +1 -0
  713. package/src/helperComponents/DeferredSubTrees.tsx +116 -0
  714. package/src/helperComponents/EntityView.tsx +16 -0
  715. package/src/helperComponents/FieldView.tsx +129 -0
  716. package/src/helperComponents/StaticRender.tsx +12 -0
  717. package/src/helperComponents/SugaredField.tsx +15 -0
  718. package/src/helperComponents/index.ts +5 -0
  719. package/src/index.ts +19 -0
  720. package/src/markers/EntityFieldMarkers.ts +7 -0
  721. package/src/markers/EntityFieldMarkersContainer.ts +45 -0
  722. package/src/markers/EntityFieldPlaceholders.ts +3 -0
  723. package/src/markers/EntityFieldsWithHoistablesMarker.ts +11 -0
  724. package/src/markers/EntityListSubTreeMarker.ts +20 -0
  725. package/src/markers/EntitySubTreeMarker.ts +20 -0
  726. package/src/markers/FieldMarker.ts +19 -0
  727. package/src/markers/HasManyRelationMarker.ts +27 -0
  728. package/src/markers/HasOneRelationMarker.ts +21 -0
  729. package/src/markers/MarkerTreeRoot.ts +9 -0
  730. package/src/markers/MeaningfulMarker.ts +12 -0
  731. package/src/markers/ParentEntityMarker.ts +9 -0
  732. package/src/markers/PlaceholderGenerator.ts +36 -0
  733. package/src/markers/SubTreeMarkers.ts +5 -0
  734. package/src/markers/index.ts +14 -0
  735. package/src/queryLanguage/CacheStore.ts +56 -0
  736. package/src/queryLanguage/MarkerFactory.ts +300 -0
  737. package/src/queryLanguage/Parser.ts +848 -0
  738. package/src/queryLanguage/ParserResults.ts +81 -0
  739. package/src/queryLanguage/QueryLanguage.ts +730 -0
  740. package/src/queryLanguage/QueryLanguageError.ts +1 -0
  741. package/src/queryLanguage/index.ts +5 -0
  742. package/src/queryLanguage/tokenList.ts +169 -0
  743. package/src/structures/BijectiveIndexedMap.ts +139 -0
  744. package/src/structures/LRUCache.ts +29 -0
  745. package/src/structures/WeakIdCache.ts +25 -0
  746. package/src/structures/index.ts +3 -0
  747. package/src/treeParameterHelpers/index.ts +1 -0
  748. package/src/treeParameterHelpers/wrapFilterInHasOnes.ts +21 -0
  749. package/src/treeParameters/AnyField.ts +9 -0
  750. package/src/treeParameters/EntityCreationParameters.ts +34 -0
  751. package/src/treeParameters/EntityListEventListeners.ts +20 -0
  752. package/src/treeParameters/EntityListParameters.ts +19 -0
  753. package/src/treeParameters/EntityListPreferences.ts +11 -0
  754. package/src/treeParameters/EventListenersStore.ts +81 -0
  755. package/src/treeParameters/FieldEventListeners.ts +22 -0
  756. package/src/treeParameters/HasManyRelation.ts +18 -0
  757. package/src/treeParameters/HasOneRelation.ts +21 -0
  758. package/src/treeParameters/LeafField.ts +18 -0
  759. package/src/treeParameters/ParentEntityParameters.ts +10 -0
  760. package/src/treeParameters/QualifiedEntityList.ts +43 -0
  761. package/src/treeParameters/QualifiedEntityParameters.ts +20 -0
  762. package/src/treeParameters/QualifiedFieldList.ts +36 -0
  763. package/src/treeParameters/QualifiedSingleEntity.ts +46 -0
  764. package/src/treeParameters/QualifiedSingleEntityParameters.ts +9 -0
  765. package/src/treeParameters/Relation.ts +17 -0
  766. package/src/treeParameters/RelativeEntityList.ts +25 -0
  767. package/src/treeParameters/RelativeSingleEntity.ts +16 -0
  768. package/src/treeParameters/RelativeSingleField.ts +20 -0
  769. package/src/treeParameters/SetOnCreate.ts +6 -0
  770. package/src/treeParameters/SingleEntityEventListeners.ts +24 -0
  771. package/src/treeParameters/SingleEntityParameters.ts +9 -0
  772. package/src/treeParameters/UnconstrainedQualifiedEntityList.ts +37 -0
  773. package/src/treeParameters/UnconstrainedQualifiedSingleEntity.ts +37 -0
  774. package/src/treeParameters/index.ts +27 -0
  775. package/src/treeParameters/primitives/Alias.ts +1 -0
  776. package/src/treeParameters/primitives/EntityId.ts +2 -0
  777. package/src/treeParameters/primitives/EntityName.ts +4 -0
  778. package/src/treeParameters/primitives/EntityRealmKey.ts +2 -0
  779. package/src/treeParameters/primitives/ExpectedEntityCount.ts +1 -0
  780. package/src/treeParameters/primitives/ExpectedQualifiedEntityMutation.ts +1 -0
  781. package/src/treeParameters/primitives/ExpectedRelationMutation.ts +1 -0
  782. package/src/treeParameters/primitives/FieldName.ts +7 -0
  783. package/src/treeParameters/primitives/FieldValue.ts +6 -0
  784. package/src/treeParameters/primitives/Filter.ts +7 -0
  785. package/src/treeParameters/primitives/Limit.ts +1 -0
  786. package/src/treeParameters/primitives/Offset.ts +1 -0
  787. package/src/treeParameters/primitives/OrderBy.ts +6 -0
  788. package/src/treeParameters/primitives/PlaceholderName.ts +4 -0
  789. package/src/treeParameters/primitives/RemovalType.ts +1 -0
  790. package/src/treeParameters/primitives/Scalar.ts +1 -0
  791. package/src/treeParameters/primitives/TreeRootId.ts +1 -0
  792. package/src/treeParameters/primitives/UniqueWhere.ts +7 -0
  793. package/src/treeParameters/primitives/index.ts +18 -0
  794. package/src/tsconfig.json +12 -0
  795. package/src/utils/Hashing.ts +81 -0
  796. package/src/utils/assert.ts +7 -0
  797. package/src/utils/assertNever.ts +10 -0
  798. package/src/utils/generateEnumerabilityPreventingEntropy.ts +3 -0
  799. package/src/utils/index.ts +6 -0
  800. package/src/utils/isEmptyObject.ts +9 -0
  801. package/src/utils/ucfirst.ts +1 -0
  802. package/dist/binding.d.ts +0 -2247
@@ -3,7 +3,7 @@ import { TemporalFieldHelper } from '../fieldHelpers/helpers/TemporalFieldHelper
3
3
  import { UuidFieldHelper } from '../fieldHelpers/helpers/UuidFieldHelper.js';
4
4
 
5
5
  class FieldAccessor {
6
- constructor(stateKey, operations, fieldName, value, valueOnServer, defaultValue, errors, hasUnpersistedChanges, touchLog, getAccessor) {
6
+ constructor(stateKey, operations, fieldName, value, valueOnServer, defaultValue, errors, hasUnpersistedChanges, touchLog, getAccessor, schema) {
7
7
  this.stateKey = stateKey;
8
8
  this.operations = operations;
9
9
  this.fieldName = fieldName;
@@ -14,6 +14,7 @@ class FieldAccessor {
14
14
  this.hasUnpersistedChanges = hasUnpersistedChanges;
15
15
  this.touchLog = touchLog;
16
16
  this.getAccessor = getAccessor;
17
+ this.schema = schema;
17
18
  }
18
19
  addError(error) {
19
20
  return this.operations.addError(this.stateKey, ErrorAccessor.normalizeError(error));
@@ -1 +1 @@
1
- {"version":3,"file":"FieldAccessor.js","sources":["../../../src/accessors/FieldAccessor.ts"],"sourcesContent":["import type { FieldOperations } from '../core/operations'\nimport { TemporalFieldHelper, UuidFieldHelper } from '../fieldHelpers'\nimport type { FieldName, FieldValue } from '../treeParameters'\nimport type { BatchUpdatesOptions } from './BatchUpdatesOptions'\nimport type { Errorable } from './Errorable'\nimport { ErrorAccessor } from './ErrorAccessor'\nimport type { FieldState } from '../core/state'\n\nclass FieldAccessor<Value extends FieldValue = FieldValue> implements Errorable {\n\tconstructor(\n\t\tprivate readonly stateKey: FieldState<Value>,\n\t\tprivate readonly operations: FieldOperations,\n\t\tpublic readonly fieldName: FieldName,\n\t\tpublic readonly value: Value | null,\n\t\tpublic readonly valueOnServer: Value | null,\n\t\tpublic readonly defaultValue: Value | undefined,\n\t\tpublic readonly errors: ErrorAccessor | undefined,\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tprivate readonly touchLog: ReadonlySet<string> | undefined,\n\t\tpublic readonly getAccessor: FieldAccessor.GetFieldAccessor<Value>,\n\t) {}\n\n\tpublic addError(error: ErrorAccessor.Error | string): () => void {\n\t\treturn this.operations.addError(this.stateKey, ErrorAccessor.normalizeError(error))\n\t}\n\n\tpublic clearErrors(): void {\n\t\tthis.operations.clearErrors(this.stateKey)\n\t}\n\n\tpublic addEventListener<Type extends keyof FieldAccessor.FieldEventListenerMap<Value>>(\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\treturn this.operations.addEventListener(this.stateKey, event, listener)\n\t}\n\n\tpublic updateValue(newValue: Value | null, options?: FieldAccessor.UpdateOptions): void {\n\t\tthis.operations.updateValue(this.stateKey, newValue, options)\n\t}\n\n\tpublic hasValue(candidate: this['value']): boolean {\n\t\treturn this.value === candidate\n\t}\n\n\tpublic isTouchedBy(agent: string) {\n\t\treturn this.touchLog?.has(agent) ?? false\n\t}\n\n\tpublic get isTouched() {\n\t\treturn this.isTouchedBy(FieldAccessor.userAgent)\n\t}\n\n\tpublic get resolvedValue() {\n\t\tif (this.defaultValue === undefined) {\n\t\t\treturn this.value\n\t\t}\n\t\treturn this.value === null ? this.defaultValue : this.value\n\t}\n\n\t// helpers\n\n\tpublic get asTemporal(): TemporalFieldHelper {\n\t\treturn new TemporalFieldHelper(this.getAccessor as FieldAccessor.GetFieldAccessor<any>)\n\t}\n\n\tpublic get asUuid(): UuidFieldHelper {\n\t\treturn new UuidFieldHelper(this.getAccessor as FieldAccessor.GetFieldAccessor<any>)\n\t}\n}\nnamespace FieldAccessor {\n\texport const userAgent = 'user'\n\n\texport interface UpdateOptions {\n\t\tagent?: string\n\t}\n\n\texport type GetFieldAccessor<Value extends FieldValue = FieldValue> = () => FieldAccessor<Value>\n\n\texport type BeforeUpdateListener<Value extends FieldValue = FieldValue> = (\n\t\tupdatedAccessor: FieldAccessor<Value>,\n\t) => void\n\texport type InitializeListener<Value extends FieldValue = FieldValue> = (\n\t\tgetAccessor: GetFieldAccessor<Value>,\n\t\toptions: BatchUpdatesOptions,\n\t) => void\n\texport type UpdateListener<Value extends FieldValue = FieldValue> = (accessor: FieldAccessor<Value>) => void\n\n\texport interface RuntimeFieldEventListenerMap<Value extends FieldValue = FieldValue> {\n\t\tbeforeUpdate: BeforeUpdateListener<Value>\n\t\tupdate: UpdateListener<Value>\n\t}\n\texport interface FieldEventListenerMap<Value extends FieldValue = FieldValue>\n\t\textends RuntimeFieldEventListenerMap<Value> {\n\t\tinitialize: InitializeListener<Value>\n\t}\n\texport type FieldEventType = keyof FieldEventListenerMap\n}\n\nexport { FieldAccessor }\n"],"names":[],"mappings":";;;;AAQA,oBAAgF;AAAA,EAC/E,YACkB,UACA,YACD,WACA,OACA,eACA,cACA,QACA,uBACC,UACD,aACf;AAVgB;AACA;AACD;AACA;AACA;AACA;AACA;AACA;AACC;AACD;AAAA;AAAA,EAGV,SAAS,OAAiD;AAChE,WAAO,KAAK,WAAW,SAAS,KAAK,UAAU,cAAc,eAAe;AAAA;AAAA,EAGtE,cAAoB;AAC1B,SAAK,WAAW,YAAY,KAAK;AAAA;AAAA,EAG3B,iBACN,OACA,UACa;AACb,WAAO,KAAK,WAAW,iBAAiB,KAAK,UAAU,OAAO;AAAA;AAAA,EAGxD,YAAY,UAAwB,SAA6C;AACvF,SAAK,WAAW,YAAY,KAAK,UAAU,UAAU;AAAA;AAAA,EAG/C,SAAS,WAAmC;AAClD,WAAO,KAAK,UAAU;AAAA;AAAA,EAGhB,YAAY,OAAe;AACjC,WAAO,KAAK,UAAU,IAAI,UAAU;AAAA;AAAA,MAG1B,YAAY;AACtB,WAAO,KAAK,YAAY,cAAc;AAAA;AAAA,MAG5B,gBAAgB;AAC1B,QAAI,KAAK,iBAAiB,QAAW;AACpC,aAAO,KAAK;AAAA;AAEb,WAAO,KAAK,UAAU,OAAO,KAAK,eAAe,KAAK;AAAA;AAAA,MAK5C,aAAkC;AAC5C,WAAO,IAAI,oBAAoB,KAAK;AAAA;AAAA,MAG1B,SAA0B;AACpC,WAAO,IAAI,gBAAgB,KAAK;AAAA;AAAA;AAGlC,UAAU,gBAAV;AACQ,EAAM,2BAAY;AAAA,GADhB;;;;"}
1
+ {"version":3,"file":"FieldAccessor.js","sources":["../../../src/accessors/FieldAccessor.ts"],"sourcesContent":["import type { FieldOperations } from '../core/operations'\nimport type { FieldState } from '../core/state'\nimport { TemporalFieldHelper, UuidFieldHelper } from '../fieldHelpers'\nimport type { FieldName, FieldValue } from '../treeParameters'\nimport type { BatchUpdatesOptions } from './BatchUpdatesOptions'\nimport type { Errorable } from './Errorable'\nimport { ErrorAccessor } from './ErrorAccessor'\nimport type { SchemaColumn } from '../core/schema/SchemaColumn'\n\nclass FieldAccessor<Value extends FieldValue = FieldValue> implements Errorable {\n\tconstructor(\n\t\tprivate readonly stateKey: FieldState<Value>,\n\t\tprivate readonly operations: FieldOperations,\n\t\tpublic readonly fieldName: FieldName,\n\t\tpublic readonly value: Value | null,\n\t\tpublic readonly valueOnServer: Value | null,\n\t\tpublic readonly defaultValue: Value | undefined,\n\t\tpublic readonly errors: ErrorAccessor | undefined,\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tprivate readonly touchLog: ReadonlySet<string> | undefined,\n\t\tpublic readonly getAccessor: FieldAccessor.GetFieldAccessor<Value>,\n\t\tpublic readonly schema: SchemaColumn,\n\t) {}\n\n\tpublic addError(error: ErrorAccessor.Error | string): () => void {\n\t\treturn this.operations.addError(this.stateKey, ErrorAccessor.normalizeError(error))\n\t}\n\n\tpublic clearErrors(): void {\n\t\tthis.operations.clearErrors(this.stateKey)\n\t}\n\n\tpublic addEventListener<Type extends keyof FieldAccessor.FieldEventListenerMap<Value>>(\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\treturn this.operations.addEventListener(this.stateKey, event, listener)\n\t}\n\n\tpublic updateValue(newValue: Value | null, options?: FieldAccessor.UpdateOptions): void {\n\t\tthis.operations.updateValue(this.stateKey, newValue, options)\n\t}\n\n\tpublic hasValue(candidate: this['value']): boolean {\n\t\treturn this.value === candidate\n\t}\n\n\tpublic isTouchedBy(agent: string) {\n\t\treturn this.touchLog?.has(agent) ?? false\n\t}\n\n\tpublic get isTouched() {\n\t\treturn this.isTouchedBy(FieldAccessor.userAgent)\n\t}\n\n\tpublic get resolvedValue() {\n\t\tif (this.defaultValue === undefined) {\n\t\t\treturn this.value\n\t\t}\n\t\treturn this.value === null ? this.defaultValue : this.value\n\t}\n\n\t// helpers\n\n\tpublic get asTemporal(): TemporalFieldHelper {\n\t\treturn new TemporalFieldHelper(this.getAccessor as FieldAccessor.GetFieldAccessor<any>)\n\t}\n\n\tpublic get asUuid(): UuidFieldHelper {\n\t\treturn new UuidFieldHelper(this.getAccessor as FieldAccessor.GetFieldAccessor<any>)\n\t}\n}\nnamespace FieldAccessor {\n\texport const userAgent = 'user'\n\n\texport interface UpdateOptions {\n\t\tagent?: string\n\t}\n\n\texport type GetFieldAccessor<Value extends FieldValue = FieldValue> = () => FieldAccessor<Value>\n\n\texport type BeforeUpdateListener<Value extends FieldValue = FieldValue> = (\n\t\tupdatedAccessor: FieldAccessor<Value>,\n\t) => void\n\texport type InitializeListener<Value extends FieldValue = FieldValue> = (\n\t\tgetAccessor: GetFieldAccessor<Value>,\n\t\toptions: BatchUpdatesOptions,\n\t) => void\n\texport type UpdateListener<Value extends FieldValue = FieldValue> = (accessor: FieldAccessor<Value>) => void\n\n\texport interface RuntimeFieldEventListenerMap<Value extends FieldValue = FieldValue> {\n\t\tbeforeUpdate: BeforeUpdateListener<Value>\n\t\tupdate: UpdateListener<Value>\n\t}\n\texport interface FieldEventListenerMap<Value extends FieldValue = FieldValue>\n\t\textends RuntimeFieldEventListenerMap<Value> {\n\t\tinitialize: InitializeListener<Value>\n\t}\n\texport type FieldEventType = keyof FieldEventListenerMap\n}\n\nexport { FieldAccessor }\n"],"names":[],"mappings":";;;;AASA,oBAAgF;AAAA,EAC/E,YACkB,UACA,YACD,WACA,OACA,eACA,cACA,QACA,uBACC,UACD,aACA,QACf;AAXgB;AACA;AACD;AACA;AACA;AACA;AACA;AACA;AACC;AACD;AACA;AAAA;AAAA,EAGV,SAAS,OAAiD;AAChE,WAAO,KAAK,WAAW,SAAS,KAAK,UAAU,cAAc,eAAe;AAAA;AAAA,EAGtE,cAAoB;AAC1B,SAAK,WAAW,YAAY,KAAK;AAAA;AAAA,EAG3B,iBACN,OACA,UACa;AACb,WAAO,KAAK,WAAW,iBAAiB,KAAK,UAAU,OAAO;AAAA;AAAA,EAGxD,YAAY,UAAwB,SAA6C;AACvF,SAAK,WAAW,YAAY,KAAK,UAAU,UAAU;AAAA;AAAA,EAG/C,SAAS,WAAmC;AAClD,WAAO,KAAK,UAAU;AAAA;AAAA,EAGhB,YAAY,OAAe;AACjC,WAAO,KAAK,UAAU,IAAI,UAAU;AAAA;AAAA,MAG1B,YAAY;AACtB,WAAO,KAAK,YAAY,cAAc;AAAA;AAAA,MAG5B,gBAAgB;AAC1B,QAAI,KAAK,iBAAiB,QAAW;AACpC,aAAO,KAAK;AAAA;AAEb,WAAO,KAAK,UAAU,OAAO,KAAK,eAAe,KAAK;AAAA;AAAA,MAK5C,aAAkC;AAC5C,WAAO,IAAI,oBAAoB,KAAK;AAAA;AAAA,MAG1B,SAA0B;AACpC,WAAO,IAAI,gBAAgB,KAAK;AAAA;AAAA;AAGlC,UAAU,gBAAV;AACQ,EAAM,2BAAY;AAAA,GADhB;;;;"}
@@ -235,7 +235,14 @@ class StateInitializer {
235
235
  hasUnpersistedChanges: false,
236
236
  getAccessor: () => {
237
237
  if (fieldState.accessor === void 0) {
238
- fieldState.accessor = new FieldAccessor(fieldState, this.fieldOperations, fieldState.placeholderName, fieldState.value, fieldState.persistedValue === void 0 ? null : fieldState.persistedValue, fieldState.fieldMarker.defaultValue, fieldState.errors, fieldState.hasUnpersistedChanges, fieldState.touchLog, fieldState.getAccessor);
238
+ const fieldSchema = this.treeStore.schema.getEntityField(parent.entity.entityName, fieldMarker.fieldName);
239
+ if (!fieldSchema) {
240
+ throw new BindingError(`Unknown field ${parent.entity.entityName}.${fieldMarker.fieldName}.`);
241
+ }
242
+ if (fieldSchema.__typename !== "_Column") {
243
+ throw new BindingError(`Invalid type of field ${parent.entity.entityName}.${fieldMarker.fieldName}. Expected '_Column', '${fieldSchema.__typename}' found.`);
244
+ }
245
+ fieldState.accessor = new FieldAccessor(fieldState, this.fieldOperations, fieldState.placeholderName, fieldState.value, fieldState.persistedValue === void 0 ? null : fieldState.persistedValue, fieldState.fieldMarker.defaultValue, fieldState.errors, fieldState.hasUnpersistedChanges, fieldState.touchLog, fieldState.getAccessor, fieldSchema);
239
246
  }
240
247
  return fieldState.accessor;
241
248
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StateInitializer.js","sources":["../../../src/core/StateInitializer.ts"],"sourcesContent":["import { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, FieldAccessor } from '../accessors'\nimport { EntityFieldPersistedData, RuntimeId, ServerGeneratedUuid, UnpersistedEntityDummyId } from '../accessorTree'\nimport { BindingError } from '../BindingError'\nimport {\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '../markers'\nimport { BijectiveIndexedMap } from '../structures'\nimport type {\n\tEntityEventListenerStore,\n\tEntityListEventListenerStore,\n\tEntityName,\n\tFieldEventListenerStore,\n\tFieldName,\n\tScalar,\n} from '../treeParameters'\nimport { assertNever } from '../utils'\nimport type { AccessorErrorManager } from './AccessorErrorManager'\nimport type { Config } from './Config'\nimport type { EventManager } from './EventManager'\nimport { EntityOperations, FieldOperations, ListOperations } from './operations'\nimport { RealmKeyGenerator } from './RealmKeyGenerator'\nimport {\n\tEntityListBlueprint,\n\tEntityListState,\n\tEntityRealmBlueprint,\n\tEntityRealmState,\n\tEntityRealmStateStub,\n\tEntityState,\n\tFieldState,\n\tgetEntityMarker,\n\tRootStateNode,\n} from './state'\nimport { TreeParameterMerger } from './TreeParameterMerger'\nimport type { TreeStore } from './TreeStore'\nimport { EventListenersStore } from '../treeParameters'\n\nexport class StateInitializer {\n\tprivate readonly fieldOperations: FieldOperations\n\tprivate readonly entityOperations: EntityOperations\n\tprivate readonly listOperations: ListOperations\n\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly config: Config,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {\n\t\tthis.fieldOperations = new FieldOperations(this.accessorErrorManager, this.eventManager, this, this.treeStore)\n\t\tthis.entityOperations = new EntityOperations(\n\t\t\tthis.accessorErrorManager,\n\t\t\tthis.batchUpdatesOptions,\n\t\t\tthis.eventManager,\n\t\t\tthis,\n\t\t\tthis.treeStore,\n\t\t)\n\t\tthis.listOperations = new ListOperations(\n\t\t\tthis.accessorErrorManager,\n\t\t\tthis.batchUpdatesOptions,\n\t\t\tthis.eventManager,\n\t\t\tthis,\n\t\t\tthis.treeStore,\n\t\t)\n\t}\n\n\tpublic initializeSubTree(tree: EntitySubTreeMarker | EntityListSubTreeMarker): RootStateNode {\n\t\tlet subTreeState: RootStateNode\n\t\tconst persistedRootData = this.treeStore.subTreePersistedData.get(tree.placeholderName)\n\n\t\tif (tree instanceof EntityListSubTreeMarker) {\n\t\t\tconst persistedEntityIds: Set<string> = persistedRootData instanceof Set ? persistedRootData : new Set()\n\t\t\tsubTreeState = this.initializeEntityListState(\n\t\t\t\t{ marker: tree, parent: undefined },\n\t\t\t\ttree.entityName,\n\t\t\t\tpersistedEntityIds,\n\t\t\t)\n\t\t} else {\n\t\t\tsubTreeState = this.materializeEntityRealm(\n\t\t\t\tthis.initializeEntityRealm(\n\t\t\t\t\tpersistedRootData instanceof ServerGeneratedUuid ? persistedRootData : new UnpersistedEntityDummyId(),\n\t\t\t\t\ttree.entityName,\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'subTree',\n\t\t\t\t\t\tmarker: tree,\n\t\t\t\t\t\tparent: undefined,\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\n\t\treturn subTreeState\n\t}\n\n\tpublic initializeEntityRealm(\n\t\tid: RuntimeId,\n\t\tentityName: EntityName,\n\t\tblueprint: EntityRealmBlueprint,\n\t\tcopyFrom?: EntityRealmState | EntityRealmStateStub,\n\t): EntityRealmState | EntityRealmStateStub {\n\t\t// This is counter-intuitive a bit. The method can also return an EntityRealmState, not just a stub.\n\t\t// The reason is so that each call-site can just default to trying to initialize a stub without having to keep\n\t\t// in mind that the realm might have already been initialized.\n\n\t\tconst entity = this.initializeEntityState(id, entityName)\n\t\tconst realmKey = RealmKeyGenerator.getRealmKey(id, blueprint)\n\n\t\tconst existing = this.treeStore.entityRealmStore.get(realmKey)\n\t\tif (existing !== undefined) {\n\t\t\treturn existing\n\t\t}\n\n\t\tif (!copyFrom || copyFrom.type !== 'entityRealm') {\n\t\t\tconst stub: EntityRealmStateStub = {\n\t\t\t\ttype: 'entityRealmStub',\n\n\t\t\t\tblueprint,\n\t\t\t\tentity,\n\t\t\t\trealmKey,\n\t\t\t\tgetAccessor: () => this.materializeEntityRealm(stub).getAccessor(),\n\t\t\t}\n\t\t\tthis.registerEntityRealm(stub)\n\n\t\t\treturn stub\n\t\t}\n\t\tconst realm = this.createEntityRealm(blueprint, realmKey, entity)\n\n\t\tthis.registerEntityRealm(realm)\n\n\t\tconst marker = getEntityMarker(realm)\n\t\tconst pathBack = this.treeStore.getPathBackToParent(realm)\n\n\t\tfor (const [placeholderName, field] of marker.fields.markers) {\n\t\t\tif (field instanceof FieldMarker) {\n\t\t\t\tconst value = copyFrom.children.get(placeholderName)\n\t\t\t\tif (!value || value.type !== 'field') {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tthis.initializeFromFieldMarker(realm, field, value.value)\n\t\t\t} else if (field instanceof HasManyRelationMarker) {\n\t\t\t\t// todo: get from copyFrom\n\t\t\t\tthis.initializeFromHasManyRelationMarker(realm, field, new Set())\n\t\t\t} else if (field instanceof HasOneRelationMarker) {\n\t\t\t\tlet runtimeId: RuntimeId\n\t\t\t\tlet subCopyFrom: EntityRealmState | undefined = undefined\n\t\t\t\tif (pathBack?.fieldBackToParent === field.parameters.field) {\n\t\t\t\t\truntimeId = pathBack.parent.entity.id\n\t\t\t\t} else {\n\t\t\t\t\tconst value = copyFrom.children.get(placeholderName)\n\t\t\t\t\tif (!value || (value.type !== 'entityRealm' && value.type !== 'entityRealmStub')) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\t\t\t\t\tif (value.type === 'entityRealm') {\n\t\t\t\t\t\tsubCopyFrom = value\n\t\t\t\t\t\truntimeId = value.entity.id\n\t\t\t\t\t} else {\n\t\t\t\t\t\truntimeId = new UnpersistedEntityDummyId()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.initializeFromHasOneRelationMarker(realm, field, runtimeId, subCopyFrom)\n\t\t\t} else {\n\t\t\t\tassertNever(field)\n\t\t\t}\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(realm)\n\t\treturn realm\n\t}\n\n\tprivate createEntityRealm(blueprint: EntityRealmBlueprint, realmKey: string, entity: EntityState): EntityRealmState {\n\t\tconst entityRealm: EntityRealmState = {\n\t\t\ttype: 'entityRealm',\n\n\t\t\tblueprint,\n\t\t\trealmKey,\n\t\t\tentity,\n\n\t\t\taccessor: undefined,\n\t\t\tchildren: new Map(),\n\t\t\tchildrenWithPendingUpdates: undefined,\n\t\t\terrors: undefined,\n\t\t\teventListeners: this.initializeEntityEventListenerStore(blueprint),\n\t\t\tfieldsWithPendingConnectionUpdates: undefined,\n\t\t\tplannedHasOneDeletions: undefined,\n\t\t\tunpersistedChangesCount: 0,\n\t\t\tgetAccessor: () => {\n\t\t\t\tif (entityRealm.accessor === undefined) {\n\t\t\t\t\tconst entity = entityRealm.entity\n\t\t\t\t\tentityRealm.accessor = new EntityAccessor(\n\t\t\t\t\t\tentityRealm,\n\t\t\t\t\t\tthis.entityOperations,\n\t\t\t\t\t\tentity.id,\n\t\t\t\t\t\tentityRealm.realmKey,\n\t\t\t\t\t\tentity.entityName,\n\n\t\t\t\t\t\t// We're technically exposing more info in runtime than we'd like but that way we don't have to allocate and\n\t\t\t\t\t\t// keep in sync two copies of the same data. TS hides the extra info anyway.\n\t\t\t\t\t\tentityRealm.children,\n\t\t\t\t\t\tthis.treeStore.persistedEntityData.get(entity.id.value),\n\t\t\t\t\t\tentityRealm.unpersistedChangesCount !== 0,\n\t\t\t\t\t\tentityRealm.errors,\n\t\t\t\t\t\tgetEntityMarker(entityRealm).environment,\n\t\t\t\t\t\tentityRealm.getAccessor,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn entityRealm.accessor\n\t\t\t},\n\t\t}\n\t\treturn entityRealm\n\t}\n\n\tprivate materializeEntityRealm(state: EntityRealmState | EntityRealmStateStub): EntityRealmState {\n\t\tif (state.type === 'entityRealm') {\n\t\t\treturn state\n\t\t}\n\t\tconst { realmKey, entity, blueprint } = state\n\n\t\tconst existing = this.treeStore.entityRealmStore.get(realmKey)\n\t\tif (existing !== undefined && existing.type === 'entityRealm') {\n\t\t\treturn existing\n\t\t}\n\n\t\tconst entityRealm = this.createEntityRealm(blueprint, realmKey, entity)\n\n\t\tthis.registerEntityRealm(entityRealm)\n\n\t\t// if (blueprint.creationParameters.forceCreation && !entity.id.existsOnServer) {\n\t\t// \tentityRealm.unpersistedChangesCount += 1\n\t\t// }\n\n\t\tconst persistedData = this.treeStore.persistedEntityData.get(entity.id.value)\n\n\t\tconst marker = getEntityMarker(state)\n\t\tconst pathBack = this.treeStore.getPathBackToParent(entityRealm)\n\n\t\tfor (const [placeholderName, field] of marker.fields.markers) {\n\t\t\tconst fieldDatum = persistedData?.get(placeholderName)\n\n\t\t\tif (field instanceof FieldMarker) {\n\t\t\t\tthis.initializeFromFieldMarker(entityRealm, field, fieldDatum)\n\t\t\t} else if (field instanceof HasManyRelationMarker) {\n\t\t\t\t// if (pathBack?.fieldBackToParent === field.parameters.field) {\n\t\t\t\t// \t// TODO this is probably wrong?\n\t\t\t\t// \tconst ids = pathBack.parent.children.get(field.placeholderName)\n\t\t\t\t// \tconst newData = this.treeStore.persistedEntityData.get(pathBack.parent.entity.id.value)\n\t\t\t\t// \tconsole.log('many?', pathBack, field, entityRealm, fieldDatum, ids)\n\t\t\t\t// }\n\t\t\t\tthis.initializeFromHasManyRelationMarker(entityRealm, field, fieldDatum instanceof Set ? fieldDatum : new Set())\n\t\t\t} else if (field instanceof HasOneRelationMarker) {\n\t\t\t\tlet runtimeId: RuntimeId\n\t\t\t\tif (pathBack?.fieldBackToParent === field.parameters.field) {\n\t\t\t\t\truntimeId = pathBack.parent.entity.id\n\t\t\t\t} else {\n\t\t\t\t\truntimeId = fieldDatum instanceof ServerGeneratedUuid ? fieldDatum : new UnpersistedEntityDummyId()\n\t\t\t\t}\n\t\t\t\tthis.initializeFromHasOneRelationMarker(entityRealm, field, runtimeId)\n\t\t\t} else {\n\t\t\t\tassertNever(field)\n\t\t\t}\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(entityRealm)\n\n\t\treturn entityRealm\n\t}\n\n\tprivate registerEntityRealm(entityRealm: EntityRealmState | EntityRealmStateStub) {\n\t\tconst { realmKey, blueprint, entity } = entityRealm\n\n\t\tthis.treeStore.entityRealmStore.set(entityRealm.realmKey, entityRealm)\n\n\t\tif (blueprint.type === 'listEntity') {\n\t\t\tblueprint.parent.children.set(entity.id.value, entityRealm)\n\t\t} else if (blueprint.type === 'hasOne') {\n\t\t\tblueprint.parent.children.set(blueprint.marker.placeholderName, entityRealm)\n\t\t}\n\t\tentity.realms.set(realmKey, entityRealm)\n\t}\n\n\tpublic initializeEntityState(id: RuntimeId, entityName: EntityName): EntityState {\n\t\tconst entityId = id.value\n\n\t\tconst existing = this.treeStore.entityStore.get(entityId)\n\t\tif (existing !== undefined) {\n\t\t\treturn existing\n\t\t}\n\n\t\tconst entityState: EntityState = {\n\t\t\tentityName,\n\t\t\thasIdSetInStone: id instanceof ServerGeneratedUuid,\n\t\t\tid,\n\t\t\tisScheduledForDeletion: false,\n\t\t\tmaidenId: id instanceof UnpersistedEntityDummyId ? id : undefined,\n\t\t\trealms: new Map(),\n\t\t}\n\t\tthis.treeStore.entityStore.set(entityId, entityState)\n\n\t\treturn entityState\n\t}\n\n\tprivate initializeEntityListState(\n\t\tblueprint: EntityListBlueprint,\n\t\tentityName: EntityName,\n\t\tinitialEntityIds: Set<string>,\n\t): EntityListState {\n\t\tconst entityListState: EntityListState = {\n\t\t\ttype: 'entityList',\n\t\t\taccessor: undefined,\n\t\t\tblueprint,\n\t\t\tchildren: new BijectiveIndexedMap(realm => realm.entity.id.value),\n\t\t\tchildrenWithPendingUpdates: undefined,\n\t\t\tentityName,\n\t\t\teventListeners: this.initializeEntityListEventListenerStore(blueprint),\n\t\t\tchildEventListeners: this.initializeEntityListChildEventListenerStore(blueprint),\n\t\t\terrors: undefined,\n\t\t\tplannedRemovals: undefined,\n\t\t\tunpersistedChangesCount: 0, // TODO force creation?\n\t\t\tgetAccessor: () => {\n\t\t\t\tif (entityListState.accessor === undefined) {\n\t\t\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(entityListState)\n\t\t\t\t\tentityListState.accessor = new EntityListAccessor(\n\t\t\t\t\t\tentityListState,\n\t\t\t\t\t\tthis.listOperations,\n\t\t\t\t\t\tentityListState.children,\n\t\t\t\t\t\tpersistedEntityIds,\n\t\t\t\t\t\tentityListState.unpersistedChangesCount !== 0,\n\t\t\t\t\t\tentityListState.errors,\n\t\t\t\t\t\tentityListState.blueprint.marker.environment,\n\t\t\t\t\t\tentityListState.getAccessor,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn entityListState.accessor\n\t\t\t},\n\t\t}\n\n\t\tconst initialData: Iterable<string | undefined> =\n\t\t\tinitialEntityIds.size === 0\n\t\t\t\t? Array.from({ length: blueprint.marker.parameters.initialEntityCount })\n\t\t\t\t: initialEntityIds\n\t\tfor (const entityId of initialData) {\n\t\t\tthis.initializeEntityRealm(\n\t\t\t\tentityId ? new ServerGeneratedUuid(entityId) : new UnpersistedEntityDummyId(),\n\t\t\t\tentityListState.entityName,\n\t\t\t\t{\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: entityListState,\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(entityListState)\n\n\t\treturn entityListState\n\t}\n\n\tprivate initializeFieldState(\n\t\tparent: EntityRealmState,\n\t\tplaceholderName: FieldName,\n\t\tfieldMarker: FieldMarker,\n\t\tpersistedValue: Scalar | undefined,\n\t): FieldState {\n\t\tconst resolvedFieldValue = persistedValue ?? fieldMarker.defaultValue ?? null\n\n\t\tconst fieldState: FieldState = {\n\t\t\ttype: 'field',\n\t\t\taccessor: undefined,\n\t\t\tfieldMarker,\n\t\t\tplaceholderName,\n\t\t\tpersistedValue,\n\t\t\tparent,\n\t\t\tvalue: resolvedFieldValue,\n\t\t\teventListeners: this.initializeFieldEventListenerStore(fieldMarker),\n\t\t\terrors: undefined,\n\t\t\ttouchLog: undefined,\n\t\t\thasUnpersistedChanges: false,\n\t\t\tgetAccessor: () => {\n\t\t\t\tif (fieldState.accessor === undefined) {\n\t\t\t\t\tfieldState.accessor = new FieldAccessor(\n\t\t\t\t\t\tfieldState,\n\t\t\t\t\t\tthis.fieldOperations,\n\t\t\t\t\t\tfieldState.placeholderName,\n\t\t\t\t\t\tfieldState.value,\n\t\t\t\t\t\tfieldState.persistedValue === undefined ? null : fieldState.persistedValue,\n\t\t\t\t\t\tfieldState.fieldMarker.defaultValue,\n\t\t\t\t\t\tfieldState.errors,\n\t\t\t\t\t\tfieldState.hasUnpersistedChanges,\n\t\t\t\t\t\tfieldState.touchLog,\n\t\t\t\t\t\tfieldState.getAccessor,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn fieldState.accessor\n\t\t\t},\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(fieldState)\n\t\treturn fieldState\n\t}\n\n\tprivate initializeFromFieldMarker(\n\t\tparent: EntityRealmState,\n\t\tfield: FieldMarker,\n\t\tfieldDatum: EntityFieldPersistedData | undefined,\n\t) {\n\t\tif (fieldDatum instanceof Set) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`Received a collection of referenced entities where a single '${field.fieldName}' field was expected. ` +\n\t\t\t\t\t`Perhaps you wanted to use a <Repeater />?`,\n\t\t\t)\n\t\t}\n\t\tif (fieldDatum instanceof ServerGeneratedUuid) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`Received a referenced entity where a single '${field.fieldName}' field was expected. ` +\n\t\t\t\t\t`Perhaps you wanted to use <HasOne />?`,\n\t\t\t)\n\t\t}\n\t\tparent.children.set(\n\t\t\tfield.placeholderName,\n\t\t\tthis.initializeFieldState(parent, field.placeholderName, field, fieldDatum),\n\t\t)\n\t}\n\n\tprivate initializeFromHasOneRelationMarker(\n\t\tparent: EntityRealmState,\n\t\tfield: HasOneRelationMarker,\n\t\tentityId: RuntimeId,\n\t\tcopyFrom?: EntityRealmState | EntityRealmStateStub,\n\t) {\n\t\tparent.children.set(\n\t\t\tfield.placeholderName,\n\t\t\tthis.initializeEntityRealm(entityId, this.getRelationTargetEntityName(parent, field), {\n\t\t\t\ttype: 'hasOne',\n\t\t\t\tparent,\n\t\t\t\tmarker: field,\n\t\t\t}, copyFrom),\n\t\t)\n\t\t// if (fieldDatum instanceof ServerGeneratedUuid || fieldDatum === null || fieldDatum === undefined) {\n\t\t// \tconst entityId = fieldDatum instanceof ServerGeneratedUuid ? fieldDatum : new UnpersistedEntityDummyId()\n\t\t//\n\t\t//\n\t\t// } else if (fieldDatum instanceof Set) {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a collection of entities for field '${relation.field}' where a single entity was expected. ` +\n\t\t// \t\t\t`Perhaps you wanted to use a <Repeater />?`,\n\t\t// \t)\n\t\t// } else {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a scalar value for field '${relation.field}' where a single entity was expected.` +\n\t\t// \t\t\t`Perhaps you meant to use a variant of <Field />?`,\n\t\t// \t)\n\t\t// }\n\t}\n\n\tprivate initializeFromHasManyRelationMarker(\n\t\tparent: EntityRealmState,\n\t\tfield: HasManyRelationMarker,\n\t\tpersistedEntityIds: Set<string>,\n\t) {\n\t\tparent.children.set(\n\t\t\tfield.placeholderName,\n\t\t\tthis.initializeEntityListState(\n\t\t\t\t{ marker: field, parent },\n\t\t\t\tthis.getRelationTargetEntityName(parent, field),\n\t\t\t\tpersistedEntityIds,\n\t\t\t),\n\t\t)\n\t\t// const relation = field.parameters\n\t\t//\n\t\t// if (fieldDatum === undefined || fieldDatum instanceof Set) {\n\t\t//\n\t\t// } else if (typeof fieldDatum === 'object') {\n\t\t// \t// Intentionally allowing `fieldDatum === null` here as well since this should only happen when a *hasOne\n\t\t// \t// relation is unlinked, e.g. a Person does not have a linked Nationality.\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a referenced entity for field '${relation.field}' where a collection of entities was expected.` +\n\t\t// \t\t\t`Perhaps you wanted to use a <HasOne />?`,\n\t\t// \t)\n\t\t// } else {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a scalar value for field '${relation.field}' where a collection of entities was expected.` +\n\t\t// \t\t\t`Perhaps you meant to use a variant of <Field />?`,\n\t\t// \t)\n\t\t// }\n\t}\n\n\tprivate getRelationTargetEntityName(\n\t\tentityRealm: EntityRealmState,\n\t\tfield: HasOneRelationMarker | HasManyRelationMarker,\n\t): EntityName {\n\t\tconst targetField = this.treeStore.schema.getEntityField(entityRealm.entity.entityName, field.parameters.field)\n\n\t\tif (targetField?.__typename !== '_Relation') {\n\t\t\tthrow new BindingError() // This should have been validated elsewhere.\n\t\t}\n\t\treturn targetField.targetEntity\n\t}\n\n\tpublic runImmediateUserInitialization(\n\t\trealm: EntityRealmState | EntityRealmStateStub,\n\t\tinitialize: EntityAccessor.BatchUpdatesHandler | undefined,\n\t) {\n\t\tif (initialize === undefined) {\n\t\t\treturn\n\t\t}\n\t\tconst entityRealm = this.materializeEntityRealm(realm)\n\n\t\trealm.getAccessor().batchUpdates(initialize)\n\n\t\tconst initializeListeners = this.eventManager.getEventListeners(entityRealm, { type: 'initialize' })\n\t\tif (initializeListeners === undefined || initializeListeners.size === 0) {\n\t\t\trealm.entity.hasIdSetInStone = true\n\t\t}\n\t}\n\n\tpublic initializeEntityEventListenerStore(blueprint: EntityRealmBlueprint): EntityEventListenerStore | undefined {\n\t\tif (blueprint.type === 'listEntity') {\n\t\t\tconst blueprintListeners = blueprint.parent.blueprint.marker.parameters.childEventListeners\n\t\t\tconst childInitialize = blueprintListeners?.get({ type: 'initialize' })\n\t\t\tconst store: EntityEventListenerStore = new EventListenersStore(() => blueprint.parent.childEventListeners)\n\n\t\t\tif (childInitialize !== undefined) {\n\t\t\t\tstore.set({ type: 'initialize' }, childInitialize)\n\t\t\t}\n\t\t\treturn store\n\t\t}\n\n\t\tconst blueprintListeners = blueprint.marker.parameters.eventListeners\n\t\tif (blueprintListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn TreeParameterMerger.cloneSingleEntityEventListeners(blueprintListeners)\n\t}\n\n\tprivate initializeEntityListEventListenerStore(\n\t\tblueprint: EntityListBlueprint,\n\t): EntityListEventListenerStore | undefined {\n\t\tconst blueprintListeners = blueprint.marker.parameters.eventListeners\n\n\t\tif (blueprintListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn TreeParameterMerger.cloneEntityListEventListeners(blueprintListeners)\n\t}\n\n\tprivate initializeEntityListChildEventListenerStore(\n\t\tblueprint: EntityListBlueprint,\n\t): EntityEventListenerStore | undefined {\n\t\tconst blueprintListeners = blueprint.marker.parameters.childEventListeners\n\n\t\tif (blueprintListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn TreeParameterMerger.cloneSingleEntityEventListeners(blueprintListeners)\n\t}\n\n\tprivate initializeFieldEventListenerStore(marker: FieldMarker): FieldEventListenerStore | undefined {\n\t\t// TODO !!!\n\t\treturn undefined\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;uBAwC8B;AAAA,EAKtB,YACW,sBACA,qBACA,QACA,cACA,WAChB;AALgB;AACA;AACA;AACA;AACA;AAEjB,SAAK,kBAAkB,IAAI,gBAAgB,KAAK,sBAAsB,KAAK,cAA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O;AAAA;AAER,WAAO,oBAAoB,gCAAgC;AAAA;AAAA,EAGpD,kCAAkC,QAA0D;AAEnG,WAAO;AAAA;AAAA;;;;"}
1
+ {"version":3,"file":"StateInitializer.js","sources":["../../../src/core/StateInitializer.ts"],"sourcesContent":["import { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, FieldAccessor } from '../accessors'\nimport { EntityFieldPersistedData, RuntimeId, ServerGeneratedUuid, UnpersistedEntityDummyId } from '../accessorTree'\nimport { BindingError } from '../BindingError'\nimport {\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '../markers'\nimport { BijectiveIndexedMap } from '../structures'\nimport type {\n\tEntityEventListenerStore,\n\tEntityListEventListenerStore,\n\tEntityName,\n\tFieldEventListenerStore,\n\tFieldName,\n\tScalar,\n} from '../treeParameters'\nimport { assertNever } from '../utils'\nimport type { AccessorErrorManager } from './AccessorErrorManager'\nimport type { Config } from './Config'\nimport type { EventManager } from './EventManager'\nimport { EntityOperations, FieldOperations, ListOperations } from './operations'\nimport { RealmKeyGenerator } from './RealmKeyGenerator'\nimport {\n\tEntityListBlueprint,\n\tEntityListState,\n\tEntityRealmBlueprint,\n\tEntityRealmState,\n\tEntityRealmStateStub,\n\tEntityState,\n\tFieldState,\n\tgetEntityMarker,\n\tRootStateNode,\n} from './state'\nimport { TreeParameterMerger } from './TreeParameterMerger'\nimport type { TreeStore } from './TreeStore'\nimport { EventListenersStore } from '../treeParameters'\n\nexport class StateInitializer {\n\tprivate readonly fieldOperations: FieldOperations\n\tprivate readonly entityOperations: EntityOperations\n\tprivate readonly listOperations: ListOperations\n\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly config: Config,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {\n\t\tthis.fieldOperations = new FieldOperations(this.accessorErrorManager, this.eventManager, this, this.treeStore)\n\t\tthis.entityOperations = new EntityOperations(\n\t\t\tthis.accessorErrorManager,\n\t\t\tthis.batchUpdatesOptions,\n\t\t\tthis.eventManager,\n\t\t\tthis,\n\t\t\tthis.treeStore,\n\t\t)\n\t\tthis.listOperations = new ListOperations(\n\t\t\tthis.accessorErrorManager,\n\t\t\tthis.batchUpdatesOptions,\n\t\t\tthis.eventManager,\n\t\t\tthis,\n\t\t\tthis.treeStore,\n\t\t)\n\t}\n\n\tpublic initializeSubTree(tree: EntitySubTreeMarker | EntityListSubTreeMarker): RootStateNode {\n\t\tlet subTreeState: RootStateNode\n\t\tconst persistedRootData = this.treeStore.subTreePersistedData.get(tree.placeholderName)\n\n\t\tif (tree instanceof EntityListSubTreeMarker) {\n\t\t\tconst persistedEntityIds: Set<string> = persistedRootData instanceof Set ? persistedRootData : new Set()\n\t\t\tsubTreeState = this.initializeEntityListState(\n\t\t\t\t{ marker: tree, parent: undefined },\n\t\t\t\ttree.entityName,\n\t\t\t\tpersistedEntityIds,\n\t\t\t)\n\t\t} else {\n\t\t\tsubTreeState = this.materializeEntityRealm(\n\t\t\t\tthis.initializeEntityRealm(\n\t\t\t\t\tpersistedRootData instanceof ServerGeneratedUuid ? persistedRootData : new UnpersistedEntityDummyId(),\n\t\t\t\t\ttree.entityName,\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'subTree',\n\t\t\t\t\t\tmarker: tree,\n\t\t\t\t\t\tparent: undefined,\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\n\t\treturn subTreeState\n\t}\n\n\tpublic initializeEntityRealm(\n\t\tid: RuntimeId,\n\t\tentityName: EntityName,\n\t\tblueprint: EntityRealmBlueprint,\n\t\tcopyFrom?: EntityRealmState | EntityRealmStateStub,\n\t): EntityRealmState | EntityRealmStateStub {\n\t\t// This is counter-intuitive a bit. The method can also return an EntityRealmState, not just a stub.\n\t\t// The reason is so that each call-site can just default to trying to initialize a stub without having to keep\n\t\t// in mind that the realm might have already been initialized.\n\n\t\tconst entity = this.initializeEntityState(id, entityName)\n\t\tconst realmKey = RealmKeyGenerator.getRealmKey(id, blueprint)\n\n\t\tconst existing = this.treeStore.entityRealmStore.get(realmKey)\n\t\tif (existing !== undefined) {\n\t\t\treturn existing\n\t\t}\n\n\t\tif (!copyFrom || copyFrom.type !== 'entityRealm') {\n\t\t\tconst stub: EntityRealmStateStub = {\n\t\t\t\ttype: 'entityRealmStub',\n\n\t\t\t\tblueprint,\n\t\t\t\tentity,\n\t\t\t\trealmKey,\n\t\t\t\tgetAccessor: () => this.materializeEntityRealm(stub).getAccessor(),\n\t\t\t}\n\t\t\tthis.registerEntityRealm(stub)\n\n\t\t\treturn stub\n\t\t}\n\t\tconst realm = this.createEntityRealm(blueprint, realmKey, entity)\n\n\t\tthis.registerEntityRealm(realm)\n\n\t\tconst marker = getEntityMarker(realm)\n\t\tconst pathBack = this.treeStore.getPathBackToParent(realm)\n\n\t\tfor (const [placeholderName, field] of marker.fields.markers) {\n\t\t\tif (field instanceof FieldMarker) {\n\t\t\t\tconst value = copyFrom.children.get(placeholderName)\n\t\t\t\tif (!value || value.type !== 'field') {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tthis.initializeFromFieldMarker(realm, field, value.value)\n\t\t\t} else if (field instanceof HasManyRelationMarker) {\n\t\t\t\t// todo: get from copyFrom\n\t\t\t\tthis.initializeFromHasManyRelationMarker(realm, field, new Set())\n\t\t\t} else if (field instanceof HasOneRelationMarker) {\n\t\t\t\tlet runtimeId: RuntimeId\n\t\t\t\tlet subCopyFrom: EntityRealmState | undefined = undefined\n\t\t\t\tif (pathBack?.fieldBackToParent === field.parameters.field) {\n\t\t\t\t\truntimeId = pathBack.parent.entity.id\n\t\t\t\t} else {\n\t\t\t\t\tconst value = copyFrom.children.get(placeholderName)\n\t\t\t\t\tif (!value || (value.type !== 'entityRealm' && value.type !== 'entityRealmStub')) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\t\t\t\t\tif (value.type === 'entityRealm') {\n\t\t\t\t\t\tsubCopyFrom = value\n\t\t\t\t\t\truntimeId = value.entity.id\n\t\t\t\t\t} else {\n\t\t\t\t\t\truntimeId = new UnpersistedEntityDummyId()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.initializeFromHasOneRelationMarker(realm, field, runtimeId, subCopyFrom)\n\t\t\t} else {\n\t\t\t\tassertNever(field)\n\t\t\t}\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(realm)\n\t\treturn realm\n\t}\n\n\tprivate createEntityRealm(blueprint: EntityRealmBlueprint, realmKey: string, entity: EntityState): EntityRealmState {\n\t\tconst entityRealm: EntityRealmState = {\n\t\t\ttype: 'entityRealm',\n\n\t\t\tblueprint,\n\t\t\trealmKey,\n\t\t\tentity,\n\n\t\t\taccessor: undefined,\n\t\t\tchildren: new Map(),\n\t\t\tchildrenWithPendingUpdates: undefined,\n\t\t\terrors: undefined,\n\t\t\teventListeners: this.initializeEntityEventListenerStore(blueprint),\n\t\t\tfieldsWithPendingConnectionUpdates: undefined,\n\t\t\tplannedHasOneDeletions: undefined,\n\t\t\tunpersistedChangesCount: 0,\n\t\t\tgetAccessor: () => {\n\t\t\t\tif (entityRealm.accessor === undefined) {\n\t\t\t\t\tconst entity = entityRealm.entity\n\t\t\t\t\tentityRealm.accessor = new EntityAccessor(\n\t\t\t\t\t\tentityRealm,\n\t\t\t\t\t\tthis.entityOperations,\n\t\t\t\t\t\tentity.id,\n\t\t\t\t\t\tentityRealm.realmKey,\n\t\t\t\t\t\tentity.entityName,\n\n\t\t\t\t\t\t// We're technically exposing more info in runtime than we'd like but that way we don't have to allocate and\n\t\t\t\t\t\t// keep in sync two copies of the same data. TS hides the extra info anyway.\n\t\t\t\t\t\tentityRealm.children,\n\t\t\t\t\t\tthis.treeStore.persistedEntityData.get(entity.id.value),\n\t\t\t\t\t\tentityRealm.unpersistedChangesCount !== 0,\n\t\t\t\t\t\tentityRealm.errors,\n\t\t\t\t\t\tgetEntityMarker(entityRealm).environment,\n\t\t\t\t\t\tentityRealm.getAccessor,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn entityRealm.accessor\n\t\t\t},\n\t\t}\n\t\treturn entityRealm\n\t}\n\n\tprivate materializeEntityRealm(state: EntityRealmState | EntityRealmStateStub): EntityRealmState {\n\t\tif (state.type === 'entityRealm') {\n\t\t\treturn state\n\t\t}\n\t\tconst { realmKey, entity, blueprint } = state\n\n\t\tconst existing = this.treeStore.entityRealmStore.get(realmKey)\n\t\tif (existing !== undefined && existing.type === 'entityRealm') {\n\t\t\treturn existing\n\t\t}\n\n\t\tconst entityRealm = this.createEntityRealm(blueprint, realmKey, entity)\n\n\t\tthis.registerEntityRealm(entityRealm)\n\n\t\t// if (blueprint.creationParameters.forceCreation && !entity.id.existsOnServer) {\n\t\t// \tentityRealm.unpersistedChangesCount += 1\n\t\t// }\n\n\t\tconst persistedData = this.treeStore.persistedEntityData.get(entity.id.value)\n\n\t\tconst marker = getEntityMarker(state)\n\t\tconst pathBack = this.treeStore.getPathBackToParent(entityRealm)\n\n\t\tfor (const [placeholderName, field] of marker.fields.markers) {\n\t\t\tconst fieldDatum = persistedData?.get(placeholderName)\n\n\t\t\tif (field instanceof FieldMarker) {\n\t\t\t\tthis.initializeFromFieldMarker(entityRealm, field, fieldDatum)\n\t\t\t} else if (field instanceof HasManyRelationMarker) {\n\t\t\t\t// if (pathBack?.fieldBackToParent === field.parameters.field) {\n\t\t\t\t// \t// TODO this is probably wrong?\n\t\t\t\t// \tconst ids = pathBack.parent.children.get(field.placeholderName)\n\t\t\t\t// \tconst newData = this.treeStore.persistedEntityData.get(pathBack.parent.entity.id.value)\n\t\t\t\t// \tconsole.log('many?', pathBack, field, entityRealm, fieldDatum, ids)\n\t\t\t\t// }\n\t\t\t\tthis.initializeFromHasManyRelationMarker(entityRealm, field, fieldDatum instanceof Set ? fieldDatum : new Set())\n\t\t\t} else if (field instanceof HasOneRelationMarker) {\n\t\t\t\tlet runtimeId: RuntimeId\n\t\t\t\tif (pathBack?.fieldBackToParent === field.parameters.field) {\n\t\t\t\t\truntimeId = pathBack.parent.entity.id\n\t\t\t\t} else {\n\t\t\t\t\truntimeId = fieldDatum instanceof ServerGeneratedUuid ? fieldDatum : new UnpersistedEntityDummyId()\n\t\t\t\t}\n\t\t\t\tthis.initializeFromHasOneRelationMarker(entityRealm, field, runtimeId)\n\t\t\t} else {\n\t\t\t\tassertNever(field)\n\t\t\t}\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(entityRealm)\n\n\t\treturn entityRealm\n\t}\n\n\tprivate registerEntityRealm(entityRealm: EntityRealmState | EntityRealmStateStub) {\n\t\tconst { realmKey, blueprint, entity } = entityRealm\n\n\t\tthis.treeStore.entityRealmStore.set(entityRealm.realmKey, entityRealm)\n\n\t\tif (blueprint.type === 'listEntity') {\n\t\t\tblueprint.parent.children.set(entity.id.value, entityRealm)\n\t\t} else if (blueprint.type === 'hasOne') {\n\t\t\tblueprint.parent.children.set(blueprint.marker.placeholderName, entityRealm)\n\t\t}\n\t\tentity.realms.set(realmKey, entityRealm)\n\t}\n\n\tpublic initializeEntityState(id: RuntimeId, entityName: EntityName): EntityState {\n\t\tconst entityId = id.value\n\n\t\tconst existing = this.treeStore.entityStore.get(entityId)\n\t\tif (existing !== undefined) {\n\t\t\treturn existing\n\t\t}\n\n\t\tconst entityState: EntityState = {\n\t\t\tentityName,\n\t\t\thasIdSetInStone: id instanceof ServerGeneratedUuid,\n\t\t\tid,\n\t\t\tisScheduledForDeletion: false,\n\t\t\tmaidenId: id instanceof UnpersistedEntityDummyId ? id : undefined,\n\t\t\trealms: new Map(),\n\t\t}\n\t\tthis.treeStore.entityStore.set(entityId, entityState)\n\n\t\treturn entityState\n\t}\n\n\tprivate initializeEntityListState(\n\t\tblueprint: EntityListBlueprint,\n\t\tentityName: EntityName,\n\t\tinitialEntityIds: Set<string>,\n\t): EntityListState {\n\t\tconst entityListState: EntityListState = {\n\t\t\ttype: 'entityList',\n\t\t\taccessor: undefined,\n\t\t\tblueprint,\n\t\t\tchildren: new BijectiveIndexedMap(realm => realm.entity.id.value),\n\t\t\tchildrenWithPendingUpdates: undefined,\n\t\t\tentityName,\n\t\t\teventListeners: this.initializeEntityListEventListenerStore(blueprint),\n\t\t\tchildEventListeners: this.initializeEntityListChildEventListenerStore(blueprint),\n\t\t\terrors: undefined,\n\t\t\tplannedRemovals: undefined,\n\t\t\tunpersistedChangesCount: 0, // TODO force creation?\n\t\t\tgetAccessor: () => {\n\t\t\t\tif (entityListState.accessor === undefined) {\n\t\t\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(entityListState)\n\t\t\t\t\tentityListState.accessor = new EntityListAccessor(\n\t\t\t\t\t\tentityListState,\n\t\t\t\t\t\tthis.listOperations,\n\t\t\t\t\t\tentityListState.children,\n\t\t\t\t\t\tpersistedEntityIds,\n\t\t\t\t\t\tentityListState.unpersistedChangesCount !== 0,\n\t\t\t\t\t\tentityListState.errors,\n\t\t\t\t\t\tentityListState.blueprint.marker.environment,\n\t\t\t\t\t\tentityListState.getAccessor,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn entityListState.accessor\n\t\t\t},\n\t\t}\n\n\t\tconst initialData: Iterable<string | undefined> =\n\t\t\tinitialEntityIds.size === 0\n\t\t\t\t? Array.from({ length: blueprint.marker.parameters.initialEntityCount })\n\t\t\t\t: initialEntityIds\n\t\tfor (const entityId of initialData) {\n\t\t\tthis.initializeEntityRealm(\n\t\t\t\tentityId ? new ServerGeneratedUuid(entityId) : new UnpersistedEntityDummyId(),\n\t\t\t\tentityListState.entityName,\n\t\t\t\t{\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: entityListState,\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(entityListState)\n\n\t\treturn entityListState\n\t}\n\n\tprivate initializeFieldState(\n\t\tparent: EntityRealmState,\n\t\tplaceholderName: FieldName,\n\t\tfieldMarker: FieldMarker,\n\t\tpersistedValue: Scalar | undefined,\n\t): FieldState {\n\t\tconst resolvedFieldValue = persistedValue ?? fieldMarker.defaultValue ?? null\n\n\t\tconst fieldState: FieldState = {\n\t\t\ttype: 'field',\n\t\t\taccessor: undefined,\n\t\t\tfieldMarker,\n\t\t\tplaceholderName,\n\t\t\tpersistedValue,\n\t\t\tparent,\n\t\t\tvalue: resolvedFieldValue,\n\t\t\teventListeners: this.initializeFieldEventListenerStore(fieldMarker),\n\t\t\terrors: undefined,\n\t\t\ttouchLog: undefined,\n\t\t\thasUnpersistedChanges: false,\n\n\t\t\tgetAccessor: () => {\n\t\t\t\tif (fieldState.accessor === undefined) {\n\t\t\t\t\tconst fieldSchema = this.treeStore.schema.getEntityField(parent.entity.entityName, fieldMarker.fieldName)\n\t\t\t\t\tif (!fieldSchema) {\n\t\t\t\t\t\tthrow new BindingError(`Unknown field ${parent.entity.entityName}.${fieldMarker.fieldName}.`)\n\t\t\t\t\t}\n\t\t\t\t\tif (fieldSchema.__typename !== '_Column') {\n\t\t\t\t\t\tthrow new BindingError(`Invalid type of field ${parent.entity.entityName}.${fieldMarker.fieldName}. Expected '_Column', '${fieldSchema.__typename}' found.`)\n\t\t\t\t\t}\n\t\t\t\t\tfieldState.accessor = new FieldAccessor(\n\t\t\t\t\t\tfieldState,\n\t\t\t\t\t\tthis.fieldOperations,\n\t\t\t\t\t\tfieldState.placeholderName,\n\t\t\t\t\t\tfieldState.value,\n\t\t\t\t\t\tfieldState.persistedValue === undefined ? null : fieldState.persistedValue,\n\t\t\t\t\t\tfieldState.fieldMarker.defaultValue,\n\t\t\t\t\t\tfieldState.errors,\n\t\t\t\t\t\tfieldState.hasUnpersistedChanges,\n\t\t\t\t\t\tfieldState.touchLog,\n\t\t\t\t\t\tfieldState.getAccessor,\n\t\t\t\t\t\tfieldSchema,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn fieldState.accessor\n\t\t\t},\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(fieldState)\n\t\treturn fieldState\n\t}\n\n\tprivate initializeFromFieldMarker(\n\t\tparent: EntityRealmState,\n\t\tfield: FieldMarker,\n\t\tfieldDatum: EntityFieldPersistedData | undefined,\n\t) {\n\t\tif (fieldDatum instanceof Set) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`Received a collection of referenced entities where a single '${field.fieldName}' field was expected. ` +\n\t\t\t\t\t`Perhaps you wanted to use a <Repeater />?`,\n\t\t\t)\n\t\t}\n\t\tif (fieldDatum instanceof ServerGeneratedUuid) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`Received a referenced entity where a single '${field.fieldName}' field was expected. ` +\n\t\t\t\t\t`Perhaps you wanted to use <HasOne />?`,\n\t\t\t)\n\t\t}\n\t\tparent.children.set(\n\t\t\tfield.placeholderName,\n\t\t\tthis.initializeFieldState(parent, field.placeholderName, field, fieldDatum),\n\t\t)\n\t}\n\n\tprivate initializeFromHasOneRelationMarker(\n\t\tparent: EntityRealmState,\n\t\tfield: HasOneRelationMarker,\n\t\tentityId: RuntimeId,\n\t\tcopyFrom?: EntityRealmState | EntityRealmStateStub,\n\t) {\n\t\tparent.children.set(\n\t\t\tfield.placeholderName,\n\t\t\tthis.initializeEntityRealm(entityId, this.getRelationTargetEntityName(parent, field), {\n\t\t\t\ttype: 'hasOne',\n\t\t\t\tparent,\n\t\t\t\tmarker: field,\n\t\t\t}, copyFrom),\n\t\t)\n\t\t// if (fieldDatum instanceof ServerGeneratedUuid || fieldDatum === null || fieldDatum === undefined) {\n\t\t// \tconst entityId = fieldDatum instanceof ServerGeneratedUuid ? fieldDatum : new UnpersistedEntityDummyId()\n\t\t//\n\t\t//\n\t\t// } else if (fieldDatum instanceof Set) {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a collection of entities for field '${relation.field}' where a single entity was expected. ` +\n\t\t// \t\t\t`Perhaps you wanted to use a <Repeater />?`,\n\t\t// \t)\n\t\t// } else {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a scalar value for field '${relation.field}' where a single entity was expected.` +\n\t\t// \t\t\t`Perhaps you meant to use a variant of <Field />?`,\n\t\t// \t)\n\t\t// }\n\t}\n\n\tprivate initializeFromHasManyRelationMarker(\n\t\tparent: EntityRealmState,\n\t\tfield: HasManyRelationMarker,\n\t\tpersistedEntityIds: Set<string>,\n\t) {\n\t\tparent.children.set(\n\t\t\tfield.placeholderName,\n\t\t\tthis.initializeEntityListState(\n\t\t\t\t{ marker: field, parent },\n\t\t\t\tthis.getRelationTargetEntityName(parent, field),\n\t\t\t\tpersistedEntityIds,\n\t\t\t),\n\t\t)\n\t\t// const relation = field.parameters\n\t\t//\n\t\t// if (fieldDatum === undefined || fieldDatum instanceof Set) {\n\t\t//\n\t\t// } else if (typeof fieldDatum === 'object') {\n\t\t// \t// Intentionally allowing `fieldDatum === null` here as well since this should only happen when a *hasOne\n\t\t// \t// relation is unlinked, e.g. a Person does not have a linked Nationality.\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a referenced entity for field '${relation.field}' where a collection of entities was expected.` +\n\t\t// \t\t\t`Perhaps you wanted to use a <HasOne />?`,\n\t\t// \t)\n\t\t// } else {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a scalar value for field '${relation.field}' where a collection of entities was expected.` +\n\t\t// \t\t\t`Perhaps you meant to use a variant of <Field />?`,\n\t\t// \t)\n\t\t// }\n\t}\n\n\tprivate getRelationTargetEntityName(\n\t\tentityRealm: EntityRealmState,\n\t\tfield: HasOneRelationMarker | HasManyRelationMarker,\n\t): EntityName {\n\t\tconst targetField = this.treeStore.schema.getEntityField(entityRealm.entity.entityName, field.parameters.field)\n\n\t\tif (targetField?.__typename !== '_Relation') {\n\t\t\tthrow new BindingError() // This should have been validated elsewhere.\n\t\t}\n\t\treturn targetField.targetEntity\n\t}\n\n\tpublic runImmediateUserInitialization(\n\t\trealm: EntityRealmState | EntityRealmStateStub,\n\t\tinitialize: EntityAccessor.BatchUpdatesHandler | undefined,\n\t) {\n\t\tif (initialize === undefined) {\n\t\t\treturn\n\t\t}\n\t\tconst entityRealm = this.materializeEntityRealm(realm)\n\n\t\trealm.getAccessor().batchUpdates(initialize)\n\n\t\tconst initializeListeners = this.eventManager.getEventListeners(entityRealm, { type: 'initialize' })\n\t\tif (initializeListeners === undefined || initializeListeners.size === 0) {\n\t\t\trealm.entity.hasIdSetInStone = true\n\t\t}\n\t}\n\n\tpublic initializeEntityEventListenerStore(blueprint: EntityRealmBlueprint): EntityEventListenerStore | undefined {\n\t\tif (blueprint.type === 'listEntity') {\n\t\t\tconst blueprintListeners = blueprint.parent.blueprint.marker.parameters.childEventListeners\n\t\t\tconst childInitialize = blueprintListeners?.get({ type: 'initialize' })\n\t\t\tconst store: EntityEventListenerStore = new EventListenersStore(() => blueprint.parent.childEventListeners)\n\n\t\t\tif (childInitialize !== undefined) {\n\t\t\t\tstore.set({ type: 'initialize' }, childInitialize)\n\t\t\t}\n\t\t\treturn store\n\t\t}\n\n\t\tconst blueprintListeners = blueprint.marker.parameters.eventListeners\n\t\tif (blueprintListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn TreeParameterMerger.cloneSingleEntityEventListeners(blueprintListeners)\n\t}\n\n\tprivate initializeEntityListEventListenerStore(\n\t\tblueprint: EntityListBlueprint,\n\t): EntityListEventListenerStore | undefined {\n\t\tconst blueprintListeners = blueprint.marker.parameters.eventListeners\n\n\t\tif (blueprintListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn TreeParameterMerger.cloneEntityListEventListeners(blueprintListeners)\n\t}\n\n\tprivate initializeEntityListChildEventListenerStore(\n\t\tblueprint: EntityListBlueprint,\n\t): EntityEventListenerStore | undefined {\n\t\tconst blueprintListeners = blueprint.marker.parameters.childEventListeners\n\n\t\tif (blueprintListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn TreeParameterMerger.cloneSingleEntityEventListeners(blueprintListeners)\n\t}\n\n\tprivate initializeFieldEventListenerStore(marker: FieldMarker): FieldEventListenerStore | undefined {\n\t\t// TODO !!!\n\t\treturn undefined\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;uBAwC8B;AAAA,EAKtB,YACW,sBACA,qBACA,QACA,cACA,WAChB;AALgB;AACA;AACA;AACA;AACA;AAEjB,SAAK,kBAAkB,IAAI,gBAAgB,KAAK,sBAAsB,KAAK,cAAc,MAAM,KAAK;AACpG,SAAK,mBAAmB,IAAI,iBAC3B,KAAK,sBACL,KAAK,qBACL,KAAK,cACL,MACA,KAAK;AAEN,SAAK,iBAAiB,IAAI,eACzB,KAAK,sBACL,KAAK,qBACL,KAAK,cACL,MACA,KAAK;AAAA;AAAA,EAxBU;AAAA,EACA;AAAA,EACA;AAAA,EA0BV,kBAAkB,MAAoE;AAC5F,QAAI;AACJ,UAAM,oBAAoB,KAAK,UAAU,qBAAqB,IAAI,KAAK;AAEvE,QAAI,gBAAgB,yBAAyB;AAC5C,YAAM,qBAAkC,6BAA6B,MAAM,oBAAoB,IAAI;AACnG,qBAAe,KAAK,0BACnB,EAAE,QAAQ,MAAM,QAAQ,UACxB,KAAK,YACL;AAAA,WAEK;AACN,qBAAe,KAAK,uBACnB,KAAK,sBACJ,6BAA6B,sBAAsB,oBAAoB,IAAI,4BAC3E,KAAK,YACL;AAAA,QACC,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,QAAQ;AAAA;AAAA;AAMZ,WAAO;AAAA;AAAA,EAGD,sBACN,IACA,YACA,WACA,UAC0C;AAK1C,UAAM,SAAS,KAAK,sBAAsB,IAAI;AAC9C,UAAM,WAAW,kBAAkB,YAAY,IAAI;AAEnD,UAAM,WAAW,KAAK,UAAU,iBAAiB,IAAI;AACrD,QAAI,aAAa,QAAW;AAC3B,aAAO;AAAA;AAGR,QAAI,CAAC,YAAY,SAAS,SAAS,eAAe;AACj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;AACpC,YAAM,sBAAqB,UAAU,OAAO,UAAU,OAAO,WAAW;AACxE,YAAM,kBAAkB,qBAAoB,IAAI,EAAE,MAAM;AACxD,YAAM,QAAkC,IAAI,oBAAoB,MAAM,UAAU,OAAO;AAEvF,UAAI,oBAAoB,QAAW;AAClC,cAAM,IAAI,EAAE,MAAM,gBAAgB;AAAA;AAEnC,aAAO;AAAA;AAGR,UAAM,qBAAqB,UAAU,OAAO,WAAW;AACvD,QAAI,uBAAuB,QAAW;AACrC,aAAO;AAAA;AAER,WAAO,oBAAoB,gCAAgC;AAAA;AAAA,EAGpD,uCACP,WAC2C;AAC3C,UAAM,qBAAqB,UAAU,OAAO,WAAW;AAEvD,QAAI,uBAAuB,QAAW;AACrC,aAAO;AAAA;AAER,WAAO,oBAAoB,8BAA8B;AAAA;AAAA,EAGlD,4CACP,WACuC;AACvC,UAAM,qBAAqB,UAAU,OAAO,WAAW;AAEvD,QAAI,uBAAuB,QAAW;AACrC,aAAO;AAAA;AAER,WAAO,oBAAoB,gCAAgC;AAAA;AAAA,EAGpD,kCAAkC,QAA0D;AAEnG,WAAO;AAAA;AAAA;;;;"}
@@ -2,7 +2,7 @@ import { ErrorAccessor } from "./ErrorAccessor.js";
2
2
  import { TemporalFieldHelper } from "../fieldHelpers/helpers/TemporalFieldHelper.js";
3
3
  import { UuidFieldHelper } from "../fieldHelpers/helpers/UuidFieldHelper.js";
4
4
  class FieldAccessor {
5
- constructor(stateKey, operations, fieldName, value, valueOnServer, defaultValue, errors, hasUnpersistedChanges, touchLog, getAccessor) {
5
+ constructor(stateKey, operations, fieldName, value, valueOnServer, defaultValue, errors, hasUnpersistedChanges, touchLog, getAccessor, schema) {
6
6
  this.stateKey = stateKey;
7
7
  this.operations = operations;
8
8
  this.fieldName = fieldName;
@@ -13,6 +13,7 @@ class FieldAccessor {
13
13
  this.hasUnpersistedChanges = hasUnpersistedChanges;
14
14
  this.touchLog = touchLog;
15
15
  this.getAccessor = getAccessor;
16
+ this.schema = schema;
16
17
  }
17
18
  addError(error) {
18
19
  return this.operations.addError(this.stateKey, ErrorAccessor.normalizeError(error));
@@ -1 +1 @@
1
- {"version":3,"file":"FieldAccessor.js","sources":["../../../src/accessors/FieldAccessor.ts"],"sourcesContent":["import type { FieldOperations } from '../core/operations'\nimport { TemporalFieldHelper, UuidFieldHelper } from '../fieldHelpers'\nimport type { FieldName, FieldValue } from '../treeParameters'\nimport type { BatchUpdatesOptions } from './BatchUpdatesOptions'\nimport type { Errorable } from './Errorable'\nimport { ErrorAccessor } from './ErrorAccessor'\nimport type { FieldState } from '../core/state'\n\nclass FieldAccessor<Value extends FieldValue = FieldValue> implements Errorable {\n\tconstructor(\n\t\tprivate readonly stateKey: FieldState<Value>,\n\t\tprivate readonly operations: FieldOperations,\n\t\tpublic readonly fieldName: FieldName,\n\t\tpublic readonly value: Value | null,\n\t\tpublic readonly valueOnServer: Value | null,\n\t\tpublic readonly defaultValue: Value | undefined,\n\t\tpublic readonly errors: ErrorAccessor | undefined,\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tprivate readonly touchLog: ReadonlySet<string> | undefined,\n\t\tpublic readonly getAccessor: FieldAccessor.GetFieldAccessor<Value>,\n\t) {}\n\n\tpublic addError(error: ErrorAccessor.Error | string): () => void {\n\t\treturn this.operations.addError(this.stateKey, ErrorAccessor.normalizeError(error))\n\t}\n\n\tpublic clearErrors(): void {\n\t\tthis.operations.clearErrors(this.stateKey)\n\t}\n\n\tpublic addEventListener<Type extends keyof FieldAccessor.FieldEventListenerMap<Value>>(\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\treturn this.operations.addEventListener(this.stateKey, event, listener)\n\t}\n\n\tpublic updateValue(newValue: Value | null, options?: FieldAccessor.UpdateOptions): void {\n\t\tthis.operations.updateValue(this.stateKey, newValue, options)\n\t}\n\n\tpublic hasValue(candidate: this['value']): boolean {\n\t\treturn this.value === candidate\n\t}\n\n\tpublic isTouchedBy(agent: string) {\n\t\treturn this.touchLog?.has(agent) ?? false\n\t}\n\n\tpublic get isTouched() {\n\t\treturn this.isTouchedBy(FieldAccessor.userAgent)\n\t}\n\n\tpublic get resolvedValue() {\n\t\tif (this.defaultValue === undefined) {\n\t\t\treturn this.value\n\t\t}\n\t\treturn this.value === null ? this.defaultValue : this.value\n\t}\n\n\t// helpers\n\n\tpublic get asTemporal(): TemporalFieldHelper {\n\t\treturn new TemporalFieldHelper(this.getAccessor as FieldAccessor.GetFieldAccessor<any>)\n\t}\n\n\tpublic get asUuid(): UuidFieldHelper {\n\t\treturn new UuidFieldHelper(this.getAccessor as FieldAccessor.GetFieldAccessor<any>)\n\t}\n}\nnamespace FieldAccessor {\n\texport const userAgent = 'user'\n\n\texport interface UpdateOptions {\n\t\tagent?: string\n\t}\n\n\texport type GetFieldAccessor<Value extends FieldValue = FieldValue> = () => FieldAccessor<Value>\n\n\texport type BeforeUpdateListener<Value extends FieldValue = FieldValue> = (\n\t\tupdatedAccessor: FieldAccessor<Value>,\n\t) => void\n\texport type InitializeListener<Value extends FieldValue = FieldValue> = (\n\t\tgetAccessor: GetFieldAccessor<Value>,\n\t\toptions: BatchUpdatesOptions,\n\t) => void\n\texport type UpdateListener<Value extends FieldValue = FieldValue> = (accessor: FieldAccessor<Value>) => void\n\n\texport interface RuntimeFieldEventListenerMap<Value extends FieldValue = FieldValue> {\n\t\tbeforeUpdate: BeforeUpdateListener<Value>\n\t\tupdate: UpdateListener<Value>\n\t}\n\texport interface FieldEventListenerMap<Value extends FieldValue = FieldValue>\n\t\textends RuntimeFieldEventListenerMap<Value> {\n\t\tinitialize: InitializeListener<Value>\n\t}\n\texport type FieldEventType = keyof FieldEventListenerMap\n}\n\nexport { FieldAccessor }\n"],"names":[],"mappings":";;;AAQA,oBAAgF;AAAA,EAC/E,YACkB,UACA,YACD,WACA,OACA,eACA,cACA,QACA,uBACC,UACD,aACf;;;;;;;;;;;;EAEK,SAAS,OAAiD;WACzD,KAAK,WAAW,SAAS,KAAK,UAAU,cAAc,eAAe;AAAA;AAAA,EAGtE,cAAoB;SACrB,WAAW,YAAY,KAAK;AAAA;AAAA,EAG3B,iBACN,OACA,UACa;WACN,KAAK,WAAW,iBAAiB,KAAK,UAAU,OAAO;AAAA;AAAA,EAGxD,YAAY,UAAwB,SAA6C;SAClF,WAAW,YAAY,KAAK,UAAU,UAAU;AAAA;AAAA,EAG/C,SAAS,WAAmC;WAC3C,KAAK,UAAU;AAAA;AAAA,EAGhB,YAAY,OAAe;WAC1B,KAAK,UAAU,IAAI,UAAU;AAAA;AAAA,MAG1B,YAAY;WACf,KAAK,YAAY,cAAc;AAAA;AAAA,MAG5B,gBAAgB;QACtB,KAAK,iBAAiB,QAAW;aAC7B,KAAK;AAAA;WAEN,KAAK,UAAU,OAAO,KAAK,eAAe,KAAK;AAAA;AAAA,MAK5C,aAAkC;WACrC,IAAI,oBAAoB,KAAK;AAAA;AAAA,MAG1B,SAA0B;WAC7B,IAAI,gBAAgB,KAAK;AAAA;AAAA;AAGlC,UAAU,gBAAV;AACc,6BAAY;AAAA,GADhB;;"}
1
+ {"version":3,"file":"FieldAccessor.js","sources":["../../../src/accessors/FieldAccessor.ts"],"sourcesContent":["import type { FieldOperations } from '../core/operations'\nimport type { FieldState } from '../core/state'\nimport { TemporalFieldHelper, UuidFieldHelper } from '../fieldHelpers'\nimport type { FieldName, FieldValue } from '../treeParameters'\nimport type { BatchUpdatesOptions } from './BatchUpdatesOptions'\nimport type { Errorable } from './Errorable'\nimport { ErrorAccessor } from './ErrorAccessor'\nimport type { SchemaColumn } from '../core/schema/SchemaColumn'\n\nclass FieldAccessor<Value extends FieldValue = FieldValue> implements Errorable {\n\tconstructor(\n\t\tprivate readonly stateKey: FieldState<Value>,\n\t\tprivate readonly operations: FieldOperations,\n\t\tpublic readonly fieldName: FieldName,\n\t\tpublic readonly value: Value | null,\n\t\tpublic readonly valueOnServer: Value | null,\n\t\tpublic readonly defaultValue: Value | undefined,\n\t\tpublic readonly errors: ErrorAccessor | undefined,\n\t\tpublic readonly hasUnpersistedChanges: boolean,\n\t\tprivate readonly touchLog: ReadonlySet<string> | undefined,\n\t\tpublic readonly getAccessor: FieldAccessor.GetFieldAccessor<Value>,\n\t\tpublic readonly schema: SchemaColumn,\n\t) {}\n\n\tpublic addError(error: ErrorAccessor.Error | string): () => void {\n\t\treturn this.operations.addError(this.stateKey, ErrorAccessor.normalizeError(error))\n\t}\n\n\tpublic clearErrors(): void {\n\t\tthis.operations.clearErrors(this.stateKey)\n\t}\n\n\tpublic addEventListener<Type extends keyof FieldAccessor.FieldEventListenerMap<Value>>(\n\t\tevent: { type: Type; key?: string },\n\t\tlistener: FieldAccessor.FieldEventListenerMap<Value>[Type],\n\t): () => void {\n\t\treturn this.operations.addEventListener(this.stateKey, event, listener)\n\t}\n\n\tpublic updateValue(newValue: Value | null, options?: FieldAccessor.UpdateOptions): void {\n\t\tthis.operations.updateValue(this.stateKey, newValue, options)\n\t}\n\n\tpublic hasValue(candidate: this['value']): boolean {\n\t\treturn this.value === candidate\n\t}\n\n\tpublic isTouchedBy(agent: string) {\n\t\treturn this.touchLog?.has(agent) ?? false\n\t}\n\n\tpublic get isTouched() {\n\t\treturn this.isTouchedBy(FieldAccessor.userAgent)\n\t}\n\n\tpublic get resolvedValue() {\n\t\tif (this.defaultValue === undefined) {\n\t\t\treturn this.value\n\t\t}\n\t\treturn this.value === null ? this.defaultValue : this.value\n\t}\n\n\t// helpers\n\n\tpublic get asTemporal(): TemporalFieldHelper {\n\t\treturn new TemporalFieldHelper(this.getAccessor as FieldAccessor.GetFieldAccessor<any>)\n\t}\n\n\tpublic get asUuid(): UuidFieldHelper {\n\t\treturn new UuidFieldHelper(this.getAccessor as FieldAccessor.GetFieldAccessor<any>)\n\t}\n}\nnamespace FieldAccessor {\n\texport const userAgent = 'user'\n\n\texport interface UpdateOptions {\n\t\tagent?: string\n\t}\n\n\texport type GetFieldAccessor<Value extends FieldValue = FieldValue> = () => FieldAccessor<Value>\n\n\texport type BeforeUpdateListener<Value extends FieldValue = FieldValue> = (\n\t\tupdatedAccessor: FieldAccessor<Value>,\n\t) => void\n\texport type InitializeListener<Value extends FieldValue = FieldValue> = (\n\t\tgetAccessor: GetFieldAccessor<Value>,\n\t\toptions: BatchUpdatesOptions,\n\t) => void\n\texport type UpdateListener<Value extends FieldValue = FieldValue> = (accessor: FieldAccessor<Value>) => void\n\n\texport interface RuntimeFieldEventListenerMap<Value extends FieldValue = FieldValue> {\n\t\tbeforeUpdate: BeforeUpdateListener<Value>\n\t\tupdate: UpdateListener<Value>\n\t}\n\texport interface FieldEventListenerMap<Value extends FieldValue = FieldValue>\n\t\textends RuntimeFieldEventListenerMap<Value> {\n\t\tinitialize: InitializeListener<Value>\n\t}\n\texport type FieldEventType = keyof FieldEventListenerMap\n}\n\nexport { FieldAccessor }\n"],"names":[],"mappings":";;;AASA,oBAAgF;AAAA,EAC/E,YACkB,UACA,YACD,WACA,OACA,eACA,cACA,QACA,uBACC,UACD,aACA,QACf;;;;;;;;;;;;;EAEK,SAAS,OAAiD;WACzD,KAAK,WAAW,SAAS,KAAK,UAAU,cAAc,eAAe;AAAA;AAAA,EAGtE,cAAoB;SACrB,WAAW,YAAY,KAAK;AAAA;AAAA,EAG3B,iBACN,OACA,UACa;WACN,KAAK,WAAW,iBAAiB,KAAK,UAAU,OAAO;AAAA;AAAA,EAGxD,YAAY,UAAwB,SAA6C;SAClF,WAAW,YAAY,KAAK,UAAU,UAAU;AAAA;AAAA,EAG/C,SAAS,WAAmC;WAC3C,KAAK,UAAU;AAAA;AAAA,EAGhB,YAAY,OAAe;WAC1B,KAAK,UAAU,IAAI,UAAU;AAAA;AAAA,MAG1B,YAAY;WACf,KAAK,YAAY,cAAc;AAAA;AAAA,MAG5B,gBAAgB;QACtB,KAAK,iBAAiB,QAAW;aAC7B,KAAK;AAAA;WAEN,KAAK,UAAU,OAAO,KAAK,eAAe,KAAK;AAAA;AAAA,MAK5C,aAAkC;WACrC,IAAI,oBAAoB,KAAK;AAAA;AAAA,MAG1B,SAA0B;WAC7B,IAAI,gBAAgB,KAAK;AAAA;AAAA;AAGlC,UAAU,gBAAV;AACc,6BAAY;AAAA,GADhB;;"}
@@ -240,7 +240,14 @@ class StateInitializer {
240
240
  hasUnpersistedChanges: false,
241
241
  getAccessor: () => {
242
242
  if (fieldState.accessor === void 0) {
243
- fieldState.accessor = new FieldAccessor(fieldState, this.fieldOperations, fieldState.placeholderName, fieldState.value, fieldState.persistedValue === void 0 ? null : fieldState.persistedValue, fieldState.fieldMarker.defaultValue, fieldState.errors, fieldState.hasUnpersistedChanges, fieldState.touchLog, fieldState.getAccessor);
243
+ const fieldSchema = this.treeStore.schema.getEntityField(parent.entity.entityName, fieldMarker.fieldName);
244
+ if (!fieldSchema) {
245
+ throw new BindingError(`Unknown field ${parent.entity.entityName}.${fieldMarker.fieldName}.`);
246
+ }
247
+ if (fieldSchema.__typename !== "_Column") {
248
+ throw new BindingError(`Invalid type of field ${parent.entity.entityName}.${fieldMarker.fieldName}. Expected '_Column', '${fieldSchema.__typename}' found.`);
249
+ }
250
+ fieldState.accessor = new FieldAccessor(fieldState, this.fieldOperations, fieldState.placeholderName, fieldState.value, fieldState.persistedValue === void 0 ? null : fieldState.persistedValue, fieldState.fieldMarker.defaultValue, fieldState.errors, fieldState.hasUnpersistedChanges, fieldState.touchLog, fieldState.getAccessor, fieldSchema);
244
251
  }
245
252
  return fieldState.accessor;
246
253
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StateInitializer.js","sources":["../../../src/core/StateInitializer.ts"],"sourcesContent":["import { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, FieldAccessor } from '../accessors'\nimport { EntityFieldPersistedData, RuntimeId, ServerGeneratedUuid, UnpersistedEntityDummyId } from '../accessorTree'\nimport { BindingError } from '../BindingError'\nimport {\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '../markers'\nimport { BijectiveIndexedMap } from '../structures'\nimport type {\n\tEntityEventListenerStore,\n\tEntityListEventListenerStore,\n\tEntityName,\n\tFieldEventListenerStore,\n\tFieldName,\n\tScalar,\n} from '../treeParameters'\nimport { assertNever } from '../utils'\nimport type { AccessorErrorManager } from './AccessorErrorManager'\nimport type { Config } from './Config'\nimport type { EventManager } from './EventManager'\nimport { EntityOperations, FieldOperations, ListOperations } from './operations'\nimport { RealmKeyGenerator } from './RealmKeyGenerator'\nimport {\n\tEntityListBlueprint,\n\tEntityListState,\n\tEntityRealmBlueprint,\n\tEntityRealmState,\n\tEntityRealmStateStub,\n\tEntityState,\n\tFieldState,\n\tgetEntityMarker,\n\tRootStateNode,\n} from './state'\nimport { TreeParameterMerger } from './TreeParameterMerger'\nimport type { TreeStore } from './TreeStore'\nimport { EventListenersStore } from '../treeParameters'\n\nexport class StateInitializer {\n\tprivate readonly fieldOperations: FieldOperations\n\tprivate readonly entityOperations: EntityOperations\n\tprivate readonly listOperations: ListOperations\n\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly config: Config,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {\n\t\tthis.fieldOperations = new FieldOperations(this.accessorErrorManager, this.eventManager, this, this.treeStore)\n\t\tthis.entityOperations = new EntityOperations(\n\t\t\tthis.accessorErrorManager,\n\t\t\tthis.batchUpdatesOptions,\n\t\t\tthis.eventManager,\n\t\t\tthis,\n\t\t\tthis.treeStore,\n\t\t)\n\t\tthis.listOperations = new ListOperations(\n\t\t\tthis.accessorErrorManager,\n\t\t\tthis.batchUpdatesOptions,\n\t\t\tthis.eventManager,\n\t\t\tthis,\n\t\t\tthis.treeStore,\n\t\t)\n\t}\n\n\tpublic initializeSubTree(tree: EntitySubTreeMarker | EntityListSubTreeMarker): RootStateNode {\n\t\tlet subTreeState: RootStateNode\n\t\tconst persistedRootData = this.treeStore.subTreePersistedData.get(tree.placeholderName)\n\n\t\tif (tree instanceof EntityListSubTreeMarker) {\n\t\t\tconst persistedEntityIds: Set<string> = persistedRootData instanceof Set ? persistedRootData : new Set()\n\t\t\tsubTreeState = this.initializeEntityListState(\n\t\t\t\t{ marker: tree, parent: undefined },\n\t\t\t\ttree.entityName,\n\t\t\t\tpersistedEntityIds,\n\t\t\t)\n\t\t} else {\n\t\t\tsubTreeState = this.materializeEntityRealm(\n\t\t\t\tthis.initializeEntityRealm(\n\t\t\t\t\tpersistedRootData instanceof ServerGeneratedUuid ? persistedRootData : new UnpersistedEntityDummyId(),\n\t\t\t\t\ttree.entityName,\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'subTree',\n\t\t\t\t\t\tmarker: tree,\n\t\t\t\t\t\tparent: undefined,\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\n\t\treturn subTreeState\n\t}\n\n\tpublic initializeEntityRealm(\n\t\tid: RuntimeId,\n\t\tentityName: EntityName,\n\t\tblueprint: EntityRealmBlueprint,\n\t\tcopyFrom?: EntityRealmState | EntityRealmStateStub,\n\t): EntityRealmState | EntityRealmStateStub {\n\t\t// This is counter-intuitive a bit. The method can also return an EntityRealmState, not just a stub.\n\t\t// The reason is so that each call-site can just default to trying to initialize a stub without having to keep\n\t\t// in mind that the realm might have already been initialized.\n\n\t\tconst entity = this.initializeEntityState(id, entityName)\n\t\tconst realmKey = RealmKeyGenerator.getRealmKey(id, blueprint)\n\n\t\tconst existing = this.treeStore.entityRealmStore.get(realmKey)\n\t\tif (existing !== undefined) {\n\t\t\treturn existing\n\t\t}\n\n\t\tif (!copyFrom || copyFrom.type !== 'entityRealm') {\n\t\t\tconst stub: EntityRealmStateStub = {\n\t\t\t\ttype: 'entityRealmStub',\n\n\t\t\t\tblueprint,\n\t\t\t\tentity,\n\t\t\t\trealmKey,\n\t\t\t\tgetAccessor: () => this.materializeEntityRealm(stub).getAccessor(),\n\t\t\t}\n\t\t\tthis.registerEntityRealm(stub)\n\n\t\t\treturn stub\n\t\t}\n\t\tconst realm = this.createEntityRealm(blueprint, realmKey, entity)\n\n\t\tthis.registerEntityRealm(realm)\n\n\t\tconst marker = getEntityMarker(realm)\n\t\tconst pathBack = this.treeStore.getPathBackToParent(realm)\n\n\t\tfor (const [placeholderName, field] of marker.fields.markers) {\n\t\t\tif (field instanceof FieldMarker) {\n\t\t\t\tconst value = copyFrom.children.get(placeholderName)\n\t\t\t\tif (!value || value.type !== 'field') {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tthis.initializeFromFieldMarker(realm, field, value.value)\n\t\t\t} else if (field instanceof HasManyRelationMarker) {\n\t\t\t\t// todo: get from copyFrom\n\t\t\t\tthis.initializeFromHasManyRelationMarker(realm, field, new Set())\n\t\t\t} else if (field instanceof HasOneRelationMarker) {\n\t\t\t\tlet runtimeId: RuntimeId\n\t\t\t\tlet subCopyFrom: EntityRealmState | undefined = undefined\n\t\t\t\tif (pathBack?.fieldBackToParent === field.parameters.field) {\n\t\t\t\t\truntimeId = pathBack.parent.entity.id\n\t\t\t\t} else {\n\t\t\t\t\tconst value = copyFrom.children.get(placeholderName)\n\t\t\t\t\tif (!value || (value.type !== 'entityRealm' && value.type !== 'entityRealmStub')) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\t\t\t\t\tif (value.type === 'entityRealm') {\n\t\t\t\t\t\tsubCopyFrom = value\n\t\t\t\t\t\truntimeId = value.entity.id\n\t\t\t\t\t} else {\n\t\t\t\t\t\truntimeId = new UnpersistedEntityDummyId()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.initializeFromHasOneRelationMarker(realm, field, runtimeId, subCopyFrom)\n\t\t\t} else {\n\t\t\t\tassertNever(field)\n\t\t\t}\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(realm)\n\t\treturn realm\n\t}\n\n\tprivate createEntityRealm(blueprint: EntityRealmBlueprint, realmKey: string, entity: EntityState): EntityRealmState {\n\t\tconst entityRealm: EntityRealmState = {\n\t\t\ttype: 'entityRealm',\n\n\t\t\tblueprint,\n\t\t\trealmKey,\n\t\t\tentity,\n\n\t\t\taccessor: undefined,\n\t\t\tchildren: new Map(),\n\t\t\tchildrenWithPendingUpdates: undefined,\n\t\t\terrors: undefined,\n\t\t\teventListeners: this.initializeEntityEventListenerStore(blueprint),\n\t\t\tfieldsWithPendingConnectionUpdates: undefined,\n\t\t\tplannedHasOneDeletions: undefined,\n\t\t\tunpersistedChangesCount: 0,\n\t\t\tgetAccessor: () => {\n\t\t\t\tif (entityRealm.accessor === undefined) {\n\t\t\t\t\tconst entity = entityRealm.entity\n\t\t\t\t\tentityRealm.accessor = new EntityAccessor(\n\t\t\t\t\t\tentityRealm,\n\t\t\t\t\t\tthis.entityOperations,\n\t\t\t\t\t\tentity.id,\n\t\t\t\t\t\tentityRealm.realmKey,\n\t\t\t\t\t\tentity.entityName,\n\n\t\t\t\t\t\t// We're technically exposing more info in runtime than we'd like but that way we don't have to allocate and\n\t\t\t\t\t\t// keep in sync two copies of the same data. TS hides the extra info anyway.\n\t\t\t\t\t\tentityRealm.children,\n\t\t\t\t\t\tthis.treeStore.persistedEntityData.get(entity.id.value),\n\t\t\t\t\t\tentityRealm.unpersistedChangesCount !== 0,\n\t\t\t\t\t\tentityRealm.errors,\n\t\t\t\t\t\tgetEntityMarker(entityRealm).environment,\n\t\t\t\t\t\tentityRealm.getAccessor,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn entityRealm.accessor\n\t\t\t},\n\t\t}\n\t\treturn entityRealm\n\t}\n\n\tprivate materializeEntityRealm(state: EntityRealmState | EntityRealmStateStub): EntityRealmState {\n\t\tif (state.type === 'entityRealm') {\n\t\t\treturn state\n\t\t}\n\t\tconst { realmKey, entity, blueprint } = state\n\n\t\tconst existing = this.treeStore.entityRealmStore.get(realmKey)\n\t\tif (existing !== undefined && existing.type === 'entityRealm') {\n\t\t\treturn existing\n\t\t}\n\n\t\tconst entityRealm = this.createEntityRealm(blueprint, realmKey, entity)\n\n\t\tthis.registerEntityRealm(entityRealm)\n\n\t\t// if (blueprint.creationParameters.forceCreation && !entity.id.existsOnServer) {\n\t\t// \tentityRealm.unpersistedChangesCount += 1\n\t\t// }\n\n\t\tconst persistedData = this.treeStore.persistedEntityData.get(entity.id.value)\n\n\t\tconst marker = getEntityMarker(state)\n\t\tconst pathBack = this.treeStore.getPathBackToParent(entityRealm)\n\n\t\tfor (const [placeholderName, field] of marker.fields.markers) {\n\t\t\tconst fieldDatum = persistedData?.get(placeholderName)\n\n\t\t\tif (field instanceof FieldMarker) {\n\t\t\t\tthis.initializeFromFieldMarker(entityRealm, field, fieldDatum)\n\t\t\t} else if (field instanceof HasManyRelationMarker) {\n\t\t\t\t// if (pathBack?.fieldBackToParent === field.parameters.field) {\n\t\t\t\t// \t// TODO this is probably wrong?\n\t\t\t\t// \tconst ids = pathBack.parent.children.get(field.placeholderName)\n\t\t\t\t// \tconst newData = this.treeStore.persistedEntityData.get(pathBack.parent.entity.id.value)\n\t\t\t\t// \tconsole.log('many?', pathBack, field, entityRealm, fieldDatum, ids)\n\t\t\t\t// }\n\t\t\t\tthis.initializeFromHasManyRelationMarker(entityRealm, field, fieldDatum instanceof Set ? fieldDatum : new Set())\n\t\t\t} else if (field instanceof HasOneRelationMarker) {\n\t\t\t\tlet runtimeId: RuntimeId\n\t\t\t\tif (pathBack?.fieldBackToParent === field.parameters.field) {\n\t\t\t\t\truntimeId = pathBack.parent.entity.id\n\t\t\t\t} else {\n\t\t\t\t\truntimeId = fieldDatum instanceof ServerGeneratedUuid ? fieldDatum : new UnpersistedEntityDummyId()\n\t\t\t\t}\n\t\t\t\tthis.initializeFromHasOneRelationMarker(entityRealm, field, runtimeId)\n\t\t\t} else {\n\t\t\t\tassertNever(field)\n\t\t\t}\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(entityRealm)\n\n\t\treturn entityRealm\n\t}\n\n\tprivate registerEntityRealm(entityRealm: EntityRealmState | EntityRealmStateStub) {\n\t\tconst { realmKey, blueprint, entity } = entityRealm\n\n\t\tthis.treeStore.entityRealmStore.set(entityRealm.realmKey, entityRealm)\n\n\t\tif (blueprint.type === 'listEntity') {\n\t\t\tblueprint.parent.children.set(entity.id.value, entityRealm)\n\t\t} else if (blueprint.type === 'hasOne') {\n\t\t\tblueprint.parent.children.set(blueprint.marker.placeholderName, entityRealm)\n\t\t}\n\t\tentity.realms.set(realmKey, entityRealm)\n\t}\n\n\tpublic initializeEntityState(id: RuntimeId, entityName: EntityName): EntityState {\n\t\tconst entityId = id.value\n\n\t\tconst existing = this.treeStore.entityStore.get(entityId)\n\t\tif (existing !== undefined) {\n\t\t\treturn existing\n\t\t}\n\n\t\tconst entityState: EntityState = {\n\t\t\tentityName,\n\t\t\thasIdSetInStone: id instanceof ServerGeneratedUuid,\n\t\t\tid,\n\t\t\tisScheduledForDeletion: false,\n\t\t\tmaidenId: id instanceof UnpersistedEntityDummyId ? id : undefined,\n\t\t\trealms: new Map(),\n\t\t}\n\t\tthis.treeStore.entityStore.set(entityId, entityState)\n\n\t\treturn entityState\n\t}\n\n\tprivate initializeEntityListState(\n\t\tblueprint: EntityListBlueprint,\n\t\tentityName: EntityName,\n\t\tinitialEntityIds: Set<string>,\n\t): EntityListState {\n\t\tconst entityListState: EntityListState = {\n\t\t\ttype: 'entityList',\n\t\t\taccessor: undefined,\n\t\t\tblueprint,\n\t\t\tchildren: new BijectiveIndexedMap(realm => realm.entity.id.value),\n\t\t\tchildrenWithPendingUpdates: undefined,\n\t\t\tentityName,\n\t\t\teventListeners: this.initializeEntityListEventListenerStore(blueprint),\n\t\t\tchildEventListeners: this.initializeEntityListChildEventListenerStore(blueprint),\n\t\t\terrors: undefined,\n\t\t\tplannedRemovals: undefined,\n\t\t\tunpersistedChangesCount: 0, // TODO force creation?\n\t\t\tgetAccessor: () => {\n\t\t\t\tif (entityListState.accessor === undefined) {\n\t\t\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(entityListState)\n\t\t\t\t\tentityListState.accessor = new EntityListAccessor(\n\t\t\t\t\t\tentityListState,\n\t\t\t\t\t\tthis.listOperations,\n\t\t\t\t\t\tentityListState.children,\n\t\t\t\t\t\tpersistedEntityIds,\n\t\t\t\t\t\tentityListState.unpersistedChangesCount !== 0,\n\t\t\t\t\t\tentityListState.errors,\n\t\t\t\t\t\tentityListState.blueprint.marker.environment,\n\t\t\t\t\t\tentityListState.getAccessor,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn entityListState.accessor\n\t\t\t},\n\t\t}\n\n\t\tconst initialData: Iterable<string | undefined> =\n\t\t\tinitialEntityIds.size === 0\n\t\t\t\t? Array.from({ length: blueprint.marker.parameters.initialEntityCount })\n\t\t\t\t: initialEntityIds\n\t\tfor (const entityId of initialData) {\n\t\t\tthis.initializeEntityRealm(\n\t\t\t\tentityId ? new ServerGeneratedUuid(entityId) : new UnpersistedEntityDummyId(),\n\t\t\t\tentityListState.entityName,\n\t\t\t\t{\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: entityListState,\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(entityListState)\n\n\t\treturn entityListState\n\t}\n\n\tprivate initializeFieldState(\n\t\tparent: EntityRealmState,\n\t\tplaceholderName: FieldName,\n\t\tfieldMarker: FieldMarker,\n\t\tpersistedValue: Scalar | undefined,\n\t): FieldState {\n\t\tconst resolvedFieldValue = persistedValue ?? fieldMarker.defaultValue ?? null\n\n\t\tconst fieldState: FieldState = {\n\t\t\ttype: 'field',\n\t\t\taccessor: undefined,\n\t\t\tfieldMarker,\n\t\t\tplaceholderName,\n\t\t\tpersistedValue,\n\t\t\tparent,\n\t\t\tvalue: resolvedFieldValue,\n\t\t\teventListeners: this.initializeFieldEventListenerStore(fieldMarker),\n\t\t\terrors: undefined,\n\t\t\ttouchLog: undefined,\n\t\t\thasUnpersistedChanges: false,\n\t\t\tgetAccessor: () => {\n\t\t\t\tif (fieldState.accessor === undefined) {\n\t\t\t\t\tfieldState.accessor = new FieldAccessor(\n\t\t\t\t\t\tfieldState,\n\t\t\t\t\t\tthis.fieldOperations,\n\t\t\t\t\t\tfieldState.placeholderName,\n\t\t\t\t\t\tfieldState.value,\n\t\t\t\t\t\tfieldState.persistedValue === undefined ? null : fieldState.persistedValue,\n\t\t\t\t\t\tfieldState.fieldMarker.defaultValue,\n\t\t\t\t\t\tfieldState.errors,\n\t\t\t\t\t\tfieldState.hasUnpersistedChanges,\n\t\t\t\t\t\tfieldState.touchLog,\n\t\t\t\t\t\tfieldState.getAccessor,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn fieldState.accessor\n\t\t\t},\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(fieldState)\n\t\treturn fieldState\n\t}\n\n\tprivate initializeFromFieldMarker(\n\t\tparent: EntityRealmState,\n\t\tfield: FieldMarker,\n\t\tfieldDatum: EntityFieldPersistedData | undefined,\n\t) {\n\t\tif (fieldDatum instanceof Set) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`Received a collection of referenced entities where a single '${field.fieldName}' field was expected. ` +\n\t\t\t\t\t`Perhaps you wanted to use a <Repeater />?`,\n\t\t\t)\n\t\t}\n\t\tif (fieldDatum instanceof ServerGeneratedUuid) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`Received a referenced entity where a single '${field.fieldName}' field was expected. ` +\n\t\t\t\t\t`Perhaps you wanted to use <HasOne />?`,\n\t\t\t)\n\t\t}\n\t\tparent.children.set(\n\t\t\tfield.placeholderName,\n\t\t\tthis.initializeFieldState(parent, field.placeholderName, field, fieldDatum),\n\t\t)\n\t}\n\n\tprivate initializeFromHasOneRelationMarker(\n\t\tparent: EntityRealmState,\n\t\tfield: HasOneRelationMarker,\n\t\tentityId: RuntimeId,\n\t\tcopyFrom?: EntityRealmState | EntityRealmStateStub,\n\t) {\n\t\tparent.children.set(\n\t\t\tfield.placeholderName,\n\t\t\tthis.initializeEntityRealm(entityId, this.getRelationTargetEntityName(parent, field), {\n\t\t\t\ttype: 'hasOne',\n\t\t\t\tparent,\n\t\t\t\tmarker: field,\n\t\t\t}, copyFrom),\n\t\t)\n\t\t// if (fieldDatum instanceof ServerGeneratedUuid || fieldDatum === null || fieldDatum === undefined) {\n\t\t// \tconst entityId = fieldDatum instanceof ServerGeneratedUuid ? fieldDatum : new UnpersistedEntityDummyId()\n\t\t//\n\t\t//\n\t\t// } else if (fieldDatum instanceof Set) {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a collection of entities for field '${relation.field}' where a single entity was expected. ` +\n\t\t// \t\t\t`Perhaps you wanted to use a <Repeater />?`,\n\t\t// \t)\n\t\t// } else {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a scalar value for field '${relation.field}' where a single entity was expected.` +\n\t\t// \t\t\t`Perhaps you meant to use a variant of <Field />?`,\n\t\t// \t)\n\t\t// }\n\t}\n\n\tprivate initializeFromHasManyRelationMarker(\n\t\tparent: EntityRealmState,\n\t\tfield: HasManyRelationMarker,\n\t\tpersistedEntityIds: Set<string>,\n\t) {\n\t\tparent.children.set(\n\t\t\tfield.placeholderName,\n\t\t\tthis.initializeEntityListState(\n\t\t\t\t{ marker: field, parent },\n\t\t\t\tthis.getRelationTargetEntityName(parent, field),\n\t\t\t\tpersistedEntityIds,\n\t\t\t),\n\t\t)\n\t\t// const relation = field.parameters\n\t\t//\n\t\t// if (fieldDatum === undefined || fieldDatum instanceof Set) {\n\t\t//\n\t\t// } else if (typeof fieldDatum === 'object') {\n\t\t// \t// Intentionally allowing `fieldDatum === null` here as well since this should only happen when a *hasOne\n\t\t// \t// relation is unlinked, e.g. a Person does not have a linked Nationality.\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a referenced entity for field '${relation.field}' where a collection of entities was expected.` +\n\t\t// \t\t\t`Perhaps you wanted to use a <HasOne />?`,\n\t\t// \t)\n\t\t// } else {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a scalar value for field '${relation.field}' where a collection of entities was expected.` +\n\t\t// \t\t\t`Perhaps you meant to use a variant of <Field />?`,\n\t\t// \t)\n\t\t// }\n\t}\n\n\tprivate getRelationTargetEntityName(\n\t\tentityRealm: EntityRealmState,\n\t\tfield: HasOneRelationMarker | HasManyRelationMarker,\n\t): EntityName {\n\t\tconst targetField = this.treeStore.schema.getEntityField(entityRealm.entity.entityName, field.parameters.field)\n\n\t\tif (targetField?.__typename !== '_Relation') {\n\t\t\tthrow new BindingError() // This should have been validated elsewhere.\n\t\t}\n\t\treturn targetField.targetEntity\n\t}\n\n\tpublic runImmediateUserInitialization(\n\t\trealm: EntityRealmState | EntityRealmStateStub,\n\t\tinitialize: EntityAccessor.BatchUpdatesHandler | undefined,\n\t) {\n\t\tif (initialize === undefined) {\n\t\t\treturn\n\t\t}\n\t\tconst entityRealm = this.materializeEntityRealm(realm)\n\n\t\trealm.getAccessor().batchUpdates(initialize)\n\n\t\tconst initializeListeners = this.eventManager.getEventListeners(entityRealm, { type: 'initialize' })\n\t\tif (initializeListeners === undefined || initializeListeners.size === 0) {\n\t\t\trealm.entity.hasIdSetInStone = true\n\t\t}\n\t}\n\n\tpublic initializeEntityEventListenerStore(blueprint: EntityRealmBlueprint): EntityEventListenerStore | undefined {\n\t\tif (blueprint.type === 'listEntity') {\n\t\t\tconst blueprintListeners = blueprint.parent.blueprint.marker.parameters.childEventListeners\n\t\t\tconst childInitialize = blueprintListeners?.get({ type: 'initialize' })\n\t\t\tconst store: EntityEventListenerStore = new EventListenersStore(() => blueprint.parent.childEventListeners)\n\n\t\t\tif (childInitialize !== undefined) {\n\t\t\t\tstore.set({ type: 'initialize' }, childInitialize)\n\t\t\t}\n\t\t\treturn store\n\t\t}\n\n\t\tconst blueprintListeners = blueprint.marker.parameters.eventListeners\n\t\tif (blueprintListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn TreeParameterMerger.cloneSingleEntityEventListeners(blueprintListeners)\n\t}\n\n\tprivate initializeEntityListEventListenerStore(\n\t\tblueprint: EntityListBlueprint,\n\t): EntityListEventListenerStore | undefined {\n\t\tconst blueprintListeners = blueprint.marker.parameters.eventListeners\n\n\t\tif (blueprintListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn TreeParameterMerger.cloneEntityListEventListeners(blueprintListeners)\n\t}\n\n\tprivate initializeEntityListChildEventListenerStore(\n\t\tblueprint: EntityListBlueprint,\n\t): EntityEventListenerStore | undefined {\n\t\tconst blueprintListeners = blueprint.marker.parameters.childEventListeners\n\n\t\tif (blueprintListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn TreeParameterMerger.cloneSingleEntityEventListeners(blueprintListeners)\n\t}\n\n\tprivate initializeFieldEventListenerStore(marker: FieldMarker): FieldEventListenerStore | undefined {\n\t\t// TODO !!!\n\t\treturn undefined\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;uBAwC8B;AAAA,EAKtB,YACW,sBACA,qBACA,QACA,cACA,WAChB;AAVe;AACA;AACA;;;;;;SASX,kBAAkB,IAAI,gBAAgB,KAAK,sBAAsB,KAAK,cAAc,MAAM,KAAK;SAC/F,mBAAmB,IAAI,iBAC3B,KAAK,sBACL,KAAK,qBACL,KAAK,cACL,MACA,KAAK;SAED,iBAAiB,IAAI,eACzB,KAAK,sBACL,KAAK,qBACL,KAAK,cACL,MACA,KAAK;AAAA;AAAA,EAIA,kBAAkB,MAAoE;QACxF;UACE,oBAAoB,KAAK,UAAU,qBAAqB,IAAI,KAAK;QAEnE,gBAAgB,yBAAyB;YACtC,qBAAkC,6BAA6B,MAAM,oBAAoB,IAAI;qBACpF,KAAK,0BACnB,EAAE,QAAQ,MAAM,QAAQ,UACxB,KAAK,YACL;AAAA,WAEK;qBACS,KAAK,uBACnB,KAAK,sBACJ,6BAA6B,sBAAsB,oBAAoB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../../../src/core/StateInitializer.ts"],"sourcesContent":["import { BatchUpdatesOptions, EntityAccessor, EntityListAccessor, FieldAccessor } from '../accessors'\nimport { EntityFieldPersistedData, RuntimeId, ServerGeneratedUuid, UnpersistedEntityDummyId } from '../accessorTree'\nimport { BindingError } from '../BindingError'\nimport {\n\tEntityListSubTreeMarker,\n\tEntitySubTreeMarker,\n\tFieldMarker,\n\tHasManyRelationMarker,\n\tHasOneRelationMarker,\n} from '../markers'\nimport { BijectiveIndexedMap } from '../structures'\nimport type {\n\tEntityEventListenerStore,\n\tEntityListEventListenerStore,\n\tEntityName,\n\tFieldEventListenerStore,\n\tFieldName,\n\tScalar,\n} from '../treeParameters'\nimport { assertNever } from '../utils'\nimport type { AccessorErrorManager } from './AccessorErrorManager'\nimport type { Config } from './Config'\nimport type { EventManager } from './EventManager'\nimport { EntityOperations, FieldOperations, ListOperations } from './operations'\nimport { RealmKeyGenerator } from './RealmKeyGenerator'\nimport {\n\tEntityListBlueprint,\n\tEntityListState,\n\tEntityRealmBlueprint,\n\tEntityRealmState,\n\tEntityRealmStateStub,\n\tEntityState,\n\tFieldState,\n\tgetEntityMarker,\n\tRootStateNode,\n} from './state'\nimport { TreeParameterMerger } from './TreeParameterMerger'\nimport type { TreeStore } from './TreeStore'\nimport { EventListenersStore } from '../treeParameters'\n\nexport class StateInitializer {\n\tprivate readonly fieldOperations: FieldOperations\n\tprivate readonly entityOperations: EntityOperations\n\tprivate readonly listOperations: ListOperations\n\n\tpublic constructor(\n\t\tprivate readonly accessorErrorManager: AccessorErrorManager,\n\t\tprivate readonly batchUpdatesOptions: BatchUpdatesOptions,\n\t\tprivate readonly config: Config,\n\t\tprivate readonly eventManager: EventManager,\n\t\tprivate readonly treeStore: TreeStore,\n\t) {\n\t\tthis.fieldOperations = new FieldOperations(this.accessorErrorManager, this.eventManager, this, this.treeStore)\n\t\tthis.entityOperations = new EntityOperations(\n\t\t\tthis.accessorErrorManager,\n\t\t\tthis.batchUpdatesOptions,\n\t\t\tthis.eventManager,\n\t\t\tthis,\n\t\t\tthis.treeStore,\n\t\t)\n\t\tthis.listOperations = new ListOperations(\n\t\t\tthis.accessorErrorManager,\n\t\t\tthis.batchUpdatesOptions,\n\t\t\tthis.eventManager,\n\t\t\tthis,\n\t\t\tthis.treeStore,\n\t\t)\n\t}\n\n\tpublic initializeSubTree(tree: EntitySubTreeMarker | EntityListSubTreeMarker): RootStateNode {\n\t\tlet subTreeState: RootStateNode\n\t\tconst persistedRootData = this.treeStore.subTreePersistedData.get(tree.placeholderName)\n\n\t\tif (tree instanceof EntityListSubTreeMarker) {\n\t\t\tconst persistedEntityIds: Set<string> = persistedRootData instanceof Set ? persistedRootData : new Set()\n\t\t\tsubTreeState = this.initializeEntityListState(\n\t\t\t\t{ marker: tree, parent: undefined },\n\t\t\t\ttree.entityName,\n\t\t\t\tpersistedEntityIds,\n\t\t\t)\n\t\t} else {\n\t\t\tsubTreeState = this.materializeEntityRealm(\n\t\t\t\tthis.initializeEntityRealm(\n\t\t\t\t\tpersistedRootData instanceof ServerGeneratedUuid ? persistedRootData : new UnpersistedEntityDummyId(),\n\t\t\t\t\ttree.entityName,\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: 'subTree',\n\t\t\t\t\t\tmarker: tree,\n\t\t\t\t\t\tparent: undefined,\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\n\t\treturn subTreeState\n\t}\n\n\tpublic initializeEntityRealm(\n\t\tid: RuntimeId,\n\t\tentityName: EntityName,\n\t\tblueprint: EntityRealmBlueprint,\n\t\tcopyFrom?: EntityRealmState | EntityRealmStateStub,\n\t): EntityRealmState | EntityRealmStateStub {\n\t\t// This is counter-intuitive a bit. The method can also return an EntityRealmState, not just a stub.\n\t\t// The reason is so that each call-site can just default to trying to initialize a stub without having to keep\n\t\t// in mind that the realm might have already been initialized.\n\n\t\tconst entity = this.initializeEntityState(id, entityName)\n\t\tconst realmKey = RealmKeyGenerator.getRealmKey(id, blueprint)\n\n\t\tconst existing = this.treeStore.entityRealmStore.get(realmKey)\n\t\tif (existing !== undefined) {\n\t\t\treturn existing\n\t\t}\n\n\t\tif (!copyFrom || copyFrom.type !== 'entityRealm') {\n\t\t\tconst stub: EntityRealmStateStub = {\n\t\t\t\ttype: 'entityRealmStub',\n\n\t\t\t\tblueprint,\n\t\t\t\tentity,\n\t\t\t\trealmKey,\n\t\t\t\tgetAccessor: () => this.materializeEntityRealm(stub).getAccessor(),\n\t\t\t}\n\t\t\tthis.registerEntityRealm(stub)\n\n\t\t\treturn stub\n\t\t}\n\t\tconst realm = this.createEntityRealm(blueprint, realmKey, entity)\n\n\t\tthis.registerEntityRealm(realm)\n\n\t\tconst marker = getEntityMarker(realm)\n\t\tconst pathBack = this.treeStore.getPathBackToParent(realm)\n\n\t\tfor (const [placeholderName, field] of marker.fields.markers) {\n\t\t\tif (field instanceof FieldMarker) {\n\t\t\t\tconst value = copyFrom.children.get(placeholderName)\n\t\t\t\tif (!value || value.type !== 'field') {\n\t\t\t\t\tthrow new BindingError()\n\t\t\t\t}\n\t\t\t\tthis.initializeFromFieldMarker(realm, field, value.value)\n\t\t\t} else if (field instanceof HasManyRelationMarker) {\n\t\t\t\t// todo: get from copyFrom\n\t\t\t\tthis.initializeFromHasManyRelationMarker(realm, field, new Set())\n\t\t\t} else if (field instanceof HasOneRelationMarker) {\n\t\t\t\tlet runtimeId: RuntimeId\n\t\t\t\tlet subCopyFrom: EntityRealmState | undefined = undefined\n\t\t\t\tif (pathBack?.fieldBackToParent === field.parameters.field) {\n\t\t\t\t\truntimeId = pathBack.parent.entity.id\n\t\t\t\t} else {\n\t\t\t\t\tconst value = copyFrom.children.get(placeholderName)\n\t\t\t\t\tif (!value || (value.type !== 'entityRealm' && value.type !== 'entityRealmStub')) {\n\t\t\t\t\t\tthrow new BindingError()\n\t\t\t\t\t}\n\t\t\t\t\tif (value.type === 'entityRealm') {\n\t\t\t\t\t\tsubCopyFrom = value\n\t\t\t\t\t\truntimeId = value.entity.id\n\t\t\t\t\t} else {\n\t\t\t\t\t\truntimeId = new UnpersistedEntityDummyId()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.initializeFromHasOneRelationMarker(realm, field, runtimeId, subCopyFrom)\n\t\t\t} else {\n\t\t\t\tassertNever(field)\n\t\t\t}\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(realm)\n\t\treturn realm\n\t}\n\n\tprivate createEntityRealm(blueprint: EntityRealmBlueprint, realmKey: string, entity: EntityState): EntityRealmState {\n\t\tconst entityRealm: EntityRealmState = {\n\t\t\ttype: 'entityRealm',\n\n\t\t\tblueprint,\n\t\t\trealmKey,\n\t\t\tentity,\n\n\t\t\taccessor: undefined,\n\t\t\tchildren: new Map(),\n\t\t\tchildrenWithPendingUpdates: undefined,\n\t\t\terrors: undefined,\n\t\t\teventListeners: this.initializeEntityEventListenerStore(blueprint),\n\t\t\tfieldsWithPendingConnectionUpdates: undefined,\n\t\t\tplannedHasOneDeletions: undefined,\n\t\t\tunpersistedChangesCount: 0,\n\t\t\tgetAccessor: () => {\n\t\t\t\tif (entityRealm.accessor === undefined) {\n\t\t\t\t\tconst entity = entityRealm.entity\n\t\t\t\t\tentityRealm.accessor = new EntityAccessor(\n\t\t\t\t\t\tentityRealm,\n\t\t\t\t\t\tthis.entityOperations,\n\t\t\t\t\t\tentity.id,\n\t\t\t\t\t\tentityRealm.realmKey,\n\t\t\t\t\t\tentity.entityName,\n\n\t\t\t\t\t\t// We're technically exposing more info in runtime than we'd like but that way we don't have to allocate and\n\t\t\t\t\t\t// keep in sync two copies of the same data. TS hides the extra info anyway.\n\t\t\t\t\t\tentityRealm.children,\n\t\t\t\t\t\tthis.treeStore.persistedEntityData.get(entity.id.value),\n\t\t\t\t\t\tentityRealm.unpersistedChangesCount !== 0,\n\t\t\t\t\t\tentityRealm.errors,\n\t\t\t\t\t\tgetEntityMarker(entityRealm).environment,\n\t\t\t\t\t\tentityRealm.getAccessor,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn entityRealm.accessor\n\t\t\t},\n\t\t}\n\t\treturn entityRealm\n\t}\n\n\tprivate materializeEntityRealm(state: EntityRealmState | EntityRealmStateStub): EntityRealmState {\n\t\tif (state.type === 'entityRealm') {\n\t\t\treturn state\n\t\t}\n\t\tconst { realmKey, entity, blueprint } = state\n\n\t\tconst existing = this.treeStore.entityRealmStore.get(realmKey)\n\t\tif (existing !== undefined && existing.type === 'entityRealm') {\n\t\t\treturn existing\n\t\t}\n\n\t\tconst entityRealm = this.createEntityRealm(blueprint, realmKey, entity)\n\n\t\tthis.registerEntityRealm(entityRealm)\n\n\t\t// if (blueprint.creationParameters.forceCreation && !entity.id.existsOnServer) {\n\t\t// \tentityRealm.unpersistedChangesCount += 1\n\t\t// }\n\n\t\tconst persistedData = this.treeStore.persistedEntityData.get(entity.id.value)\n\n\t\tconst marker = getEntityMarker(state)\n\t\tconst pathBack = this.treeStore.getPathBackToParent(entityRealm)\n\n\t\tfor (const [placeholderName, field] of marker.fields.markers) {\n\t\t\tconst fieldDatum = persistedData?.get(placeholderName)\n\n\t\t\tif (field instanceof FieldMarker) {\n\t\t\t\tthis.initializeFromFieldMarker(entityRealm, field, fieldDatum)\n\t\t\t} else if (field instanceof HasManyRelationMarker) {\n\t\t\t\t// if (pathBack?.fieldBackToParent === field.parameters.field) {\n\t\t\t\t// \t// TODO this is probably wrong?\n\t\t\t\t// \tconst ids = pathBack.parent.children.get(field.placeholderName)\n\t\t\t\t// \tconst newData = this.treeStore.persistedEntityData.get(pathBack.parent.entity.id.value)\n\t\t\t\t// \tconsole.log('many?', pathBack, field, entityRealm, fieldDatum, ids)\n\t\t\t\t// }\n\t\t\t\tthis.initializeFromHasManyRelationMarker(entityRealm, field, fieldDatum instanceof Set ? fieldDatum : new Set())\n\t\t\t} else if (field instanceof HasOneRelationMarker) {\n\t\t\t\tlet runtimeId: RuntimeId\n\t\t\t\tif (pathBack?.fieldBackToParent === field.parameters.field) {\n\t\t\t\t\truntimeId = pathBack.parent.entity.id\n\t\t\t\t} else {\n\t\t\t\t\truntimeId = fieldDatum instanceof ServerGeneratedUuid ? fieldDatum : new UnpersistedEntityDummyId()\n\t\t\t\t}\n\t\t\t\tthis.initializeFromHasOneRelationMarker(entityRealm, field, runtimeId)\n\t\t\t} else {\n\t\t\t\tassertNever(field)\n\t\t\t}\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(entityRealm)\n\n\t\treturn entityRealm\n\t}\n\n\tprivate registerEntityRealm(entityRealm: EntityRealmState | EntityRealmStateStub) {\n\t\tconst { realmKey, blueprint, entity } = entityRealm\n\n\t\tthis.treeStore.entityRealmStore.set(entityRealm.realmKey, entityRealm)\n\n\t\tif (blueprint.type === 'listEntity') {\n\t\t\tblueprint.parent.children.set(entity.id.value, entityRealm)\n\t\t} else if (blueprint.type === 'hasOne') {\n\t\t\tblueprint.parent.children.set(blueprint.marker.placeholderName, entityRealm)\n\t\t}\n\t\tentity.realms.set(realmKey, entityRealm)\n\t}\n\n\tpublic initializeEntityState(id: RuntimeId, entityName: EntityName): EntityState {\n\t\tconst entityId = id.value\n\n\t\tconst existing = this.treeStore.entityStore.get(entityId)\n\t\tif (existing !== undefined) {\n\t\t\treturn existing\n\t\t}\n\n\t\tconst entityState: EntityState = {\n\t\t\tentityName,\n\t\t\thasIdSetInStone: id instanceof ServerGeneratedUuid,\n\t\t\tid,\n\t\t\tisScheduledForDeletion: false,\n\t\t\tmaidenId: id instanceof UnpersistedEntityDummyId ? id : undefined,\n\t\t\trealms: new Map(),\n\t\t}\n\t\tthis.treeStore.entityStore.set(entityId, entityState)\n\n\t\treturn entityState\n\t}\n\n\tprivate initializeEntityListState(\n\t\tblueprint: EntityListBlueprint,\n\t\tentityName: EntityName,\n\t\tinitialEntityIds: Set<string>,\n\t): EntityListState {\n\t\tconst entityListState: EntityListState = {\n\t\t\ttype: 'entityList',\n\t\t\taccessor: undefined,\n\t\t\tblueprint,\n\t\t\tchildren: new BijectiveIndexedMap(realm => realm.entity.id.value),\n\t\t\tchildrenWithPendingUpdates: undefined,\n\t\t\tentityName,\n\t\t\teventListeners: this.initializeEntityListEventListenerStore(blueprint),\n\t\t\tchildEventListeners: this.initializeEntityListChildEventListenerStore(blueprint),\n\t\t\terrors: undefined,\n\t\t\tplannedRemovals: undefined,\n\t\t\tunpersistedChangesCount: 0, // TODO force creation?\n\t\t\tgetAccessor: () => {\n\t\t\t\tif (entityListState.accessor === undefined) {\n\t\t\t\t\tconst persistedEntityIds = this.treeStore.getEntityListPersistedIds(entityListState)\n\t\t\t\t\tentityListState.accessor = new EntityListAccessor(\n\t\t\t\t\t\tentityListState,\n\t\t\t\t\t\tthis.listOperations,\n\t\t\t\t\t\tentityListState.children,\n\t\t\t\t\t\tpersistedEntityIds,\n\t\t\t\t\t\tentityListState.unpersistedChangesCount !== 0,\n\t\t\t\t\t\tentityListState.errors,\n\t\t\t\t\t\tentityListState.blueprint.marker.environment,\n\t\t\t\t\t\tentityListState.getAccessor,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn entityListState.accessor\n\t\t\t},\n\t\t}\n\n\t\tconst initialData: Iterable<string | undefined> =\n\t\t\tinitialEntityIds.size === 0\n\t\t\t\t? Array.from({ length: blueprint.marker.parameters.initialEntityCount })\n\t\t\t\t: initialEntityIds\n\t\tfor (const entityId of initialData) {\n\t\t\tthis.initializeEntityRealm(\n\t\t\t\tentityId ? new ServerGeneratedUuid(entityId) : new UnpersistedEntityDummyId(),\n\t\t\t\tentityListState.entityName,\n\t\t\t\t{\n\t\t\t\t\ttype: 'listEntity',\n\t\t\t\t\tparent: entityListState,\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(entityListState)\n\n\t\treturn entityListState\n\t}\n\n\tprivate initializeFieldState(\n\t\tparent: EntityRealmState,\n\t\tplaceholderName: FieldName,\n\t\tfieldMarker: FieldMarker,\n\t\tpersistedValue: Scalar | undefined,\n\t): FieldState {\n\t\tconst resolvedFieldValue = persistedValue ?? fieldMarker.defaultValue ?? null\n\n\t\tconst fieldState: FieldState = {\n\t\t\ttype: 'field',\n\t\t\taccessor: undefined,\n\t\t\tfieldMarker,\n\t\t\tplaceholderName,\n\t\t\tpersistedValue,\n\t\t\tparent,\n\t\t\tvalue: resolvedFieldValue,\n\t\t\teventListeners: this.initializeFieldEventListenerStore(fieldMarker),\n\t\t\terrors: undefined,\n\t\t\ttouchLog: undefined,\n\t\t\thasUnpersistedChanges: false,\n\n\t\t\tgetAccessor: () => {\n\t\t\t\tif (fieldState.accessor === undefined) {\n\t\t\t\t\tconst fieldSchema = this.treeStore.schema.getEntityField(parent.entity.entityName, fieldMarker.fieldName)\n\t\t\t\t\tif (!fieldSchema) {\n\t\t\t\t\t\tthrow new BindingError(`Unknown field ${parent.entity.entityName}.${fieldMarker.fieldName}.`)\n\t\t\t\t\t}\n\t\t\t\t\tif (fieldSchema.__typename !== '_Column') {\n\t\t\t\t\t\tthrow new BindingError(`Invalid type of field ${parent.entity.entityName}.${fieldMarker.fieldName}. Expected '_Column', '${fieldSchema.__typename}' found.`)\n\t\t\t\t\t}\n\t\t\t\t\tfieldState.accessor = new FieldAccessor(\n\t\t\t\t\t\tfieldState,\n\t\t\t\t\t\tthis.fieldOperations,\n\t\t\t\t\t\tfieldState.placeholderName,\n\t\t\t\t\t\tfieldState.value,\n\t\t\t\t\t\tfieldState.persistedValue === undefined ? null : fieldState.persistedValue,\n\t\t\t\t\t\tfieldState.fieldMarker.defaultValue,\n\t\t\t\t\t\tfieldState.errors,\n\t\t\t\t\t\tfieldState.hasUnpersistedChanges,\n\t\t\t\t\t\tfieldState.touchLog,\n\t\t\t\t\t\tfieldState.getAccessor,\n\t\t\t\t\t\tfieldSchema,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treturn fieldState.accessor\n\t\t\t},\n\t\t}\n\n\t\tthis.eventManager.registerNewlyInitialized(fieldState)\n\t\treturn fieldState\n\t}\n\n\tprivate initializeFromFieldMarker(\n\t\tparent: EntityRealmState,\n\t\tfield: FieldMarker,\n\t\tfieldDatum: EntityFieldPersistedData | undefined,\n\t) {\n\t\tif (fieldDatum instanceof Set) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`Received a collection of referenced entities where a single '${field.fieldName}' field was expected. ` +\n\t\t\t\t\t`Perhaps you wanted to use a <Repeater />?`,\n\t\t\t)\n\t\t}\n\t\tif (fieldDatum instanceof ServerGeneratedUuid) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`Received a referenced entity where a single '${field.fieldName}' field was expected. ` +\n\t\t\t\t\t`Perhaps you wanted to use <HasOne />?`,\n\t\t\t)\n\t\t}\n\t\tparent.children.set(\n\t\t\tfield.placeholderName,\n\t\t\tthis.initializeFieldState(parent, field.placeholderName, field, fieldDatum),\n\t\t)\n\t}\n\n\tprivate initializeFromHasOneRelationMarker(\n\t\tparent: EntityRealmState,\n\t\tfield: HasOneRelationMarker,\n\t\tentityId: RuntimeId,\n\t\tcopyFrom?: EntityRealmState | EntityRealmStateStub,\n\t) {\n\t\tparent.children.set(\n\t\t\tfield.placeholderName,\n\t\t\tthis.initializeEntityRealm(entityId, this.getRelationTargetEntityName(parent, field), {\n\t\t\t\ttype: 'hasOne',\n\t\t\t\tparent,\n\t\t\t\tmarker: field,\n\t\t\t}, copyFrom),\n\t\t)\n\t\t// if (fieldDatum instanceof ServerGeneratedUuid || fieldDatum === null || fieldDatum === undefined) {\n\t\t// \tconst entityId = fieldDatum instanceof ServerGeneratedUuid ? fieldDatum : new UnpersistedEntityDummyId()\n\t\t//\n\t\t//\n\t\t// } else if (fieldDatum instanceof Set) {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a collection of entities for field '${relation.field}' where a single entity was expected. ` +\n\t\t// \t\t\t`Perhaps you wanted to use a <Repeater />?`,\n\t\t// \t)\n\t\t// } else {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a scalar value for field '${relation.field}' where a single entity was expected.` +\n\t\t// \t\t\t`Perhaps you meant to use a variant of <Field />?`,\n\t\t// \t)\n\t\t// }\n\t}\n\n\tprivate initializeFromHasManyRelationMarker(\n\t\tparent: EntityRealmState,\n\t\tfield: HasManyRelationMarker,\n\t\tpersistedEntityIds: Set<string>,\n\t) {\n\t\tparent.children.set(\n\t\t\tfield.placeholderName,\n\t\t\tthis.initializeEntityListState(\n\t\t\t\t{ marker: field, parent },\n\t\t\t\tthis.getRelationTargetEntityName(parent, field),\n\t\t\t\tpersistedEntityIds,\n\t\t\t),\n\t\t)\n\t\t// const relation = field.parameters\n\t\t//\n\t\t// if (fieldDatum === undefined || fieldDatum instanceof Set) {\n\t\t//\n\t\t// } else if (typeof fieldDatum === 'object') {\n\t\t// \t// Intentionally allowing `fieldDatum === null` here as well since this should only happen when a *hasOne\n\t\t// \t// relation is unlinked, e.g. a Person does not have a linked Nationality.\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a referenced entity for field '${relation.field}' where a collection of entities was expected.` +\n\t\t// \t\t\t`Perhaps you wanted to use a <HasOne />?`,\n\t\t// \t)\n\t\t// } else {\n\t\t// \tthrow new BindingError(\n\t\t// \t\t`Received a scalar value for field '${relation.field}' where a collection of entities was expected.` +\n\t\t// \t\t\t`Perhaps you meant to use a variant of <Field />?`,\n\t\t// \t)\n\t\t// }\n\t}\n\n\tprivate getRelationTargetEntityName(\n\t\tentityRealm: EntityRealmState,\n\t\tfield: HasOneRelationMarker | HasManyRelationMarker,\n\t): EntityName {\n\t\tconst targetField = this.treeStore.schema.getEntityField(entityRealm.entity.entityName, field.parameters.field)\n\n\t\tif (targetField?.__typename !== '_Relation') {\n\t\t\tthrow new BindingError() // This should have been validated elsewhere.\n\t\t}\n\t\treturn targetField.targetEntity\n\t}\n\n\tpublic runImmediateUserInitialization(\n\t\trealm: EntityRealmState | EntityRealmStateStub,\n\t\tinitialize: EntityAccessor.BatchUpdatesHandler | undefined,\n\t) {\n\t\tif (initialize === undefined) {\n\t\t\treturn\n\t\t}\n\t\tconst entityRealm = this.materializeEntityRealm(realm)\n\n\t\trealm.getAccessor().batchUpdates(initialize)\n\n\t\tconst initializeListeners = this.eventManager.getEventListeners(entityRealm, { type: 'initialize' })\n\t\tif (initializeListeners === undefined || initializeListeners.size === 0) {\n\t\t\trealm.entity.hasIdSetInStone = true\n\t\t}\n\t}\n\n\tpublic initializeEntityEventListenerStore(blueprint: EntityRealmBlueprint): EntityEventListenerStore | undefined {\n\t\tif (blueprint.type === 'listEntity') {\n\t\t\tconst blueprintListeners = blueprint.parent.blueprint.marker.parameters.childEventListeners\n\t\t\tconst childInitialize = blueprintListeners?.get({ type: 'initialize' })\n\t\t\tconst store: EntityEventListenerStore = new EventListenersStore(() => blueprint.parent.childEventListeners)\n\n\t\t\tif (childInitialize !== undefined) {\n\t\t\t\tstore.set({ type: 'initialize' }, childInitialize)\n\t\t\t}\n\t\t\treturn store\n\t\t}\n\n\t\tconst blueprintListeners = blueprint.marker.parameters.eventListeners\n\t\tif (blueprintListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn TreeParameterMerger.cloneSingleEntityEventListeners(blueprintListeners)\n\t}\n\n\tprivate initializeEntityListEventListenerStore(\n\t\tblueprint: EntityListBlueprint,\n\t): EntityListEventListenerStore | undefined {\n\t\tconst blueprintListeners = blueprint.marker.parameters.eventListeners\n\n\t\tif (blueprintListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn TreeParameterMerger.cloneEntityListEventListeners(blueprintListeners)\n\t}\n\n\tprivate initializeEntityListChildEventListenerStore(\n\t\tblueprint: EntityListBlueprint,\n\t): EntityEventListenerStore | undefined {\n\t\tconst blueprintListeners = blueprint.marker.parameters.childEventListeners\n\n\t\tif (blueprintListeners === undefined) {\n\t\t\treturn undefined\n\t\t}\n\t\treturn TreeParameterMerger.cloneSingleEntityEventListeners(blueprintListeners)\n\t}\n\n\tprivate initializeFieldEventListenerStore(marker: FieldMarker): FieldEventListenerStore | undefined {\n\t\t// TODO !!!\n\t\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C;QACG,eAAe,QAAW;;;UAGxB,cAAc,KAAK,uBAAuB;UAE1C,cAAc,aAAa;UAE3B,sBAAsB,KAAK,aAAa,kBAAkB,aAAa,EAAE,MAAM;QACjF,wBAAwB,UAAa,oBAAoB,SAAS,GAAG;YAClE,OAAO,kBAAkB;AAAA;AAAA;AAAA,EAI1B,mCAAmC,WAAuE;QAC5G,UAAU,SAAS,cAAc;YAC9B,sBAAqB,UAAU,OAAO,UAAU,OAAO,WAAW;YAClE,kBAAkB,qBAAoB,IAAI,EAAE,MAAM;YAClD,QAAkC,IAAI,oBAAoB,MAAM,UAAU,OAAO;UAEnF,oBAAoB,QAAW;cAC5B,IAAI,EAAE,MAAM,gBAAgB;AAAA;aAE5B;AAAA;UAGF,qBAAqB,UAAU,OAAO,WAAW;QACnD,uBAAuB,QAAW;aAC9B;AAAA;WAED,oBAAoB,gCAAgC;AAAA;AAAA,EAGpD,uCACP,WAC2C;UACrC,qBAAqB,UAAU,OAAO,WAAW;QAEnD,uBAAuB,QAAW;aAC9B;AAAA;WAED,oBAAoB,8BAA8B;AAAA;AAAA,EAGlD,4CACP,WACuC;UACjC,qBAAqB,UAAU,OAAO,WAAW;QAEnD,uBAAuB,QAAW;aAC9B;AAAA;WAED,oBAAoB,gCAAgC;AAAA;AAAA,EAGpD,kCAAkC,QAA0D;WAE5F;AAAA;AAAA;;"}
@@ -0,0 +1,4 @@
1
+ export declare class BindingError extends Error {
2
+ }
3
+ export declare const throwBindingError: (message: string) => never;
4
+ //# sourceMappingURL=BindingError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BindingError.d.ts","sourceRoot":"","sources":["../../src/BindingError.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;CAAG;AAE1C,eAAO,MAAM,iBAAiB,YAAa,MAAM,KAAG,KAEnD,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { EntityAccessor } from '../accessors';
3
+ export interface EntityProviderProps {
4
+ accessor: EntityAccessor;
5
+ children: ReactNode;
6
+ }
7
+ export declare function AccessorProvider(props: EntityProviderProps): JSX.Element;
8
+ //# sourceMappingURL=AccessorProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccessorProvider.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/AccessorProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAIlD,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,cAAc,CAAA;IACxB,QAAQ,EAAE,SAAS,CAAA;CACnB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,mBAAmB,eAM1D"}
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import type { BindingOperations } from '../accessors';
3
+ export declare const defaultBindingOperations: Readonly<BindingOperations>;
4
+ export declare const BindingOperationsContext: import("react").Context<BindingOperations>;
5
+ //# sourceMappingURL=BindingOperationsContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BindingOperationsContext.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/BindingOperationsContext.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAWrD,eAAO,MAAM,wBAAwB,6BAiBnC,CAAA;AAEF,eAAO,MAAM,wBAAwB,4CAA6D,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { BindingOperations } from '../accessors';
3
+ export interface BindingOperationsProviderProps {
4
+ bindingOperations: BindingOperations | undefined;
5
+ children: ReactNode;
6
+ }
7
+ export declare function BindingOperationsProvider(props: BindingOperationsProviderProps): JSX.Element;
8
+ //# sourceMappingURL=BindingOperationsProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BindingOperationsProvider.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/BindingOperationsProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAGrD,MAAM,WAAW,8BAA8B;IAC9C,iBAAiB,EAAE,iBAAiB,GAAG,SAAS,CAAA;IAChD,QAAQ,EAAE,SAAS,CAAA;CACnB;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,8BAA8B,eAM9E"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const EntityKeyContext: import("react").Context<string | undefined>;
3
+ //# sourceMappingURL=EntityKeyContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntityKeyContext.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/EntityKeyContext.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,gBAAgB,6CAA+C,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface EntityKeyProviderProps {
3
+ entityKey: string;
4
+ children: ReactNode;
5
+ }
6
+ export declare function EntityKeyProvider(props: EntityKeyProviderProps): JSX.Element;
7
+ //# sourceMappingURL=EntityKeyProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntityKeyProvider.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/EntityKeyProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,SAAS,CAAA;CACnB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eAE9D"}
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { Environment } from '../dao';
3
+ export declare const EnvironmentContext: import("react").Context<Environment>;
4
+ //# sourceMappingURL=EnvironmentContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnvironmentContext.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/EnvironmentContext.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAEpC,eAAO,MAAM,kBAAkB,sCAAmD,CAAA"}
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const TreeRootIdContext: import("react").Context<string | undefined>;
3
+ //# sourceMappingURL=TreeRootIdContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeRootIdContext.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/TreeRootIdContext.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,iBAAiB,6CAAmD,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { TreeRootId } from '../treeParameters';
3
+ export interface TreeRootIdProviderProps {
4
+ treeRootId: TreeRootId | undefined;
5
+ children: ReactNode;
6
+ }
7
+ export declare function TreeRootIdProvider(props: TreeRootIdProviderProps): JSX.Element;
8
+ //# sourceMappingURL=TreeRootIdProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TreeRootIdProvider.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/TreeRootIdProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGnD,MAAM,WAAW,uBAAuB;IACvC,UAAU,EAAE,UAAU,GAAG,SAAS,CAAA;IAClC,QAAQ,EAAE,SAAS,CAAA;CACnB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,eAEhE"}
@@ -0,0 +1,27 @@
1
+ export * from './AccessorProvider';
2
+ export * from './BindingOperationsProvider';
3
+ export * from './EntityKeyProvider';
4
+ export * from './EnvironmentContext';
5
+ export * from './TreeRootIdProvider';
6
+ export * from './useAccessorUpdateSubscription';
7
+ export * from './useBindingOperations';
8
+ export * from './useDesugaredRelativeEntityList';
9
+ export * from './useDesugaredRelativeSingleEntity';
10
+ export * from './useDesugaredRelativeSingleField';
11
+ export * from './useEntity';
12
+ export * from './useEntityKey';
13
+ export * from './useHasEntity';
14
+ export * from './useEntityList';
15
+ export * from './useEntityListSubTree';
16
+ export * from './useEntityListSubTreeParameters';
17
+ export * from './useEntitySubTree';
18
+ export * from './useEntitySubTreeParameters';
19
+ export * from './useEnvironment';
20
+ export * from './useField';
21
+ export * from './useGetEntityByKey';
22
+ export * from './useGetEntityListSubTree';
23
+ export * from './useGetEntitySubTree';
24
+ export * from './useGetTreeFilters';
25
+ export * from './usePersist';
26
+ export * from './useTreeRootId';
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAA;AAClC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,oBAAoB,CAAA;AAClC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,qBAAqB,CAAA;AACnC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA;AACnC,cAAc,cAAc,CAAA;AAC5B,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,16 @@
1
+ import type { EntityAccessor, EntityListAccessor, FieldAccessor } from '../accessors';
2
+ import type { FieldValue } from '../treeParameters';
3
+ export declare type ForceAccessorUpdate = () => void;
4
+ /**
5
+ * It is VERY IMPORTANT for the parameter to be referentially stable!
6
+ */
7
+ declare function useAccessorUpdateSubscription<Value extends FieldValue = FieldValue>(getFieldAccessor: () => FieldAccessor<Value>): FieldAccessor<Value>;
8
+ declare function useAccessorUpdateSubscription(getEntityAccessor: () => EntityAccessor): EntityAccessor;
9
+ declare function useAccessorUpdateSubscription(getListAccessor: () => EntityListAccessor): EntityListAccessor;
10
+ declare function useAccessorUpdateSubscription(getAccessor: () => EntityListAccessor | EntityAccessor): EntityListAccessor | EntityAccessor;
11
+ declare function useAccessorUpdateSubscription<Value extends FieldValue = FieldValue>(getFieldAccessor: () => FieldAccessor<Value>, withForceUpdate: true): [FieldAccessor<Value>, ForceAccessorUpdate];
12
+ declare function useAccessorUpdateSubscription(getEntityAccessor: () => EntityAccessor, withForceUpdate: true): [EntityAccessor, ForceAccessorUpdate];
13
+ declare function useAccessorUpdateSubscription(getListAccessor: () => EntityListAccessor, withForceUpdate: true): [EntityListAccessor, ForceAccessorUpdate];
14
+ declare function useAccessorUpdateSubscription(getAccessor: () => EntityListAccessor | EntityAccessor, withForceUpdate: true): [EntityListAccessor | EntityAccessor, ForceAccessorUpdate];
15
+ export { useAccessorUpdateSubscription };
16
+ //# sourceMappingURL=useAccessorUpdateSubscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAccessorUpdateSubscription.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/useAccessorUpdateSubscription.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACrF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,oBAAY,mBAAmB,GAAG,MAAM,IAAI,CAAA;AAE5C;;GAEG;AACH,iBAAS,6BAA6B,CAAC,KAAK,SAAS,UAAU,GAAG,UAAU,EAC3E,gBAAgB,EAAE,MAAM,aAAa,CAAC,KAAK,CAAC,GAC1C,aAAa,CAAC,KAAK,CAAC,CAAA;AACvB,iBAAS,6BAA6B,CAAC,iBAAiB,EAAE,MAAM,cAAc,GAAG,cAAc,CAAA;AAC/F,iBAAS,6BAA6B,CAAC,eAAe,EAAE,MAAM,kBAAkB,GAAG,kBAAkB,CAAA;AACrG,iBAAS,6BAA6B,CACrC,WAAW,EAAE,MAAM,kBAAkB,GAAG,cAAc,GACpD,kBAAkB,GAAG,cAAc,CAAA;AACtC,iBAAS,6BAA6B,CAAC,KAAK,SAAS,UAAU,GAAG,UAAU,EAC3E,gBAAgB,EAAE,MAAM,aAAa,CAAC,KAAK,CAAC,EAC5C,eAAe,EAAE,IAAI,GACnB,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC,CAAA;AAC9C,iBAAS,6BAA6B,CACrC,iBAAiB,EAAE,MAAM,cAAc,EACvC,eAAe,EAAE,IAAI,GACnB,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAA;AACxC,iBAAS,6BAA6B,CACrC,eAAe,EAAE,MAAM,kBAAkB,EACzC,eAAe,EAAE,IAAI,GACnB,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAA;AAC5C,iBAAS,6BAA6B,CACrC,WAAW,EAAE,MAAM,kBAAkB,GAAG,cAAc,EACtD,eAAe,EAAE,IAAI,GACnB,CAAC,kBAAkB,GAAG,cAAc,EAAE,mBAAmB,CAAC,CAAA;AAyE7D,OAAO,EAAE,6BAA6B,EAAE,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { BindingOperations } from '../accessors';
2
+ export declare const useBindingOperations: () => BindingOperations;
3
+ //# sourceMappingURL=useBindingOperations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBindingOperations.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/useBindingOperations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAGrD,eAAO,MAAM,oBAAoB,QAAO,iBAAyD,CAAA"}
@@ -0,0 +1,11 @@
1
+ import type { RelativeEntityList, SugaredRelativeEntityList } from '../treeParameters';
2
+ /**
3
+ * @deprecated Use useEntityList instead.
4
+ */
5
+ declare function useDesugaredRelativeEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList): RelativeEntityList;
6
+ /**
7
+ * @deprecated Use useEntityList instead.
8
+ */
9
+ declare function useDesugaredRelativeEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined): RelativeEntityList | undefined;
10
+ export { useDesugaredRelativeEntityList };
11
+ //# sourceMappingURL=useDesugaredRelativeEntityList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDesugaredRelativeEntityList.d.ts","sourceRoot":"","sources":["../../../src/accessorPropagation/useDesugaredRelativeEntityList.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAGtF;;GAEG;AACH,iBAAS,8BAA8B,CACtC,yBAAyB,EAAE,MAAM,GAAG,yBAAyB,GAC3D,kBAAkB,CAAA;AACrB;;GAEG;AACH,iBAAS,8BAA8B,CACtC,yBAAyB,EAAE,MAAM,GAAG,yBAAyB,GAAG,SAAS,GACvE,kBAAkB,GAAG,SAAS,CAAA;AAqDjC,OAAO,EAAE,8BAA8B,EAAE,CAAA"}
@@ -0,0 +1,11 @@
1
+ import type { RelativeSingleEntity, SugaredRelativeSingleEntity } from '../treeParameters';
2
+ /**
3
+ * @deprecated Use useEntity instead.
4
+ */
5
+ declare function useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): RelativeSingleEntity;
6
+ /**
7
+ * @deprecated Use useEntity instead.
8
+ */
9
+ declare function useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined): RelativeSingleEntity | undefined;
10
+ export { useDesugaredRelativeSingleEntity };
11
+ //# sourceMappingURL=useDesugaredRelativeSingleEntity.d.ts.map