@expo/entity 0.60.0 → 0.61.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 (375) hide show
  1. package/build/src/AuthorizationResultBasedEntityAssociationLoader.d.ts +6 -6
  2. package/build/src/AuthorizationResultBasedEntityAssociationLoader.js +5 -10
  3. package/build/src/AuthorizationResultBasedEntityLoader.d.ts +9 -9
  4. package/build/src/AuthorizationResultBasedEntityLoader.js +27 -35
  5. package/build/src/AuthorizationResultBasedEntityMutator.d.ts +13 -13
  6. package/build/src/AuthorizationResultBasedEntityMutator.js +54 -65
  7. package/build/src/ComposedEntityCacheAdapter.d.ts +3 -3
  8. package/build/src/ComposedEntityCacheAdapter.js +15 -23
  9. package/build/src/ComposedSecondaryEntityCache.d.ts +1 -1
  10. package/build/src/ComposedSecondaryEntityCache.js +4 -12
  11. package/build/src/EnforcingEntityAssociationLoader.d.ts +5 -5
  12. package/build/src/EnforcingEntityAssociationLoader.js +6 -11
  13. package/build/src/EnforcingEntityCreator.d.ts +4 -4
  14. package/build/src/EnforcingEntityCreator.js +3 -8
  15. package/build/src/EnforcingEntityDeleter.d.ts +4 -4
  16. package/build/src/EnforcingEntityDeleter.js +3 -8
  17. package/build/src/EnforcingEntityLoader.d.ts +5 -5
  18. package/build/src/EnforcingEntityLoader.js +9 -14
  19. package/build/src/EnforcingEntityUpdater.d.ts +4 -4
  20. package/build/src/EnforcingEntityUpdater.js +3 -8
  21. package/build/src/Entity.d.ts +9 -9
  22. package/build/src/Entity.js +11 -16
  23. package/build/src/EntityAssociationLoader.d.ts +5 -5
  24. package/build/src/EntityAssociationLoader.js +5 -10
  25. package/build/src/EntityCompanion.d.ts +9 -9
  26. package/build/src/EntityCompanion.js +6 -11
  27. package/build/src/EntityCompanionProvider.d.ts +13 -12
  28. package/build/src/EntityCompanionProvider.js +13 -21
  29. package/build/src/EntityConfiguration.d.ts +4 -4
  30. package/build/src/EntityConfiguration.js +14 -23
  31. package/build/src/EntityConstructionUtils.d.ts +8 -8
  32. package/build/src/EntityConstructionUtils.js +15 -23
  33. package/build/src/EntityCreator.d.ts +7 -7
  34. package/build/src/EntityCreator.js +3 -8
  35. package/build/src/EntityDatabaseAdapter.d.ts +4 -4
  36. package/build/src/EntityDatabaseAdapter.js +19 -27
  37. package/build/src/EntityDeleter.d.ts +7 -7
  38. package/build/src/EntityDeleter.js +3 -8
  39. package/build/src/EntityFieldDefinition.d.ts +4 -4
  40. package/build/src/EntityFieldDefinition.js +5 -10
  41. package/build/src/EntityFields.d.ts +2 -1
  42. package/build/src/EntityFields.js +12 -27
  43. package/build/src/EntityInvalidationUtils.d.ts +8 -8
  44. package/build/src/EntityInvalidationUtils.js +4 -9
  45. package/build/src/EntityLoader.d.ts +7 -7
  46. package/build/src/EntityLoader.js +3 -8
  47. package/build/src/EntityLoaderFactory.d.ts +10 -10
  48. package/build/src/EntityLoaderFactory.js +7 -12
  49. package/build/src/EntityMutationInfo.d.ts +2 -2
  50. package/build/src/EntityMutationInfo.js +2 -6
  51. package/build/src/EntityMutationTriggerConfiguration.d.ts +4 -4
  52. package/build/src/EntityMutationTriggerConfiguration.js +2 -8
  53. package/build/src/EntityMutationValidatorConfiguration.d.ts +4 -4
  54. package/build/src/EntityMutationValidatorConfiguration.js +1 -6
  55. package/build/src/EntityMutatorFactory.d.ts +13 -13
  56. package/build/src/EntityMutatorFactory.js +5 -10
  57. package/build/src/EntityPrivacyPolicy.d.ts +7 -7
  58. package/build/src/EntityPrivacyPolicy.js +22 -27
  59. package/build/src/EntityQueryContext.d.ts +1 -1
  60. package/build/src/EntityQueryContext.js +11 -22
  61. package/build/src/EntityQueryContextProvider.d.ts +2 -1
  62. package/build/src/EntityQueryContextProvider.js +7 -12
  63. package/build/src/EntitySecondaryCacheLoader.d.ts +7 -7
  64. package/build/src/EntitySecondaryCacheLoader.js +4 -9
  65. package/build/src/EntityUpdater.d.ts +7 -7
  66. package/build/src/EntityUpdater.js +3 -8
  67. package/build/src/GenericEntityCacheAdapter.d.ts +4 -4
  68. package/build/src/GenericEntityCacheAdapter.js +5 -13
  69. package/build/src/GenericSecondaryEntityCache.d.ts +2 -2
  70. package/build/src/GenericSecondaryEntityCache.js +10 -18
  71. package/build/src/IEntityCacheAdapter.d.ts +2 -2
  72. package/build/src/IEntityCacheAdapter.js +1 -3
  73. package/build/src/IEntityCacheAdapterProvider.d.ts +2 -2
  74. package/build/src/IEntityCacheAdapterProvider.js +1 -3
  75. package/build/src/IEntityDatabaseAdapterProvider.d.ts +2 -2
  76. package/build/src/IEntityDatabaseAdapterProvider.js +1 -3
  77. package/build/src/IEntityGenericCacher.d.ts +2 -2
  78. package/build/src/IEntityGenericCacher.js +1 -3
  79. package/build/src/ReadonlyEntity.d.ts +9 -9
  80. package/build/src/ReadonlyEntity.js +9 -17
  81. package/build/src/ViewerContext.d.ts +6 -6
  82. package/build/src/ViewerContext.js +3 -8
  83. package/build/src/ViewerScopedEntityCompanion.d.ts +8 -8
  84. package/build/src/ViewerScopedEntityCompanion.js +5 -10
  85. package/build/src/ViewerScopedEntityCompanionProvider.d.ts +6 -6
  86. package/build/src/ViewerScopedEntityCompanionProvider.js +3 -8
  87. package/build/src/ViewerScopedEntityLoaderFactory.d.ts +8 -8
  88. package/build/src/ViewerScopedEntityLoaderFactory.js +1 -6
  89. package/build/src/ViewerScopedEntityMutatorFactory.d.ts +7 -7
  90. package/build/src/ViewerScopedEntityMutatorFactory.js +1 -6
  91. package/build/src/entityUtils.d.ts +1 -1
  92. package/build/src/entityUtils.js +9 -21
  93. package/build/src/errors/EntityCacheAdapterError.d.ts +1 -1
  94. package/build/src/errors/EntityCacheAdapterError.js +5 -11
  95. package/build/src/errors/EntityDatabaseAdapterError.d.ts +1 -1
  96. package/build/src/errors/EntityDatabaseAdapterError.js +41 -59
  97. package/build/src/errors/EntityError.js +5 -10
  98. package/build/src/errors/EntityInvalidFieldValueError.d.ts +5 -5
  99. package/build/src/errors/EntityInvalidFieldValueError.js +4 -9
  100. package/build/src/errors/EntityNotAuthorizedError.d.ts +4 -4
  101. package/build/src/errors/EntityNotAuthorizedError.js +6 -11
  102. package/build/src/errors/EntityNotFoundError.d.ts +5 -5
  103. package/build/src/errors/EntityNotFoundError.js +4 -9
  104. package/build/src/index.d.ts +77 -77
  105. package/build/src/index.js +77 -94
  106. package/build/src/internal/CompositeFieldHolder.d.ts +3 -2
  107. package/build/src/internal/CompositeFieldHolder.js +11 -21
  108. package/build/src/internal/CompositeFieldValueMap.d.ts +2 -2
  109. package/build/src/internal/CompositeFieldValueMap.js +7 -12
  110. package/build/src/internal/EntityDataManager.d.ts +6 -6
  111. package/build/src/internal/EntityDataManager.js +25 -33
  112. package/build/src/internal/EntityFieldTransformationUtils.d.ts +1 -1
  113. package/build/src/internal/EntityFieldTransformationUtils.js +11 -23
  114. package/build/src/internal/EntityLoadInterfaces.d.ts +3 -2
  115. package/build/src/internal/EntityLoadInterfaces.js +4 -9
  116. package/build/src/internal/EntityTableDataCoordinator.d.ts +8 -8
  117. package/build/src/internal/EntityTableDataCoordinator.js +4 -9
  118. package/build/src/internal/ReadThroughEntityCache.d.ts +3 -3
  119. package/build/src/internal/ReadThroughEntityCache.js +7 -15
  120. package/build/src/internal/SingleFieldHolder.d.ts +3 -2
  121. package/build/src/internal/SingleFieldHolder.js +9 -19
  122. package/build/src/metrics/EntityMetricsUtils.d.ts +3 -3
  123. package/build/src/metrics/EntityMetricsUtils.js +6 -14
  124. package/build/src/metrics/IEntityMetricsAdapter.d.ts +2 -2
  125. package/build/src/metrics/IEntityMetricsAdapter.js +8 -12
  126. package/build/src/metrics/NoOpEntityMetricsAdapter.d.ts +1 -1
  127. package/build/src/metrics/NoOpEntityMetricsAdapter.js +1 -6
  128. package/build/src/rules/AllowIfAllSubRulesAllowPrivacyPolicyRule.d.ts +5 -5
  129. package/build/src/rules/AllowIfAllSubRulesAllowPrivacyPolicyRule.js +5 -10
  130. package/build/src/rules/AllowIfAnySubRuleAllowsPrivacyPolicyRule.d.ts +5 -5
  131. package/build/src/rules/AllowIfAnySubRuleAllowsPrivacyPolicyRule.js +5 -10
  132. package/build/src/rules/AllowIfInParentCascadeDeletionPrivacyPolicyRule.d.ts +6 -6
  133. package/build/src/rules/AllowIfInParentCascadeDeletionPrivacyPolicyRule.js +6 -11
  134. package/build/src/rules/AlwaysAllowPrivacyPolicyRule.d.ts +5 -5
  135. package/build/src/rules/AlwaysAllowPrivacyPolicyRule.js +3 -8
  136. package/build/src/rules/AlwaysDenyPrivacyPolicyRule.d.ts +5 -5
  137. package/build/src/rules/AlwaysDenyPrivacyPolicyRule.js +3 -8
  138. package/build/src/rules/AlwaysSkipPrivacyPolicyRule.d.ts +5 -5
  139. package/build/src/rules/AlwaysSkipPrivacyPolicyRule.js +3 -8
  140. package/build/src/rules/EvaluateIfEntityFieldPredicatePrivacyPolicyRule.d.ts +5 -5
  141. package/build/src/rules/EvaluateIfEntityFieldPredicatePrivacyPolicyRule.js +3 -8
  142. package/build/src/rules/PrivacyPolicyRule.d.ts +4 -4
  143. package/build/src/rules/PrivacyPolicyRule.js +3 -8
  144. package/build/src/utils/EntityCreationUtils.d.ts +5 -5
  145. package/build/src/utils/EntityCreationUtils.js +6 -11
  146. package/build/src/utils/EntityPrivacyUtils.d.ts +5 -5
  147. package/build/src/utils/EntityPrivacyUtils.js +20 -27
  148. package/build/src/utils/collections/SerializableKeyMap.js +1 -6
  149. package/build/src/utils/collections/maps.js +11 -27
  150. package/build/src/utils/collections/sets.js +1 -5
  151. package/build/src/utils/mergeEntityMutationTriggerConfigurations.d.ts +3 -3
  152. package/build/src/utils/mergeEntityMutationTriggerConfigurations.js +1 -5
  153. package/package.json +7 -6
  154. package/src/AuthorizationResultBasedEntityAssociationLoader.ts +7 -6
  155. package/src/AuthorizationResultBasedEntityLoader.ts +19 -17
  156. package/src/AuthorizationResultBasedEntityMutator.ts +24 -22
  157. package/src/ComposedEntityCacheAdapter.ts +5 -4
  158. package/src/ComposedSecondaryEntityCache.ts +2 -2
  159. package/src/EnforcingEntityAssociationLoader.ts +7 -7
  160. package/src/EnforcingEntityCreator.ts +4 -4
  161. package/src/EnforcingEntityDeleter.ts +4 -4
  162. package/src/EnforcingEntityLoader.ts +8 -8
  163. package/src/EnforcingEntityUpdater.ts +4 -4
  164. package/src/Entity.ts +13 -13
  165. package/src/EntityAssociationLoader.ts +6 -6
  166. package/src/EntityCompanion.ts +13 -10
  167. package/src/EntityCompanionProvider.ts +15 -14
  168. package/src/EntityConfiguration.ts +6 -8
  169. package/src/EntityConstructionUtils.ts +16 -12
  170. package/src/EntityCreator.ts +7 -7
  171. package/src/EntityDatabaseAdapter.ts +6 -6
  172. package/src/EntityDeleter.ts +7 -7
  173. package/src/EntityFieldDefinition.ts +4 -4
  174. package/src/EntityFields.ts +3 -3
  175. package/src/EntityInvalidationUtils.ts +10 -10
  176. package/src/EntityLoader.ts +7 -7
  177. package/src/EntityLoaderFactory.ts +13 -10
  178. package/src/EntityMutationInfo.ts +2 -2
  179. package/src/EntityMutationTriggerConfiguration.ts +4 -4
  180. package/src/EntityMutationValidatorConfiguration.ts +4 -4
  181. package/src/EntityMutatorFactory.ts +13 -13
  182. package/src/EntityPrivacyPolicy.ts +9 -10
  183. package/src/EntityQueryContext.ts +1 -1
  184. package/src/EntityQueryContextProvider.ts +2 -2
  185. package/src/EntitySecondaryCacheLoader.ts +8 -8
  186. package/src/EntityUpdater.ts +7 -7
  187. package/src/GenericEntityCacheAdapter.ts +5 -5
  188. package/src/GenericSecondaryEntityCache.ts +4 -4
  189. package/src/IEntityCacheAdapter.ts +2 -2
  190. package/src/IEntityCacheAdapterProvider.ts +2 -2
  191. package/src/IEntityDatabaseAdapterProvider.ts +2 -2
  192. package/src/IEntityGenericCacher.ts +2 -2
  193. package/src/ReadonlyEntity.ts +11 -11
  194. package/src/ViewerContext.ts +8 -8
  195. package/src/ViewerScopedEntityCompanion.ts +8 -8
  196. package/src/ViewerScopedEntityCompanionProvider.ts +6 -6
  197. package/src/ViewerScopedEntityLoaderFactory.ts +11 -8
  198. package/src/ViewerScopedEntityMutatorFactory.ts +8 -8
  199. package/src/__tests__/AuthorizationResultBasedEntityAssociationLoader-test.ts +6 -6
  200. package/src/__tests__/AuthorizationResultBasedEntityLoader-constructor-test.ts +16 -15
  201. package/src/__tests__/AuthorizationResultBasedEntityLoader-test.ts +21 -18
  202. package/src/__tests__/ComposedCacheAdapter-test.ts +8 -7
  203. package/src/__tests__/ComposedSecondaryEntityCache-test.ts +3 -3
  204. package/src/__tests__/EnforcingEntityAssociationLoader-test.ts +2 -2
  205. package/src/__tests__/EnforcingEntityLoader-test.ts +4 -4
  206. package/src/__tests__/Entity-test.ts +8 -8
  207. package/src/__tests__/EntityAssociationLoader-test.ts +6 -6
  208. package/src/__tests__/EntityCommonUseCases-test.ts +17 -13
  209. package/src/__tests__/EntityCompanion-test.ts +11 -11
  210. package/src/__tests__/EntityCompanionProvider-test.ts +8 -7
  211. package/src/__tests__/EntityConfiguration-test.ts +3 -3
  212. package/src/__tests__/EntityDatabaseAdapter-test.ts +11 -7
  213. package/src/__tests__/EntityEdges-test.ts +17 -19
  214. package/src/__tests__/EntityFields-test.ts +3 -3
  215. package/src/__tests__/EntityLoader-test.ts +7 -7
  216. package/src/__tests__/EntityMutator-MutationCacheConsistency-test.ts +12 -11
  217. package/src/__tests__/EntityMutator-SingleCompositeFieldCacheConsistency-test.ts +4 -4
  218. package/src/__tests__/EntityMutator-test.ts +32 -36
  219. package/src/__tests__/EntityPrivacyPolicy-test.ts +19 -19
  220. package/src/__tests__/EntityQueryContext-test.ts +9 -9
  221. package/src/__tests__/EntitySecondaryCacheLoader-test.ts +8 -7
  222. package/src/__tests__/EntitySelfReferentialEdges-test.ts +12 -12
  223. package/src/__tests__/GenericEntityCacheAdapter-test.ts +6 -6
  224. package/src/__tests__/GenericSecondaryEntityCache-test.ts +16 -18
  225. package/src/__tests__/ReadonlyEntity-test.ts +10 -10
  226. package/src/__tests__/ViewerContext-test.ts +3 -3
  227. package/src/__tests__/ViewerScopedEntityCompanion-test.ts +7 -7
  228. package/src/__tests__/ViewerScopedEntityCompanionProvider-test.ts +5 -5
  229. package/src/__tests__/ViewerScopedEntityLoaderFactory-test.ts +5 -5
  230. package/src/__tests__/ViewerScopedEntityMutatorFactory-test.ts +6 -6
  231. package/src/__tests__/cases/TwoEntitySameTableDisjointRows-test.ts +9 -9
  232. package/src/__tests__/cases/TwoEntitySameTableOverlappingRows-test.ts +8 -8
  233. package/src/__tests__/entityUtils-test.ts +4 -4
  234. package/src/entityUtils.ts +1 -1
  235. package/src/errors/EntityCacheAdapterError.ts +1 -1
  236. package/src/errors/EntityDatabaseAdapterError.ts +1 -1
  237. package/src/errors/EntityInvalidFieldValueError.ts +5 -5
  238. package/src/errors/EntityNotAuthorizedError.ts +4 -4
  239. package/src/errors/EntityNotFoundError.ts +5 -5
  240. package/src/errors/__tests__/EntityDatabaseAdapterError-test.ts +2 -2
  241. package/src/errors/__tests__/EntityError-test.ts +7 -7
  242. package/src/index.ts +77 -77
  243. package/src/internal/CompositeFieldHolder.ts +6 -10
  244. package/src/internal/CompositeFieldValueMap.ts +3 -5
  245. package/src/internal/EntityDataManager.ts +11 -14
  246. package/src/internal/EntityFieldTransformationUtils.ts +2 -2
  247. package/src/internal/EntityLoadInterfaces.ts +3 -2
  248. package/src/internal/EntityTableDataCoordinator.ts +9 -9
  249. package/src/internal/ReadThroughEntityCache.ts +4 -4
  250. package/src/internal/SingleFieldHolder.ts +4 -8
  251. package/src/internal/__tests__/CompositeFieldHolder-test.ts +1 -1
  252. package/src/internal/__tests__/CompositeFieldValueMap-test.ts +3 -3
  253. package/src/internal/__tests__/EntityDataManager-test.ts +15 -18
  254. package/src/internal/__tests__/EntityFieldTransformationUtils-test.ts +3 -3
  255. package/src/internal/__tests__/ReadThroughEntityCache-test.ts +6 -6
  256. package/src/metrics/EntityMetricsUtils.ts +5 -5
  257. package/src/metrics/IEntityMetricsAdapter.ts +3 -3
  258. package/src/metrics/NoOpEntityMetricsAdapter.ts +2 -2
  259. package/src/metrics/__tests__/EntityMetricsUtils-test.ts +4 -7
  260. package/src/rules/AllowIfAllSubRulesAllowPrivacyPolicyRule.ts +5 -5
  261. package/src/rules/AllowIfAnySubRuleAllowsPrivacyPolicyRule.ts +5 -5
  262. package/src/rules/AllowIfInParentCascadeDeletionPrivacyPolicyRule.ts +9 -6
  263. package/src/rules/AlwaysAllowPrivacyPolicyRule.ts +5 -5
  264. package/src/rules/AlwaysDenyPrivacyPolicyRule.ts +5 -5
  265. package/src/rules/AlwaysSkipPrivacyPolicyRule.ts +5 -5
  266. package/src/rules/EvaluateIfEntityFieldPredicatePrivacyPolicyRule.ts +5 -5
  267. package/src/rules/PrivacyPolicyRule.ts +4 -4
  268. package/src/rules/__tests__/AllowIfAllSubRulesAllowPrivacyPolicyRule-test.ts +8 -8
  269. package/src/rules/__tests__/AllowIfAnySubRuleAllowsPrivacyPolicyRule-test.ts +8 -8
  270. package/src/rules/__tests__/AllowIfInParentCascadeDeletionPrivacyPolicyRule-test.ts +7 -7
  271. package/src/rules/__tests__/AlwaysAllowPrivacyPolicyRule-test.ts +5 -5
  272. package/src/rules/__tests__/AlwaysDenyPrivacyPolicyRule-test.ts +5 -5
  273. package/src/rules/__tests__/AlwaysSkipPrivacyPolicyRule-test.ts +5 -5
  274. package/src/rules/__tests__/EvaluateIfEntityFieldPredicatePrivacyPolicyRule-test.ts +9 -8
  275. package/src/utils/EntityCreationUtils.ts +7 -7
  276. package/src/utils/EntityPrivacyUtils.ts +13 -9
  277. package/src/utils/__testfixtures__/PrivacyPolicyRuleTestUtils.ts +6 -5
  278. package/src/utils/__testfixtures__/SimpleTestEntity.ts +7 -7
  279. package/src/utils/__testfixtures__/StubCacheAdapter.ts +6 -5
  280. package/src/utils/__testfixtures__/StubDatabaseAdapter.ts +6 -6
  281. package/src/utils/__testfixtures__/StubDatabaseAdapterProvider.ts +4 -4
  282. package/src/utils/__testfixtures__/StubQueryContextProvider.ts +2 -2
  283. package/src/utils/__testfixtures__/TSMockitoExtensions.ts +5 -5
  284. package/src/utils/__testfixtures__/TestEntity.ts +9 -8
  285. package/src/utils/__testfixtures__/TestEntity2.ts +7 -7
  286. package/src/utils/__testfixtures__/TestEntityWithMutationTriggers.ts +10 -10
  287. package/src/utils/__testfixtures__/TestViewerContext.ts +1 -1
  288. package/src/utils/__testfixtures__/createUnitTestEntityCompanionProvider.ts +6 -6
  289. package/src/utils/__testfixtures__/describeFieldTestCase.ts +1 -1
  290. package/src/utils/__tests__/EntityCreationUtils-test.ts +7 -7
  291. package/src/utils/__tests__/EntityPrivacyUtils-test.ts +20 -21
  292. package/src/utils/__tests__/canViewerDeleteAsync-edgeDeletionPermissionInferenceBehavior-test.ts +12 -12
  293. package/src/utils/__tests__/mergeEntityMutationTriggerConfigurations-test.ts +2 -2
  294. package/src/utils/collections/__tests__/SerializableKeyMap-test.ts +2 -1
  295. package/src/utils/collections/__tests__/maps-test.ts +5 -5
  296. package/src/utils/collections/__tests__/sets-test.ts +1 -1
  297. package/src/utils/mergeEntityMutationTriggerConfigurations.ts +3 -3
  298. package/build/src/AuthorizationResultBasedEntityAssociationLoader.js.map +0 -1
  299. package/build/src/AuthorizationResultBasedEntityLoader.js.map +0 -1
  300. package/build/src/AuthorizationResultBasedEntityMutator.js.map +0 -1
  301. package/build/src/ComposedEntityCacheAdapter.js.map +0 -1
  302. package/build/src/ComposedSecondaryEntityCache.js.map +0 -1
  303. package/build/src/EnforcingEntityAssociationLoader.js.map +0 -1
  304. package/build/src/EnforcingEntityCreator.js.map +0 -1
  305. package/build/src/EnforcingEntityDeleter.js.map +0 -1
  306. package/build/src/EnforcingEntityLoader.js.map +0 -1
  307. package/build/src/EnforcingEntityUpdater.js.map +0 -1
  308. package/build/src/Entity.js.map +0 -1
  309. package/build/src/EntityAssociationLoader.js.map +0 -1
  310. package/build/src/EntityCompanion.js.map +0 -1
  311. package/build/src/EntityCompanionProvider.js.map +0 -1
  312. package/build/src/EntityConfiguration.js.map +0 -1
  313. package/build/src/EntityConstructionUtils.js.map +0 -1
  314. package/build/src/EntityCreator.js.map +0 -1
  315. package/build/src/EntityDatabaseAdapter.js.map +0 -1
  316. package/build/src/EntityDeleter.js.map +0 -1
  317. package/build/src/EntityFieldDefinition.js.map +0 -1
  318. package/build/src/EntityFields.js.map +0 -1
  319. package/build/src/EntityInvalidationUtils.js.map +0 -1
  320. package/build/src/EntityLoader.js.map +0 -1
  321. package/build/src/EntityLoaderFactory.js.map +0 -1
  322. package/build/src/EntityMutationInfo.js.map +0 -1
  323. package/build/src/EntityMutationTriggerConfiguration.js.map +0 -1
  324. package/build/src/EntityMutationValidatorConfiguration.js.map +0 -1
  325. package/build/src/EntityMutatorFactory.js.map +0 -1
  326. package/build/src/EntityPrivacyPolicy.js.map +0 -1
  327. package/build/src/EntityQueryContext.js.map +0 -1
  328. package/build/src/EntityQueryContextProvider.js.map +0 -1
  329. package/build/src/EntitySecondaryCacheLoader.js.map +0 -1
  330. package/build/src/EntityUpdater.js.map +0 -1
  331. package/build/src/GenericEntityCacheAdapter.js.map +0 -1
  332. package/build/src/GenericSecondaryEntityCache.js.map +0 -1
  333. package/build/src/IEntityCacheAdapter.js.map +0 -1
  334. package/build/src/IEntityCacheAdapterProvider.js.map +0 -1
  335. package/build/src/IEntityDatabaseAdapterProvider.js.map +0 -1
  336. package/build/src/IEntityGenericCacher.js.map +0 -1
  337. package/build/src/ReadonlyEntity.js.map +0 -1
  338. package/build/src/ViewerContext.js.map +0 -1
  339. package/build/src/ViewerScopedEntityCompanion.js.map +0 -1
  340. package/build/src/ViewerScopedEntityCompanionProvider.js.map +0 -1
  341. package/build/src/ViewerScopedEntityLoaderFactory.js.map +0 -1
  342. package/build/src/ViewerScopedEntityMutatorFactory.js.map +0 -1
  343. package/build/src/entityUtils.js.map +0 -1
  344. package/build/src/errors/EntityCacheAdapterError.js.map +0 -1
  345. package/build/src/errors/EntityDatabaseAdapterError.js.map +0 -1
  346. package/build/src/errors/EntityError.js.map +0 -1
  347. package/build/src/errors/EntityInvalidFieldValueError.js.map +0 -1
  348. package/build/src/errors/EntityNotAuthorizedError.js.map +0 -1
  349. package/build/src/errors/EntityNotFoundError.js.map +0 -1
  350. package/build/src/index.js.map +0 -1
  351. package/build/src/internal/CompositeFieldHolder.js.map +0 -1
  352. package/build/src/internal/CompositeFieldValueMap.js.map +0 -1
  353. package/build/src/internal/EntityDataManager.js.map +0 -1
  354. package/build/src/internal/EntityFieldTransformationUtils.js.map +0 -1
  355. package/build/src/internal/EntityLoadInterfaces.js.map +0 -1
  356. package/build/src/internal/EntityTableDataCoordinator.js.map +0 -1
  357. package/build/src/internal/ReadThroughEntityCache.js.map +0 -1
  358. package/build/src/internal/SingleFieldHolder.js.map +0 -1
  359. package/build/src/metrics/EntityMetricsUtils.js.map +0 -1
  360. package/build/src/metrics/IEntityMetricsAdapter.js.map +0 -1
  361. package/build/src/metrics/NoOpEntityMetricsAdapter.js.map +0 -1
  362. package/build/src/rules/AllowIfAllSubRulesAllowPrivacyPolicyRule.js.map +0 -1
  363. package/build/src/rules/AllowIfAnySubRuleAllowsPrivacyPolicyRule.js.map +0 -1
  364. package/build/src/rules/AllowIfInParentCascadeDeletionPrivacyPolicyRule.js.map +0 -1
  365. package/build/src/rules/AlwaysAllowPrivacyPolicyRule.js.map +0 -1
  366. package/build/src/rules/AlwaysDenyPrivacyPolicyRule.js.map +0 -1
  367. package/build/src/rules/AlwaysSkipPrivacyPolicyRule.js.map +0 -1
  368. package/build/src/rules/EvaluateIfEntityFieldPredicatePrivacyPolicyRule.js.map +0 -1
  369. package/build/src/rules/PrivacyPolicyRule.js.map +0 -1
  370. package/build/src/utils/EntityCreationUtils.js.map +0 -1
  371. package/build/src/utils/EntityPrivacyUtils.js.map +0 -1
  372. package/build/src/utils/collections/SerializableKeyMap.js.map +0 -1
  373. package/build/src/utils/collections/maps.js.map +0 -1
  374. package/build/src/utils/collections/sets.js.map +0 -1
  375. package/build/src/utils/mergeEntityMutationTriggerConfigurations.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { EntityDatabaseAdapter } from '../EntityDatabaseAdapter';
