@contember/binding 1.0.0-rc.9 → 1.1.0-alpha.1

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 (586) hide show
  1. package/dist/development/BindingError.js +0 -1
  2. package/dist/development/BindingError.js.map +1 -1
  3. package/dist/development/accessorPropagation/AccessorProvider.js +3 -5
  4. package/dist/development/accessorPropagation/AccessorProvider.js.map +1 -1
  5. package/dist/development/accessorPropagation/BindingOperationsContext.js +2 -4
  6. package/dist/development/accessorPropagation/BindingOperationsContext.js.map +1 -1
  7. package/dist/development/accessorPropagation/BindingOperationsProvider.js +2 -4
  8. package/dist/development/accessorPropagation/BindingOperationsProvider.js.map +1 -1
  9. package/dist/development/accessorPropagation/EntityKeyContext.js +1 -3
  10. package/dist/development/accessorPropagation/EntityKeyContext.js.map +1 -1
  11. package/dist/development/accessorPropagation/EntityKeyProvider.js +2 -4
  12. package/dist/development/accessorPropagation/EntityKeyProvider.js.map +1 -1
  13. package/dist/development/accessorPropagation/EnvironmentContext.js +2 -4
  14. package/dist/development/accessorPropagation/EnvironmentContext.js.map +1 -1
  15. package/dist/development/accessorPropagation/TreeRootIdContext.js +1 -3
  16. package/dist/development/accessorPropagation/TreeRootIdContext.js.map +1 -1
  17. package/dist/development/accessorPropagation/TreeRootIdProvider.js +2 -4
  18. package/dist/development/accessorPropagation/TreeRootIdProvider.js.map +1 -1
  19. package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js +2 -4
  20. package/dist/development/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
  21. package/dist/development/accessorPropagation/useBindingOperations.js +2 -4
  22. package/dist/development/accessorPropagation/useBindingOperations.js.map +1 -1
  23. package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js +3 -5
  24. package/dist/development/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
  25. package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js +3 -5
  26. package/dist/development/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
  27. package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js +3 -5
  28. package/dist/development/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
  29. package/dist/development/accessorPropagation/useEntity.js +7 -9
  30. package/dist/development/accessorPropagation/useEntity.js.map +1 -1
  31. package/dist/development/accessorPropagation/useEntityKey.js +3 -5
  32. package/dist/development/accessorPropagation/useEntityKey.js.map +1 -1
  33. package/dist/development/accessorPropagation/useEntityList.js +7 -9
  34. package/dist/development/accessorPropagation/useEntityList.js.map +1 -1
  35. package/dist/development/accessorPropagation/useEntityListSubTree.js +4 -6
  36. package/dist/development/accessorPropagation/useEntityListSubTree.js.map +1 -1
  37. package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js +2 -4
  38. package/dist/development/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
  39. package/dist/development/accessorPropagation/useEntitySubTree.js +4 -6
  40. package/dist/development/accessorPropagation/useEntitySubTree.js.map +1 -1
  41. package/dist/development/accessorPropagation/useEntitySubTreeParameters.js +2 -4
  42. package/dist/development/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
  43. package/dist/development/accessorPropagation/useEnvironment.js +2 -4
  44. package/dist/development/accessorPropagation/useEnvironment.js.map +1 -1
  45. package/dist/development/accessorPropagation/useField.js +7 -9
  46. package/dist/development/accessorPropagation/useField.js.map +1 -1
  47. package/dist/development/accessorPropagation/useGetEntityByKey.js +1 -3
  48. package/dist/development/accessorPropagation/useGetEntityByKey.js.map +1 -1
  49. package/dist/development/accessorPropagation/useGetEntityListSubTree.js +4 -6
  50. package/dist/development/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
  51. package/dist/development/accessorPropagation/useGetEntitySubTree.js +4 -6
  52. package/dist/development/accessorPropagation/useGetEntitySubTree.js.map +1 -1
  53. package/dist/development/accessorPropagation/useGetTreeFilters.js +1 -3
  54. package/dist/development/accessorPropagation/useGetTreeFilters.js.map +1 -1
  55. package/dist/development/accessorPropagation/useHasEntity.js +2 -4
  56. package/dist/development/accessorPropagation/useHasEntity.js.map +1 -1
  57. package/dist/development/accessorPropagation/usePersist.js +1 -3
  58. package/dist/development/accessorPropagation/usePersist.js.map +1 -1
  59. package/dist/development/accessorPropagation/useTreeRootId.js +2 -4
  60. package/dist/development/accessorPropagation/useTreeRootId.js.map +1 -1
  61. package/dist/development/accessorSorting/SetOrderFieldOnCreate.js +9 -11
  62. package/dist/development/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
  63. package/dist/development/accessorSorting/addEntityAtIndex.js +2 -4
  64. package/dist/development/accessorSorting/addEntityAtIndex.js.map +1 -1
  65. package/dist/development/accessorSorting/errors.js +1 -3
  66. package/dist/development/accessorSorting/errors.js.map +1 -1
  67. package/dist/development/accessorSorting/moveEntity.js +1 -3
  68. package/dist/development/accessorSorting/moveEntity.js.map +1 -1
  69. package/dist/development/accessorSorting/repairEntitiesOrder.js +0 -1
  70. package/dist/development/accessorSorting/repairEntitiesOrder.js.map +1 -1
  71. package/dist/development/accessorSorting/sortEntities.js +0 -1
  72. package/dist/development/accessorSorting/sortEntities.js.map +1 -1
  73. package/dist/development/accessorSorting/useSortedEntities.js +6 -8
  74. package/dist/development/accessorSorting/useSortedEntities.js.map +1 -1
  75. package/dist/development/accessorTree/AccessorTree.js +4 -6
  76. package/dist/development/accessorTree/AccessorTree.js.map +1 -1
  77. package/dist/development/accessorTree/DirtinessContext.js +1 -3
  78. package/dist/development/accessorTree/DirtinessContext.js.map +1 -1
  79. package/dist/development/accessorTree/MutationStateContext.js +1 -3
  80. package/dist/development/accessorTree/MutationStateContext.js.map +1 -1
  81. package/dist/development/accessorTree/NormalizedPersistedData.js +0 -1
  82. package/dist/development/accessorTree/NormalizedPersistedData.js.map +1 -1
  83. package/dist/development/accessorTree/RuntimeId.js +38 -20
  84. package/dist/development/accessorTree/RuntimeId.js.map +1 -1
  85. package/dist/development/accessorTree/accessorTreeStateReducer.js +0 -1
  86. package/dist/development/accessorTree/accessorTreeStateReducer.js.map +1 -1
  87. package/dist/development/accessorTree/metadataToRequestError.js +0 -1
  88. package/dist/development/accessorTree/metadataToRequestError.js.map +1 -1
  89. package/dist/development/accessorTree/useDataBinding.js +5 -7
  90. package/dist/development/accessorTree/useDataBinding.js.map +1 -1
  91. package/dist/development/accessorTree/useDirtinessState.js +2 -4
  92. package/dist/development/accessorTree/useDirtinessState.js.map +1 -1
  93. package/dist/development/accessorTree/useMutationState.js +2 -4
  94. package/dist/development/accessorTree/useMutationState.js.map +1 -1
  95. package/dist/development/accessors/EntityAccessor.js +4 -38
  96. package/dist/development/accessors/EntityAccessor.js.map +1 -1
  97. package/dist/development/accessors/EntityListAccessor.js +2 -4
  98. package/dist/development/accessors/EntityListAccessor.js.map +1 -1
  99. package/dist/development/accessors/ErrorAccessor.js +0 -1
  100. package/dist/development/accessors/ErrorAccessor.js.map +1 -1
  101. package/dist/development/accessors/FieldAccessor.js +3 -5
  102. package/dist/development/accessors/FieldAccessor.js.map +1 -1
  103. package/dist/development/accessors/TreeRootAccessor.js +0 -1
  104. package/dist/development/accessors/TreeRootAccessor.js.map +1 -1
  105. package/dist/development/bindingTypes.js +0 -1
  106. package/dist/development/bindingTypes.js.map +1 -1
  107. package/dist/development/core/AccessorErrorManager.js +18 -11
  108. package/dist/development/core/AccessorErrorManager.js.map +1 -1
  109. package/dist/development/core/Config.js +18 -12
  110. package/dist/development/core/Config.js.map +1 -1
  111. package/dist/development/core/DataBinding.js +80 -72
  112. package/dist/development/core/DataBinding.js.map +1 -1
  113. package/dist/development/core/DirtinessTracker.js +10 -3
  114. package/dist/development/core/DirtinessTracker.js.map +1 -1
  115. package/dist/development/core/ErrorsPreprocessor.js +3 -5
  116. package/dist/development/core/ErrorsPreprocessor.js.map +1 -1
  117. package/dist/development/core/EventManager.js +20 -16
  118. package/dist/development/core/EventManager.js.map +1 -1
  119. package/dist/development/core/IncrementalMarkerBuilder.js +14 -8
  120. package/dist/development/core/IncrementalMarkerBuilder.js.map +1 -1
  121. package/dist/development/core/MarkerComparator.js +6 -8
  122. package/dist/development/core/MarkerComparator.js.map +1 -1
  123. package/dist/development/core/MarkerMerger.js +18 -19
  124. package/dist/development/core/MarkerMerger.js.map +1 -1
  125. package/dist/development/core/MarkerTreeGenerator.js +18 -13
  126. package/dist/development/core/MarkerTreeGenerator.js.map +1 -1
  127. package/dist/development/core/MutationGenerator.js +17 -19
  128. package/dist/development/core/MutationGenerator.js.map +1 -1
  129. package/dist/development/core/QueryGenerator.js +9 -11
  130. package/dist/development/core/QueryGenerator.js.map +1 -1
  131. package/dist/development/core/RealmKeyGenerator.js +10 -6
  132. package/dist/development/core/RealmKeyGenerator.js.map +1 -1
  133. package/dist/development/core/RequestResponseNormalizer.js +33 -39
  134. package/dist/development/core/RequestResponseNormalizer.js.map +1 -1
  135. package/dist/development/core/StateInitializer.js +36 -34
  136. package/dist/development/core/StateInitializer.js.map +1 -1
  137. package/dist/development/core/TreeAugmenter.js +15 -17
  138. package/dist/development/core/TreeAugmenter.js.map +1 -1
  139. package/dist/development/core/TreeFilterGenerator.js +9 -9
  140. package/dist/development/core/TreeFilterGenerator.js.map +1 -1
  141. package/dist/development/core/TreeParameterMerger.js +2 -4
  142. package/dist/development/core/TreeParameterMerger.js.map +1 -1
  143. package/dist/development/core/TreeStore.js +22 -18
  144. package/dist/development/core/TreeStore.js.map +1 -1
  145. package/dist/development/core/VariableInputTransformer.js +6 -5
  146. package/dist/development/core/VariableInputTransformer.js.map +1 -1
  147. package/dist/development/core/exceptions/ErrorLocator.js +10 -6
  148. package/dist/development/core/exceptions/ErrorLocator.js.map +1 -1
  149. package/dist/development/core/exceptions/LocalizedBindingError.js +1 -3
  150. package/dist/development/core/exceptions/LocalizedBindingError.js.map +1 -1
  151. package/dist/development/core/exceptions/MarkerSugarer.js +7 -9
  152. package/dist/development/core/exceptions/MarkerSugarer.js.map +1 -1
  153. package/dist/development/core/exceptions/TreeParameterSugarer.js +0 -1
  154. package/dist/development/core/exceptions/TreeParameterSugarer.js.map +1 -1
  155. package/dist/development/core/factories/createBatchUpdatesOptions.js +1 -3
  156. package/dist/development/core/factories/createBatchUpdatesOptions.js.map +1 -1
  157. package/dist/development/core/operations/EntityOperations.js +17 -18
  158. package/dist/development/core/operations/EntityOperations.js.map +1 -1
  159. package/dist/development/core/operations/FieldOperations.js +11 -13
  160. package/dist/development/core/operations/FieldOperations.js.map +1 -1
  161. package/dist/development/core/operations/ListOperations.js +14 -16
  162. package/dist/development/core/operations/ListOperations.js.map +1 -1
  163. package/dist/development/core/operations/OperationsHelpers.js +6 -8
  164. package/dist/development/core/operations/OperationsHelpers.js.map +1 -1
  165. package/dist/development/core/requestAliases/MutationAlias.js +7 -7
  166. package/dist/development/core/requestAliases/MutationAlias.js.map +1 -1
  167. package/dist/development/core/requestAliases/mutationOperationSubTreeType.js +0 -1
  168. package/dist/development/core/requestAliases/mutationOperationSubTreeType.js.map +1 -1
  169. package/dist/development/core/requestAliases/mutationOperationType.js +0 -1
  170. package/dist/development/core/requestAliases/mutationOperationType.js.map +1 -1
  171. package/dist/development/core/schema/Schema.js +3 -1
  172. package/dist/development/core/schema/Schema.js.map +1 -1
  173. package/dist/development/core/schema/SchemaLoader.js +9 -5
  174. package/dist/development/core/schema/SchemaLoader.js.map +1 -1
  175. package/dist/development/core/schema/SchemaPreprocessor.js +0 -1
  176. package/dist/development/core/schema/SchemaPreprocessor.js.map +1 -1
  177. package/dist/development/core/state/StateIterator.js +2 -4
  178. package/dist/development/core/state/StateIterator.js.map +1 -1
  179. package/dist/development/core/state/getEntityMarker.js +0 -1
  180. package/dist/development/core/state/getEntityMarker.js.map +1 -1
  181. package/dist/development/core/utils/getCombinedSignal.js +0 -1
  182. package/dist/development/core/utils/getCombinedSignal.js.map +1 -1
  183. package/dist/development/coreComponents/Component.js +2 -4
  184. package/dist/development/coreComponents/Component.js.map +1 -1
  185. package/dist/development/coreComponents/DataBindingProvider.js +3 -5
  186. package/dist/development/coreComponents/DataBindingProvider.js.map +1 -1
  187. package/dist/development/coreComponents/Entity.js +3 -5
  188. package/dist/development/coreComponents/Entity.js.map +1 -1
  189. package/dist/development/coreComponents/EntityList.js +3 -5
  190. package/dist/development/coreComponents/EntityList.js.map +1 -1
  191. package/dist/development/coreComponents/EntityListSubTree.js +13 -23
  192. package/dist/development/coreComponents/EntityListSubTree.js.map +1 -1
  193. package/dist/development/coreComponents/EntitySubTree.js +14 -34
  194. package/dist/development/coreComponents/EntitySubTree.js.map +1 -1
  195. package/dist/development/coreComponents/Field.js +10 -8
  196. package/dist/development/coreComponents/Field.js.map +1 -1
  197. package/dist/development/coreComponents/HasMany.js +10 -14
  198. package/dist/development/coreComponents/HasMany.js.map +1 -1
  199. package/dist/development/coreComponents/HasOne.js +10 -14
  200. package/dist/development/coreComponents/HasOne.js.map +1 -1
  201. package/dist/development/coreComponents/ParentEntity.js +3 -5
  202. package/dist/development/coreComponents/ParentEntity.js.map +1 -1
  203. package/dist/development/dao/Environment.js +147 -89
  204. package/dist/development/dao/Environment.js.map +1 -1
  205. package/dist/development/dao/TreeNodeEnvironmentFactory.js +159 -0
  206. package/dist/development/dao/TreeNodeEnvironmentFactory.js.map +1 -0
  207. package/dist/development/dao/VariableFieldValue.js +0 -1
  208. package/dist/development/dao/VariableFieldValue.js.map +1 -1
  209. package/dist/development/entityEvents/useDerivedField.js +4 -6
  210. package/dist/development/entityEvents/useDerivedField.js.map +1 -1
  211. package/dist/development/entityEvents/useEntityBeforePersist.js +1 -3
  212. package/dist/development/entityEvents/useEntityBeforePersist.js.map +1 -1
  213. package/dist/development/entityEvents/useEntityBeforeUpdate.js +1 -3
  214. package/dist/development/entityEvents/useEntityBeforeUpdate.js.map +1 -1
  215. package/dist/development/entityEvents/useEntityEvent.js +3 -5
  216. package/dist/development/entityEvents/useEntityEvent.js.map +1 -1
  217. package/dist/development/entityEvents/useEntityPersistError.js +1 -3
  218. package/dist/development/entityEvents/useEntityPersistError.js.map +1 -1
  219. package/dist/development/entityEvents/useEntityPersistSuccess.js +1 -3
  220. package/dist/development/entityEvents/useEntityPersistSuccess.js.map +1 -1
  221. package/dist/development/entityEvents/useOnConnectionUpdate.js +1 -3
  222. package/dist/development/entityEvents/useOnConnectionUpdate.js.map +1 -1
  223. package/dist/development/fieldHelpers/helpers/FieldHelper.js +8 -4
  224. package/dist/development/fieldHelpers/helpers/FieldHelper.js.map +1 -1
  225. package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.js +1 -3
  226. package/dist/development/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -1
  227. package/dist/development/fieldHelpers/helpers/UuidFieldHelper.js +2 -4
  228. package/dist/development/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
  229. package/dist/development/helperComponents/DeferredSubTrees.js +9 -11
  230. package/dist/development/helperComponents/DeferredSubTrees.js.map +1 -1
  231. package/dist/development/helperComponents/EntityView.js +2 -4
  232. package/dist/development/helperComponents/EntityView.js.map +1 -1
  233. package/dist/development/helperComponents/FieldView.js +7 -9
  234. package/dist/development/helperComponents/FieldView.js.map +1 -1
  235. package/dist/development/helperComponents/StaticRender.js +2 -4
  236. package/dist/development/helperComponents/StaticRender.js.map +1 -1
  237. package/dist/development/helperComponents/SugaredField.js +3 -5
  238. package/dist/development/helperComponents/SugaredField.js.map +1 -1
  239. package/dist/development/index.js +101 -101
  240. package/dist/development/index.js.map +1 -1
  241. package/dist/development/markers/EntityFieldMarkersContainer.js +5 -7
  242. package/dist/development/markers/EntityFieldMarkersContainer.js.map +1 -1
  243. package/dist/development/markers/EntityFieldsWithHoistablesMarker.js +0 -1
  244. package/dist/development/markers/EntityFieldsWithHoistablesMarker.js.map +1 -1
  245. package/dist/development/markers/EntityListSubTreeMarker.js +8 -4
  246. package/dist/development/markers/EntityListSubTreeMarker.js.map +1 -1
  247. package/dist/development/markers/EntitySubTreeMarker.js +8 -4
  248. package/dist/development/markers/EntitySubTreeMarker.js.map +1 -1
  249. package/dist/development/markers/FieldMarker.js +8 -4
  250. package/dist/development/markers/FieldMarker.js.map +1 -1
  251. package/dist/development/markers/HasManyRelationMarker.js +9 -5
  252. package/dist/development/markers/HasManyRelationMarker.js.map +1 -1
  253. package/dist/development/markers/HasOneRelationMarker.js +8 -4
  254. package/dist/development/markers/HasOneRelationMarker.js.map +1 -1
  255. package/dist/development/markers/MarkerTreeRoot.js +0 -1
  256. package/dist/development/markers/MarkerTreeRoot.js.map +1 -1
  257. package/dist/development/markers/ParentEntityMarker.js +0 -1
  258. package/dist/development/markers/ParentEntityMarker.js.map +1 -1
  259. package/dist/development/markers/PlaceholderGenerator.js +1 -3
  260. package/dist/development/markers/PlaceholderGenerator.js.map +1 -1
  261. package/dist/development/queryLanguage/CacheStore.js +10 -4
  262. package/dist/development/queryLanguage/CacheStore.js.map +1 -1
  263. package/dist/development/queryLanguage/MarkerFactory.js +15 -16
  264. package/dist/development/queryLanguage/MarkerFactory.js.map +1 -1
  265. package/dist/development/queryLanguage/Parser.js +572 -547
  266. package/dist/development/queryLanguage/Parser.js.map +1 -1
  267. package/dist/development/queryLanguage/QueryLanguage.js +32 -27
  268. package/dist/development/queryLanguage/QueryLanguage.js.map +1 -1
  269. package/dist/development/queryLanguage/QueryLanguageError.js +0 -1
  270. package/dist/development/queryLanguage/QueryLanguageError.js.map +1 -1
  271. package/dist/development/queryLanguage/tokenList.js +6 -3
  272. package/dist/development/queryLanguage/tokenList.js.map +1 -1
  273. package/dist/development/structures/BijectiveIndexedMap.js +14 -9
  274. package/dist/development/structures/BijectiveIndexedMap.js.map +1 -1
  275. package/dist/development/structures/LRUCache.js +7 -2
  276. package/dist/development/structures/LRUCache.js.map +1 -1
  277. package/dist/development/structures/WeakIdCache.js +11 -4
  278. package/dist/development/structures/WeakIdCache.js.map +1 -1
  279. package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.js +1 -3
  280. package/dist/development/treeParameterHelpers/wrapFilterInHasOnes.js.map +1 -1
  281. package/dist/development/treeParameters/EntityCreationParameters.js +0 -1
  282. package/dist/development/treeParameters/EntityCreationParameters.js.map +1 -1
  283. package/dist/development/treeParameters/EntityListPreferences.js +0 -1
  284. package/dist/development/treeParameters/EntityListPreferences.js.map +1 -1
  285. package/dist/development/treeParameters/EventListenersStore.js +0 -1
  286. package/dist/development/treeParameters/EventListenersStore.js.map +1 -1
  287. package/dist/development/treeParameters/LeafField.js +0 -1
  288. package/dist/development/treeParameters/LeafField.js.map +1 -1
  289. package/dist/development/treeParameters/QualifiedEntityParameters.js +0 -1
  290. package/dist/development/treeParameters/QualifiedEntityParameters.js.map +1 -1
  291. package/dist/development/treeParameters/Relation.js +0 -1
  292. package/dist/development/treeParameters/Relation.js.map +1 -1
  293. package/dist/development/utils/Hashing.js +0 -1
  294. package/dist/development/utils/Hashing.js.map +1 -1
  295. package/dist/development/utils/assert.js +1 -3
  296. package/dist/development/utils/assert.js.map +1 -1
  297. package/dist/development/utils/assertNever.js +2 -4
  298. package/dist/development/utils/assertNever.js.map +1 -1
  299. package/dist/development/utils/generateEnumerabilityPreventingEntropy.js +0 -1
  300. package/dist/development/utils/generateEnumerabilityPreventingEntropy.js.map +1 -1
  301. package/dist/development/utils/isEmptyObject.js +0 -1
  302. package/dist/development/utils/isEmptyObject.js.map +1 -1
  303. package/dist/development/utils/ucfirst.js +0 -1
  304. package/dist/development/utils/ucfirst.js.map +1 -1
  305. package/dist/production/BindingError.js.map +1 -1
  306. package/dist/production/accessorPropagation/AccessorProvider.js.map +1 -1
  307. package/dist/production/accessorPropagation/BindingOperationsContext.js.map +1 -1
  308. package/dist/production/accessorPropagation/BindingOperationsProvider.js.map +1 -1
  309. package/dist/production/accessorPropagation/EntityKeyContext.js.map +1 -1
  310. package/dist/production/accessorPropagation/EntityKeyProvider.js.map +1 -1
  311. package/dist/production/accessorPropagation/EnvironmentContext.js.map +1 -1
  312. package/dist/production/accessorPropagation/TreeRootIdContext.js.map +1 -1
  313. package/dist/production/accessorPropagation/TreeRootIdProvider.js.map +1 -1
  314. package/dist/production/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
  315. package/dist/production/accessorPropagation/useBindingOperations.js.map +1 -1
  316. package/dist/production/accessorPropagation/useDesugaredRelativeEntityList.js.map +1 -1
  317. package/dist/production/accessorPropagation/useDesugaredRelativeSingleEntity.js.map +1 -1
  318. package/dist/production/accessorPropagation/useDesugaredRelativeSingleField.js.map +1 -1
  319. package/dist/production/accessorPropagation/useEntity.js.map +1 -1
  320. package/dist/production/accessorPropagation/useEntityKey.js.map +1 -1
  321. package/dist/production/accessorPropagation/useEntityList.js.map +1 -1
  322. package/dist/production/accessorPropagation/useEntityListSubTree.js.map +1 -1
  323. package/dist/production/accessorPropagation/useEntityListSubTreeParameters.js.map +1 -1
  324. package/dist/production/accessorPropagation/useEntitySubTree.js.map +1 -1
  325. package/dist/production/accessorPropagation/useEntitySubTreeParameters.js.map +1 -1
  326. package/dist/production/accessorPropagation/useEnvironment.js.map +1 -1
  327. package/dist/production/accessorPropagation/useField.js.map +1 -1
  328. package/dist/production/accessorPropagation/useGetEntityByKey.js.map +1 -1
  329. package/dist/production/accessorPropagation/useGetEntityListSubTree.js.map +1 -1
  330. package/dist/production/accessorPropagation/useGetEntitySubTree.js.map +1 -1
  331. package/dist/production/accessorPropagation/useGetTreeFilters.js.map +1 -1
  332. package/dist/production/accessorPropagation/useHasEntity.js.map +1 -1
  333. package/dist/production/accessorPropagation/usePersist.js.map +1 -1
  334. package/dist/production/accessorPropagation/useTreeRootId.js.map +1 -1
  335. package/dist/production/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
  336. package/dist/production/accessorSorting/addEntityAtIndex.js.map +1 -1
  337. package/dist/production/accessorSorting/errors.js.map +1 -1
  338. package/dist/production/accessorSorting/moveEntity.js.map +1 -1
  339. package/dist/production/accessorSorting/repairEntitiesOrder.js.map +1 -1
  340. package/dist/production/accessorSorting/sortEntities.js.map +1 -1
  341. package/dist/production/accessorSorting/useSortedEntities.js.map +1 -1
  342. package/dist/production/accessorTree/AccessorTree.js.map +1 -1
  343. package/dist/production/accessorTree/DirtinessContext.js.map +1 -1
  344. package/dist/production/accessorTree/MutationStateContext.js.map +1 -1
  345. package/dist/production/accessorTree/NormalizedPersistedData.js.map +1 -1
  346. package/dist/production/accessorTree/RuntimeId.js +17 -4
  347. package/dist/production/accessorTree/RuntimeId.js.map +1 -1
  348. package/dist/production/accessorTree/accessorTreeStateReducer.js.map +1 -1
  349. package/dist/production/accessorTree/metadataToRequestError.js.map +1 -1
  350. package/dist/production/accessorTree/useDataBinding.js.map +1 -1
  351. package/dist/production/accessorTree/useDirtinessState.js.map +1 -1
  352. package/dist/production/accessorTree/useMutationState.js.map +1 -1
  353. package/dist/production/accessors/EntityAccessor.js +0 -32
  354. package/dist/production/accessors/EntityAccessor.js.map +1 -1
  355. package/dist/production/accessors/EntityListAccessor.js +1 -1
  356. package/dist/production/accessors/EntityListAccessor.js.map +1 -1
  357. package/dist/production/accessors/ErrorAccessor.js.map +1 -1
  358. package/dist/production/accessors/FieldAccessor.js.map +1 -1
  359. package/dist/production/accessors/TreeRootAccessor.js.map +1 -1
  360. package/dist/production/bindingTypes.js.map +1 -1
  361. package/dist/production/core/AccessorErrorManager.js +3 -0
  362. package/dist/production/core/AccessorErrorManager.js.map +1 -1
  363. package/dist/production/core/Config.js.map +1 -1
  364. package/dist/production/core/DataBinding.js +28 -16
  365. package/dist/production/core/DataBinding.js.map +1 -1
  366. package/dist/production/core/DirtinessTracker.js.map +1 -1
  367. package/dist/production/core/ErrorsPreprocessor.js.map +1 -1
  368. package/dist/production/core/EventManager.js.map +1 -1
  369. package/dist/production/core/IncrementalMarkerBuilder.js.map +1 -1
  370. package/dist/production/core/MarkerComparator.js +1 -1
  371. package/dist/production/core/MarkerComparator.js.map +1 -1
  372. package/dist/production/core/MarkerMerger.js +1 -4
  373. package/dist/production/core/MarkerMerger.js.map +1 -1
  374. package/dist/production/core/MarkerTreeGenerator.js.map +1 -1
  375. package/dist/production/core/MutationGenerator.js +5 -5
  376. package/dist/production/core/MutationGenerator.js.map +1 -1
  377. package/dist/production/core/QueryGenerator.js.map +1 -1
  378. package/dist/production/core/RealmKeyGenerator.js.map +1 -1
  379. package/dist/production/core/RequestResponseNormalizer.js +27 -31
  380. package/dist/production/core/RequestResponseNormalizer.js.map +1 -1
  381. package/dist/production/core/StateInitializer.js +10 -12
  382. package/dist/production/core/StateInitializer.js.map +1 -1
  383. package/dist/production/core/TreeAugmenter.js +10 -10
  384. package/dist/production/core/TreeAugmenter.js.map +1 -1
  385. package/dist/production/core/TreeFilterGenerator.js +2 -2
  386. package/dist/production/core/TreeFilterGenerator.js.map +1 -1
  387. package/dist/production/core/TreeParameterMerger.js.map +1 -1
  388. package/dist/production/core/TreeStore.js +3 -3
  389. package/dist/production/core/TreeStore.js.map +1 -1
  390. package/dist/production/core/VariableInputTransformer.js +4 -1
  391. package/dist/production/core/VariableInputTransformer.js.map +1 -1
  392. package/dist/production/core/exceptions/ErrorLocator.js.map +1 -1
  393. package/dist/production/core/exceptions/LocalizedBindingError.js.map +1 -1
  394. package/dist/production/core/exceptions/MarkerSugarer.js.map +1 -1
  395. package/dist/production/core/exceptions/TreeParameterSugarer.js.map +1 -1
  396. package/dist/production/core/factories/createBatchUpdatesOptions.js.map +1 -1
  397. package/dist/production/core/operations/EntityOperations.js +6 -6
  398. package/dist/production/core/operations/EntityOperations.js.map +1 -1
  399. package/dist/production/core/operations/FieldOperations.js.map +1 -1
  400. package/dist/production/core/operations/ListOperations.js +2 -2
  401. package/dist/production/core/operations/ListOperations.js.map +1 -1
  402. package/dist/production/core/operations/OperationsHelpers.js +2 -2
  403. package/dist/production/core/operations/OperationsHelpers.js.map +1 -1
  404. package/dist/production/core/requestAliases/MutationAlias.js +5 -3
  405. package/dist/production/core/requestAliases/MutationAlias.js.map +1 -1
  406. package/dist/production/core/requestAliases/mutationOperationSubTreeType.js.map +1 -1
  407. package/dist/production/core/requestAliases/mutationOperationType.js.map +1 -1
  408. package/dist/production/core/schema/Schema.js +3 -0
  409. package/dist/production/core/schema/Schema.js.map +1 -1
  410. package/dist/production/core/schema/SchemaLoader.js.map +1 -1
  411. package/dist/production/core/schema/SchemaPreprocessor.js.map +1 -1
  412. package/dist/production/core/state/StateIterator.js.map +1 -1
  413. package/dist/production/core/state/getEntityMarker.js.map +1 -1
  414. package/dist/production/core/utils/getCombinedSignal.js.map +1 -1
  415. package/dist/production/coreComponents/Component.js.map +1 -1
  416. package/dist/production/coreComponents/DataBindingProvider.js.map +1 -1
  417. package/dist/production/coreComponents/Entity.js.map +1 -1
  418. package/dist/production/coreComponents/EntityList.js.map +1 -1
  419. package/dist/production/coreComponents/EntityListSubTree.js +4 -12
  420. package/dist/production/coreComponents/EntityListSubTree.js.map +1 -1
  421. package/dist/production/coreComponents/EntitySubTree.js +4 -22
  422. package/dist/production/coreComponents/EntitySubTree.js.map +1 -1
  423. package/dist/production/coreComponents/Field.js +5 -1
  424. package/dist/production/coreComponents/Field.js.map +1 -1
  425. package/dist/production/coreComponents/HasMany.js +3 -5
  426. package/dist/production/coreComponents/HasMany.js.map +1 -1
  427. package/dist/production/coreComponents/HasOne.js +3 -5
  428. package/dist/production/coreComponents/HasOne.js.map +1 -1
  429. package/dist/production/coreComponents/ParentEntity.js.map +1 -1
  430. package/dist/production/dao/Environment.js +147 -94
  431. package/dist/production/dao/Environment.js.map +1 -1
  432. package/dist/production/dao/TreeNodeEnvironmentFactory.js +159 -0
  433. package/dist/production/dao/TreeNodeEnvironmentFactory.js.map +1 -0
  434. package/dist/production/dao/VariableFieldValue.js.map +1 -1
  435. package/dist/production/entityEvents/useDerivedField.js.map +1 -1
  436. package/dist/production/entityEvents/useEntityBeforePersist.js.map +1 -1
  437. package/dist/production/entityEvents/useEntityBeforeUpdate.js.map +1 -1
  438. package/dist/production/entityEvents/useEntityEvent.js.map +1 -1
  439. package/dist/production/entityEvents/useEntityPersistError.js.map +1 -1
  440. package/dist/production/entityEvents/useEntityPersistSuccess.js.map +1 -1
  441. package/dist/production/entityEvents/useOnConnectionUpdate.js.map +1 -1
  442. package/dist/production/fieldHelpers/helpers/FieldHelper.js.map +1 -1
  443. package/dist/production/fieldHelpers/helpers/TemporalFieldHelper.js.map +1 -1
  444. package/dist/production/fieldHelpers/helpers/UuidFieldHelper.js.map +1 -1
  445. package/dist/production/helperComponents/DeferredSubTrees.js.map +1 -1
  446. package/dist/production/helperComponents/EntityView.js.map +1 -1
  447. package/dist/production/helperComponents/FieldView.js.map +1 -1
  448. package/dist/production/helperComponents/StaticRender.js.map +1 -1
  449. package/dist/production/helperComponents/SugaredField.js.map +1 -1
  450. package/dist/production/index.js +2 -2
  451. package/dist/production/markers/EntityFieldMarkersContainer.js.map +1 -1
  452. package/dist/production/markers/EntityFieldsWithHoistablesMarker.js.map +1 -1
  453. package/dist/production/markers/EntityListSubTreeMarker.js.map +1 -1
  454. package/dist/production/markers/EntitySubTreeMarker.js.map +1 -1
  455. package/dist/production/markers/FieldMarker.js.map +1 -1
  456. package/dist/production/markers/HasManyRelationMarker.js.map +1 -1
  457. package/dist/production/markers/HasOneRelationMarker.js.map +1 -1
  458. package/dist/production/markers/MarkerTreeRoot.js.map +1 -1
  459. package/dist/production/markers/ParentEntityMarker.js.map +1 -1
  460. package/dist/production/markers/PlaceholderGenerator.js.map +1 -1
  461. package/dist/production/queryLanguage/CacheStore.js.map +1 -1
  462. package/dist/production/queryLanguage/MarkerFactory.js +4 -3
  463. package/dist/production/queryLanguage/MarkerFactory.js.map +1 -1
  464. package/dist/production/queryLanguage/Parser.js +24 -7
  465. package/dist/production/queryLanguage/Parser.js.map +1 -1
  466. package/dist/production/queryLanguage/QueryLanguage.js.map +1 -1
  467. package/dist/production/queryLanguage/QueryLanguageError.js.map +1 -1
  468. package/dist/production/queryLanguage/tokenList.js +5 -0
  469. package/dist/production/queryLanguage/tokenList.js.map +1 -1
  470. package/dist/production/structures/BijectiveIndexedMap.js.map +1 -1
  471. package/dist/production/structures/LRUCache.js.map +1 -1
  472. package/dist/production/structures/WeakIdCache.js.map +1 -1
  473. package/dist/production/treeParameterHelpers/wrapFilterInHasOnes.js.map +1 -1
  474. package/dist/production/treeParameters/EntityCreationParameters.js.map +1 -1
  475. package/dist/production/treeParameters/EntityListPreferences.js.map +1 -1
  476. package/dist/production/treeParameters/EventListenersStore.js.map +1 -1
  477. package/dist/production/treeParameters/LeafField.js.map +1 -1
  478. package/dist/production/treeParameters/QualifiedEntityParameters.js.map +1 -1
  479. package/dist/production/treeParameters/Relation.js.map +1 -1
  480. package/dist/production/utils/Hashing.js.map +1 -1
  481. package/dist/production/utils/assert.js.map +1 -1
  482. package/dist/production/utils/assertNever.js +1 -1
  483. package/dist/production/utils/assertNever.js.map +1 -1
  484. package/dist/production/utils/generateEnumerabilityPreventingEntropy.js.map +1 -1
  485. package/dist/production/utils/isEmptyObject.js.map +1 -1
  486. package/dist/production/utils/ucfirst.js.map +1 -1
  487. package/dist/types/accessorTree/MutationRequestResponse.d.ts +9 -1
  488. package/dist/types/accessorTree/MutationRequestResponse.d.ts.map +1 -1
  489. package/dist/types/accessorTree/NormalizedPersistedData.d.ts +4 -4
  490. package/dist/types/accessorTree/NormalizedPersistedData.d.ts.map +1 -1
  491. package/dist/types/accessorTree/PersistResult.d.ts +2 -1
  492. package/dist/types/accessorTree/PersistResult.d.ts.map +1 -1
  493. package/dist/types/accessorTree/QueryRequestResponse.d.ts +15 -10
  494. package/dist/types/accessorTree/QueryRequestResponse.d.ts.map +1 -1
  495. package/dist/types/accessorTree/RequestError.d.ts +9 -1
  496. package/dist/types/accessorTree/RequestError.d.ts.map +1 -1
  497. package/dist/types/accessorTree/RuntimeId.d.ts +16 -6
  498. package/dist/types/accessorTree/RuntimeId.d.ts.map +1 -1
  499. package/dist/types/accessors/EntityAccessor.d.ts +1 -3
  500. package/dist/types/accessors/EntityAccessor.d.ts.map +1 -1
  501. package/dist/types/accessors/EntityListAccessor.d.ts +2 -2
  502. package/dist/types/accessors/EntityListAccessor.d.ts.map +1 -1
  503. package/dist/types/core/AccessorErrorManager.d.ts.map +1 -1
  504. package/dist/types/core/DataBinding.d.ts +1 -0
  505. package/dist/types/core/DataBinding.d.ts.map +1 -1
  506. package/dist/types/core/ErrorsPreprocessor.d.ts +2 -2
  507. package/dist/types/core/ErrorsPreprocessor.d.ts.map +1 -1
  508. package/dist/types/core/MarkerMerger.d.ts.map +1 -1
  509. package/dist/types/core/RequestResponseNormalizer.d.ts.map +1 -1
  510. package/dist/types/core/StateInitializer.d.ts.map +1 -1
  511. package/dist/types/core/TreeStore.d.ts +3 -3
  512. package/dist/types/core/TreeStore.d.ts.map +1 -1
  513. package/dist/types/core/VariableInputTransformer.d.ts.map +1 -1
  514. package/dist/types/core/operations/ListOperations.d.ts +2 -1
  515. package/dist/types/core/operations/ListOperations.d.ts.map +1 -1
  516. package/dist/types/core/requestAliases/MutationAlias.d.ts.map +1 -1
  517. package/dist/types/core/schema/Schema.d.ts +2 -0
  518. package/dist/types/core/schema/Schema.d.ts.map +1 -1
  519. package/dist/types/core/schema/index.d.ts +0 -1
  520. package/dist/types/core/schema/index.d.ts.map +1 -1
  521. package/dist/types/coreComponents/EntityListSubTree.d.ts +1 -1
  522. package/dist/types/coreComponents/EntityListSubTree.d.ts.map +1 -1
  523. package/dist/types/coreComponents/EntitySubTree.d.ts +1 -1
  524. package/dist/types/coreComponents/EntitySubTree.d.ts.map +1 -1
  525. package/dist/types/coreComponents/Field.d.ts.map +1 -1
  526. package/dist/types/coreComponents/HasMany.d.ts +1 -1
  527. package/dist/types/coreComponents/HasMany.d.ts.map +1 -1
  528. package/dist/types/coreComponents/HasOne.d.ts +1 -1
  529. package/dist/types/coreComponents/HasOne.d.ts.map +1 -1
  530. package/dist/types/dao/Environment.d.ts +81 -42
  531. package/dist/types/dao/Environment.d.ts.map +1 -1
  532. package/dist/types/dao/TreeNodeEnvironmentFactory.d.ts +19 -0
  533. package/dist/types/dao/TreeNodeEnvironmentFactory.d.ts.map +1 -0
  534. package/dist/types/queryLanguage/MarkerFactory.d.ts.map +1 -1
  535. package/dist/types/queryLanguage/Parser.d.ts +1 -0
  536. package/dist/types/queryLanguage/Parser.d.ts.map +1 -1
  537. package/dist/types/queryLanguage/tokenList.d.ts +1 -0
  538. package/dist/types/queryLanguage/tokenList.d.ts.map +1 -1
  539. package/dist/types/treeParameters/primitives/EntityId.d.ts +1 -1
  540. package/dist/types/treeParameters/primitives/EntityId.d.ts.map +1 -1
  541. package/dist/types/tsconfig.tsbuildinfo +1 -1
  542. package/package.json +13 -10
  543. package/src/accessorTree/MutationRequestResponse.ts +4 -1
  544. package/src/accessorTree/NormalizedPersistedData.ts +4 -4
  545. package/src/accessorTree/PersistResult.ts +2 -1
  546. package/src/accessorTree/QueryRequestResponse.ts +18 -14
  547. package/src/accessorTree/RequestError.ts +7 -1
  548. package/src/accessorTree/RuntimeId.ts +27 -6
  549. package/src/accessors/EntityAccessor.ts +2 -51
  550. package/src/accessors/EntityListAccessor.ts +3 -3
  551. package/src/core/AccessorErrorManager.ts +3 -0
  552. package/src/core/DataBinding.ts +32 -33
  553. package/src/core/ErrorsPreprocessor.ts +2 -2
  554. package/src/core/MarkerMerger.ts +1 -4
  555. package/src/core/MutationGenerator.ts +5 -5
  556. package/src/core/RequestResponseNormalizer.ts +37 -38
  557. package/src/core/StateInitializer.ts +15 -17
  558. package/src/core/TreeAugmenter.ts +11 -11
  559. package/src/core/TreeFilterGenerator.ts +5 -5
  560. package/src/core/TreeStore.ts +12 -6
  561. package/src/core/VariableInputTransformer.ts +7 -4
  562. package/src/core/operations/EntityOperations.ts +5 -5
  563. package/src/core/operations/FieldOperations.ts +2 -2
  564. package/src/core/operations/ListOperations.ts +4 -4
  565. package/src/core/operations/OperationsHelpers.ts +2 -2
  566. package/src/core/requestAliases/MutationAlias.ts +5 -3
  567. package/src/core/schema/Schema.ts +5 -0
  568. package/src/core/schema/index.ts +0 -1
  569. package/src/coreComponents/EntityListSubTree.tsx +5 -16
  570. package/src/coreComponents/EntitySubTree.tsx +17 -32
  571. package/src/coreComponents/Field.tsx +4 -0
  572. package/src/coreComponents/HasMany.tsx +4 -6
  573. package/src/coreComponents/HasOne.tsx +6 -7
  574. package/src/dao/Environment.ts +221 -126
  575. package/src/dao/TreeNodeEnvironmentFactory.ts +228 -0
  576. package/src/queryLanguage/MarkerFactory.ts +5 -3
  577. package/src/queryLanguage/Parser.ts +36 -12
  578. package/src/queryLanguage/tokenList.ts +6 -0
  579. package/src/treeParameters/primitives/EntityId.ts +1 -1
  580. package/src/tsconfig.json +1 -1
  581. package/src/utils/assertNever.ts +1 -1
  582. package/dist/development/core/schema/SchemaValidator.js +0 -118
  583. package/dist/development/core/schema/SchemaValidator.js.map +0 -1
  584. package/dist/types/core/schema/SchemaValidator.d.ts +0 -14
  585. package/dist/types/core/schema/SchemaValidator.d.ts.map +0 -1
  586. package/src/core/schema/SchemaValidator.ts +0 -238
