@expo/entity 0.60.0 → 0.62.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 -10
  44. package/build/src/EntityInvalidationUtils.js +5 -10
  45. package/build/src/EntityLoader.d.ts +7 -7
  46. package/build/src/EntityLoader.js +3 -8
  47. package/build/src/EntityLoaderFactory.d.ts +11 -11
  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 +10 -10
  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 +9 -9
  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 +8 -7
  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 +8 -25
  176. package/src/EntityLoader.ts +7 -7
  177. package/src/EntityLoaderFactory.ts +13 -12
  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 +12 -19
  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 -9
  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 -21
  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,15 +1,9 @@
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.ComposedEntityCacheAdapter = void 0;
7
- const nullthrows_1 = __importDefault(require("nullthrows"));
8
- const ReadThroughEntityCache_1 = require("./internal/ReadThroughEntityCache");
1
+ import nullthrows from '@expo/nullthrows';
2
+ import { CacheStatus } from "./internal/ReadThroughEntityCache.js";
9
3
  /**
10
4
  * A IEntityCacheAdapter that composes other IEntityCacheAdapter instances.
11
5
  */
12
- class ComposedEntityCacheAdapter {
6
+ export class ComposedEntityCacheAdapter {
13
7
  cacheAdapters;
14
8
  /**
15
9
  * @param cacheAdapters - list of cache adapters to compose in order of precedence.
@@ -25,16 +19,16 @@ class ComposedEntityCacheAdapter {
25
19
  const fulfilledValuesByCacheIndex = Array.from({ length: this.cacheAdapters.length }, () => []);
26
20
  let unfulfilledValues = values;
27
21
  for (let i = 0; i < this.cacheAdapters.length; i++) {
28
- const cacheAdapter = (0, nullthrows_1.default)(this.cacheAdapters[i]);
22
+ const cacheAdapter = nullthrows(this.cacheAdapters[i]);
29
23
  const cacheResultsFromAdapter = await cacheAdapter.loadManyAsync(key, unfulfilledValues);
30
24
  const newUnfulfilledValues = [];
31
25
  for (const [value, cacheResult] of cacheResultsFromAdapter) {
32
- if (cacheResult.status === ReadThroughEntityCache_1.CacheStatus.MISS) {
26
+ if (cacheResult.status === CacheStatus.MISS) {
33
27
  newUnfulfilledValues.push(value);
34
28
  }
35
29
  else {
36
30
  retMap.set(value, cacheResult);
37
- (0, nullthrows_1.default)(fulfilledValuesByCacheIndex[i]).push(value);
31
+ nullthrows(fulfilledValuesByCacheIndex[i]).push(value);
38
32
  }
39
33
  }
40
34
  unfulfilledValues = newUnfulfilledValues;
@@ -45,18 +39,18 @@ class ComposedEntityCacheAdapter {
45
39
  // Recache values from lower layers that were not found in higher layers
46
40
  // Write to lower layers first
47
41
  for (let i = this.cacheAdapters.length - 1; i >= 0; i--) {
48
- const cacheAdapter = (0, nullthrows_1.default)(this.cacheAdapters[i]);
42
+ const cacheAdapter = nullthrows(this.cacheAdapters[i]);
49
43
  const hitsToCache = key.vendNewLoadValueMap();
50
44
  const negativesToCache = [];
51
45
  // Loop over all lower layer caches to collect hits and misses
52
46
  for (let j = i + 1; j < this.cacheAdapters.length; j++) {
53
- const fulfilledValues = (0, nullthrows_1.default)(fulfilledValuesByCacheIndex[j]);
47
+ const fulfilledValues = nullthrows(fulfilledValuesByCacheIndex[j]);
54
48
  fulfilledValues.forEach((value) => {
55
- const cacheResult = (0, nullthrows_1.default)(retMap.get(value));
56
- if (cacheResult.status === ReadThroughEntityCache_1.CacheStatus.HIT) {
49
+ const cacheResult = nullthrows(retMap.get(value));
50
+ if (cacheResult.status === CacheStatus.HIT) {
57
51
  hitsToCache.set(value, cacheResult.item);
58
52
  }
59
- else if (cacheResult.status === ReadThroughEntityCache_1.CacheStatus.NEGATIVE) {
53
+ else if (cacheResult.status === CacheStatus.NEGATIVE) {
60
54
  negativesToCache.push(value);
61
55
  }
62
56
  });
@@ -71,31 +65,29 @@ class ComposedEntityCacheAdapter {
71
65
  await Promise.all(promises);
72
66
  }
73
67
  for (const value of unfulfilledValues) {
74
- retMap.set(value, { status: ReadThroughEntityCache_1.CacheStatus.MISS });
68
+ retMap.set(value, { status: CacheStatus.MISS });
75
69
  }
76
70
  return retMap;
77
71
  }
78
72
  async cacheManyAsync(key, objectMap) {
79
73
  // write to lower layers first
80
74
  for (let i = this.cacheAdapters.length - 1; i >= 0; i--) {
81
- const cacheAdapter = (0, nullthrows_1.default)(this.cacheAdapters[i]);
75
+ const cacheAdapter = nullthrows(this.cacheAdapters[i]);
82
76
  await cacheAdapter.cacheManyAsync(key, objectMap);
83
77
  }
84
78
  }
85
79
  async cacheDBMissesAsync(key, values) {
86
80
  // write to lower layers first
87
81
  for (let i = this.cacheAdapters.length - 1; i >= 0; i--) {
88
- const cacheAdapter = (0, nullthrows_1.default)(this.cacheAdapters[i]);
82
+ const cacheAdapter = nullthrows(this.cacheAdapters[i]);
89
83
  await cacheAdapter.cacheDBMissesAsync(key, values);
90
84
  }
91
85
  }
92
86
  async invalidateManyAsync(key, values) {
93
87
  // delete from lower layers first
94
88
  for (let i = this.cacheAdapters.length - 1; i >= 0; i--) {
95
- const cacheAdapter = (0, nullthrows_1.default)(this.cacheAdapters[i]);
89
+ const cacheAdapter = nullthrows(this.cacheAdapters[i]);
96
90
  await cacheAdapter.invalidateManyAsync(key, values);
97
91
  }
98
92
  }
99
93
  }
100
- exports.ComposedEntityCacheAdapter = ComposedEntityCacheAdapter;
101
- //# sourceMappingURL=ComposedEntityCacheAdapter.js.map
@@ -1,4 +1,4 @@
1
- import { ISecondaryEntityCache } from './EntitySecondaryCacheLoader';
1
+ import type { ISecondaryEntityCache } from './EntitySecondaryCacheLoader.ts';
2
2
  /**
3
3
  * A ISecondaryEntityCache that composes other ISecondaryEntityCache instances.
4
4
  */
@@ -1,14 +1,8 @@
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.ComposedSecondaryEntityCache = void 0;
7
- const nullthrows_1 = __importDefault(require("nullthrows"));
1
+ import nullthrows from '@expo/nullthrows';
8
2
  /**
9
3
  * A ISecondaryEntityCache that composes other ISecondaryEntityCache instances.
10
4
  */
11
- class ComposedSecondaryEntityCache {
5
+ export class ComposedSecondaryEntityCache {
12
6
  secondaryEntityCaches;
13
7
  /**
14
8
  * @param secondaryEntityCaches - list of caches to compose in order of precedence.
@@ -26,15 +20,13 @@ class ComposedSecondaryEntityCache {
26
20
  return await fetcher(loadParamsArray);
27
21
  }
28
22
  const [firstCache, ...restCaches] = secondaryEntityCaches;
29
- return await (0, nullthrows_1.default)(firstCache).loadManyThroughAsync(loadParamsArray, (fetcherLoadParamsArray) => ComposedSecondaryEntityCache.loadManyThroughRecursivelyAsync(restCaches, fetcherLoadParamsArray, fetcher));
23
+ return await nullthrows(firstCache).loadManyThroughAsync(loadParamsArray, (fetcherLoadParamsArray) => ComposedSecondaryEntityCache.loadManyThroughRecursivelyAsync(restCaches, fetcherLoadParamsArray, fetcher));
30
24
  }
31
25
  async invalidateManyAsync(loadParamsArray) {
32
26
  // invalidate lower layers first
33
27
  for (let i = this.secondaryEntityCaches.length - 1; i >= 0; i--) {
34
- const secondaryEntityCache = (0, nullthrows_1.default)(this.secondaryEntityCaches[i]);
28
+ const secondaryEntityCache = nullthrows(this.secondaryEntityCaches[i]);
35
29
  await secondaryEntityCache.invalidateManyAsync(loadParamsArray);
36
30
  }
37
31
  }
38
32
  }
39
- exports.ComposedSecondaryEntityCache = ComposedSecondaryEntityCache;
40
- //# sourceMappingURL=ComposedSecondaryEntityCache.js.map
@@ -1,8 +1,8 @@
1
- import { AuthorizationResultBasedEntityAssociationLoader, EntityLoadThroughDirective } from './AuthorizationResultBasedEntityAssociationLoader';
2
- import { IEntityClass } from './Entity';
3
- import { EntityPrivacyPolicy } from './EntityPrivacyPolicy';
4
- import { ReadonlyEntity } from './ReadonlyEntity';
5
- import { ViewerContext } from './ViewerContext';
1
+ import type { AuthorizationResultBasedEntityAssociationLoader, EntityLoadThroughDirective } from './AuthorizationResultBasedEntityAssociationLoader.ts';
2
+ import type { IEntityClass } from './Entity.ts';
3
+ import type { EntityPrivacyPolicy } from './EntityPrivacyPolicy.ts';
4
+ import type { ReadonlyEntity } from './ReadonlyEntity.ts';
5
+ import type { ViewerContext } from './ViewerContext.ts';
6
6
  /**
7
7
  * An association loader is a set of convenience methods for loading entities
8
8
  * associated with an entity. In relational databases, these entities are often referenced
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnforcingEntityAssociationLoader = void 0;
4
- const results_1 = require("@expo/results");
5
- const entityUtils_1 = require("./entityUtils");
1
+ import { enforceAsyncResult } from '@expo/results';
2
+ import { enforceResultsAsync } from "./entityUtils.js";
6
3
  /**
7
4
  * An association loader is a set of convenience methods for loading entities
8
5
  * associated with an entity. In relational databases, these entities are often referenced
9
6
  * by foreign keys.
10
7
  */
11
- class EnforcingEntityAssociationLoader {
8
+ export class EnforcingEntityAssociationLoader {
12
9
  authorizationResultBasedEntityAssociationLoader;
13
10
  constructor(authorizationResultBasedEntityAssociationLoader) {
14
11
  this.authorizationResultBasedEntityAssociationLoader = authorizationResultBasedEntityAssociationLoader;
@@ -20,7 +17,7 @@ class EnforcingEntityAssociationLoader {
20
17
  * @param associatedEntityClass - class of the associated entity
21
18
  */
22
19
  async loadAssociatedEntityAsync(fieldIdentifyingAssociatedEntity, associatedEntityClass) {
23
- return await (0, results_1.enforceAsyncResult)(this.authorizationResultBasedEntityAssociationLoader.loadAssociatedEntityAsync(fieldIdentifyingAssociatedEntity, associatedEntityClass));
20
+ return await enforceAsyncResult(this.authorizationResultBasedEntityAssociationLoader.loadAssociatedEntityAsync(fieldIdentifyingAssociatedEntity, associatedEntityClass));
24
21
  }
25
22
  /**
26
23
  * Load many entities associated with this entity, often referred to as entites belonging
@@ -31,7 +28,7 @@ class EnforcingEntityAssociationLoader {
31
28
  * @param associatedEntityFieldContainingThisID - field of associated entity which contains the ID of this entity
32
29
  */
33
30
  async loadManyAssociatedEntitiesAsync(associatedEntityClass, associatedEntityFieldContainingThisID) {
34
- return await (0, entityUtils_1.enforceResultsAsync)(this.authorizationResultBasedEntityAssociationLoader.loadManyAssociatedEntitiesAsync(associatedEntityClass, associatedEntityFieldContainingThisID));
31
+ return await enforceResultsAsync(this.authorizationResultBasedEntityAssociationLoader.loadManyAssociatedEntitiesAsync(associatedEntityClass, associatedEntityFieldContainingThisID));
35
32
  }
36
33
  /**
37
34
  * Load an associated entity identified by a field value of this entity. In a relational database,
@@ -52,12 +49,10 @@ class EnforcingEntityAssociationLoader {
52
49
  * @param associatedEntityLookupByField - field of associated entities with which to look up the associated entities
53
50
  */
54
51
  async loadManyAssociatedEntitiesByFieldEqualingAsync(fieldIdentifyingAssociatedEntity, associatedEntityClass, associatedEntityLookupByField) {
55
- return await (0, entityUtils_1.enforceResultsAsync)(this.authorizationResultBasedEntityAssociationLoader.loadManyAssociatedEntitiesByFieldEqualingAsync(fieldIdentifyingAssociatedEntity, associatedEntityClass, associatedEntityLookupByField));
52
+ return await enforceResultsAsync(this.authorizationResultBasedEntityAssociationLoader.loadManyAssociatedEntitiesByFieldEqualingAsync(fieldIdentifyingAssociatedEntity, associatedEntityClass, associatedEntityLookupByField));
56
53
  }
57
54
  async loadAssociatedEntityThroughAsync(loadDirectives) {
58
55
  const result = await this.authorizationResultBasedEntityAssociationLoader.loadAssociatedEntityThroughAsync(loadDirectives);
59
56
  return result?.enforceValue() ?? null;
60
57
  }
61
58
  }
62
- exports.EnforcingEntityAssociationLoader = EnforcingEntityAssociationLoader;
63
- //# sourceMappingURL=EnforcingEntityAssociationLoader.js.map
@@ -1,7 +1,7 @@
1
- import { AuthorizationResultBasedCreateMutator } from './AuthorizationResultBasedEntityMutator';
2
- import { EntityPrivacyPolicy } from './EntityPrivacyPolicy';
3
- import { ReadonlyEntity } from './ReadonlyEntity';
4
- import { ViewerContext } from './ViewerContext';
1
+ import type { AuthorizationResultBasedCreateMutator } from './AuthorizationResultBasedEntityMutator.ts';
2
+ import type { EntityPrivacyPolicy } from './EntityPrivacyPolicy.ts';
3
+ import type { ReadonlyEntity } from './ReadonlyEntity.ts';
4
+ import type { ViewerContext } from './ViewerContext.ts';
5
5
  /**
6
6
  * Enforcing entity creator. All creates
7
7
  * through this creator will throw if authorization is not successful.
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnforcingEntityCreator = void 0;
4
- const results_1 = require("@expo/results");
1
+ import { enforceAsyncResult } from '@expo/results';
5
2
  /**
6
3
  * Enforcing entity creator. All creates
7
4
  * through this creator will throw if authorization is not successful.
8
5
  */
9
- class EnforcingEntityCreator {
6
+ export class EnforcingEntityCreator {
10
7
  entityCreator;
11
8
  constructor(entityCreator) {
12
9
  this.entityCreator = entityCreator;
@@ -26,8 +23,6 @@ class EnforcingEntityCreator {
26
23
  * @returns authorized, cached, newly-created entity, throwing if unsuccessful
27
24
  */
28
25
  async createAsync() {
29
- return await (0, results_1.enforceAsyncResult)(this.entityCreator.createAsync());
26
+ return await enforceAsyncResult(this.entityCreator.createAsync());
30
27
  }
31
28
  }
32
- exports.EnforcingEntityCreator = EnforcingEntityCreator;
33
- //# sourceMappingURL=EnforcingEntityCreator.js.map
@@ -1,7 +1,7 @@
1
- import { AuthorizationResultBasedDeleteMutator } from './AuthorizationResultBasedEntityMutator';
2
- import { EntityPrivacyPolicy } from './EntityPrivacyPolicy';
3
- import { ReadonlyEntity } from './ReadonlyEntity';
4
- import { ViewerContext } from './ViewerContext';
1
+ import type { AuthorizationResultBasedDeleteMutator } from './AuthorizationResultBasedEntityMutator.ts';
2
+ import type { EntityPrivacyPolicy } from './EntityPrivacyPolicy.ts';
3
+ import type { ReadonlyEntity } from './ReadonlyEntity.ts';
4
+ import type { ViewerContext } from './ViewerContext.ts';
5
5
  /**
6
6
  * Enforcing entity deleter. All deletes
7
7
  * through this deleter will throw if authorization is not successful.
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnforcingEntityDeleter = void 0;
4
- const results_1 = require("@expo/results");
1
+ import { enforceAsyncResult } from '@expo/results';
5
2
  /**
6
3
  * Enforcing entity deleter. All deletes
7
4
  * through this deleter will throw if authorization is not successful.
8
5
  */
9
- class EnforcingEntityDeleter {
6
+ export class EnforcingEntityDeleter {
10
7
  entityDeleter;
11
8
  constructor(entityDeleter) {
12
9
  this.entityDeleter = entityDeleter;
@@ -16,8 +13,6 @@ class EnforcingEntityDeleter {
16
13
  * Throws when delete is not successful.
17
14
  */
18
15
  async deleteAsync() {
19
- await (0, results_1.enforceAsyncResult)(this.entityDeleter.deleteAsync());
16
+ await enforceAsyncResult(this.entityDeleter.deleteAsync());
20
17
  }
21
18
  }
22
- exports.EnforcingEntityDeleter = EnforcingEntityDeleter;
23
- //# sourceMappingURL=EnforcingEntityDeleter.js.map
@@ -1,8 +1,8 @@
1
- import { AuthorizationResultBasedEntityLoader } from './AuthorizationResultBasedEntityLoader';
2
- import { EntityCompositeField, EntityCompositeFieldValue } from './EntityConfiguration';
3
- import { EntityPrivacyPolicy } from './EntityPrivacyPolicy';
4
- import { ReadonlyEntity } from './ReadonlyEntity';
5
- import { ViewerContext } from './ViewerContext';
1
+ import type { AuthorizationResultBasedEntityLoader } from './AuthorizationResultBasedEntityLoader.ts';
2
+ import type { EntityCompositeField, EntityCompositeFieldValue } from './EntityConfiguration.ts';
3
+ import type { EntityPrivacyPolicy } from './EntityPrivacyPolicy.ts';
4
+ import type { ReadonlyEntity } from './ReadonlyEntity.ts';
5
+ import type { ViewerContext } from './ViewerContext.ts';
6
6
  /**
7
7
  * Enforcing entity loader. All normal loads are batched,
8
8
  * cached, and authorized against the entity's EntityPrivacyPolicy. All loads
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnforcingEntityLoader = void 0;
4
- const CompositeFieldHolder_1 = require("./internal/CompositeFieldHolder");
5
- const CompositeFieldValueMap_1 = require("./internal/CompositeFieldValueMap");
6
- const maps_1 = require("./utils/collections/maps");
1
+ import { CompositeFieldValueHolder } from "./internal/CompositeFieldHolder.js";
2
+ import { CompositeFieldValueMap } from "./internal/CompositeFieldValueMap.js";
3
+ import { mapMap } from "./utils/collections/maps.js";
7
4
  /**
8
5
  * Enforcing entity loader. All normal loads are batched,
9
6
  * cached, and authorized against the entity's EntityPrivacyPolicy. All loads
10
7
  * through this loader will throw if the load is not successful.
11
8
  */
12
- class EnforcingEntityLoader {
9
+ export class EnforcingEntityLoader {
13
10
  entityLoader;
14
11
  constructor(entityLoader) {
15
12
  this.entityLoader = entityLoader;
@@ -23,7 +20,7 @@ class EnforcingEntityLoader {
23
20
  */
24
21
  async loadManyByFieldEqualingManyAsync(fieldName, fieldValues) {
25
22
  const fieldValuesToResults = await this.entityLoader.loadManyByFieldEqualingManyAsync(fieldName, fieldValues);
26
- return (0, maps_1.mapMap)(fieldValuesToResults, (results) => results.map((result) => result.enforceValue()));
23
+ return mapMap(fieldValuesToResults, (results) => results.map((result) => result.enforceValue()));
27
24
  }
28
25
  /**
29
26
  * Load many entities where compositeField is one of compositeFieldValues.
@@ -34,9 +31,9 @@ class EnforcingEntityLoader {
34
31
  */
35
32
  async loadManyByCompositeFieldEqualingManyAsync(compositeField, compositeFieldValues) {
36
33
  const compositeFieldValuesToResults = await this.entityLoader.loadManyByCompositeFieldEqualingManyAsync(compositeField, compositeFieldValues);
37
- return new CompositeFieldValueMap_1.CompositeFieldValueMap(Array.from(compositeFieldValuesToResults.entries()).map(([compositeFieldValue, results]) => {
34
+ return new CompositeFieldValueMap(Array.from(compositeFieldValuesToResults.entries()).map(([compositeFieldValue, results]) => {
38
35
  return [
39
- new CompositeFieldHolder_1.CompositeFieldValueHolder(compositeFieldValue),
36
+ new CompositeFieldValueHolder(compositeFieldValue),
40
37
  results.map((result) => result.enforceValue()),
41
38
  ];
42
39
  }));
@@ -118,7 +115,7 @@ class EnforcingEntityLoader {
118
115
  */
119
116
  async loadManyByIDsAsync(ids) {
120
117
  const entityResults = await this.entityLoader.loadManyByIDsAsync(ids);
121
- return (0, maps_1.mapMap)(entityResults, (result) => result.enforceValue());
118
+ return mapMap(entityResults, (result) => result.enforceValue());
122
119
  }
123
120
  /**
124
121
  * Loads many entities for a list of IDs, returning null for any IDs that are non-existent.
@@ -128,8 +125,6 @@ class EnforcingEntityLoader {
128
125
  */
129
126
  async loadManyByIDsNullableAsync(ids) {
130
127
  const entityResults = await this.entityLoader.loadManyByIDsNullableAsync(ids);
131
- return (0, maps_1.mapMap)(entityResults, (result) => result?.enforceValue() ?? null);
128
+ return mapMap(entityResults, (result) => result?.enforceValue() ?? null);
132
129
  }
133
130
  }
134
- exports.EnforcingEntityLoader = EnforcingEntityLoader;
135
- //# sourceMappingURL=EnforcingEntityLoader.js.map
@@ -1,7 +1,7 @@
1
- import { AuthorizationResultBasedUpdateMutator } from './AuthorizationResultBasedEntityMutator';
2
- import { EntityPrivacyPolicy } from './EntityPrivacyPolicy';
3
- import { ReadonlyEntity } from './ReadonlyEntity';
4
- import { ViewerContext } from './ViewerContext';
1
+ import type { AuthorizationResultBasedUpdateMutator } from './AuthorizationResultBasedEntityMutator.ts';
2
+ import type { EntityPrivacyPolicy } from './EntityPrivacyPolicy.ts';
3
+ import type { ReadonlyEntity } from './ReadonlyEntity.ts';
4
+ import type { ViewerContext } from './ViewerContext.ts';
5
5
  /**
6
6
  * Enforcing entity updater. All updates
7
7
  * through this updater will throw if authorization is not successful.
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnforcingEntityUpdater = void 0;
4
- const results_1 = require("@expo/results");
1
+ import { enforceAsyncResult } from '@expo/results';
5
2
  /**
6
3
  * Enforcing entity updater. All updates
7
4
  * through this updater will throw if authorization is not successful.
8
5
  */
9
- class EnforcingEntityUpdater {
6
+ export class EnforcingEntityUpdater {
10
7
  entityUpdater;
11
8
  constructor(entityUpdater) {
12
9
  this.entityUpdater = entityUpdater;
@@ -26,8 +23,6 @@ class EnforcingEntityUpdater {
26
23
  * @returns authorized updated entity, throws upon update failure
27
24
  */
28
25
  async updateAsync() {
29
- return await (0, results_1.enforceAsyncResult)(this.entityUpdater.updateAsync());
26
+ return await enforceAsyncResult(this.entityUpdater.updateAsync());
30
27
  }
31
28
  }
32
- exports.EnforcingEntityUpdater = EnforcingEntityUpdater;
33
- //# sourceMappingURL=EnforcingEntityUpdater.js.map
@@ -1,12 +1,12 @@
1
- import { AuthorizationResultBasedCreateMutator, AuthorizationResultBasedDeleteMutator, AuthorizationResultBasedUpdateMutator } from './AuthorizationResultBasedEntityMutator';
2
- import { EnforcingEntityCreator } from './EnforcingEntityCreator';
3
- import { EnforcingEntityDeleter } from './EnforcingEntityDeleter';
4
- import { EnforcingEntityUpdater } from './EnforcingEntityUpdater';
5
- import { EntityCompanionDefinition } from './EntityCompanionProvider';
6
- import { EntityPrivacyPolicy } from './EntityPrivacyPolicy';
7
- import { EntityQueryContext } from './EntityQueryContext';
8
- import { ReadonlyEntity } from './ReadonlyEntity';
9
- import { ViewerContext } from './ViewerContext';
1
+ import type { AuthorizationResultBasedCreateMutator, AuthorizationResultBasedDeleteMutator, AuthorizationResultBasedUpdateMutator } from './AuthorizationResultBasedEntityMutator.ts';
2
+ import type { EnforcingEntityCreator } from './EnforcingEntityCreator.ts';
3
+ import type { EnforcingEntityDeleter } from './EnforcingEntityDeleter.ts';
4
+ import type { EnforcingEntityUpdater } from './EnforcingEntityUpdater.ts';
5
+ import type { EntityCompanionDefinition } from './EntityCompanionProvider.ts';
6
+ import type { EntityPrivacyPolicy } from './EntityPrivacyPolicy.ts';
7
+ import type { EntityQueryContext } from './EntityQueryContext.ts';
8
+ import { ReadonlyEntity } from './ReadonlyEntity.ts';
9
+ import type { ViewerContext } from './ViewerContext.ts';
10
10
  /**
11
11
  * Entity is a privacy-first data model.
12
12
  *
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Entity = void 0;
4
- const EntityCreator_1 = require("./EntityCreator");
5
- const EntityDeleter_1 = require("./EntityDeleter");
6
- const EntityUpdater_1 = require("./EntityUpdater");
7
- const ReadonlyEntity_1 = require("./ReadonlyEntity");
1
+ import { EntityCreator } from "./EntityCreator.js";
2
+ import { EntityDeleter } from "./EntityDeleter.js";
3
+ import { EntityUpdater } from "./EntityUpdater.js";
4
+ import { ReadonlyEntity } from "./ReadonlyEntity.js";
8
5
  /**
9
6
  * Entity is a privacy-first data model.
10
7
  *
@@ -29,7 +26,7 @@ const ReadonlyEntity_1 = require("./ReadonlyEntity");
29
26
  * TViewerContext - the type of ViewerContext that can be used with this entity
30
27
  * TSelectedFields - the keys of fields in TFields that belong to this entity; used when there are multiple entities backed by the same underlying table with different field subsets
31
28
  */
32
- class Entity extends ReadonlyEntity_1.ReadonlyEntity {
29
+ export class Entity extends ReadonlyEntity {
33
30
  /**
34
31
  * Vend mutator for creating a new entity in given query context.
35
32
  * @param viewerContext - viewer context of creating user
@@ -40,7 +37,7 @@ class Entity extends ReadonlyEntity_1.ReadonlyEntity {
40
37
  .getViewerScopedEntityCompanionForClass(this)
41
38
  .getQueryContextProvider()
42
39
  .getQueryContext()) {
43
- return new EntityCreator_1.EntityCreator(viewerContext, queryContext, this).enforcing();
40
+ return new EntityCreator(viewerContext, queryContext, this).enforcing();
44
41
  }
45
42
  /**
46
43
  * Vend mutator for creating a new entity in given query context.
@@ -52,7 +49,7 @@ class Entity extends ReadonlyEntity_1.ReadonlyEntity {
52
49
  .getViewerScopedEntityCompanionForClass(this)
53
50
  .getQueryContextProvider()
54
51
  .getQueryContext()) {
55
- return new EntityCreator_1.EntityCreator(viewerContext, queryContext, this).withAuthorizationResults();
52
+ return new EntityCreator(viewerContext, queryContext, this).withAuthorizationResults();
56
53
  }
57
54
  /**
58
55
  * Vend mutator for updating an existing entity in given query context.
@@ -65,7 +62,7 @@ class Entity extends ReadonlyEntity_1.ReadonlyEntity {
65
62
  .getViewerScopedEntityCompanionForClass(this)
66
63
  .getQueryContextProvider()
67
64
  .getQueryContext()) {
68
- return new EntityUpdater_1.EntityUpdater(existingEntity, queryContext, this).enforcing();
65
+ return new EntityUpdater(existingEntity, queryContext, this).enforcing();
69
66
  }
70
67
  /**
71
68
  * Vend mutator for updating an existing entity in given query context.
@@ -78,7 +75,7 @@ class Entity extends ReadonlyEntity_1.ReadonlyEntity {
78
75
  .getViewerScopedEntityCompanionForClass(this)
79
76
  .getQueryContextProvider()
80
77
  .getQueryContext()) {
81
- return new EntityUpdater_1.EntityUpdater(existingEntity, queryContext, this).withAuthorizationResults();
78
+ return new EntityUpdater(existingEntity, queryContext, this).withAuthorizationResults();
82
79
  }
83
80
  /**
84
81
  * Vend mutator for deleting an existing entity in given query context.
@@ -91,7 +88,7 @@ class Entity extends ReadonlyEntity_1.ReadonlyEntity {
91
88
  .getViewerScopedEntityCompanionForClass(this)
92
89
  .getQueryContextProvider()
93
90
  .getQueryContext()) {
94
- return new EntityDeleter_1.EntityDeleter(existingEntity, queryContext, this).enforcing();
91
+ return new EntityDeleter(existingEntity, queryContext, this).enforcing();
95
92
  }
96
93
  /**
97
94
  * Vend mutator for deleting an existing entity in given query context.
@@ -104,8 +101,6 @@ class Entity extends ReadonlyEntity_1.ReadonlyEntity {
104
101
  .getViewerScopedEntityCompanionForClass(this)
105
102
  .getQueryContextProvider()
106
103
  .getQueryContext()) {
107
- return new EntityDeleter_1.EntityDeleter(existingEntity, queryContext, this).withAuthorizationResults();
104
+ return new EntityDeleter(existingEntity, queryContext, this).withAuthorizationResults();
108
105
  }
109
106
  }
110
- exports.Entity = Entity;
111
- //# sourceMappingURL=Entity.js.map
@@ -1,8 +1,8 @@
1
- import { AuthorizationResultBasedEntityAssociationLoader } from './AuthorizationResultBasedEntityAssociationLoader';
2
- import { EnforcingEntityAssociationLoader } from './EnforcingEntityAssociationLoader';
3
- import { EntityQueryContext } from './EntityQueryContext';
4
- import { ReadonlyEntity } from './ReadonlyEntity';
5
- import { ViewerContext } from './ViewerContext';
1
+ import { AuthorizationResultBasedEntityAssociationLoader } from './AuthorizationResultBasedEntityAssociationLoader.ts';
2
+ import { EnforcingEntityAssociationLoader } from './EnforcingEntityAssociationLoader.ts';
3
+ import type { EntityQueryContext } from './EntityQueryContext.ts';
4
+ import type { ReadonlyEntity } from './ReadonlyEntity.ts';
5
+ import type { ViewerContext } from './ViewerContext.ts';
6
6
  /**
7
7
  * An association loader is a set of convenience methods for loading entities
8
8
  * associated with an entity. In relational databases, these entities are often referenced
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntityAssociationLoader = void 0;
4
- const AuthorizationResultBasedEntityAssociationLoader_1 = require("./AuthorizationResultBasedEntityAssociationLoader");
5
- const EnforcingEntityAssociationLoader_1 = require("./EnforcingEntityAssociationLoader");
1
+ import { AuthorizationResultBasedEntityAssociationLoader } from "./AuthorizationResultBasedEntityAssociationLoader.js";
2
+ import { EnforcingEntityAssociationLoader } from "./EnforcingEntityAssociationLoader.js";
6
3
  /**
7
4
  * An association loader is a set of convenience methods for loading entities
8
5
  * associated with an entity. In relational databases, these entities are often referenced
9
6
  * by foreign keys.
10
7
  */
11
- class EntityAssociationLoader {
8
+ export class EntityAssociationLoader {
12
9
  entity;
13
10
  queryContext;
14
11
  constructor(entity, queryContext = entity
@@ -25,7 +22,7 @@ class EntityAssociationLoader {
25
22
  * and will throw otherwise.
26
23
  */
27
24
  enforcing() {
28
- return new EnforcingEntityAssociationLoader_1.EnforcingEntityAssociationLoader(this.withAuthorizationResults());
25
+ return new EnforcingEntityAssociationLoader(this.withAuthorizationResults());
29
26
  }
30
27
  /**
31
28
  * Authorization-result-based entity loader. All loads through this
@@ -33,8 +30,6 @@ class EntityAssociationLoader {
33
30
  * means an authorization error or entity construction error occurred. Other errors are thrown.
34
31
  */
35
32
  withAuthorizationResults() {
36
- return new AuthorizationResultBasedEntityAssociationLoader_1.AuthorizationResultBasedEntityAssociationLoader(this.entity, this.queryContext);
33
+ return new AuthorizationResultBasedEntityAssociationLoader(this.entity, this.queryContext);
37
34
  }
38
35
  }
39
- exports.EntityAssociationLoader = EntityAssociationLoader;
40
- //# sourceMappingURL=EntityAssociationLoader.js.map
@@ -1,12 +1,12 @@
1
- import { EntityCompanionDefinition, EntityCompanionProvider } from './EntityCompanionProvider';
2
- import { EntityLoaderFactory } from './EntityLoaderFactory';
3
- import { EntityMutatorFactory } from './EntityMutatorFactory';
4
- import { EntityPrivacyPolicy } from './EntityPrivacyPolicy';
5
- import { EntityQueryContextProvider } from './EntityQueryContextProvider';
6
- import { ReadonlyEntity } from './ReadonlyEntity';
7
- import { ViewerContext } from './ViewerContext';
8
- import { EntityTableDataCoordinator } from './internal/EntityTableDataCoordinator';
9
- import { IEntityMetricsAdapter } from './metrics/IEntityMetricsAdapter';
1
+ import type { EntityCompanionDefinition, EntityCompanionProvider } from './EntityCompanionProvider.ts';
2
+ import { EntityLoaderFactory } from './EntityLoaderFactory.ts';
3
+ import { EntityMutatorFactory } from './EntityMutatorFactory.ts';
4
+ import type { EntityPrivacyPolicy } from './EntityPrivacyPolicy.ts';
5
+ import type { EntityQueryContextProvider } from './EntityQueryContextProvider.ts';
6
+ import type { ReadonlyEntity } from './ReadonlyEntity.ts';
7
+ import type { ViewerContext } from './ViewerContext.ts';
8
+ import type { EntityTableDataCoordinator } from './internal/EntityTableDataCoordinator.ts';
9
+ import type { IEntityMetricsAdapter } from './metrics/IEntityMetricsAdapter.ts';
10
10
  export interface IPrivacyPolicyClass<TPrivacyPolicy> {
11
11
  new (): TPrivacyPolicy;
12
12
  }
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EntityCompanion = void 0;
4
- const EntityLoaderFactory_1 = require("./EntityLoaderFactory");
5
- const EntityMutatorFactory_1 = require("./EntityMutatorFactory");
6
- const mergeEntityMutationTriggerConfigurations_1 = require("./utils/mergeEntityMutationTriggerConfigurations");
1
+ import { EntityLoaderFactory } from "./EntityLoaderFactory.js";
2
+ import { EntityMutatorFactory } from "./EntityMutatorFactory.js";
3
+ import { mergeEntityMutationTriggerConfigurations } from "./utils/mergeEntityMutationTriggerConfigurations.js";
7
4
  /**
8
5
  * Composition root responsible for orchestrating setup of Entity mutators and loaders.
9
6
  */
10
- class EntityCompanion {
7
+ export class EntityCompanion {
11
8
  entityCompanionProvider;
12
9
  entityCompanionDefinition;
13
10
  tableDataCoordinator;
@@ -21,8 +18,8 @@ class EntityCompanion {
21
18
  this.tableDataCoordinator = tableDataCoordinator;
22
19
  this.metricsAdapter = metricsAdapter;
23
20
  this.privacyPolicy = new entityCompanionDefinition.privacyPolicyClass();
24
- this.entityLoaderFactory = new EntityLoaderFactory_1.EntityLoaderFactory(this, tableDataCoordinator.dataManager, metricsAdapter);
25
- this.entityMutatorFactory = new EntityMutatorFactory_1.EntityMutatorFactory(entityCompanionProvider, tableDataCoordinator.entityConfiguration, entityCompanionDefinition.entityClass, this.privacyPolicy, entityCompanionDefinition.mutationValidators ?? {}, (0, mergeEntityMutationTriggerConfigurations_1.mergeEntityMutationTriggerConfigurations)(entityCompanionDefinition.mutationTriggers ?? {}, entityCompanionProvider.globalMutationTriggers ?? {}), this.entityLoaderFactory, tableDataCoordinator.databaseAdapter, metricsAdapter);
21
+ this.entityLoaderFactory = new EntityLoaderFactory(this, tableDataCoordinator.dataManager, metricsAdapter);
22
+ this.entityMutatorFactory = new EntityMutatorFactory(entityCompanionProvider, tableDataCoordinator.entityConfiguration, entityCompanionDefinition.entityClass, this.privacyPolicy, entityCompanionDefinition.mutationValidators ?? {}, mergeEntityMutationTriggerConfigurations(entityCompanionDefinition.mutationTriggers ?? {}, entityCompanionProvider.globalMutationTriggers ?? {}), this.entityLoaderFactory, tableDataCoordinator.databaseAdapter, metricsAdapter);
26
23
  }
27
24
  getLoaderFactory() {
28
25
  return this.entityLoaderFactory;
@@ -43,5 +40,3 @@ class EntityCompanion {
43
40
  return this.metricsAdapter;
44
41
  }
45
42
  }
46
- exports.EntityCompanion = EntityCompanion;
47
- //# sourceMappingURL=EntityCompanion.js.map