2
- import { EntityQueryContext, EntityTransactionalQueryContext } from '../EntityQueryContext';
3
- import { EntityQueryContextProvider } from '../EntityQueryContextProvider';
4
- import { IEntityLoadKey, IEntityLoadValue, LoadPair } from './EntityLoadInterfaces';
5
- import { ReadThroughEntityCache } from './ReadThroughEntityCache';
6
- import { IEntityMetricsAdapter } from '../metrics/IEntityMetricsAdapter';
1
+ import type { EntityDatabaseAdapter } from '../EntityDatabaseAdapter.ts';
2
+ import type { EntityQueryContext, EntityTransactionalQueryContext } from '../EntityQueryContext.ts';
3
+ import type { EntityQueryContextProvider } from '../EntityQueryContextProvider.ts';
4
+ import type { IEntityLoadKey, IEntityLoadValue, LoadPair } from './EntityLoadInterfaces.ts';
5
+ import type { ReadThroughEntityCache } from './ReadThroughEntityCache.ts';
6
+ import type { IEntityMetricsAdapter } from '../metrics/IEntityMetricsAdapter.ts';
7
7
  /**
8
8
  * A data manager is responsible for orchestrating multiple sources of entity
9
9
  * data including local caches, EntityCacheAdapter, and EntityDatabaseAdapter.
@@ -1,16 +1,10 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.EntityDataManager = void 0;
7
- const dataloader_1 = __importDefault(require("dataloader"));
8
- const invariant_1 = __importDefault(require("invariant"));
9
- const EntityQueryContext_1 = require("../EntityQueryContext");
10
- const entityUtils_1 = require("../entityUtils");
11
- const EntityMetricsUtils_1 = require("../metrics/EntityMetricsUtils");
12
- const IEntityMetricsAdapter_1 = require("../metrics/IEntityMetricsAdapter");
13
- const maps_1 = require("../utils/collections/maps");
1
+ import DataLoader from 'dataloader';
2
+ import invariant from 'invariant';
3
+ import { TransactionalDataLoaderMode } from "../EntityQueryContext.js";
4
+ import { partitionErrors } from "../entityUtils.js";
5
+ import { timeAndLogLoadMapEventAsync, timeAndLogLoadOneEventAsync, } from "../metrics/EntityMetricsUtils.js";
6
+ import { EntityMetricsLoadType, IncrementLoadCountEventType, } from "../metrics/IEntityMetricsAdapter.js";
7
+ import { computeIfAbsent } from "../utils/collections/maps.js";
14
8
  /**
15
9
  * A data manager is responsible for orchestrating multiple sources of entity
16
10
  * data including local caches, EntityCacheAdapter, and EntityDatabaseAdapter.
@@ -19,7 +13,7 @@ const maps_1 = require("../utils/collections/maps");
19
13
  *
20
14
  * @internal
21
15
  */