@@ -1,560 +1,580 @@
1
- import { GraphQlBuilder } from '@contember/client';
2
- import { EmbeddedActionsParser, Lexer } from 'chevrotain';
3
- import { CacheStore } from './CacheStore.js';
4
- import { QueryLanguageError } from './QueryLanguageError.js';
5
- import { tokenList, tokens, TokenRegExps } from './tokenList.js';
6
- import { Environment } from '../dao/Environment.js';
7
-
8
- class Parser extends EmbeddedActionsParser {
9
- static rawInput = "";
10
- static lexer = new Lexer(tokenList);
11
- static parser = new Parser();
12
- static environment = new Environment();
13
- static cacheStore = new CacheStore();
14
- qualifiedEntityList = this.RULE("qualifiedEntityList", () => {
15
- const entityName = this.SUBRULE(this.entityIdentifier);
16
- const filter = this.OPTION(() => this.SUBRULE(this.nonUniqueWhere));
17
- const relativeSingleEntity = this.OPTION1(() => {
18
- this.CONSUME(tokens.Dot);
19
- return this.SUBRULE(this.relativeSingleEntity);
20
- });
21
- const hasOneRelationPath = this.ACTION(() => relativeSingleEntity === void 0 ? [] : relativeSingleEntity.hasOneRelationPath);
22
- return {
23
- entityName,
24
- filter,
25
- hasOneRelationPath
26
- };
27
- });
28
- qualifiedFieldList = this.RULE("qualifiedFieldList", () => {
29
- const entityName = this.SUBRULE(this.entityIdentifier);
30
- const filter = this.OPTION(() => this.SUBRULE(this.nonUniqueWhere));
31
- this.CONSUME(tokens.Dot);
32
- const { hasOneRelationPath, field } = this.SUBRULE(this.relativeSingleField);
33
- return {
34
- entityName,
35
- field,
36
- filter,
37
- hasOneRelationPath
38
- };
39
- });
40
- qualifiedSingleEntity = this.RULE("qualifiedSingleEntity", () => {
41
- const entityName = this.SUBRULE(this.entityIdentifier);
42
- const where = this.SUBRULE(this.uniqueWhere);
43
- const filter = this.OPTION(() => this.SUBRULE(this.nonUniqueWhere));
44
- const relativeSingleEntity = this.OPTION1(() => {
45
- this.CONSUME(tokens.Dot);
46
- return this.SUBRULE(this.relativeSingleEntity);
47
- });
48
- const hasOneRelationPath = this.ACTION(() => relativeSingleEntity === void 0 ? [] : relativeSingleEntity.hasOneRelationPath);
49
- return {
50
- entityName,
51
- where,
52
- hasOneRelationPath,
53
- filter
54
- };
55
- });
56
- unconstrainedQualifiedEntityList = this.RULE("unconstrainedQualifiedEntityList", () => {
57
- const entityName = this.SUBRULE(this.entityIdentifier);
58
- const relativeSingleEntity = this.OPTION(() => {
59
- this.CONSUME(tokens.Dot);
60
- return this.SUBRULE(this.relativeSingleEntity);
61
- });
62
- const hasOneRelationPath = this.ACTION(() => relativeSingleEntity === void 0 ? [] : relativeSingleEntity.hasOneRelationPath);
63
- return {
64
- entityName,
65
- hasOneRelationPath
66
- };
67
- });
68
- unconstrainedQualifiedSingleEntity = this.RULE("unconstrainedQualifiedSingleEntity", () => {
69
- const entityName = this.SUBRULE(this.entityIdentifier);
70
- const relativeSingleEntity = this.OPTION1(() => {
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import { GraphQlBuilder } from "@contember/client";
8
+ import { EmbeddedActionsParser, Lexer } from "chevrotain";
9
+ import { CacheStore } from "./CacheStore.js";
10
+ import { QueryLanguageError } from "./QueryLanguageError.js";
11
+ import { tokenList, tokens, TokenRegExps } from "./tokenList.js";
12
+ import { BindingError } from "../BindingError.js";
13
+ import { Environment } from "../dao/Environment.js";
14
+ const _Parser = class extends EmbeddedActionsParser {
15
+ constructor() {
16
+ super(tokenList, { outputCst: false, maxLookahead: 1 });
17
+ __publicField(this, "qualifiedEntityList", this.RULE("qualifiedEntityList", () => {
18
+ const entityName = this.SUBRULE(this.entityIdentifier);
19
+ const filter = this.OPTION(() => this.SUBRULE(this.nonUniqueWhere));
20
+ const relativeSingleEntity = this.OPTION1(() => {
21
+ this.CONSUME(tokens.Dot);
22
+ return this.SUBRULE(this.relativeSingleEntity);
23
+ });
24
+ const hasOneRelationPath = this.ACTION(() => relativeSingleEntity === void 0 ? [] : relativeSingleEntity.hasOneRelationPath);
25
+ return {
26
+ entityName,
27
+ filter,
28
+ hasOneRelationPath
29
+ };
30
+ }));
31
+ __publicField(this, "qualifiedFieldList", this.RULE("qualifiedFieldList", () => {
32
+ const entityName = this.SUBRULE(this.entityIdentifier);
33
+ const filter = this.OPTION(() => this.SUBRULE(this.nonUniqueWhere));
71
34
  this.CONSUME(tokens.Dot);
72
- return this.SUBRULE(this.relativeSingleEntity);
73
- });
74
- const hasOneRelationPath = this.ACTION(() => relativeSingleEntity === void 0 ? [] : relativeSingleEntity.hasOneRelationPath);
75
- return {
76
- entityName,
77
- hasOneRelationPath
78
- };
79
- });
80
- relativeSingleField = this.RULE("relativeSingleField", () => {
81
- let { hasOneRelationPath } = this.SUBRULE(this.relativeSingleEntity);
82
- const last = this.ACTION(() => hasOneRelationPath.pop());
83
- this.ACTION(() => {
84
- if (last.reducedBy !== void 0 || last.filter !== void 0) {
85
- throw new QueryLanguageError(`Cannot parse '${Parser.rawInput}': the last field '${last.field}' is being reduced or filtered, which, grammatically, makes it a relation but a single field is expected.`);
86
- }
87
- });
88
- const field = this.ACTION(() => last.field);
89
- return {
90
- hasOneRelationPath,
91
- field
92
- };
93
- });
94
- relativeSingleEntity = this.RULE("relativeSingleEntity", () => {
95
- const hasOneRelationPath = [];
96
- this.AT_LEAST_ONE_SEP({
97
- SEP: tokens.Dot,
98
- DEF: () => {
99
- hasOneRelationPath.push(this.SUBRULE(this.hasOneRelation));
100
- }
101
- });
102
- return {
103
- hasOneRelationPath
104
- };
105
- });
106
- relativeEntityList = this.RULE("relativeEntityList", () => {
107
- let { hasOneRelationPath } = this.SUBRULE(this.relativeSingleEntity);
108
- const last = this.ACTION(() => hasOneRelationPath.pop());
109
- this.ACTION(() => {
110
- if (last.reducedBy !== void 0) {
111
- throw new QueryLanguageError(`Cannot parse '${Parser.rawInput}': the last field '${last.field}' is being reduced, which, grammatically, makes it a has-one relation but a has-many relation is expected.`);
112
- }
113
- });
114
- const hasManyRelation = this.ACTION(() => ({
115
- field: last.field,
116
- filter: last.filter
117
- }));
118
- return {
119
- hasOneRelationPath,
120
- hasManyRelation
121
- };
122
- });
123
- hasOneRelation = this.RULE("hasOneRelation", () => {
124
- const fieldName = this.SUBRULE(this.fieldName);
125
- const reducedBy = this.OPTION(() => this.SUBRULE(this.uniqueWhere));
126
- const filter = this.OPTION1(() => this.SUBRULE(this.nonUniqueWhere));
127
- const hasOneRelation = {
128
- field: fieldName,
129
- filter,
130
- reducedBy
131
- };
132
- return hasOneRelation;
133
- });
134
- nonUniqueWhere = this.RULE("nonUniqueWhere", () => {
135
- const cnfWhere = [];
136
- this.AT_LEAST_ONE(() => {
137
- this.CONSUME(tokens.LeftBracket);
138
- cnfWhere.push(this.SUBRULE(this.disjunction));
139
- this.CONSUME(tokens.RightBracket);
140
- });
141
- if (cnfWhere.length === 1) {
142
- return cnfWhere[0];
143
- }
144
- return {
145
- and: cnfWhere
146
- };
147
- });
148
- disjunction = this.RULE("disjunction", () => {
149
- const conjunctions = [];
150
- this.AT_LEAST_ONE_SEP({
151
- SEP: tokens.Or,
152
- DEF: () => {
153
- conjunctions.push(this.SUBRULE(this.conjunction));
154
- }
155
- });
156
- if (conjunctions.length === 1) {
157
- return conjunctions[0];
158
- }
159
- return {
160
- or: conjunctions
161
- };
162
- });
163
- conjunction = this.RULE("conjunction", () => {
164
- const negations = [];
165
- this.AT_LEAST_ONE_SEP({
166
- SEP: tokens.And,
167
- DEF: () => {
168
- negations.push(this.SUBRULE(this.negation));
169
- }
170
- });
171
- if (negations.length === 1) {
172
- return negations[0];
173
- }
174
- return {
175
- and: negations
176
- };
177
- });
178
- negation = this.RULE("negation", () => {
179
- return this.OR([
180
- {
181
- ALT: () => {
182
- this.CONSUME(tokens.Not);
183
- return {
184
- not: this.SUBRULE(this.filterGroup)
185
- };
35
+ const { hasOneRelationPath, field } = this.SUBRULE(this.relativeSingleField);
36
+ return {
37
+ entityName,
38
+ field,
39
+ filter,
40
+ hasOneRelationPath
41
+ };
42
+ }));
43
+ __publicField(this, "qualifiedSingleEntity", this.RULE("qualifiedSingleEntity", () => {
44
+ const entityName = this.SUBRULE(this.entityIdentifier);
45
+ const where = this.SUBRULE(this.uniqueWhere);
46
+ const filter = this.OPTION(() => this.SUBRULE(this.nonUniqueWhere));
47
+ const relativeSingleEntity = this.OPTION1(() => {
48
+ this.CONSUME(tokens.Dot);
49
+ return this.SUBRULE(this.relativeSingleEntity);
50
+ });
51
+ const hasOneRelationPath = this.ACTION(() => relativeSingleEntity === void 0 ? [] : relativeSingleEntity.hasOneRelationPath);
52
+ return {
53
+ entityName,
54
+ where,
55
+ hasOneRelationPath,
56
+ filter
57
+ };
58
+ }));
59
+ __publicField(this, "unconstrainedQualifiedEntityList", this.RULE("unconstrainedQualifiedEntityList", () => {
60
+ const entityName = this.SUBRULE(this.entityIdentifier);
61
+ const relativeSingleEntity = this.OPTION(() => {
62
+ this.CONSUME(tokens.Dot);
63
+ return this.SUBRULE(this.relativeSingleEntity);
64
+ });
65
+ const hasOneRelationPath = this.ACTION(() => relativeSingleEntity === void 0 ? [] : relativeSingleEntity.hasOneRelationPath);
66
+ return {
67
+ entityName,
68
+ hasOneRelationPath
69
+ };
70
+ }));
71
+ __publicField(this, "unconstrainedQualifiedSingleEntity", this.RULE("unconstrainedQualifiedSingleEntity", () => {
72
+ const entityName = this.SUBRULE(this.entityIdentifier);
73
+ const relativeSingleEntity = this.OPTION1(() => {
74
+ this.CONSUME(tokens.Dot);
75
+ return this.SUBRULE(this.relativeSingleEntity);
76
+ });
77
+ const hasOneRelationPath = this.ACTION(() => relativeSingleEntity === void 0 ? [] : relativeSingleEntity.hasOneRelationPath);
78
+ return {
79
+ entityName,
80
+ hasOneRelationPath
81
+ };
82
+ }));
83
+ __publicField(this, "relativeSingleField", this.RULE("relativeSingleField", () => {
84
+ let { hasOneRelationPath } = this.SUBRULE(this.relativeSingleEntity);
85
+ const last = this.ACTION(() => hasOneRelationPath.pop());
86
+ this.ACTION(() => {
87
+ if (last.reducedBy !== void 0 || last.filter !== void 0) {
88
+ throw new QueryLanguageError(`Cannot parse '${_Parser.rawInput}': the last field '${last.field}' is being reduced or filtered, which, grammatically, makes it a relation but a single field is expected.`);
186
89
  }
187
- },
188
- {
189
- ALT: () => {
190
- return this.SUBRULE1(this.filterGroup);
90
+ });
91
+ const field = this.ACTION(() => last.field);
92
+ return {
93
+ hasOneRelationPath,
94
+ field
95
+ };
96
+ }));
97
+ __publicField(this, "relativeSingleEntity", this.RULE("relativeSingleEntity", () => {
98
+ const hasOneRelationPath = [];
99
+ this.AT_LEAST_ONE_SEP({
100
+ SEP: tokens.Dot,
101
+ DEF: () => {
102
+ hasOneRelationPath.push(this.SUBRULE(this.hasOneRelation));
191
103
  }
192
- }
193
- ]);
194
- });
195
- filterGroup = this.RULE("filterGroup", () => {
196
- return this.OR([
197
- {
198
- ALT: () => {
199
- this.CONSUME(tokens.LeftParenthesis);
200
- const subFilter = this.SUBRULE(this.disjunction);
201
- this.CONSUME1(tokens.RightParenthesis);
202
- return subFilter;
104
+ });
105
+ return {
106
+ hasOneRelationPath
107
+ };
108
+ }));
109
+ __publicField(this, "relativeEntityList", this.RULE("relativeEntityList", () => {
110
+ let { hasOneRelationPath } = this.SUBRULE(this.relativeSingleEntity);
111
+ const last = this.ACTION(() => hasOneRelationPath.pop());
112
+ this.ACTION(() => {
113
+ if (last.reducedBy !== void 0) {
114
+ throw new QueryLanguageError(`Cannot parse '${_Parser.rawInput}': the last field '${last.field}' is being reduced, which, grammatically, makes it a has-one relation but a has-many relation is expected.`);
203
115
  }
204
- },
205
- {
206
- ALT: () => this.SUBRULE1(this.filterAtom)
116
+ });
117
+ const hasManyRelation = this.ACTION(() => ({
118
+ field: last.field,
119
+ filter: last.filter
120
+ }));
121
+ return {
122
+ hasOneRelationPath,
123
+ hasManyRelation
124
+ };
125
+ }));
126
+ __publicField(this, "hasOneRelation", this.RULE("hasOneRelation", () => {
127
+ const fieldName = this.SUBRULE(this.fieldName);
128
+ const reducedBy = this.OPTION(() => this.SUBRULE(this.uniqueWhere));
129
+ const filter = this.OPTION1(() => this.SUBRULE(this.nonUniqueWhere));
130
+ const hasOneRelation = {
131
+ field: fieldName,
132
+ filter,
133
+ reducedBy
134
+ };
135
+ return hasOneRelation;
136
+ }));
137
+ __publicField(this, "nonUniqueWhere", this.RULE("nonUniqueWhere", () => {
138
+ const cnfWhere = [];
139
+ this.AT_LEAST_ONE(() => {
140
+ this.CONSUME(tokens.LeftBracket);
141
+ cnfWhere.push(this.SUBRULE(this.disjunction));
142
+ this.CONSUME(tokens.RightBracket);
143
+ });
144
+ if (cnfWhere.length === 1) {
145
+ return cnfWhere[0];
207
146
  }
208
- ]);
209
- });
210
- filterAtom = this.RULE("filterAtom", () => {
211
- return this.OR([
212
- {
213
- ALT: () => {
214
- const variable = this.SUBRULE(this.variable);
215
- return this.ACTION(() => {
216
- if (typeof variable !== "object" || variable instanceof GraphQlBuilder.GraphQlLiteral) {
217
- throw new QueryLanguageError(`Invalid filter value '${JSON.stringify(variable)}'`);
218
- }
219
- return variable;
220
- });
147
+ return {
148
+ and: cnfWhere
149
+ };
150
+ }));
151
+ __publicField(this, "disjunction", this.RULE("disjunction", () => {
152
+ const conjunctions = [];
153
+ this.AT_LEAST_ONE_SEP({
154
+ SEP: tokens.Or,
155
+ DEF: () => {
156
+ conjunctions.push(this.SUBRULE(this.conjunction));
221
157
  }
222
- },
223
- {
224
- ALT: () => this.SUBRULE1(this.fieldWhere)
225
- }
226
- ]);
227
- });
228
- fieldWhere = this.RULE("fieldWhere", () => {
229
- const fields = [];
230
- this.AT_LEAST_ONE_SEP({
231
- SEP: tokens.Dot,
232
- DEF: () => {
233
- fields.push(this.SUBRULE(this.fieldIdentifier));
158
+ });
159
+ if (conjunctions.length === 1) {
160
+ return conjunctions[0];
234
161
  }
235
- });
236
- const condition = this.SUBRULE(this.condition);
237
- let i = fields.length - 1;
238
- let where = {
239
- [fields[i--]]: condition
240
- };
241
- while (i >= 0) {
242
- where = {
243
- [fields[i--]]: where
162
+ return {
163
+ or: conjunctions
244
164
  };
245
- }
246
- return where;
247
- });
248
- condition = this.RULE("condition", () => {
249
- const operator = this.SUBRULE(this.conditionOperator);
250
- const columnValue = this.SUBRULE(this.columnValue);
251
- const condition = {};
252
- return this.ACTION(() => {
253
- if (columnValue === null) {
254
- if (operator === "eq") {
255
- condition.null = true;
256
- } else if (operator === "notEq") {
257
- condition.null = false;
258
- } else {
259
- throw new QueryLanguageError(`The null keyword as a right hand operand can only be tested for (in)equality.`);
165
+ }));
166
+ __publicField(this, "conjunction", this.RULE("conjunction", () => {
167
+ const negations = [];
168
+ this.AT_LEAST_ONE_SEP({
169
+ SEP: tokens.And,
170
+ DEF: () => {
171
+ negations.push(this.SUBRULE(this.negation));
260
172
  }
261
- return condition;
173
+ });
174
+ if (negations.length === 1) {
175
+ return negations[0];
262
176
  }
263
- condition[operator] = columnValue;
264
- return condition;
265
- });
266
- });
267
- conditionOperator = this.RULE("conditionOperator", () => {
268
- return this.OR([
269
- {
270
- ALT: () => {
271
- this.CONSUME(tokens.Equals);
272
- return "eq";
273
- }
274
- },
275
- {
276
- ALT: () => {
277
- this.CONSUME(tokens.NotEquals);
278
- return "notEq";
279
- }
280
- },
281
- {
282
- ALT: () => {
283
- this.CONSUME(tokens.LowerThan);
284
- return "lt";
177
+ return {
178
+ and: negations
179
+ };
180
+ }));
181
+ __publicField(this, "negation", this.RULE("negation", () => {
182
+ return this.OR([
183
+ {
184
+ ALT: () => {
185
+ this.CONSUME(tokens.Not);
186
+ return {
187
+ not: this.SUBRULE(this.filterGroup)
188
+ };
189
+ }
190
+ },
191
+ {
192
+ ALT: () => {
193
+ return this.SUBRULE1(this.filterGroup);
194
+ }
285
195
  }
286
- },
287
- {
288
- ALT: () => {
289
- this.CONSUME(tokens.LowerEqual);
290
- return "lte";
196
+ ]);
197
+ }));
198
+ __publicField(this, "filterGroup", this.RULE("filterGroup", () => {
199
+ return this.OR([
200
+ {
201
+ ALT: () => {
202
+ this.CONSUME(tokens.LeftParenthesis);
203
+ const subFilter = this.SUBRULE(this.disjunction);
204
+ this.CONSUME1(tokens.RightParenthesis);
205
+ return subFilter;
206
+ }
207
+ },
208
+ {
209
+ ALT: () => this.SUBRULE1(this.filterAtom)
291
210
  }
292
- },
293
- {
294
- ALT: () => {
295
- this.CONSUME(tokens.GreaterThan);
296
- return "gt";
211
+ ]);
212
+ }));
213
+ __publicField(this, "filterAtom", this.RULE("filterAtom", () => {
214
+ return this.OR([
215
+ {
216
+ ALT: () => {
217
+ const variable = this.SUBRULE(this.variable);
218
+ return this.ACTION(() => {
219
+ if (typeof variable !== "object" || variable instanceof GraphQlBuilder.GraphQlLiteral) {
220
+ throw new QueryLanguageError(`Invalid filter value '${JSON.stringify(variable)}'`);
221
+ }
222
+ return variable;
223
+ });
224
+ }
225
+ },
226
+ {
227
+ ALT: () => this.SUBRULE1(this.fieldWhere)
297
228
  }
298
- },
299
- {
300
- ALT: () => {
301
- this.CONSUME(tokens.GreaterEqual);
302
- return "gte";
229
+ ]);
230
+ }));
231
+ __publicField(this, "fieldWhere", this.RULE("fieldWhere", () => {
232
+ const fields = [];
233
+ this.AT_LEAST_ONE_SEP({
234
+ SEP: tokens.Dot,
235
+ DEF: () => {
236
+ fields.push(this.SUBRULE(this.fieldIdentifier));
303
237
  }
238
+ });
239
+ const condition = this.SUBRULE(this.condition);
240
+ let i = fields.length - 1;
241
+ let where = {
242
+ [fields[i--]]: condition
243
+ };
244
+ while (i >= 0) {
245
+ where = {
246
+ [fields[i--]]: where
247
+ };
304
248
  }
305
- ]);
306
- });
307
- columnValue = this.RULE("columnValue", () => {
308
- return this.OR([
309
- {
310
- ALT: () => {
311
- this.CONSUME(tokens.Null);
312
- return null;
313
- }
314
- },
315
- {
316
- ALT: () => {
317
- this.CONSUME(tokens.True);
318
- return true;
319
- }
320
- },
321
- {
322
- ALT: () => {
323
- this.CONSUME(tokens.False);
324
- return false;
249
+ return where;
250
+ }));
251
+ __publicField(this, "condition", this.RULE("condition", () => {
252
+ const operator = this.SUBRULE(this.conditionOperator);
253
+ const columnValue = this.SUBRULE(this.columnValue);
254
+ const condition = {};
255
+ return this.ACTION(() => {
256
+ if (columnValue === null) {
257
+ if (operator === "eq") {
258
+ condition.null = true;
259
+ } else if (operator === "notEq") {
260
+ condition.null = false;
261
+ } else {
262
+ throw new QueryLanguageError(`The null keyword as a right hand operand can only be tested for (in)equality.`);
263
+ }
264
+ return condition;
325
265
  }
326
- },
327
- {
328
- ALT: () => this.SUBRULE(this.primaryValue)
329
- }
330
- ]);
331
- });
332
- uniqueWhere = this.RULE("uniqueWhere", () => {
333
- const where = {};
334
- this.CONSUME(tokens.LeftParenthesis);
335
- this.AT_LEAST_ONE_SEP({
336
- SEP: tokens.Comma,
337
- DEF: () => {
338
- const nestedFields = [];
339
- this.AT_LEAST_ONE_SEP1({
340
- SEP: tokens.Dot,
341
- DEF: () => {
342
- nestedFields.push(this.SUBRULE(this.fieldIdentifier));
266
+ condition[operator] = columnValue;
267
+ return condition;
268
+ });
269
+ }));
270
+ __publicField(this, "conditionOperator", this.RULE("conditionOperator", () => {
271
+ return this.OR([
272
+ {
273
+ ALT: () => {
274
+ this.CONSUME(tokens.Equals);
275
+ return "eq";
343
276
  }
344
- });
345
- this.CONSUME(tokens.Equals);
346
- const primaryValue = this.SUBRULE(this.primaryValue);
347
- this.ACTION(() => {
348
- let nestedWhere = where;
349
- for (let i = 0, len = nestedFields.length; i < len; i++) {
350
- const nestedField = nestedFields[i];
351
- const isLast = len - 1 === i;
352
- if (isLast) {
353
- if (nestedField in nestedWhere) {
354
- throw new QueryLanguageError(`Duplicate '${nestedFields.slice(0, i + 1).join(".")}' field`);
355
- }
356
- nestedWhere[nestedField] = primaryValue;
357
- } else {
358
- if (nestedField in nestedWhere) {
359
- const existingWhere = nestedWhere[nestedField];
360
- if (typeof existingWhere === "object" && !(existingWhere instanceof GraphQlBuilder.GraphQlLiteral)) {
361
- nestedWhere = existingWhere;
362
- } else {
363
- throw new QueryLanguageError(`Malformed expression: cannot simultaneously treat the '${nestedFields.slice(0, i + 1).join(".")}' field as a scalar as well as a relation.`);
364
- }
365
- } else {
366
- const newWhere = {};
367
- nestedWhere[nestedField] = newWhere;
368
- nestedWhere = newWhere;
369
- }
370
- }
277
+ },
278
+ {
279
+ ALT: () => {
280
+ this.CONSUME(tokens.NotEquals);
281
+ return "notEq";
371
282
  }
372
- });
373
- }
374
- });
375
- this.CONSUME(tokens.RightParenthesis);
376
- return where;
377
- });
378
- orderBy = this.RULE("orderBy", () => {
379
- const order = [];
380
- this.AT_LEAST_ONE_SEP({
381
- SEP: tokens.Comma,
382
- DEF: () => {
383
- const fieldNames = [];
384
- this.AT_LEAST_ONE_SEP1({
385
- SEP: tokens.Dot,
386
- DEF: () => {
387
- fieldNames.push(this.SUBRULE(this.fieldIdentifier));
283
+ },
284
+ {
285
+ ALT: () => {
286
+ this.CONSUME(tokens.LowerThan);
287
+ return "lt";
388
288
  }
389
- });
390
- let literal = this.OPTION(() => this.SUBRULE1(this.graphQlLiteral));
391
- this.ACTION(() => {
392
- if (literal) {
393
- if (literal.value !== "asc" && literal.value !== "desc") {
394
- throw new QueryLanguageError(`The only valid order directions are \`asc\` and \`desc\`.`);
395
- }
396
- } else {
397
- literal = new GraphQlBuilder.GraphQlLiteral("asc");
289
+ },
290
+ {
291
+ ALT: () => {
292
+ this.CONSUME(tokens.LowerEqual);
293
+ return "lte";
398
294
  }
399
- let orderBy = literal;
400
- for (let i = fieldNames.length - 1; i >= 0; i--) {
401
- orderBy = { [fieldNames[i]]: orderBy };
295
+ },
296
+ {
297
+ ALT: () => {
298
+ this.CONSUME(tokens.GreaterThan);
299
+ return "gt";
402
300
  }
403
- order.push(orderBy);
404
- });
405
- }
406
- });
407
- return order;
408
- });
409
- taggedMap = this.RULE("taggedMap", () => {
410
- const name = this.SUBRULE(this.identifier);
411
- return {
412
- name,
413
- entries: this.OPTION(() => this.SUBRULE(this.taggedMapEntries)) ?? []
414
- };
415
- });
416
- taggedMapEntries = this.RULE("taggedMapEntries", () => {
417
- this.CONSUME(tokens.LeftParenthesis);
418
- const entries = [];
419
- this.AT_LEAST_ONE_SEP({
420
- SEP: tokens.Comma,
421
- DEF: () => entries.push(this.SUBRULE(this.taggedMapEntry))
422
- });
423
- this.CONSUME(tokens.RightParenthesis);
424
- return entries;
425
- });
426
- taggedMapEntry = this.RULE("taggedMapEntry", () => {
427
- const variableName = this.CONSUME(tokens.Identifier).image;
428
- this.CONSUME1(tokens.Colon);
429
- const value = this.OR([
430
- {
431
- ALT: () => this.SUBRULE(this.taggedMapLiteralValue)
432
- },
433
- {
434
- ALT: () => this.SUBRULE(this.taggedMapVariableValue)
435
- }
436
- ]);
437
- return {
438
- key: variableName,
439
- value
440
- };
441
- });
442
- taggedMapLiteralValue = this.RULE("taggedMapLiteralValue", () => {
443
- const value = this.OR([
444
- {
445
- ALT: () => this.SUBRULE(this.string)
446
- },
447
- {
448
- ALT: () => this.SUBRULE(this.number)
449
- }
450
- ]);
451
- return {
452
- type: "literal",
453
- value
454
- };
455
- });
456
- taggedMapVariableValue = this.RULE("taggedMapVariableValue", () => {
457
- const start = this.CONSUME(tokens.DollarSign);
458
- this.SUBRULE(this.relativeSingleField);
459
- const end = this.LA(0);
460
- const field = this.input.slice(this.input.indexOf(start) + 1, this.input.indexOf(end) + 1).map((it) => it.image).join("");
461
- return {
462
- type: "variable",
463
- value: field
464
- };
465
- });
466
- fieldName = this.RULE("fieldName", () => {
467
- return this.OR([
468
- {
469
- ALT: () => this.SUBRULE(this.fieldIdentifier)
470
- }
471
- ]);
472
- });
473
- primaryValue = this.RULE("primaryValue", () => {
474
- return this.OR([
475
- {
476
- ALT: () => this.SUBRULE(this.string)
477
- },
478
- {
479
- ALT: () => this.SUBRULE(this.number)
480
- },
481
- {
482
- ALT: () => this.SUBRULE(this.graphQlLiteral)
483
- },
484
- {
485
- ALT: () => {
486
- const variableValue = this.SUBRULE(this.variable);
487
- return this.ACTION(() => {
488
- if (typeof variableValue === "string" || typeof variableValue === "number" || variableValue instanceof GraphQlBuilder.GraphQlLiteral) {
489
- return variableValue;
301
+ },
302
+ {
303
+ ALT: () => {
304
+ this.CONSUME(tokens.GreaterEqual);
305
+ return "gte";
306
+ }
307
+ }
308
+ ]);
309
+ }));
310
+ __publicField(this, "columnValue", this.RULE("columnValue", () => {
311
+ return this.OR([
312
+ {
313
+ ALT: () => {
314
+ this.CONSUME(tokens.Null);
315
+ return null;
316
+ }
317
+ },
318
+ {
319
+ ALT: () => {
320
+ this.CONSUME(tokens.True);
321
+ return true;
322
+ }
323
+ },
324
+ {
325
+ ALT: () => {
326
+ this.CONSUME(tokens.False);
327
+ return false;
328
+ }
329
+ },
330
+ {
331
+ ALT: () => this.SUBRULE(this.primaryValue)
332
+ }
333
+ ]);
334
+ }));
335
+ __publicField(this, "uniqueWhere", this.RULE("uniqueWhere", () => {
336
+ const where = {};
337
+ this.CONSUME(tokens.LeftParenthesis);
338
+ this.AT_LEAST_ONE_SEP({
339
+ SEP: tokens.Comma,
340
+ DEF: () => {
341
+ const nestedFields = [];
342
+ this.AT_LEAST_ONE_SEP1({
343
+ SEP: tokens.Dot,
344
+ DEF: () => {
345
+ nestedFields.push(this.SUBRULE(this.fieldIdentifier));
346
+ }
347
+ });
348
+ this.CONSUME(tokens.Equals);
349
+ const primaryValue = this.SUBRULE(this.primaryValue);
350
+ this.ACTION(() => {
351
+ let nestedWhere = where;
352
+ for (let i = 0, len = nestedFields.length; i < len; i++) {
353
+ const nestedField = nestedFields[i];
354
+ const isLast = len - 1 === i;
355
+ if (isLast) {
356
+ if (nestedField in nestedWhere) {
357
+ throw new QueryLanguageError(`Duplicate '${nestedFields.slice(0, i + 1).join(".")}' field`);
358
+ }
359
+ nestedWhere[nestedField] = primaryValue;
360
+ } else {
361
+ if (nestedField in nestedWhere) {
362
+ const existingWhere = nestedWhere[nestedField];
363
+ if (typeof existingWhere === "object" && !(existingWhere instanceof GraphQlBuilder.GraphQlLiteral)) {
364
+ nestedWhere = existingWhere;
365
+ } else {
366
+ throw new QueryLanguageError(`Malformed expression: cannot simultaneously treat the '${nestedFields.slice(0, i + 1).join(".")}' field as a scalar as well as a relation.`);
367
+ }
368
+ } else {
369
+ const newWhere = {};
370
+ nestedWhere[nestedField] = newWhere;
371
+ nestedWhere = newWhere;
372
+ }
373
+ }
490
374
  }
491
- throw new QueryLanguageError(`A variable can resolve to a literal, string or a number, not ${typeof variableValue}`);
492
375
  });
493
376
  }
494
- }
495
- ]);
496
- });
497
- fieldIdentifier = this.RULE("fieldIdentifier", () => {
498
- return this.SUBRULE(this.identifier);
499
- });
500
- identifier = this.RULE("identifier", () => {
501
- return this.OR([
502
- {
503
- ALT: () => this.CONSUME(tokens.Identifier).image
504
- },
505
- {
506
- ALT: () => this.CONSUME(tokens.EntityIdentifier).image
507
- }
508
- ]);
509
- });
510
- entityIdentifier = this.RULE("entityIdentifier", () => {
511
- return this.OR([
512
- {
513
- ALT: () => this.CONSUME(tokens.EntityIdentifier).image
514
- },
515
- {
516
- ALT: () => {
517
- const variable = this.SUBRULE(this.variable);
518
- return this.ACTION(() => {
519
- if (!(typeof variable === "string") || !TokenRegExps.entityIdentifier.test(variable)) {
520
- throw new QueryLanguageError(`The value of the variable $${variable} is not a valid entity identifier.`);
377
+ });
378
+ this.CONSUME(tokens.RightParenthesis);
379
+ return where;
380
+ }));
381
+ __publicField(this, "orderBy", this.RULE("orderBy", () => {
382
+ const order = [];
383
+ this.AT_LEAST_ONE_SEP({
384
+ SEP: tokens.Comma,
385
+ DEF: () => {
386
+ const fieldNames = [];
387
+ this.AT_LEAST_ONE_SEP1({
388
+ SEP: tokens.Dot,
389
+ DEF: () => {
390
+ fieldNames.push(this.SUBRULE(this.fieldIdentifier));
391
+ }
392
+ });
393
+ let literal = this.OPTION(() => this.SUBRULE1(this.graphQlLiteral));
394
+ this.ACTION(() => {
395
+ if (literal) {
396
+ if (literal.value !== "asc" && literal.value !== "desc") {
397
+ throw new QueryLanguageError(`The only valid order directions are \`asc\` and \`desc\`.`);
398
+ }
399
+ } else {
400
+ literal = new GraphQlBuilder.GraphQlLiteral("asc");
401
+ }
402
+ let orderBy = literal;
403
+ for (let i = fieldNames.length - 1; i >= 0; i--) {
404
+ orderBy = { [fieldNames[i]]: orderBy };
521
405
  }
522
- return variable;
406
+ order.push(orderBy);
523
407
  });
524
408
  }
525
- }
526
- ]);
527
- });
528
- string = this.RULE("string", () => {
529
- const image = this.CONSUME(tokens.StringLiteral).image;
530
- return image.substring(1, image.length - 1).replace("\\'", "'").replace("\\b", "\b").replace("\\f", "\f").replace("\\n", "\n").replace("\\r", "\r").replace("\\t", " ").replace("\\v", "\v");
531
- });
532
- number = this.RULE("number", () => {
533
- return parseFloat(this.CONSUME(tokens.NumberLiteral).image);
534
- });
535
- graphQlLiteral = this.RULE("graphQlLiteral", () => {
536
- const image = this.SUBRULE(this.identifier);
537
- return new GraphQlBuilder.GraphQlLiteral(image);
538
- });
539
- variable = this.RULE("variable", () => {
540
- this.CONSUME(tokens.DollarSign);
541
- const variableName = this.CONSUME(tokens.Identifier).image;
542
- return this.ACTION(() => {
543
- if (Parser.environment.hasName(variableName)) {
544
- return Parser.environment.getValue(variableName);
545
- }
546
- if (Parser.environment.hasDimension(variableName)) {
547
- const dimensionValue = Parser.environment.getDimension(variableName);
548
- if (dimensionValue.length === 1) {
409
+ });
410
+ return order;
411
+ }));
412
+ __publicField(this, "taggedMap", this.RULE("taggedMap", () => {
413
+ const name = this.SUBRULE(this.pageName);
414
+ return {
415
+ name,
416
+ entries: this.OPTION(() => this.SUBRULE(this.taggedMapEntries)) ?? []
417
+ };
418
+ }));
419
+ __publicField(this, "taggedMapEntries", this.RULE("taggedMapEntries", () => {
420
+ this.CONSUME(tokens.LeftParenthesis);
421
+ const entries = [];
422
+ this.AT_LEAST_ONE_SEP({
423
+ SEP: tokens.Comma,
424
+ DEF: () => entries.push(this.SUBRULE(this.taggedMapEntry))
425
+ });
426
+ this.CONSUME(tokens.RightParenthesis);
427
+ return entries;
428
+ }));
429
+ __publicField(this, "taggedMapEntry", this.RULE("taggedMapEntry", () => {
430
+ const variableName = this.CONSUME(tokens.Identifier).image;
431
+ this.CONSUME1(tokens.Colon);
432
+ const value = this.OR([
433
+ {
434
+ ALT: () => this.SUBRULE(this.taggedMapLiteralValue)
435
+ },
436
+ {
437
+ ALT: () => this.SUBRULE(this.taggedMapVariableValue)
438
+ }
439
+ ]);
440
+ return {
441
+ key: variableName,
442
+ value
443
+ };
444
+ }));
445
+ __publicField(this, "taggedMapLiteralValue", this.RULE("taggedMapLiteralValue", () => {
446
+ const value = this.OR([
447
+ {
448
+ ALT: () => this.SUBRULE(this.string)
449
+ },
450
+ {
451
+ ALT: () => this.SUBRULE(this.number)
452
+ }
453
+ ]);
454
+ return {
455
+ type: "literal",
456
+ value
457
+ };
458
+ }));
459
+ __publicField(this, "taggedMapVariableValue", this.RULE("taggedMapVariableValue", () => {
460
+ const start = this.CONSUME(tokens.DollarSign);
461
+ this.SUBRULE(this.relativeSingleField);
462
+ const end = this.LA(0);
463
+ const field = this.input.slice(this.input.indexOf(start) + 1, this.input.indexOf(end) + 1).map((it) => it.image).join("");
464
+ return {
465
+ type: "variable",
466
+ value: field
467
+ };
468
+ }));
469
+ __publicField(this, "fieldName", this.RULE("fieldName", () => {
470
+ return this.OR([
471
+ {
472
+ ALT: () => this.SUBRULE(this.fieldIdentifier)
473
+ }
474
+ ]);
475
+ }));
476
+ __publicField(this, "primaryValue", this.RULE("primaryValue", () => {
477
+ return this.OR([
478
+ {
479
+ ALT: () => this.SUBRULE(this.string)
480
+ },
481
+ {
482
+ ALT: () => this.SUBRULE(this.number)
483
+ },
484
+ {
485
+ ALT: () => this.SUBRULE(this.graphQlLiteral)
486
+ },
487
+ {
488
+ ALT: () => {
489
+ const variableValue = this.SUBRULE(this.variable);
490
+ return this.ACTION(() => {
491
+ if (typeof variableValue === "string" || typeof variableValue === "number" || variableValue instanceof GraphQlBuilder.GraphQlLiteral) {
492
+ return variableValue;
493
+ }
494
+ throw new QueryLanguageError(`A variable can resolve to a literal, string or a number, not ${typeof variableValue}`);
495
+ });
496
+ }
497
+ }
498
+ ]);
499
+ }));
500
+ __publicField(this, "fieldIdentifier", this.RULE("fieldIdentifier", () => {
501
+ return this.SUBRULE(this.identifier);
502
+ }));
503
+ __publicField(this, "identifier", this.RULE("identifier", () => {
504
+ return this.OR([
505
+ {
506
+ ALT: () => this.CONSUME(tokens.Identifier).image
507
+ },
508
+ {
509
+ ALT: () => this.CONSUME(tokens.EntityIdentifier).image
510
+ }
511
+ ]);
512
+ }));
513
+ __publicField(this, "pageName", this.RULE("pageName", () => {
514
+ const parts = [];
515
+ this.AT_LEAST_ONE_SEP({
516
+ SEP: tokens.Slash,
517
+ DEF: () => parts.push(this.CONSUME(tokens.Identifier).image)
518
+ });
519
+ return parts.join("/");
520
+ }));
521
+ __publicField(this, "entityIdentifier", this.RULE("entityIdentifier", () => {
522
+ return this.OR([
523
+ {
524
+ ALT: () => this.CONSUME(tokens.EntityIdentifier).image
525
+ },
526
+ {
527
+ ALT: () => {
528
+ const variable = this.SUBRULE(this.variable);
529
+ return this.ACTION(() => {
530
+ if (!(typeof variable === "string") || !TokenRegExps.entityIdentifier.test(variable)) {
531
+ throw new QueryLanguageError(`The value of the variable $${variable} is not a valid entity identifier.`);
532
+ }
533
+ return variable;
534
+ });
535
+ }
536
+ }
537
+ ]);
538
+ }));
539
+ __publicField(this, "string", this.RULE("string", () => {
540
+ const image = this.CONSUME(tokens.StringLiteral).image;
541
+ return image.substring(1, image.length - 1).replace("\\'", "'").replace("\\b", "\b").replace("\\f", "\f").replace("\\n", "\n").replace("\\r", "\r").replace("\\t", " ").replace("\\v", "\v");
542
+ }));
543
+ __publicField(this, "number", this.RULE("number", () => {
544
+ return parseFloat(this.CONSUME(tokens.NumberLiteral).image);
545
+ }));
546
+ __publicField(this, "graphQlLiteral", this.RULE("graphQlLiteral", () => {
547
+ const image = this.SUBRULE(this.identifier);
548
+ return new GraphQlBuilder.GraphQlLiteral(image);
549
+ }));
550
+ __publicField(this, "variable", this.RULE("variable", () => {
551
+ this.CONSUME(tokens.DollarSign);
552
+ const variableName = this.CONSUME(tokens.Identifier).image;
553
+ return this.ACTION(() => {
554
+ if (variableName === "rootWhereAsFilter") {
555
+ console.warn("$rootWhereAsFilter is deprecated, use $rootFilter");
556
+ }
557
+ switch (variableName) {
558
+ case "rootWhereAsFilter":
559
+ case "rootFilter":
560
+ return _Parser.environment.getSubTree().filter;
561
+ }
562
+ if (_Parser.environment.hasVariable(variableName)) {
563
+ return _Parser.environment.getVariable(variableName);
564
+ }
565
+ if (_Parser.environment.hasParameter(variableName)) {
566
+ return _Parser.environment.getParameter(variableName);
567
+ }
568
+ if (_Parser.environment.hasDimension(variableName)) {
569
+ const dimensionValue = _Parser.environment.getDimension(variableName);
570
+ if (dimensionValue.length > 1) {
571
+ throw new BindingError(`The variable $${variableName} resolved to a dimension which exists but contains ${dimensionValue.length} values. It has to contain exactly one. Perhaps you forgot to set the 'maxItems' prop of your DimensionsSwitcher?`);
572
+ }
549
573
  return dimensionValue[0];
550
574
  }
551
- throw new QueryLanguageError(`The variable $${variableName} resolved to a dimension which exists but contains ${dimensionValue.length} values. It has to contain exactly one. Perhaps you forgot to set the 'maxItems' prop of your DimensionsSwitcher?`);
552
- }
553
- throw new QueryLanguageError(`Undefined variable $${variableName}.`);
554
- });
555
- });
556
- constructor() {
557
- super(tokenList, { outputCst: false, maxLookahead: 1 });
575
+ throw new QueryLanguageError(`Undefined variable $${variableName}.`);
576
+ });
577
+ }));
558
578
  this.performSelfAnalysis();
559
579
  }
560
580
  static parseQueryLanguageExpression(input, entry, environment) {
@@ -562,64 +582,69 @@ class Parser extends EmbeddedActionsParser {
562
582
  if (cached !== void 0) {
563
583
  return cached;
564
584
  }
565
- const lexingResult = Parser.lexer.tokenize(Parser.rawInput = input);
585
+ const lexingResult = _Parser.lexer.tokenize(_Parser.rawInput = input);
566
586
  if (lexingResult.errors.length !== 0) {
567
587
  throw new QueryLanguageError(`Failed to tokenize '${input}'.
568
588
 
569
589
  ${lexingResult.errors.map((i) => i.message).join("\n")}`);
570
590
  }
571
- Parser.environment = environment;
572
- Parser.parser.input = lexingResult.tokens;
591
+ _Parser.environment = environment;
592
+ _Parser.parser.input = lexingResult.tokens;
573
593
  let expression;
574
594
  switch (entry) {
575
595
  case "relativeSingleField":
576
- expression = Parser.parser.relativeSingleField();
596
+ expression = _Parser.parser.relativeSingleField();
577
597
  break;
578
598
  case "relativeSingleEntity":
579
- expression = Parser.parser.relativeSingleEntity();
599
+ expression = _Parser.parser.relativeSingleEntity();
580
600
  break;
581
601
  case "relativeEntityList":
582
- expression = Parser.parser.relativeEntityList();
602
+ expression = _Parser.parser.relativeEntityList();
583
603
  break;
584
604
  case "qualifiedEntityList":
585
- expression = Parser.parser.qualifiedEntityList();
605
+ expression = _Parser.parser.qualifiedEntityList();
586
606
  break;
587
607
  case "qualifiedFieldList":
588
- expression = Parser.parser.qualifiedFieldList();
608
+ expression = _Parser.parser.qualifiedFieldList();
589
609
  break;
590
610
  case "qualifiedSingleEntity":
591
- expression = Parser.parser.qualifiedSingleEntity();
611
+ expression = _Parser.parser.qualifiedSingleEntity();
592
612
  break;
593
613
  case "unconstrainedQualifiedEntityList":
594
- expression = Parser.parser.unconstrainedQualifiedEntityList();
614
+ expression = _Parser.parser.unconstrainedQualifiedEntityList();
595
615
  break;
596
616
  case "unconstrainedQualifiedSingleEntity":
597
- expression = Parser.parser.unconstrainedQualifiedSingleEntity();
617
+ expression = _Parser.parser.unconstrainedQualifiedSingleEntity();
598
618
  break;
599
619
  case "uniqueWhere":
600
- expression = Parser.parser.uniqueWhere();
620
+ expression = _Parser.parser.uniqueWhere();
601
621
  break;
602
622
  case "filter":
603
- expression = Parser.parser.nonUniqueWhere();
623
+ expression = _Parser.parser.nonUniqueWhere();
604
624
  break;
605
625
  case "orderBy":
606
- expression = Parser.parser.orderBy();
626
+ expression = _Parser.parser.orderBy();
607
627
  break;
608
628
  case "taggedMap":
609
- expression = Parser.parser.taggedMap();
629
+ expression = _Parser.parser.taggedMap();
610
630
  break;
611
631
  default:
612
632
  throw new QueryLanguageError(`Not implemented entry point '${entry}'`);
613
633
  }
614
- if (Parser.parser.errors.length !== 0) {
634
+ if (_Parser.parser.errors.length !== 0) {
615
635
  throw new QueryLanguageError(`Failed to parse '${input}'.
616
636
 
617
- ${Parser.parser.errors.map((i) => i.message).join("\n")}`);
637
+ ${_Parser.parser.errors.map((i) => i.message).join("\n")}`);
618
638
  }
619
639
  this.cacheStore.set(environment, entry, input, expression);
620
640
  return expression;
621
641
  }
622
- }
623
-
642
+ };
643
+ let Parser = _Parser;
644
+ __publicField(Parser, "rawInput", "");
645
+ __publicField(Parser, "lexer", new Lexer(tokenList));
646
+ __publicField(Parser, "parser", new _Parser());
647
+ __publicField(Parser, "environment", Environment.create());
648
+ __publicField(Parser, "cacheStore", new CacheStore());
624
649
  export { Parser };
625
650
  //# sourceMappingURL=Parser.js.map