@contember/binding 1.0.0-rc.7 → 1.0.0

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