22
- class EntityDataManager {
16
+ export class EntityDataManager {
23
17
  databaseAdapter;
24
18
  entityCache;
25
19
  queryContextProvider;
@@ -37,8 +31,8 @@ class EntityDataManager {
37
31
  this.entityClassName = entityClassName;
38
32
  }
39
33
  getDataLoaderForLoadKey(key) {
40
- return (0, maps_1.computeIfAbsent)(this.dataLoaders, key.getLoadMethodType() + key.getDataManagerDataLoaderKey(), () => {
41
- return new dataloader_1.default(async (serializedLoadValues) => {
34
+ return computeIfAbsent(this.dataLoaders, key.getLoadMethodType() + key.getDataManagerDataLoaderKey(), () => {
35
+ return new DataLoader(async (serializedLoadValues) => {
42
36
  const values = serializedLoadValues.map((serializedLoadValue) => key.deserializeLoadValue(serializedLoadValue));
43
37
  const objectMap = await this.loadManyForNonTransactionalDataLoaderAsync(key, values);
44
38
  return values.map((value) => objectMap.get(value) ?? []);
@@ -47,7 +41,7 @@ class EntityDataManager {
47
41
  }
48
42
  async loadManyForNonTransactionalDataLoaderAsync(key, values) {
49
43
  this.metricsAdapter.incrementDataManagerLoadCount({
50
- type: IEntityMetricsAdapter_1.IncrementLoadCountEventType.CACHE,
44
+ type: IncrementLoadCountEventType.CACHE,
51
45
  isInTransaction: false,
52
46
  fieldValueCount: values.length,
53
47
  entityClassName: this.entityClassName,
@@ -55,7 +49,7 @@ class EntityDataManager {
55
49
  });
56
50
  return await this.entityCache.readManyThroughAsync(key, values, async (fetcherValues) => {
57
51
  this.metricsAdapter.incrementDataManagerLoadCount({
58
- type: IEntityMetricsAdapter_1.IncrementLoadCountEventType.DATABASE,
52
+ type: IncrementLoadCountEventType.DATABASE,
59
53
  isInTransaction: false,
60
54
  fieldValueCount: fetcherValues.length,
61
55
  entityClassName: this.entityClassName,
@@ -65,21 +59,21 @@ class EntityDataManager {
65
59
  });
66
60
  }
67
61
  getTransactionalDataLoaderForLoadKey(queryContext, key) {
68
- const dataLoaderMapForTransaction = (0, maps_1.computeIfAbsent)(this.transactionalDataLoaders, queryContext.transactionId, () => new Map());
69
- return (0, maps_1.computeIfAbsent)(dataLoaderMapForTransaction, key.getLoadMethodType() + key.getDataManagerDataLoaderKey(), () => {
70
- return new dataloader_1.default(async (serializedLoadValues) => {
62
+ const dataLoaderMapForTransaction = computeIfAbsent(this.transactionalDataLoaders, queryContext.transactionId, () => new Map());
63
+ return computeIfAbsent(dataLoaderMapForTransaction, key.getLoadMethodType() + key.getDataManagerDataLoaderKey(), () => {
64
+ return new DataLoader(async (serializedLoadValues) => {
71
65
  const values = serializedLoadValues.map((serializedLoadValue) => key.deserializeLoadValue(serializedLoadValue));
72
66
  const objectMap = await this.loadManyForTransactionalDataLoaderAsync(queryContext, key, values);
73
67
  return values.map((value) => objectMap.get(value) ?? []);
74
68
  }, {
75
69
  // only cache if transactional dataloader caching is enabled for the transactional query context
76
- cache: queryContext.transactionalDataLoaderMode === EntityQueryContext_1.TransactionalDataLoaderMode.ENABLED,
70
+ cache: queryContext.transactionalDataLoaderMode === TransactionalDataLoaderMode.ENABLED,
77
71
  });
78
72
  });
79
73
  }
80
74
  async loadManyForTransactionalDataLoaderAsync(queryContext, key, values) {
81
75
  this.metricsAdapter.incrementDataManagerLoadCount({
82
- type: IEntityMetricsAdapter_1.IncrementLoadCountEventType.DATABASE,
76
+ type: IncrementLoadCountEventType.DATABASE,
83
77
  isInTransaction: true,
84
78
  fieldValueCount: values.length,
85
79
  entityClassName: this.entityClassName,
@@ -96,14 +90,14 @@ class EntityDataManager {
96
90
  * @returns map from load value to objects that match the query for that load value
97
91
  */
98
92
  async loadManyEqualingAsync(queryContext, key, values) {
99
- return await (0, EntityMetricsUtils_1.timeAndLogLoadMapEventAsync)(this.metricsAdapter, IEntityMetricsAdapter_1.EntityMetricsLoadType.LOAD_MANY, this.entityClassName, queryContext)(this.loadManyEqualingInternalAsync(queryContext, key, values));
93
+ return await timeAndLogLoadMapEventAsync(this.metricsAdapter, EntityMetricsLoadType.LOAD_MANY, this.entityClassName, queryContext)(this.loadManyEqualingInternalAsync(queryContext, key, values));
100
94
  }
101
95
  async loadManyEqualingInternalAsync(queryContext, key, values) {
102
96
  key.validateRuntimeLoadValuesForDataManagerDataLoader(values, this.entityClassName);
103
97
  if (queryContext.isInTransaction() &&
104
- queryContext.transactionalDataLoaderMode === EntityQueryContext_1.TransactionalDataLoaderMode.DISABLED) {
98
+ queryContext.transactionalDataLoaderMode === TransactionalDataLoaderMode.DISABLED) {
105
99
  this.metricsAdapter.incrementDataManagerLoadCount({
106
- type: IEntityMetricsAdapter_1.IncrementLoadCountEventType.DATABASE,
100
+ type: IncrementLoadCountEventType.DATABASE,
107
101
  isInTransaction: true,
108
102
  fieldValueCount: values.length,
109
103
  entityClassName: this.entityClassName,
@@ -112,7 +106,7 @@ class EntityDataManager {
112
106
  return await this.databaseAdapter.fetchManyWhereAsync(queryContext, key, values);
113
107
  }
114
108
  this.metricsAdapter.incrementDataManagerLoadCount({
115
- type: IEntityMetricsAdapter_1.IncrementLoadCountEventType.DATALOADER,
109
+ type: IncrementLoadCountEventType.DATALOADER,
116
110
  isInTransaction: queryContext.isInTransaction(),
117
111
  fieldValueCount: values.length,
118
112
  entityClassName: this.entityClassName,
@@ -122,12 +116,12 @@ class EntityDataManager {
122
116
  ? this.getTransactionalDataLoaderForLoadKey(queryContext, key)
123
117
  : this.getDataLoaderForLoadKey(key);
124
118
  const results = await dataLoader.loadMany(values.map((v) => key.serializeLoadValue(v)));
125
- const [successfulValues, errors] = (0, entityUtils_1.partitionErrors)(results);
119
+ const [successfulValues, errors] = partitionErrors(results);
126
120
  if (errors.length > 0) {
127
121
  const error = errors[0];
128
122
  throw error;
129
123
  }
130
- (0, invariant_1.default)(values.length === successfulValues.length, `length mismatch between values (${values.length}) and successful values (${successfulValues.length})`);
124
+ invariant(values.length === successfulValues.length, `length mismatch between values (${values.length}) and successful values (${successfulValues.length})`);
131
125
  const mapToReturn = key.vendNewLoadValueMap();
132
126
  for (let i = 0; i < successfulValues.length; i++) {
133
127
  mapToReturn.set(values[i], successfulValues[i]);
@@ -146,7 +140,7 @@ class EntityDataManager {
146
140
  * @returns at most one that match the query for that load value
147
141
  */
148
142
  async loadOneEqualingAsync(queryContext, key, value) {
149
- return await (0, EntityMetricsUtils_1.timeAndLogLoadOneEventAsync)(this.metricsAdapter, IEntityMetricsAdapter_1.EntityMetricsLoadType.LOAD_ONE, this.entityClassName, queryContext)(this.databaseAdapter.fetchOneWhereAsync(queryContext, key, value));
143
+ return await timeAndLogLoadOneEventAsync(this.metricsAdapter, EntityMetricsLoadType.LOAD_ONE, this.entityClassName, queryContext)(this.databaseAdapter.fetchOneWhereAsync(queryContext, key, value));
150
144
  }
151
145
  async invalidateOneAsync(key, value) {
152
146
  await this.entityCache.invalidateManyAsync(key, [value]);
@@ -167,7 +161,7 @@ class EntityDataManager {
167
161
  * @param pairs - key-value pairs to invalidate
168
162
  */
169
163
  invalidateKeyValuePairsForTransaction(queryContext, pairs) {
170
- if (queryContext.transactionalDataLoaderMode === EntityQueryContext_1.TransactionalDataLoaderMode.DISABLED) {
164
+ if (queryContext.transactionalDataLoaderMode === TransactionalDataLoaderMode.DISABLED) {
171
165
  return;
172
166
  }
173
167
  // invalidate all query contexts in transaction tree
@@ -208,5 +202,3 @@ class EntityDataManager {
208
202
  });
209
203
  }
210
204
  }
211
- exports.EntityDataManager = EntityDataManager;
212
- //# sourceMappingURL=EntityDataManager.js.map
@@ -1,4 +1,4 @@
1
- import { EntityConfiguration } from '../EntityConfiguration';
1
+ import type { EntityConfiguration } from '../EntityConfiguration.ts';
2
2
  /**
3
3
  * @internal
4
4
  */
@@ -1,24 +1,17 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.transformFieldsToCacheObject = exports.transformCacheObjectToFields = exports.transformFieldsToDatabaseObject = exports.transformDatabaseObjectToFields = exports.getDatabaseFieldForEntityField = void 0;
7
- const invariant_1 = __importDefault(require("invariant"));
8
- const nullthrows_1 = __importDefault(require("nullthrows"));
1
+ import nullthrows from '@expo/nullthrows';
2
+ import invariant from 'invariant';
9
3
  /**
10
4
  * @internal
11
5
  */
12
- const getDatabaseFieldForEntityField = (entityConfiguration, entityField) => {
6
+ export const getDatabaseFieldForEntityField = (entityConfiguration, entityField) => {
13
7
  const databaseField = entityConfiguration.entityToDBFieldsKeyMapping.get(entityField);
14
- (0, invariant_1.default)(databaseField, `database field mapping missing for ${String(entityField)}`);
8
+ invariant(databaseField, `database field mapping missing for ${String(entityField)}`);
15
9
  return databaseField;
16
10
  };
17
- exports.getDatabaseFieldForEntityField = getDatabaseFieldForEntityField;
18
11
  /**
19
12
  * @internal
20
13
  */
21
- const transformDatabaseObjectToFields = (entityConfiguration, fieldTransformerMap, databaseObject) => {
14
+ export const transformDatabaseObjectToFields = (entityConfiguration, fieldTransformerMap, databaseObject) => {
22
15
  const fields = {};
23
16
  for (const k in databaseObject) {
24
17
  const val = databaseObject[k];
@@ -29,25 +22,23 @@ const transformDatabaseObjectToFields = (entityConfiguration, fieldTransformerMa
29
22
  }
30
23
  return fields;
31
24
  };
32
- exports.transformDatabaseObjectToFields = transformDatabaseObjectToFields;
33
25
  /**
34
26
  * @internal
35
27
  */
36
- const transformFieldsToDatabaseObject = (entityConfiguration, fieldTransformerMap, fields) => {
28
+ export const transformFieldsToDatabaseObject = (entityConfiguration, fieldTransformerMap, fields) => {
37
29
  const databaseObject = {};
38
30
  for (const k in fields) {
39
31
  const val = fields[k];
40
32
  const databaseKey = entityConfiguration.entityToDBFieldsKeyMapping.get(k);
41
- (0, invariant_1.default)(databaseKey, `must be database key for field: ${k}`);
33
+ invariant(databaseKey, `must be database key for field: ${k}`);
42
34
  databaseObject[databaseKey] = maybeTransformFieldValueToDatabaseValue(entityConfiguration, fieldTransformerMap, k, val);
43
35
  }
44
36
  return databaseObject;
45
37
  };
46
- exports.transformFieldsToDatabaseObject = transformFieldsToDatabaseObject;
47
38
  /**
48
39
  * @internal
49
40
  */
50
- const transformCacheObjectToFields = (entityConfiguration, fieldTransformerMap, cacheObject) => {
41
+ export const transformCacheObjectToFields = (entityConfiguration, fieldTransformerMap, cacheObject) => {
51
42
  const fields = {};
52
43
  for (const fieldsKey in cacheObject) {
53
44
  const val = cacheObject[fieldsKey];
@@ -55,11 +46,10 @@ const transformCacheObjectToFields = (entityConfiguration, fieldTransformerMap,
55
46
  }
56
47
  return fields;
57
48
  };
58
- exports.transformCacheObjectToFields = transformCacheObjectToFields;
59
49
  /**
60
50
  * @internal
61
51
  */
62
- const transformFieldsToCacheObject = (entityConfiguration, fieldTransformerMap, fields) => {
52
+ export const transformFieldsToCacheObject = (entityConfiguration, fieldTransformerMap, fields) => {
63
53
  const cacheObject = {};
64
54
  for (const fieldsKey in fields) {
65
55
  const val = fields[fieldsKey];
@@ -67,17 +57,16 @@ const transformFieldsToCacheObject = (entityConfiguration, fieldTransformerMap,
67
57
  }
68
58
  return cacheObject;
69
59
  };
70
- exports.transformFieldsToCacheObject = transformFieldsToCacheObject;
71
60
  const maybeTransformDatabaseValueToFieldValue = (entityConfiguration, fieldTransformerMap, fieldName, value) => {
72
61
  // this will always be non-null due to the way the dbToEntityFieldsKeyMapping is computed and this
73
62
  // function is called conditionally
74
- const fieldDefinition = (0, nullthrows_1.default)(entityConfiguration.schema.get(fieldName));
63
+ const fieldDefinition = nullthrows(entityConfiguration.schema.get(fieldName));
75
64
  const transformer = fieldTransformerMap.get(fieldDefinition.constructor.name);
76
65
  const readTransformer = transformer?.read;
77
66
  return readTransformer ? readTransformer(value) : value;
78
67
  };
79
68
  const maybeTransformFieldValueToDatabaseValue = (entityConfiguration, fieldTransformerMap, fieldName, value) => {
80
- const fieldDefinition = (0, nullthrows_1.default)(entityConfiguration.schema.get(fieldName));
69
+ const fieldDefinition = nullthrows(entityConfiguration.schema.get(fieldName));
81
70
  const transformer = fieldTransformerMap.get(fieldDefinition.constructor.name);
82
71
  const writeTransformer = transformer?.write;
83
72
  return writeTransformer ? writeTransformer(value) : value;
@@ -100,4 +89,3 @@ const maybeTransformFieldValueToCacheValue = (entityConfiguration, fieldTransfor
100
89
  const writeTransformer = transformer?.write;
101
90
  return writeTransformer ? writeTransformer(value) : value;
102
91
  };
103
- //# sourceMappingURL=EntityFieldTransformationUtils.js.map
@@ -1,5 +1,6 @@
1
- import { EntityConfiguration } from '../EntityConfiguration';
2
- import { ISerializable, SerializableKeyMap } from '../utils/collections/SerializableKeyMap';
1
+ import type { EntityConfiguration } from '../EntityConfiguration.ts';
2
+ import type { ISerializable } from '../utils/collections/SerializableKeyMap.ts';
3
+ import { SerializableKeyMap } from '../utils/collections/SerializableKeyMap.ts';
3
4
  /**
4
5
  * Load method type identifier of a load key. Used for keying data loaders and identification in metrics.
5
6
  *
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LoadValueMap = exports.EntityLoadMethodType = void 0;
4
- const SerializableKeyMap_1 = require("../utils/collections/SerializableKeyMap");
1
+ import { SerializableKeyMap } from "../utils/collections/SerializableKeyMap.js";
5
2
  /**
6
3
  * Load method type identifier of a load key. Used for keying data loaders and identification in metrics.
7
4
  *
8
5
  * @internal
9
6
  */
10
- var EntityLoadMethodType;
7
+ export var EntityLoadMethodType;
11
8
  (function (EntityLoadMethodType) {
12
9
  /**
13
10
  * Load method type for loading entities by single fieldName and fieldValue(s).
@@ -17,13 +14,11 @@ var EntityLoadMethodType;
17
14
  * Load method type for loading entities by composite field.
18
15
  */
19
16
  EntityLoadMethodType["COMPOSITE"] = "composite";
20
- })(EntityLoadMethodType || (exports.EntityLoadMethodType = EntityLoadMethodType = {}));
17
+ })(EntityLoadMethodType || (EntityLoadMethodType = {}));
21
18
  /**
22
19
  * Map from load value interface to value.
23
20
  *
24
21
  * @internal
25
22
  */
26
- class LoadValueMap extends SerializableKeyMap_1.SerializableKeyMap {
23
+ export class LoadValueMap extends SerializableKeyMap {
27
24
  }
28
- exports.LoadValueMap = LoadValueMap;
29
- //# sourceMappingURL=EntityLoadInterfaces.js.map
@@ -1,11 +1,11 @@
1
- import { EntityConfiguration } from '../EntityConfiguration';
2
- import { EntityDatabaseAdapter } from '../EntityDatabaseAdapter';
3
- import { EntityQueryContextProvider } from '../EntityQueryContextProvider';
4
- import { IEntityCacheAdapter } from '../IEntityCacheAdapter';
5
- import { IEntityCacheAdapterProvider } from '../IEntityCacheAdapterProvider';
6
- import { IEntityDatabaseAdapterProvider } from '../IEntityDatabaseAdapterProvider';
7
- import { EntityDataManager } from './EntityDataManager';
8
- import { IEntityMetricsAdapter } from '../metrics/IEntityMetricsAdapter';
1
+ import type { EntityConfiguration } from '../EntityConfiguration.ts';
2
+ import type { EntityDatabaseAdapter } from '../EntityDatabaseAdapter.ts';
3
+ import type { EntityQueryContextProvider } from '../EntityQueryContextProvider.ts';
4
+ import type { IEntityCacheAdapter } from '../IEntityCacheAdapter.ts';
5
+ import type { IEntityCacheAdapterProvider } from '../IEntityCacheAdapterProvider.ts';
6
+ import type { IEntityDatabaseAdapterProvider } from '../IEntityDatabaseAdapterProvider.ts';
7
+ import { EntityDataManager } from './EntityDataManager.ts';
8
+ import type { IEntityMetricsAdapter } from '../metrics/IEntityMetricsAdapter.ts';
9
9
  /**
10
10
  * Responsible for orchestrating fetching and caching of entity data from a
11
11
  * table. Note that one instance is shared amongst all entities that read from
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntityTableDataCoordinator = void 0;
4
- const EntityDataManager_1 = require("./EntityDataManager");
5
- const ReadThroughEntityCache_1 = require("./ReadThroughEntityCache");
1
+ import { EntityDataManager } from "./EntityDataManager.js";
2
+ import { ReadThroughEntityCache } from "./ReadThroughEntityCache.js";
6
3
  /**
7
4
  * Responsible for orchestrating fetching and caching of entity data from a
8
5
  * table. Note that one instance is shared amongst all entities that read from
@@ -10,7 +7,7 @@ const ReadThroughEntityCache_1 = require("./ReadThroughEntityCache");
10
7
  *
11
8
  * @internal
12
9
  */
13
- class EntityTableDataCoordinator {
10
+ export class EntityTableDataCoordinator {
14
11
  entityConfiguration;
15
12
  queryContextProvider;
16
13
  metricsAdapter;
@@ -25,11 +22,9 @@ class EntityTableDataCoordinator {
25
22
  this.entityClassName = entityClassName;
26
23
  this.databaseAdapter = databaseAdapterProvider.getDatabaseAdapter(entityConfiguration);
27
24
  this.cacheAdapter = cacheAdapterProvider.getCacheAdapter(entityConfiguration);
28
- this.dataManager = new EntityDataManager_1.EntityDataManager(this.databaseAdapter, new ReadThroughEntityCache_1.ReadThroughEntityCache(entityConfiguration, this.cacheAdapter), queryContextProvider, metricsAdapter, entityClassName);
25
+ this.dataManager = new EntityDataManager(this.databaseAdapter, new ReadThroughEntityCache(entityConfiguration, this.cacheAdapter), queryContextProvider, metricsAdapter, entityClassName);
29
26
  }
30
27
  getQueryContextProvider() {
31
28
  return this.queryContextProvider;
32
29
  }
33
30
  }
34
- exports.EntityTableDataCoordinator = EntityTableDataCoordinator;
35
- //# sourceMappingURL=EntityTableDataCoordinator.js.map
@@ -1,6 +1,6 @@
1
- import { EntityConfiguration } from '../EntityConfiguration';
2
- import { IEntityCacheAdapter } from '../IEntityCacheAdapter';
3
- import { IEntityLoadKey, IEntityLoadValue } from './EntityLoadInterfaces';
1
+ import type { EntityConfiguration } from '../EntityConfiguration.ts';
2
+ import type { IEntityCacheAdapter } from '../IEntityCacheAdapter.ts';
3
+ import type { IEntityLoadKey, IEntityLoadValue } from './EntityLoadInterfaces.ts';
4
4
  /**
5
5
  * @internal
6
6
  */
@@ -1,27 +1,21 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ReadThroughEntityCache = exports.CacheStatus = void 0;
7
- const invariant_1 = __importDefault(require("invariant"));
8
- const maps_1 = require("../utils/collections/maps");
1
+ import invariant from 'invariant';
2
+ import { filterMap } from "../utils/collections/maps.js";
9
3
  /**
10
4
  * @internal
11
5
  */
12
- var CacheStatus;
6
+ export var CacheStatus;
13
7
  (function (CacheStatus) {
14
8
  CacheStatus[CacheStatus["HIT"] = 0] = "HIT";
15
9
  CacheStatus[CacheStatus["MISS"] = 1] = "MISS";
16
10
  CacheStatus[CacheStatus["NEGATIVE"] = 2] = "NEGATIVE";
17
- })(CacheStatus || (exports.CacheStatus = CacheStatus = {}));
11
+ })(CacheStatus || (CacheStatus = {}));
18
12
  /**
19
13
  * A read-through entity cache is responsible for coordinating EntityDatabaseAdapter and
20
14
  * EntityCacheAdapter within the EntityDataManager.
21
15
  *
22
16
  * @internal
23
17
  */
24
- class ReadThroughEntityCache {
18
+ export class ReadThroughEntityCache {
25
19
  entityConfiguration;
26
20
  entityCacheAdapter;
27
21
  constructor(entityConfiguration, entityCacheAdapter) {
@@ -53,8 +47,8 @@ class ReadThroughEntityCache {
53
47
  return await fetcher(values);
54
48
  }
55
49
  const cacheLoadResults = await this.entityCacheAdapter.loadManyAsync(key, values);
56
- (0, invariant_1.default)(cacheLoadResults.size === values.length, `${this.constructor.name} loadMany should return a result for each value`);
57
- const valuesToFetchFromDB = Array.from((0, maps_1.filterMap)(cacheLoadResults, (cacheLoadResult) => cacheLoadResult.status === CacheStatus.MISS).keys());
50
+ invariant(cacheLoadResults.size === values.length, `${this.constructor.name} loadMany should return a result for each value`);
51
+ const valuesToFetchFromDB = Array.from(filterMap(cacheLoadResults, (cacheLoadResult) => cacheLoadResult.status === CacheStatus.MISS).keys());
58
52
  // put transformed cache hits in result map
59
53
  const results = key.vendNewLoadValueMap();
60
54
  cacheLoadResults.forEach((cacheLoadResult, value) => {
@@ -105,5 +99,3 @@ class ReadThroughEntityCache {
105
99
  await this.entityCacheAdapter.invalidateManyAsync(key, values);
106
100
  }
107
101
  }
108
- exports.ReadThroughEntityCache = ReadThroughEntityCache;
109
- //# sourceMappingURL=ReadThroughEntityCache.js.map
@@ -1,5 +1,6 @@
1
- import { EntityConfiguration } from '../EntityConfiguration';
2
- import { EntityLoadMethodType, IEntityLoadKey, IEntityLoadValue, LoadValueMap } from './EntityLoadInterfaces';
1
+ import type { EntityConfiguration } from '../EntityConfiguration.ts';
2
+ import type { IEntityLoadKey, IEntityLoadValue } from './EntityLoadInterfaces.ts';
3
+ import { EntityLoadMethodType, LoadValueMap } from './EntityLoadInterfaces.ts';
3
4
  /**
4
5
  * A load key that represents a single field (fieldName) on an entity.
5
6
  *
@@ -1,18 +1,12 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SingleFieldValueHolderMap = exports.SingleFieldValueHolder = exports.SingleFieldHolder = void 0;
7
- const invariant_1 = __importDefault(require("invariant"));
8
- const EntityFieldTransformationUtils_1 = require("./EntityFieldTransformationUtils");
9
- const EntityLoadInterfaces_1 = require("./EntityLoadInterfaces");
1
+ import invariant from 'invariant';
2
+ import { getDatabaseFieldForEntityField } from "./EntityFieldTransformationUtils.js";
3
+ import { EntityLoadMethodType, LoadValueMap } from "./EntityLoadInterfaces.js";
10
4
  /**
11
5
  * A load key that represents a single field (fieldName) on an entity.
12
6
  *
13
7
  * @internal
14
8
  */
15
- class SingleFieldHolder {
9
+ export class SingleFieldHolder {
16
10
  fieldName;
17
11
  constructor(fieldName) {
18
12
  this.fieldName = fieldName;
@@ -24,7 +18,7 @@ class SingleFieldHolder {
24
18
  return entityConfiguration.cacheableKeys.has(this.fieldName);
25
19
  }
26
20
  getDatabaseColumns(entityConfiguration) {
27
- return [(0, EntityFieldTransformationUtils_1.getDatabaseFieldForEntityField)(entityConfiguration, this.fieldName)];
21
+ return [getDatabaseFieldForEntityField(entityConfiguration, this.fieldName)];
28
22
  }
29
23
  getDatabaseValues(value) {
30
24
  return [value.fieldValue];
@@ -38,11 +32,11 @@ class SingleFieldHolder {
38
32
  }
39
33
  createCacheKeyPartsForLoadValue(entityConfiguration, value) {
40
34
  const columnName = entityConfiguration.entityToDBFieldsKeyMapping.get(this.fieldName);
41
- (0, invariant_1.default)(columnName, `database field mapping missing for ${String(this.fieldName)}`);
35
+ invariant(columnName, `database field mapping missing for ${String(this.fieldName)}`);
42
36
  return [columnName, String(value.fieldValue)];
43
37
  }
44
38
  getLoadMethodType() {
45
- return EntityLoadInterfaces_1.EntityLoadMethodType.SINGLE;
39
+ return EntityLoadMethodType.SINGLE;
46
40
  }
47
41
  getDataManagerDataLoaderKey() {
48
42
  return this.fieldName;
@@ -63,13 +57,12 @@ class SingleFieldHolder {
63
57
  return new SingleFieldValueHolderMap();
64
58
  }
65
59
  }
66
- exports.SingleFieldHolder = SingleFieldHolder;
67
60
  /**
68
61
  * A load value for a SingleFieldHolder.
69
62
  *
70
63
  * @internal
71
64
  */
72
- class SingleFieldValueHolder {
65
+ export class SingleFieldValueHolder {
73
66
  fieldValue;
74
67
  constructor(fieldValue) {
75
68
  this.fieldValue = fieldValue;
@@ -84,14 +77,11 @@ class SingleFieldValueHolder {
84
77
  return new SingleFieldValueHolder(fieldValue);
85
78
  }
86
79
  }
87
- exports.SingleFieldValueHolder = SingleFieldValueHolder;
88
80
  /**
89
81
  * @internal
90
82
  */
91
- class SingleFieldValueHolderMap extends EntityLoadInterfaces_1.LoadValueMap {
83
+ export class SingleFieldValueHolderMap extends LoadValueMap {
92
84
  deserializeKey(serializedKey) {
93
85
  return SingleFieldValueHolder.deserialize(serializedKey);
94
86
  }
95
87
  }
96
- exports.SingleFieldValueHolderMap = SingleFieldValueHolderMap;
97
- //# sourceMappingURL=SingleFieldHolder.js.map
@@ -1,6 +1,6 @@
1
- import { EntityQueryContext } from '../EntityQueryContext';
2
- import { EntityMetricsLoadType, EntityMetricsMutationType, IEntityMetricsAdapter } from './IEntityMetricsAdapter';
3
- import { IEntityLoadValue } from '../internal/EntityLoadInterfaces';
1
+ import type { EntityQueryContext } from '../EntityQueryContext.ts';
2
+ import type { EntityMetricsLoadType, EntityMetricsMutationType, IEntityMetricsAdapter } from './IEntityMetricsAdapter.ts';
3
+ import type { IEntityLoadValue } from '../internal/EntityLoadInterfaces.ts';
4
4
  export declare const timeAndLogLoadEventAsync: (metricsAdapter: IEntityMetricsAdapter, loadType: EntityMetricsLoadType, entityClassName: string, queryContext: EntityQueryContext) => <TFields>(promise: Promise<readonly Readonly<TFields>[]>) => Promise<readonly Readonly<TFields>[]>;
5
5
  export declare const timeAndLogLoadOneEventAsync: (metricsAdapter: IEntityMetricsAdapter, loadType: EntityMetricsLoadType, entityClassName: string, queryContext: EntityQueryContext) => <TFields>(promise: Promise<Readonly<TFields> | null>) => Promise<Readonly<TFields> | null>;
6
6
  export declare const timeAndLogLoadMapEventAsync: (metricsAdapter: IEntityMetricsAdapter, loadType: EntityMetricsLoadType, entityClassName: string, queryContext: EntityQueryContext) => <TFields extends Record<string, any>, TSerializedLoadValue, TLoadValue extends IEntityLoadValue<TSerializedLoadValue>>(promise: Promise<ReadonlyMap<TLoadValue, readonly Readonly<TFields>[]>>) => Promise<ReadonlyMap<TLoadValue, readonly Readonly<TFields>[]>>;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.timeAndLogMutationEventAsync = exports.timeAndLogLoadMapEventAsync = exports.timeAndLogLoadOneEventAsync = exports.timeAndLogLoadEventAsync = void 0;
4
- const maps_1 = require("../utils/collections/maps");
5
- const timeAndLogLoadEventAsync = (metricsAdapter, loadType, entityClassName, queryContext) => async (promise) => {
1
+ import { reduceMap } from "../utils/collections/maps.js";
2
+ export const timeAndLogLoadEventAsync = (metricsAdapter, loadType, entityClassName, queryContext) => async (promise) => {
6
3
  const startTime = Date.now();
7
4
  const result = await promise;
8
5
  const endTime = Date.now();
@@ -15,8 +12,7 @@ const timeAndLogLoadEventAsync = (metricsAdapter, loadType, entityClassName, que
15
12
  });
16
13
  return result;
17
14
  };
18
- exports.timeAndLogLoadEventAsync = timeAndLogLoadEventAsync;
19
- const timeAndLogLoadOneEventAsync = (metricsAdapter, loadType, entityClassName, queryContext) => async (promise) => {
15
+ export const timeAndLogLoadOneEventAsync = (metricsAdapter, loadType, entityClassName, queryContext) => async (promise) => {
20
16
  const startTime = Date.now();
21
17
  const result = await promise;
22
18
  const endTime = Date.now();
@@ -29,12 +25,11 @@ const timeAndLogLoadOneEventAsync = (metricsAdapter, loadType, entityClassName,
29
25
  });
30
26
  return result;
31
27
  };
32
- exports.timeAndLogLoadOneEventAsync = timeAndLogLoadOneEventAsync;
33
- const timeAndLogLoadMapEventAsync = (metricsAdapter, loadType, entityClassName, queryContext) => async (promise) => {
28
+ export const timeAndLogLoadMapEventAsync = (metricsAdapter, loadType, entityClassName, queryContext) => async (promise) => {
34
29
  const startTime = Date.now();
35
30
  const result = await promise;
36
31
  const endTime = Date.now();
37
- const count = (0, maps_1.reduceMap)(result, (acc, v) => acc + v.length, 0);
32
+ const count = reduceMap(result, (acc, v) => acc + v.length, 0);
38
33
  metricsAdapter.logDataManagerLoadEvent({
39
34
  type: loadType,
40
35
  isInTransaction: queryContext.isInTransaction(),
@@ -44,8 +39,7 @@ const timeAndLogLoadMapEventAsync = (metricsAdapter, loadType, entityClassName,
44
39
  });
45
40
  return result;
46
41
  };
47
- exports.timeAndLogLoadMapEventAsync = timeAndLogLoadMapEventAsync;
48
- const timeAndLogMutationEventAsync = (metricsAdapter, mutationType, entityClassName, queryContext) => async (promise) => {
42
+ export const timeAndLogMutationEventAsync = (metricsAdapter, mutationType, entityClassName, queryContext) => async (promise) => {
49
43
  const startTime = Date.now();
50
44
  const result = await promise;
51
45
  const endTime = Date.now();
@@ -57,5 +51,3 @@ const timeAndLogMutationEventAsync = (metricsAdapter, mutationType, entityClassN
57
51
  });
58
52
  return result;
59
53
  };
60
- exports.timeAndLogMutationEventAsync = timeAndLogMutationEventAsync;
61
- //# sourceMappingURL=EntityMetricsUtils.js.map
@@ -1,5 +1,5 @@
1
- import { EntityAuthorizationAction, EntityPrivacyPolicyEvaluationMode } from '../EntityPrivacyPolicy';
2
- import { EntityLoadMethodType } from '../internal/EntityLoadInterfaces';
1
+ import type { EntityAuthorizationAction, EntityPrivacyPolicyEvaluationMode } from '../EntityPrivacyPolicy.ts';
2
+ import type { EntityLoadMethodType } from '../internal/EntityLoadInterfaces.ts';
3
3
  export declare enum EntityMetricsLoadType {
4
4
  LOAD_MANY = 0,
5
5
  LOAD_MANY_EQUALITY_CONJUNCTION = 1,
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntityMetricsAuthorizationResult = exports.IncrementLoadCountEventType = exports.EntityMetricsMutationType = exports.EntityMetricsLoadType = void 0;
4
- var EntityMetricsLoadType;
1
+ export var EntityMetricsLoadType;
5
2
  (function (EntityMetricsLoadType) {
6
3
  EntityMetricsLoadType[EntityMetricsLoadType["LOAD_MANY"] = 0] = "LOAD_MANY";
7
4
  EntityMetricsLoadType[EntityMetricsLoadType["LOAD_MANY_EQUALITY_CONJUNCTION"] = 1] = "LOAD_MANY_EQUALITY_CONJUNCTION";
@@ -9,14 +6,14 @@ var EntityMetricsLoadType;
9
6
  EntityMetricsLoadType[EntityMetricsLoadType["LOAD_MANY_SQL"] = 3] = "LOAD_MANY_SQL";
10
7
  EntityMetricsLoadType[EntityMetricsLoadType["LOAD_ONE"] = 4] = "LOAD_ONE";
11
8
  EntityMetricsLoadType[EntityMetricsLoadType["LOAD_PAGE"] = 5] = "LOAD_PAGE";
12
- })(EntityMetricsLoadType || (exports.EntityMetricsLoadType = EntityMetricsLoadType = {}));
13
- var EntityMetricsMutationType;
9
+ })(EntityMetricsLoadType || (EntityMetricsLoadType = {}));
10
+ export var EntityMetricsMutationType;
14
11
  (function (EntityMetricsMutationType) {
15
12
  EntityMetricsMutationType[EntityMetricsMutationType["CREATE"] = 0] = "CREATE";
16
13
  EntityMetricsMutationType[EntityMetricsMutationType["UPDATE"] = 1] = "UPDATE";
17
14
  EntityMetricsMutationType[EntityMetricsMutationType["DELETE"] = 2] = "DELETE";
18
- })(EntityMetricsMutationType || (exports.EntityMetricsMutationType = EntityMetricsMutationType = {}));
19
- var IncrementLoadCountEventType;
15
+ })(EntityMetricsMutationType || (EntityMetricsMutationType = {}));
16
+ export var IncrementLoadCountEventType;
20
17
  (function (IncrementLoadCountEventType) {
21
18
  /**
22
19
  * Type for when a dataloader load is initiated via the standard load methods
@@ -31,10 +28,9 @@ var IncrementLoadCountEventType;
31
28
  * Type for when a database load is initiated due to a dataloader and cache miss, when an entity query doesn't support caching, or during a transaction.
32
29
  */
33
30
  IncrementLoadCountEventType[IncrementLoadCountEventType["DATABASE"] = 2] = "DATABASE";
34
- })(IncrementLoadCountEventType || (exports.IncrementLoadCountEventType = IncrementLoadCountEventType = {}));
35
- var EntityMetricsAuthorizationResult;
31
+ })(IncrementLoadCountEventType || (IncrementLoadCountEventType = {}));
32
+ export var EntityMetricsAuthorizationResult;
36
33
  (function (EntityMetricsAuthorizationResult) {
37
34
  EntityMetricsAuthorizationResult[EntityMetricsAuthorizationResult["DENY"] = 0] = "DENY";
38
35
  EntityMetricsAuthorizationResult[EntityMetricsAuthorizationResult["ALLOW"] = 1] = "ALLOW";
39
- })(EntityMetricsAuthorizationResult || (exports.EntityMetricsAuthorizationResult = EntityMetricsAuthorizationResult = {}));
40
- //# sourceMappingURL=IEntityMetricsAdapter.js.map
36
+ })(EntityMetricsAuthorizationResult || (EntityMetricsAuthorizationResult = {}));