@expo/entity 0.31.1 → 0.32.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 (255) hide show
  1. package/build/ComposedEntityCacheAdapter.d.ts +4 -6
  2. package/build/ComposedEntityCacheAdapter.js +3 -6
  3. package/build/ComposedEntityCacheAdapter.js.map +1 -1
  4. package/build/EnforcingEntityLoader.d.ts +1 -1
  5. package/build/Entity.d.ts +20 -10
  6. package/build/Entity.js +2 -2
  7. package/build/Entity.js.map +1 -1
  8. package/build/EntityAssociationLoader.d.ts +9 -9
  9. package/build/EntityCompanion.d.ts +6 -5
  10. package/build/EntityCompanion.js +6 -4
  11. package/build/EntityCompanion.js.map +1 -1
  12. package/build/EntityCompanionProvider.d.ts +28 -36
  13. package/build/EntityCompanionProvider.js +4 -19
  14. package/build/EntityCompanionProvider.js.map +1 -1
  15. package/build/EntityConfiguration.d.ts +3 -3
  16. package/build/EntityConfiguration.js +2 -2
  17. package/build/EntityConfiguration.js.map +1 -1
  18. package/build/EntityDatabaseAdapter.d.ts +1 -1
  19. package/build/EntityDatabaseAdapter.js +1 -1
  20. package/build/EntityDatabaseAdapter.js.map +1 -1
  21. package/build/EntityFieldDefinition.d.ts +2 -2
  22. package/build/EntityFieldDefinition.js +1 -1
  23. package/build/EntityFieldDefinition.js.map +1 -1
  24. package/build/EntityLoader.d.ts +4 -2
  25. package/build/EntityLoader.js +21 -7
  26. package/build/EntityLoader.js.map +1 -1
  27. package/build/EntityLoaderFactory.d.ts +4 -7
  28. package/build/EntityLoaderFactory.js +3 -5
  29. package/build/EntityLoaderFactory.js.map +1 -1
  30. package/build/EntityMutationInfo.d.ts +3 -3
  31. package/build/EntityMutationInfo.js +1 -1
  32. package/build/EntityMutationInfo.js.map +1 -1
  33. package/build/EntityMutationTriggerConfiguration.d.ts +3 -3
  34. package/build/EntityMutationValidator.d.ts +1 -1
  35. package/build/EntityMutator.d.ts +9 -7
  36. package/build/EntityMutator.js +21 -21
  37. package/build/EntityMutator.js.map +1 -1
  38. package/build/EntityMutatorFactory.d.ts +4 -2
  39. package/build/EntityMutatorFactory.js +5 -4
  40. package/build/EntityMutatorFactory.js.map +1 -1
  41. package/build/EntityPrivacyPolicy.d.ts +3 -3
  42. package/build/EntityPrivacyPolicy.js +2 -2
  43. package/build/EntityPrivacyPolicy.js.map +1 -1
  44. package/build/EntityQueryContext.d.ts +13 -5
  45. package/build/EntityQueryContext.js +11 -4
  46. package/build/EntityQueryContext.js.map +1 -1
  47. package/build/EntityQueryContextProvider.d.ts +3 -3
  48. package/build/EntityQueryContextProvider.js +2 -2
  49. package/build/EntityQueryContextProvider.js.map +1 -1
  50. package/build/EntitySecondaryCacheLoader.d.ts +1 -1
  51. package/build/EntitySecondaryCacheLoader.js +1 -1
  52. package/build/EntitySecondaryCacheLoader.js.map +1 -1
  53. package/build/GenericEntityCacheAdapter.d.ts +14 -0
  54. package/build/GenericEntityCacheAdapter.js +38 -0
  55. package/build/GenericEntityCacheAdapter.js.map +1 -0
  56. package/build/{EntityCacheAdapter.d.ts → IEntityCacheAdapter.d.ts} +5 -8
  57. package/build/IEntityCacheAdapter.js +3 -0
  58. package/build/IEntityCacheAdapter.js.map +1 -0
  59. package/build/IEntityCacheAdapterProvider.d.ts +2 -2
  60. package/build/IEntityGenericCacher.d.ts +31 -2
  61. package/build/ReadonlyEntity.d.ts +19 -7
  62. package/build/ReadonlyEntity.js +15 -13
  63. package/build/ReadonlyEntity.js.map +1 -1
  64. package/build/ViewerContext.d.ts +3 -3
  65. package/build/ViewerContext.js +3 -3
  66. package/build/ViewerContext.js.map +1 -1
  67. package/build/ViewerScopedEntityCompanion.d.ts +2 -2
  68. package/build/ViewerScopedEntityCompanion.js.map +1 -1
  69. package/build/ViewerScopedEntityCompanionProvider.d.ts +3 -3
  70. package/build/ViewerScopedEntityCompanionProvider.js +3 -3
  71. package/build/ViewerScopedEntityCompanionProvider.js.map +1 -1
  72. package/build/ViewerScopedEntityLoaderFactory.d.ts +1 -1
  73. package/build/ViewerScopedEntityMutatorFactory.d.ts +1 -1
  74. package/build/__tests__/ComposedCacheAdapter-test.js +4 -8
  75. package/build/__tests__/ComposedCacheAdapter-test.js.map +1 -1
  76. package/build/__tests__/EnforcingEntityLoader-test.js +1 -0
  77. package/build/__tests__/EnforcingEntityLoader-test.js.map +1 -1
  78. package/build/__tests__/Entity-test.js +42 -20
  79. package/build/__tests__/Entity-test.js.map +1 -1
  80. package/build/__tests__/EntityAssociationLoader-test.js +6 -6
  81. package/build/__tests__/EntityAssociationLoader-test.js.map +1 -1
  82. package/build/__tests__/EntityCommonUseCases-test.js +20 -22
  83. package/build/__tests__/EntityCommonUseCases-test.js.map +1 -1
  84. package/build/__tests__/EntityCompanion-test.js +2 -1
  85. package/build/__tests__/EntityCompanion-test.js.map +1 -1
  86. package/build/__tests__/EntityCompanionProvider-test.js +15 -40
  87. package/build/__tests__/EntityCompanionProvider-test.js.map +1 -1
  88. package/build/__tests__/EntityEdges-test.js +48 -54
  89. package/build/__tests__/EntityEdges-test.js.map +1 -1
  90. package/build/__tests__/EntityLoader-constructor-test.d.ts +9 -5
  91. package/build/__tests__/EntityLoader-constructor-test.js +13 -14
  92. package/build/__tests__/EntityLoader-constructor-test.js.map +1 -1
  93. package/build/__tests__/EntityLoader-test.js +19 -11
  94. package/build/__tests__/EntityLoader-test.js.map +1 -1
  95. package/build/__tests__/EntityMutator-MutationCacheConsistency-test.js +20 -22
  96. package/build/__tests__/EntityMutator-MutationCacheConsistency-test.js.map +1 -1
  97. package/build/__tests__/EntityMutator-test.js +67 -14
  98. package/build/__tests__/EntityMutator-test.js.map +1 -1
  99. package/build/__tests__/EntityPrivacyPolicy-test.js +82 -29
  100. package/build/__tests__/EntityPrivacyPolicy-test.js.map +1 -1
  101. package/build/__tests__/EntityQueryContext-test.js +12 -0
  102. package/build/__tests__/EntityQueryContext-test.js.map +1 -1
  103. package/build/__tests__/EntitySecondaryCacheLoader-test.js +1 -2
  104. package/build/__tests__/EntitySecondaryCacheLoader-test.js.map +1 -1
  105. package/build/__tests__/EntitySelfReferentialEdges-test.js +16 -20
  106. package/build/__tests__/EntitySelfReferentialEdges-test.js.map +1 -1
  107. package/build/__tests__/GenericEntityCacheAdapter-test.d.ts +1 -0
  108. package/build/__tests__/GenericEntityCacheAdapter-test.js +80 -0
  109. package/build/__tests__/GenericEntityCacheAdapter-test.js.map +1 -0
  110. package/build/__tests__/ReadonlyEntity-test.js +79 -13
  111. package/build/__tests__/ReadonlyEntity-test.js.map +1 -1
  112. package/build/__tests__/ViewerScopedEntityCompanionProvider-test.js +2 -25
  113. package/build/__tests__/ViewerScopedEntityCompanionProvider-test.js.map +1 -1
  114. package/build/__tests__/cases/TwoEntitySameTableDisjointRows-test.js +20 -23
  115. package/build/__tests__/cases/TwoEntitySameTableDisjointRows-test.js.map +1 -1
  116. package/build/__tests__/cases/TwoEntitySameTableOverlappingRows-test.js +17 -20
  117. package/build/__tests__/cases/TwoEntitySameTableOverlappingRows-test.js.map +1 -1
  118. package/build/errors/EntityError.js +2 -2
  119. package/build/errors/EntityError.js.map +1 -1
  120. package/build/errors/EntityInvalidFieldValueError.d.ts +2 -2
  121. package/build/errors/EntityInvalidFieldValueError.js.map +1 -1
  122. package/build/errors/EntityNotAuthorizedError.d.ts +2 -2
  123. package/build/errors/EntityNotAuthorizedError.js +1 -1
  124. package/build/errors/EntityNotAuthorizedError.js.map +1 -1
  125. package/build/errors/EntityNotFoundError.d.ts +2 -2
  126. package/build/errors/EntityNotFoundError.js.map +1 -1
  127. package/build/index.d.ts +2 -1
  128. package/build/index.js +3 -3
  129. package/build/index.js.map +1 -1
  130. package/build/internal/EntityDataManager.d.ts +1 -1
  131. package/build/internal/EntityDataManager.js +1 -1
  132. package/build/internal/EntityDataManager.js.map +1 -1
  133. package/build/internal/EntityFieldTransformationUtils.d.ts +1 -1
  134. package/build/internal/EntityFieldTransformationUtils.js +4 -4
  135. package/build/internal/EntityFieldTransformationUtils.js.map +1 -1
  136. package/build/internal/EntityTableDataCoordinator.d.ts +3 -3
  137. package/build/internal/EntityTableDataCoordinator.js.map +1 -1
  138. package/build/internal/ReadThroughEntityCache.d.ts +3 -3
  139. package/build/internal/ReadThroughEntityCache.js +1 -1
  140. package/build/internal/ReadThroughEntityCache.js.map +1 -1
  141. package/build/internal/__tests__/EntityDataManager-test.js +1 -1
  142. package/build/internal/__tests__/EntityDataManager-test.js.map +1 -1
  143. package/build/internal/__tests__/ReadThroughEntityCache-test.js.map +1 -1
  144. package/build/metrics/EntityMetricsUtils.js.map +1 -1
  145. package/build/metrics/IEntityMetricsAdapter.js +4 -4
  146. package/build/metrics/IEntityMetricsAdapter.js.map +1 -1
  147. package/build/rules/AlwaysAllowPrivacyPolicyRule.d.ts +2 -2
  148. package/build/rules/AlwaysAllowPrivacyPolicyRule.js.map +1 -1
  149. package/build/rules/AlwaysDenyPrivacyPolicyRule.d.ts +2 -2
  150. package/build/rules/AlwaysDenyPrivacyPolicyRule.js.map +1 -1
  151. package/build/rules/AlwaysSkipPrivacyPolicyRule.d.ts +2 -2
  152. package/build/rules/AlwaysSkipPrivacyPolicyRule.js.map +1 -1
  153. package/build/rules/PrivacyPolicyRule.d.ts +1 -1
  154. package/build/rules/PrivacyPolicyRule.js +1 -1
  155. package/build/rules/PrivacyPolicyRule.js.map +1 -1
  156. package/build/testfixtures/DateIDTestEntity.d.ts +2 -3
  157. package/build/testfixtures/DateIDTestEntity.js +7 -9
  158. package/build/testfixtures/DateIDTestEntity.js.map +1 -1
  159. package/build/testfixtures/SimpleTestEntity.d.ts +3 -4
  160. package/build/testfixtures/SimpleTestEntity.js +7 -9
  161. package/build/testfixtures/SimpleTestEntity.js.map +1 -1
  162. package/build/testfixtures/TestEntity.d.ts +2 -3
  163. package/build/testfixtures/TestEntity.js +14 -10
  164. package/build/testfixtures/TestEntity.js.map +1 -1
  165. package/build/testfixtures/TestEntity2.d.ts +2 -3
  166. package/build/testfixtures/TestEntity2.js +7 -9
  167. package/build/testfixtures/TestEntity2.js.map +1 -1
  168. package/build/testfixtures/TestEntityNumberKey.d.ts +2 -3
  169. package/build/testfixtures/TestEntityNumberKey.js +7 -9
  170. package/build/testfixtures/TestEntityNumberKey.js.map +1 -1
  171. package/build/utils/testing/PrivacyPolicyRuleTestUtils.d.ts +4 -4
  172. package/build/utils/testing/StubCacheAdapter.d.ts +6 -5
  173. package/build/utils/testing/StubCacheAdapter.js +5 -6
  174. package/build/utils/testing/StubCacheAdapter.js.map +1 -1
  175. package/build/utils/testing/StubDatabaseAdapterProvider.js.map +1 -1
  176. package/build/utils/testing/StubQueryContextProvider.d.ts +2 -1
  177. package/build/utils/testing/StubQueryContextProvider.js +1 -1
  178. package/build/utils/testing/StubQueryContextProvider.js.map +1 -1
  179. package/build/utils/testing/createUnitTestEntityCompanionProvider.js +2 -2
  180. package/build/utils/testing/createUnitTestEntityCompanionProvider.js.map +1 -1
  181. package/package.json +3 -3
  182. package/src/ComposedEntityCacheAdapter.ts +4 -11
  183. package/src/EnforcingEntityLoader.ts +1 -1
  184. package/src/Entity.ts +23 -12
  185. package/src/EntityAssociationLoader.ts +12 -12
  186. package/src/EntityCompanion.ts +13 -32
  187. package/src/EntityCompanionProvider.ts +41 -80
  188. package/src/EntityConfiguration.ts +4 -5
  189. package/src/EntityFieldDefinition.ts +2 -2
  190. package/src/EntityLoader.ts +19 -2
  191. package/src/EntityLoaderFactory.ts +7 -9
  192. package/src/EntityMutationInfo.ts +2 -2
  193. package/src/EntityMutationTriggerConfiguration.ts +3 -3
  194. package/src/EntityMutationValidator.ts +1 -1
  195. package/src/EntityMutator.ts +38 -31
  196. package/src/EntityMutatorFactory.ts +6 -1
  197. package/src/EntityPrivacyPolicy.ts +2 -2
  198. package/src/EntityQueryContext.ts +24 -4
  199. package/src/EntityQueryContextProvider.ts +7 -5
  200. package/src/EntitySecondaryCacheLoader.ts +1 -1
  201. package/src/GenericEntityCacheAdapter.ts +65 -0
  202. package/src/{EntityCacheAdapter.ts → IEntityCacheAdapter.ts} +5 -8
  203. package/src/IEntityCacheAdapterProvider.ts +2 -2
  204. package/src/IEntityGenericCacher.ts +32 -2
  205. package/src/ReadonlyEntity.ts +32 -32
  206. package/src/ViewerContext.ts +10 -8
  207. package/src/ViewerScopedEntityCompanion.ts +2 -2
  208. package/src/ViewerScopedEntityCompanionProvider.ts +4 -12
  209. package/src/ViewerScopedEntityLoaderFactory.ts +1 -1
  210. package/src/ViewerScopedEntityMutatorFactory.ts +1 -1
  211. package/src/__tests__/ComposedCacheAdapter-test.ts +6 -11
  212. package/src/__tests__/EnforcingEntityLoader-test.ts +1 -0
  213. package/src/__tests__/Entity-test.ts +42 -21
  214. package/src/__tests__/EntityCommonUseCases-test.ts +20 -22
  215. package/src/__tests__/EntityCompanion-test.ts +6 -9
  216. package/src/__tests__/EntityCompanionProvider-test.ts +14 -26
  217. package/src/__tests__/EntityEdges-test.ts +43 -49
  218. package/src/__tests__/EntityLoader-constructor-test.ts +16 -12
  219. package/src/__tests__/EntityLoader-test.ts +9 -0
  220. package/src/__tests__/EntityMutator-MutationCacheConsistency-test.ts +20 -22
  221. package/src/__tests__/EntityMutator-test.ts +119 -19
  222. package/src/__tests__/EntityPrivacyPolicy-test.ts +82 -29
  223. package/src/__tests__/EntityQueryContext-test.ts +23 -1
  224. package/src/__tests__/EntitySelfReferentialEdges-test.ts +8 -10
  225. package/src/__tests__/GenericEntityCacheAdapter-test.ts +102 -0
  226. package/src/__tests__/ReadonlyEntity-test.ts +79 -13
  227. package/src/__tests__/ViewerScopedEntityCompanionProvider-test.ts +2 -5
  228. package/src/__tests__/cases/TwoEntitySameTableDisjointRows-test.ts +30 -24
  229. package/src/__tests__/cases/TwoEntitySameTableOverlappingRows-test.ts +14 -18
  230. package/src/errors/EntityInvalidFieldValueError.ts +2 -2
  231. package/src/errors/EntityNotAuthorizedError.ts +2 -2
  232. package/src/errors/EntityNotFoundError.ts +2 -2
  233. package/src/index.ts +2 -1
  234. package/src/internal/EntityDataManager.ts +1 -1
  235. package/src/internal/EntityTableDataCoordinator.ts +4 -4
  236. package/src/internal/ReadThroughEntityCache.ts +2 -2
  237. package/src/internal/__tests__/EntityDataManager-test.ts +2 -1
  238. package/src/internal/__tests__/ReadThroughEntityCache-test.ts +8 -8
  239. package/src/metrics/EntityMetricsUtils.ts +1 -1
  240. package/src/rules/AlwaysAllowPrivacyPolicyRule.ts +2 -2
  241. package/src/rules/AlwaysDenyPrivacyPolicyRule.ts +2 -2
  242. package/src/rules/AlwaysSkipPrivacyPolicyRule.ts +2 -2
  243. package/src/rules/PrivacyPolicyRule.ts +1 -1
  244. package/src/testfixtures/DateIDTestEntity.ts +6 -8
  245. package/src/testfixtures/SimpleTestEntity.ts +6 -8
  246. package/src/testfixtures/TestEntity.ts +19 -15
  247. package/src/testfixtures/TestEntity2.ts +6 -8
  248. package/src/testfixtures/TestEntityNumberKey.ts +6 -8
  249. package/src/utils/testing/PrivacyPolicyRuleTestUtils.ts +4 -4
  250. package/src/utils/testing/StubCacheAdapter.ts +9 -11
  251. package/src/utils/testing/StubDatabaseAdapterProvider.ts +1 -1
  252. package/src/utils/testing/StubQueryContextProvider.ts +4 -3
  253. package/src/utils/testing/createUnitTestEntityCompanionProvider.ts +3 -3
  254. package/build/EntityCacheAdapter.js +0 -13
  255. package/build/EntityCacheAdapter.js.map +0 -1
@@ -1,19 +1,17 @@
1
- import EntityCacheAdapter from './EntityCacheAdapter';
2
- import EntityConfiguration from './EntityConfiguration';
1
+ import IEntityCacheAdapter from './IEntityCacheAdapter';
3
2
  import { CacheLoadResult } from './internal/ReadThroughEntityCache';
4
3
  /**
5
- * A EntityCacheAdapter that composes other EntityCacheAdapter instances.
4
+ * A IEntityCacheAdapter that composes other IEntityCacheAdapter instances.
6
5
  */
7
- export default class ComposedEntityCacheAdapter<TFields> extends EntityCacheAdapter<TFields> {
6
+ export default class ComposedEntityCacheAdapter<TFields> implements IEntityCacheAdapter<TFields> {
8
7
  private readonly cacheAdapters;
9
8
  /**
10
- * @param entityConfiguration - configuration for entity being loaded
11
9
  * @param cacheAdapters - list of cache adapters to compose in order of precedence.
12
10
  * Earlier cache adapters are read from first and written to (including invalidations) last.
13
11
  * Typically, caches closer to the application should be ordered before caches closer to the database.
14
12
  * A lower layer cache is closer to the database, while a higher layer cache is closer to the application.
15
13
  */
16
- constructor(entityConfiguration: EntityConfiguration<TFields>, cacheAdapters: EntityCacheAdapter<TFields>[]);
14
+ constructor(cacheAdapters: IEntityCacheAdapter<TFields>[]);
17
15
  loadManyAsync<N extends keyof TFields>(fieldName: N, fieldValues: readonly NonNullable<TFields[N]>[]): Promise<ReadonlyMap<NonNullable<TFields[N]>, CacheLoadResult<TFields>>>;
18
16
  cacheManyAsync<N extends keyof TFields>(fieldName: N, objectMap: ReadonlyMap<NonNullable<TFields[N]>, Readonly<TFields>>): Promise<void>;
19
17
  cacheDBMissesAsync<N extends keyof TFields>(fieldName: N, fieldValues: readonly NonNullable<TFields[N]>[]): Promise<void>;
@@ -4,21 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const nullthrows_1 = __importDefault(require("nullthrows"));
7
- const EntityCacheAdapter_1 = __importDefault(require("./EntityCacheAdapter"));
8
7
  const ReadThroughEntityCache_1 = require("./internal/ReadThroughEntityCache");
9
8
  /**
10
- * A EntityCacheAdapter that composes other EntityCacheAdapter instances.
9
+ * A IEntityCacheAdapter that composes other IEntityCacheAdapter instances.
11
10
  */
12
- class ComposedEntityCacheAdapter extends EntityCacheAdapter_1.default {
11
+ class ComposedEntityCacheAdapter {
13
12
  /**
14
- * @param entityConfiguration - configuration for entity being loaded
15
13
  * @param cacheAdapters - list of cache adapters to compose in order of precedence.
16
14
  * Earlier cache adapters are read from first and written to (including invalidations) last.
17
15
  * Typically, caches closer to the application should be ordered before caches closer to the database.
18
16
  * A lower layer cache is closer to the database, while a higher layer cache is closer to the application.
19
17
  */
20
- constructor(entityConfiguration, cacheAdapters) {
21
- super(entityConfiguration);
18
+ constructor(cacheAdapters) {
22
19
  this.cacheAdapters = cacheAdapters;
23
20
  }
24
21
  async loadManyAsync(fieldName, fieldValues) {
@@ -1 +1 @@
1
- {"version":3,"file":"ComposedEntityCacheAdapter.js","sourceRoot":"","sources":["../src/ComposedEntityCacheAdapter.ts"],"names":[],"mappings":";;;;;AAAA,4DAAoC;AAEpC,8EAAsD;AAEtD,8EAAiF;AAEjF;;GAEG;AACH,MAAqB,0BAAoC,SAAQ,4BAA2B;IAC1F;;;;;;OAMG;IACH,YACE,mBAAiD,EAChC,aAA4C;QAE7D,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAFV,kBAAa,GAAb,aAAa,CAA+B;IAG/D,CAAC;IAEM,KAAK,CAAC,aAAa,CACxB,SAAY,EACZ,WAA+C;QAE/C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAqD,CAAC;QAC5E,MAAM,gCAAgC,GAAgC,KAAK,CAAC,IAAI,CAC9E,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,EACrC,GAAG,EAAE,CAAC,EAAE,CACT,CAAC;QAEF,IAAI,sBAAsB,GAAG,WAAW,CAAC;QACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAClD,MAAM,YAAY,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;YACvD,MAAM,uBAAuB,GAAG,MAAM,YAAY,CAAC,aAAa,CAC9D,SAAS,EACT,sBAAsB,CACvB,CAAC;YAEF,MAAM,yBAAyB,GAAG,EAAE,CAAC;YACrC,KAAK,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,uBAAuB,EAAE;gBAC/D,IAAI,WAAW,CAAC,MAAM,KAAK,oCAAW,CAAC,IAAI,EAAE;oBAC3C,yBAAyB,CAAC,IAAI,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U,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;YACvD,MAAM,YAAY,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;SACzD;IACH,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAC7B,SAAY,EACZ,WAA+C;QAE/C,8BAA8B;QAC9B,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;YACvD,MAAM,YAAY,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;YACvD,MAAM,YAAY,CAAC,kBAAkB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;SAC/D;IACH,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAC9B,SAAY,EACZ,WAA+C;QAE/C,iCAAiC;QACjC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;YACvD,MAAM,YAAY,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;YACvD,MAAM,YAAY,CAAC,mBAAmB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;SAChE;IACH,CAAC;CACF;AA/GD,6CA+GC"}
@@ -7,7 +7,7 @@ import ViewerContext from './ViewerContext';
7
7
  * Enforcing view on an entity loader. All loads through this loader will throw
8
8
  * if the loads are not successful.
9
9
  */
10
- export default class EnforcingEntityLoader<TFields, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TPrivacyPolicy extends EntityPrivacyPolicy<TFields, TID, TViewerContext, TEntity, TSelectedFields>, TSelectedFields extends keyof TFields> {
10
+ export default class EnforcingEntityLoader<TFields extends object, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TPrivacyPolicy extends EntityPrivacyPolicy<TFields, TID, TViewerContext, TEntity, TSelectedFields>, TSelectedFields extends keyof TFields> {
11
11
  private readonly entityLoader;
12
12
  constructor(entityLoader: EntityLoader<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>);
13
13
  /**
package/build/Entity.d.ts CHANGED
@@ -23,33 +23,33 @@ import ViewerContext from './ViewerContext';
23
23
  * All concrete entity implementations should extend this class and provide their
24
24
  * own EntityCompanionDefinition.
25
25
  */
26
- export default abstract class Entity<TFields, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TSelectedFields extends keyof TFields = keyof TFields> extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields> {
26
+ export default abstract class Entity<TFields extends object, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TSelectedFields extends keyof TFields = keyof TFields> extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields> {
27
27
  /**
28
28
  * Vend mutator for creating a new entity in given query context.
29
29
  * @param viewerContext - viewer context of creating user
30
30
  * @param queryContext - query context in which to perform the create
31
31
  * @returns mutator for creating an entity
32
32
  */
33
- static creator<TMFields, TMID extends NonNullable<TMFields[TMSelectedFields]>, TMViewerContext extends ViewerContext, TMViewerContext2 extends TMViewerContext, TMEntity extends Entity<TMFields, TMID, TMViewerContext, TMSelectedFields>, TMPrivacyPolicy extends EntityPrivacyPolicy<TMFields, TMID, TMViewerContext, TMEntity, TMSelectedFields>, TMSelectedFields extends keyof TMFields = keyof TMFields>(this: IEntityClass<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>, viewerContext: TMViewerContext2, queryContext?: EntityQueryContext): CreateMutator<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>;
33
+ static creator<TMFields extends object, TMID extends NonNullable<TMFields[TMSelectedFields]>, TMViewerContext extends ViewerContext, TMViewerContext2 extends TMViewerContext, TMEntity extends Entity<TMFields, TMID, TMViewerContext, TMSelectedFields>, TMPrivacyPolicy extends EntityPrivacyPolicy<TMFields, TMID, TMViewerContext, TMEntity, TMSelectedFields>, TMSelectedFields extends keyof TMFields = keyof TMFields>(this: IEntityClass<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>, viewerContext: TMViewerContext2, queryContext?: EntityQueryContext): CreateMutator<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>;
34
34
  /**
35
35
  * Vend mutator for updating an existing entity in given query context.
36
36
  * @param existingEntity - entity to update
37
37
  * @param queryContext - query context in which to perform the update
38
38
  * @returns mutator for updating existingEntity
39
39
  */
40
- static updater<TMFields, TMID extends NonNullable<TMFields[TMSelectedFields]>, TMViewerContext extends ViewerContext, TMEntity extends Entity<TMFields, TMID, TMViewerContext, TMSelectedFields>, TMPrivacyPolicy extends EntityPrivacyPolicy<TMFields, TMID, TMViewerContext, TMEntity, TMSelectedFields>, TMSelectedFields extends keyof TMFields = keyof TMFields>(this: IEntityClass<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>, existingEntity: TMEntity, queryContext?: EntityQueryContext): UpdateMutator<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>;
40
+ static updater<TMFields extends object, TMID extends NonNullable<TMFields[TMSelectedFields]>, TMViewerContext extends ViewerContext, TMEntity extends Entity<TMFields, TMID, TMViewerContext, TMSelectedFields>, TMPrivacyPolicy extends EntityPrivacyPolicy<TMFields, TMID, TMViewerContext, TMEntity, TMSelectedFields>, TMSelectedFields extends keyof TMFields = keyof TMFields>(this: IEntityClass<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>, existingEntity: TMEntity, queryContext?: EntityQueryContext): UpdateMutator<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>;
41
41
  /**
42
42
  * Delete an existing entity in given query context.
43
43
  * @param existingEntity - entity to delete
44
44
  * @param queryContext - query context in which to perform the delete
45
45
  */
46
- static deleteAsync<TMFields, TMID extends NonNullable<TMFields[TMSelectedFields]>, TMViewerContext extends ViewerContext, TMEntity extends Entity<TMFields, TMID, TMViewerContext, TMSelectedFields>, TMPrivacyPolicy extends EntityPrivacyPolicy<TMFields, TMID, TMViewerContext, TMEntity, TMSelectedFields>, TMSelectedFields extends keyof TMFields = keyof TMFields>(this: IEntityClass<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>, existingEntity: TMEntity, queryContext?: EntityQueryContext): Promise<Result<void>>;
46
+ static deleteAsync<TMFields extends object, TMID extends NonNullable<TMFields[TMSelectedFields]>, TMViewerContext extends ViewerContext, TMEntity extends Entity<TMFields, TMID, TMViewerContext, TMSelectedFields>, TMPrivacyPolicy extends EntityPrivacyPolicy<TMFields, TMID, TMViewerContext, TMEntity, TMSelectedFields>, TMSelectedFields extends keyof TMFields = keyof TMFields>(this: IEntityClass<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>, existingEntity: TMEntity, queryContext?: EntityQueryContext): Promise<Result<void>>;
47
47
  /**
48
48
  * Delete an existing entity in given query context, throwing if deletion is unsuccessful.
49
49
  * @param existingEntity - entity to delete
50
50
  * @param queryContext - query context in which to perform the delete
51
51
  */
52
- static enforceDeleteAsync<TMFields, TMID extends NonNullable<TMFields[TMSelectedFields]>, TMViewerContext extends ViewerContext, TMEntity extends Entity<TMFields, TMID, TMViewerContext, TMSelectedFields>, TMPrivacyPolicy extends EntityPrivacyPolicy<TMFields, TMID, TMViewerContext, TMEntity, TMSelectedFields>, TMSelectedFields extends keyof TMFields = keyof TMFields>(this: IEntityClass<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>, existingEntity: TMEntity, queryContext?: EntityQueryContext): Promise<void>;
52
+ static enforceDeleteAsync<TMFields extends object, TMID extends NonNullable<TMFields[TMSelectedFields]>, TMViewerContext extends ViewerContext, TMEntity extends Entity<TMFields, TMID, TMViewerContext, TMSelectedFields>, TMPrivacyPolicy extends EntityPrivacyPolicy<TMFields, TMID, TMViewerContext, TMEntity, TMSelectedFields>, TMSelectedFields extends keyof TMFields = keyof TMFields>(this: IEntityClass<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>, existingEntity: TMEntity, queryContext?: EntityQueryContext): Promise<void>;
53
53
  /**
54
54
  * Check whether an entity loaded by a viewer can be updated by that same viewer.
55
55
  *
@@ -66,7 +66,7 @@ export default abstract class Entity<TFields, TID extends NonNullable<TFields[TS
66
66
  * @param existingEntity - entity loaded by viewer
67
67
  * @param queryContext - query context in which to perform the check
68
68
  */
69
- static canViewerUpdateAsync<TMFields, TMID extends NonNullable<TMFields[TMSelectedFields]>, TMViewerContext extends ViewerContext, TMEntity extends Entity<TMFields, TMID, TMViewerContext, TMSelectedFields>, TMPrivacyPolicy extends EntityPrivacyPolicy<TMFields, TMID, TMViewerContext, TMEntity, TMSelectedFields>, TMSelectedFields extends keyof TMFields = keyof TMFields>(this: IEntityClass<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>, existingEntity: TMEntity, queryContext?: EntityQueryContext): Promise<boolean>;
69
+ static canViewerUpdateAsync<TMFields extends object, TMID extends NonNullable<TMFields[TMSelectedFields]>, TMViewerContext extends ViewerContext, TMEntity extends Entity<TMFields, TMID, TMViewerContext, TMSelectedFields>, TMPrivacyPolicy extends EntityPrivacyPolicy<TMFields, TMID, TMViewerContext, TMEntity, TMSelectedFields>, TMSelectedFields extends keyof TMFields = keyof TMFields>(this: IEntityClass<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>, existingEntity: TMEntity, queryContext?: EntityQueryContext): Promise<boolean>;
70
70
  /**
71
71
  * Check whether an entity loaded by a viewer can be deleted by that same viewer.
72
72
  *
@@ -76,12 +76,22 @@ export default abstract class Entity<TFields, TID extends NonNullable<TFields[TS
76
76
  * @param existingEntity - entity loaded by viewer
77
77
  * @param queryContext - query context in which to perform the check
78
78
  */
79
- static canViewerDeleteAsync<TMFields, TMID extends NonNullable<TMFields[TMSelectedFields]>, TMViewerContext extends ViewerContext, TMEntity extends Entity<TMFields, TMID, TMViewerContext, TMSelectedFields>, TMPrivacyPolicy extends EntityPrivacyPolicy<TMFields, TMID, TMViewerContext, TMEntity, TMSelectedFields>, TMSelectedFields extends keyof TMFields = keyof TMFields>(this: IEntityClass<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>, existingEntity: TMEntity, queryContext?: EntityQueryContext): Promise<boolean>;
79
+ static canViewerDeleteAsync<TMFields extends object, TMID extends NonNullable<TMFields[TMSelectedFields]>, TMViewerContext extends ViewerContext, TMEntity extends Entity<TMFields, TMID, TMViewerContext, TMSelectedFields>, TMPrivacyPolicy extends EntityPrivacyPolicy<TMFields, TMID, TMViewerContext, TMEntity, TMSelectedFields>, TMSelectedFields extends keyof TMFields = keyof TMFields>(this: IEntityClass<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>, existingEntity: TMEntity, queryContext?: EntityQueryContext): Promise<boolean>;
80
80
  }
81
81
  /**
82
82
  * An interface to pass in constructor (class) of an Entity as a function argument.
83
83
  */
84
- export interface IEntityClass<TFields, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TPrivacyPolicy extends EntityPrivacyPolicy<TFields, TID, TViewerContext, TEntity, TSelectedFields>, TSelectedFields extends keyof TFields = keyof TFields> {
85
- new (viewerContext: TViewerContext, obj: Readonly<TFields>): TEntity;
86
- getCompanionDefinition(): EntityCompanionDefinition<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>;
84
+ export interface IEntityClass<TFields extends object, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TPrivacyPolicy extends EntityPrivacyPolicy<TFields, TID, TViewerContext, TEntity, TSelectedFields>, TSelectedFields extends keyof TFields = keyof TFields> {
85
+ new (constructorParam: {
86
+ viewerContext: TViewerContext;
87
+ id: TID;
88
+ databaseFields: Readonly<TFields>;
89
+ selectedFields: Readonly<Pick<TFields, TSelectedFields>>;
90
+ }): TEntity;
91
+ /**
92
+ * Returns a EntityCompanionDefinition for this entity.
93
+ *
94
+ * Memoized by the entity framework.
95
+ */
96
+ defineCompanionDefinition(): EntityCompanionDefinition<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>;
87
97
  }
package/build/Entity.js CHANGED
@@ -114,7 +114,7 @@ class Entity extends ReadonlyEntity_1.default {
114
114
  const companion = existingEntity
115
115
  .getViewerContext()
116
116
  .getViewerScopedEntityCompanionForClass(this);
117
- const privacyPolicy = new (this.getCompanionDefinition().privacyPolicyClass)();
117
+ const privacyPolicy = companion.entityCompanion.privacyPolicy;
118
118
  const evaluationResult = await (0, results_1.asyncResult)(privacyPolicy.authorizeUpdateAsync(existingEntity.getViewerContext(), queryContext, { cascadingDeleteCause: null }, existingEntity, companion.getMetricsAdapter()));
119
119
  return evaluationResult.ok;
120
120
  }
@@ -135,7 +135,7 @@ class Entity extends ReadonlyEntity_1.default {
135
135
  const companion = existingEntity
136
136
  .getViewerContext()
137
137
  .getViewerScopedEntityCompanionForClass(this);
138
- const privacyPolicy = new (this.getCompanionDefinition().privacyPolicyClass)();
138
+ const privacyPolicy = companion.entityCompanion.privacyPolicy;
139
139
  const evaluationResult = await (0, results_1.asyncResult)(privacyPolicy.authorizeDeleteAsync(existingEntity.getViewerContext(), queryContext, { cascadingDeleteCause: null }, existingEntity, companion.getMetricsAdapter()));
140
140
  return evaluationResult.ok;
141
141
  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SAC9C,gBAAgB,EAAE;SAClB,sCAAsC,CAAC,IAAI,CAAC;SAC5C,uBAAuB,EAAE;SACzB,eAAe,EAAE;QAEpB,MAAM,SAAS,GAAG,cAAc;aAC7B,gBAAgB,EAAE;aAClB,sCAAsC,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,aAAa,GAAG,SAAS,CAAC,eAAe,CAAC,aAAa,CAAC;QAC9D,MAAM,gBAAgB,GAAG,MAAM,IAAA,qBAAW,EACxC,aAAa,CAAC,oBAAoB,CAChC,cAAc,CAAC,gBAAgB,EAAE,EACjC,YAAY,EACZ,EAAE,oBAAoB,EAAE,IAAI,EAAE,EAC9B,cAAc,EACd,SAAS,CAAC,iBAAiB,EAAE,CAC9B,CACF,CAAC;QACF,OAAO,gBAAgB,CAAC,EAAE,CAAC;IAC7B,CAAC;CACF;AA/RD,yBA+RC"}
@@ -9,7 +9,7 @@ import ViewerContext from './ViewerContext';
9
9
  * associated with an entity. In relational databases, these entities are often referenced
10
10
  * by foreign keys.
11
11
  */
12
- export default class EntityAssociationLoader<TFields, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TSelectedFields extends keyof TFields> {
12
+ export default class EntityAssociationLoader<TFields extends object, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TSelectedFields extends keyof TFields> {
13
13
  private readonly entity;
14
14
  constructor(entity: TEntity);
15
15
  /**
@@ -19,7 +19,7 @@ export default class EntityAssociationLoader<TFields, TID extends NonNullable<TF
19
19
  * @param associatedEntityClass - class of the associated entity
20
20
  * @param queryContext - query context in which to perform the load
21
21
  */
22
- loadAssociatedEntityAsync<TIdentifyingField extends keyof Pick<TFields, TSelectedFields>, TAssociatedFields, TAssociatedID extends NonNullable<TAssociatedFields[TAssociatedSelectedFields]>, TAssociatedEntity extends ReadonlyEntity<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedSelectedFields>, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedSelectedFields>, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields>(fieldIdentifyingAssociatedEntity: TIdentifyingField, associatedEntityClass: IEntityClass<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedPrivacyPolicy, TAssociatedSelectedFields>, queryContext?: EntityQueryContext): Promise<Result<null extends TFields[TIdentifyingField] ? TAssociatedEntity | null : TAssociatedEntity>>;
22
+ loadAssociatedEntityAsync<TIdentifyingField extends keyof Pick<TFields, TSelectedFields>, TAssociatedFields extends object, TAssociatedID extends NonNullable<TAssociatedFields[TAssociatedSelectedFields]>, TAssociatedEntity extends ReadonlyEntity<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedSelectedFields>, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedSelectedFields>, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields>(fieldIdentifyingAssociatedEntity: TIdentifyingField, associatedEntityClass: IEntityClass<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedPrivacyPolicy, TAssociatedSelectedFields>, queryContext?: EntityQueryContext): Promise<Result<null extends TFields[TIdentifyingField] ? TAssociatedEntity | null : TAssociatedEntity>>;
23
23
  /**
24
24
  * Load many entities associated with this entity, often referred to as entites belonging
25
25
  * to this entity. In a relational database, the field in the foreign entity is a
@@ -29,7 +29,7 @@ export default class EntityAssociationLoader<TFields, TID extends NonNullable<TF
29
29
  * @param associatedEntityFieldContainingThisID - field of associated entity which contains the ID of this entity
30
30
  * @param queryContext - query context in which to perform the load
31
31
  */
32
- loadManyAssociatedEntitiesAsync<TAssociatedFields, TAssociatedID extends NonNullable<TAssociatedFields[TAssociatedSelectedFields]>, TAssociatedEntity extends ReadonlyEntity<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedSelectedFields>, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedSelectedFields>, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields>(associatedEntityClass: IEntityClass<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedPrivacyPolicy, TAssociatedSelectedFields>, associatedEntityFieldContainingThisID: keyof Pick<TAssociatedFields, TAssociatedSelectedFields>, queryContext?: EntityQueryContext): Promise<readonly Result<TAssociatedEntity>[]>;
32
+ loadManyAssociatedEntitiesAsync<TAssociatedFields extends object, TAssociatedID extends NonNullable<TAssociatedFields[TAssociatedSelectedFields]>, TAssociatedEntity extends ReadonlyEntity<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedSelectedFields>, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedSelectedFields>, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields>(associatedEntityClass: IEntityClass<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedPrivacyPolicy, TAssociatedSelectedFields>, associatedEntityFieldContainingThisID: keyof Pick<TAssociatedFields, TAssociatedSelectedFields>, queryContext?: EntityQueryContext): Promise<readonly Result<TAssociatedEntity>[]>;
33
33
  /**
34
34
  * Load an associated entity identified by a field value of this entity. In a relational database,
35
35
  * the field in this entity is a foreign key to a unique field of the associated entity.
@@ -38,7 +38,7 @@ export default class EntityAssociationLoader<TFields, TID extends NonNullable<TF
38
38
  * @param associatedEntityLookupByField - field of associated entity with which to look up the associated entity
39
39
  * @param queryContext - query context in which to perform the load
40
40
  */
41
- loadAssociatedEntityByFieldEqualingAsync<TAssociatedFields, TAssociatedID extends NonNullable<TAssociatedFields[TAssociatedSelectedFields]>, TAssociatedEntity extends ReadonlyEntity<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedSelectedFields>, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedSelectedFields>, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields>(fieldIdentifyingAssociatedEntity: keyof Pick<TFields, TSelectedFields>, associatedEntityClass: IEntityClass<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedPrivacyPolicy, TAssociatedSelectedFields>, associatedEntityLookupByField: keyof Pick<TAssociatedFields, TAssociatedSelectedFields>, queryContext?: EntityQueryContext): Promise<Result<TAssociatedEntity> | null>;
41
+ loadAssociatedEntityByFieldEqualingAsync<TAssociatedFields extends object, TAssociatedID extends NonNullable<TAssociatedFields[TAssociatedSelectedFields]>, TAssociatedEntity extends ReadonlyEntity<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedSelectedFields>, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedSelectedFields>, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields>(fieldIdentifyingAssociatedEntity: keyof Pick<TFields, TSelectedFields>, associatedEntityClass: IEntityClass<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedPrivacyPolicy, TAssociatedSelectedFields>, associatedEntityLookupByField: keyof Pick<TAssociatedFields, TAssociatedSelectedFields>, queryContext?: EntityQueryContext): Promise<Result<TAssociatedEntity> | null>;
42
42
  /**
43
43
  * Load many associated entities identified by a field value of this entity. In a relational database,
44
44
  * the field in this entity refers to a field of the associated entity.
@@ -47,14 +47,14 @@ export default class EntityAssociationLoader<TFields, TID extends NonNullable<TF
47
47
  * @param associatedEntityLookupByField - field of associated entities with which to look up the associated entities
48
48
  * @param queryContext - query context in which to perform the load
49
49
  */
50
- loadManyAssociatedEntitiesByFieldEqualingAsync<TAssociatedFields, TAssociatedID extends NonNullable<TAssociatedFields[TAssociatedSelectedFields]>, TAssociatedEntity extends ReadonlyEntity<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedSelectedFields>, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedSelectedFields>, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields>(fieldIdentifyingAssociatedEntity: keyof Pick<TFields, TSelectedFields>, associatedEntityClass: IEntityClass<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedPrivacyPolicy, TAssociatedSelectedFields>, associatedEntityLookupByField: keyof Pick<TAssociatedFields, TAssociatedSelectedFields>, queryContext?: EntityQueryContext): Promise<readonly Result<TAssociatedEntity>[]>;
50
+ loadManyAssociatedEntitiesByFieldEqualingAsync<TAssociatedFields extends object, TAssociatedID extends NonNullable<TAssociatedFields[TAssociatedSelectedFields]>, TAssociatedEntity extends ReadonlyEntity<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedSelectedFields>, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedSelectedFields>, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields>(fieldIdentifyingAssociatedEntity: keyof Pick<TFields, TSelectedFields>, associatedEntityClass: IEntityClass<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedPrivacyPolicy, TAssociatedSelectedFields>, associatedEntityLookupByField: keyof Pick<TAssociatedFields, TAssociatedSelectedFields>, queryContext?: EntityQueryContext): Promise<readonly Result<TAssociatedEntity>[]>;
51
51
  /**
52
52
  * Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each
53
53
  * fold step, load an associated entity identified by a field value of the current fold value.
54
54
  * @param loadDirectives - associated entity load directives instructing each step of the fold
55
55
  * @param queryContext - query context in which to perform the loads
56
56
  */
57
- loadAssociatedEntityThroughAsync<TFields2, TID2 extends NonNullable<TFields2[TSelectedFields2]>, TEntity2 extends ReadonlyEntity<TFields2, TID2, TViewerContext, TSelectedFields2>, TPrivacyPolicy2 extends EntityPrivacyPolicy<TFields2, TID2, TViewerContext, TEntity2, TSelectedFields2>, TSelectedFields2 extends keyof TFields2 = keyof TFields2>(loadDirectives: [
57
+ loadAssociatedEntityThroughAsync<TFields2 extends object, TID2 extends NonNullable<TFields2[TSelectedFields2]>, TEntity2 extends ReadonlyEntity<TFields2, TID2, TViewerContext, TSelectedFields2>, TPrivacyPolicy2 extends EntityPrivacyPolicy<TFields2, TID2, TViewerContext, TEntity2, TSelectedFields2>, TSelectedFields2 extends keyof TFields2 = keyof TFields2>(loadDirectives: [
58
58
  EntityLoadThroughDirective<TViewerContext, TFields, TFields2, TID2, TEntity2, TPrivacyPolicy2, TSelectedFields, TSelectedFields2>
59
59
  ], queryContext?: EntityQueryContext): Promise<Result<TEntity2> | null>;
60
60
  /**
@@ -63,7 +63,7 @@ export default class EntityAssociationLoader<TFields, TID extends NonNullable<TF
63
63
  * @param loadDirectives - associated entity load directives instructing each step of the fold
64
64
  * @param queryContext - query context in which to perform the loads
65
65
  */
66
- loadAssociatedEntityThroughAsync<TFields2, TID2 extends NonNullable<TFields2[TSelectedFields2]>, TEntity2 extends ReadonlyEntity<TFields2, TID2, TViewerContext, TSelectedFields2>, TPrivacyPolicy2 extends EntityPrivacyPolicy<TFields2, TID2, TViewerContext, TEntity2, TSelectedFields2>, TFields3, TID3 extends NonNullable<TFields3[TSelectedFields3]>, TEntity3 extends ReadonlyEntity<TFields3, TID3, TViewerContext, TSelectedFields3>, TPrivacyPolicy3 extends EntityPrivacyPolicy<TFields3, TID3, TViewerContext, TEntity3, TSelectedFields3>, TSelectedFields2 extends keyof TFields2 = keyof TFields2, TSelectedFields3 extends keyof TFields3 = keyof TFields3>(loadDirectives: [
66
+ loadAssociatedEntityThroughAsync<TFields2 extends object, TID2 extends NonNullable<TFields2[TSelectedFields2]>, TEntity2 extends ReadonlyEntity<TFields2, TID2, TViewerContext, TSelectedFields2>, TPrivacyPolicy2 extends EntityPrivacyPolicy<TFields2, TID2, TViewerContext, TEntity2, TSelectedFields2>, TFields3 extends object, TID3 extends NonNullable<TFields3[TSelectedFields3]>, TEntity3 extends ReadonlyEntity<TFields3, TID3, TViewerContext, TSelectedFields3>, TPrivacyPolicy3 extends EntityPrivacyPolicy<TFields3, TID3, TViewerContext, TEntity3, TSelectedFields3>, TSelectedFields2 extends keyof TFields2 = keyof TFields2, TSelectedFields3 extends keyof TFields3 = keyof TFields3>(loadDirectives: [
67
67
  EntityLoadThroughDirective<TViewerContext, TFields, TFields2, TID2, TEntity2, TPrivacyPolicy2, TSelectedFields, TSelectedFields2>,
68
68
  EntityLoadThroughDirective<TViewerContext, TFields2, TFields3, TID3, TEntity3, TPrivacyPolicy3, TSelectedFields2, TSelectedFields3>
69
69
  ], queryContext?: EntityQueryContext): Promise<Result<TEntity3> | null>;
@@ -73,7 +73,7 @@ export default class EntityAssociationLoader<TFields, TID extends NonNullable<TF
73
73
  * @param loadDirectives - associated entity load directives instructing each step of the fold
74
74
  * @param queryContext - query context in which to perform the loads
75
75
  */
76
- loadAssociatedEntityThroughAsync<TFields2, TID2 extends NonNullable<TFields2[TSelectedFields2]>, TEntity2 extends ReadonlyEntity<TFields2, TID2, TViewerContext, TSelectedFields2>, TPrivacyPolicy2 extends EntityPrivacyPolicy<TFields2, TID2, TViewerContext, TEntity2, TSelectedFields2>, TFields3, TID3 extends NonNullable<TFields3[TSelectedFields3]>, TEntity3 extends ReadonlyEntity<TFields3, TID3, TViewerContext, TSelectedFields3>, TPrivacyPolicy3 extends EntityPrivacyPolicy<TFields3, TID3, TViewerContext, TEntity3, TSelectedFields3>, TFields4, TID4 extends NonNullable<TFields4[TSelectedFields4]>, TEntity4 extends ReadonlyEntity<TFields4, TID4, TViewerContext, TSelectedFields4>, TPrivacyPolicy4 extends EntityPrivacyPolicy<TFields4, TID4, TViewerContext, TEntity4, TSelectedFields4>, TSelectedFields2 extends keyof TFields2 = keyof TFields2, TSelectedFields3 extends keyof TFields3 = keyof TFields3, TSelectedFields4 extends keyof TFields4 = keyof TFields4>(loadDirective: [
76
+ loadAssociatedEntityThroughAsync<TFields2 extends object, TID2 extends NonNullable<TFields2[TSelectedFields2]>, TEntity2 extends ReadonlyEntity<TFields2, TID2, TViewerContext, TSelectedFields2>, TPrivacyPolicy2 extends EntityPrivacyPolicy<TFields2, TID2, TViewerContext, TEntity2, TSelectedFields2>, TFields3 extends object, TID3 extends NonNullable<TFields3[TSelectedFields3]>, TEntity3 extends ReadonlyEntity<TFields3, TID3, TViewerContext, TSelectedFields3>, TPrivacyPolicy3 extends EntityPrivacyPolicy<TFields3, TID3, TViewerContext, TEntity3, TSelectedFields3>, TFields4 extends object, TID4 extends NonNullable<TFields4[TSelectedFields4]>, TEntity4 extends ReadonlyEntity<TFields4, TID4, TViewerContext, TSelectedFields4>, TPrivacyPolicy4 extends EntityPrivacyPolicy<TFields4, TID4, TViewerContext, TEntity4, TSelectedFields4>, TSelectedFields2 extends keyof TFields2 = keyof TFields2, TSelectedFields3 extends keyof TFields3 = keyof TFields3, TSelectedFields4 extends keyof TFields4 = keyof TFields4>(loadDirective: [
77
77
  EntityLoadThroughDirective<TViewerContext, TFields, TFields2, TID2, TEntity2, TPrivacyPolicy2, TSelectedFields, TSelectedFields2>,
78
78
  EntityLoadThroughDirective<TViewerContext, TFields2, TFields3, TID3, TEntity3, TPrivacyPolicy3, TSelectedFields2, TSelectedFields3>,
79
79
  EntityLoadThroughDirective<TViewerContext, TFields3, TFields4, TID4, TEntity4, TPrivacyPolicy4, TSelectedFields3, TSelectedFields4>
@@ -89,7 +89,7 @@ export default class EntityAssociationLoader<TFields, TID extends NonNullable<TF
89
89
  /**
90
90
  * Instruction for each step of a load-associated-through method.
91
91
  */
92
- export interface EntityLoadThroughDirective<TViewerContext extends ViewerContext, TFields, TAssociatedFields, TAssociatedID extends NonNullable<TAssociatedFields[TAssociatedSelectedFields]>, TAssociatedEntity extends ReadonlyEntity<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedSelectedFields>, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedSelectedFields>, TSelectedFields extends keyof TFields = keyof TFields, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields> {
92
+ export interface EntityLoadThroughDirective<TViewerContext extends ViewerContext, TFields, TAssociatedFields extends object, TAssociatedID extends NonNullable<TAssociatedFields[TAssociatedSelectedFields]>, TAssociatedEntity extends ReadonlyEntity<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedSelectedFields>, TAssociatedPrivacyPolicy extends EntityPrivacyPolicy<TAssociatedFields, TAssociatedID, TViewerContext, TAssociatedEntity, TAssociatedSelectedFields>, TSelectedFields extends keyof TFields = keyof TFields, TAssociatedSelectedFields extends keyof TAssociatedFields = keyof TAssociatedFields> {
93
93
  /**
94
94
  * Class of entity to load at this step.
95
95
  */
@@ -1,7 +1,5 @@
1
- import { IEntityClass } from './Entity';
1
+ import EntityCompanionProvider, { EntityCompanionDefinition } from './EntityCompanionProvider';
2
2
  import EntityLoaderFactory from './EntityLoaderFactory';
3
- import EntityMutationTriggerConfiguration from './EntityMutationTriggerConfiguration';
4
- import EntityMutationValidator from './EntityMutationValidator';
5
3
  import EntityMutatorFactory from './EntityMutatorFactory';
6
4
  import EntityPrivacyPolicy from './EntityPrivacyPolicy';
7
5
  import EntityQueryContextProvider from './EntityQueryContextProvider';
@@ -15,12 +13,15 @@ export interface IPrivacyPolicyClass<TPrivacyPolicy> {
15
13
  /**
16
14
  * Composition root responsible for orchestrating setup of Entity mutators and loaders.
17
15
  */
18
- export default class EntityCompanion<TFields, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TPrivacyPolicy extends EntityPrivacyPolicy<TFields, TID, TViewerContext, TEntity, TSelectedFields>, TSelectedFields extends keyof TFields> {
16
+ export default class EntityCompanion<TFields extends object, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TPrivacyPolicy extends EntityPrivacyPolicy<TFields, TID, TViewerContext, TEntity, TSelectedFields>, TSelectedFields extends keyof TFields> {
17
+ readonly entityCompanionProvider: EntityCompanionProvider;
18
+ readonly entityCompanionDefinition: EntityCompanionDefinition<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>;
19
19
  private readonly tableDataCoordinator;
20
20
  private readonly metricsAdapter;
21
+ readonly privacyPolicy: TPrivacyPolicy;
21
22
  private readonly entityLoaderFactory;
22
23
  private readonly entityMutatorFactory;
23
- constructor(entityClass: IEntityClass<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>, tableDataCoordinator: EntityTableDataCoordinator<TFields>, PrivacyPolicyClass: IPrivacyPolicyClass<TPrivacyPolicy>, mutationValidators: EntityMutationValidator<TFields, TID, TViewerContext, TEntity, TSelectedFields>[], mutationTriggers: EntityMutationTriggerConfiguration<TFields, TID, TViewerContext, TEntity, TSelectedFields>, metricsAdapter: IEntityMetricsAdapter);
24
+ constructor(entityCompanionProvider: EntityCompanionProvider, entityCompanionDefinition: EntityCompanionDefinition<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>, tableDataCoordinator: EntityTableDataCoordinator<TFields>, metricsAdapter: IEntityMetricsAdapter);
24
25
  getLoaderFactory(): EntityLoaderFactory<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>;
25
26
  getMutatorFactory(): EntityMutatorFactory<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>;
26
27
  /**
@@ -9,12 +9,14 @@ const EntityMutatorFactory_1 = __importDefault(require("./EntityMutatorFactory")
9
9
  * Composition root responsible for orchestrating setup of Entity mutators and loaders.
10
10
  */
11
11
  class EntityCompanion {
12
- constructor(entityClass, tableDataCoordinator, PrivacyPolicyClass, mutationValidators, mutationTriggers, metricsAdapter) {
12
+ constructor(entityCompanionProvider, entityCompanionDefinition, tableDataCoordinator, metricsAdapter) {
13
+ this.entityCompanionProvider = entityCompanionProvider;
14
+ this.entityCompanionDefinition = entityCompanionDefinition;
13
15
  this.tableDataCoordinator = tableDataCoordinator;
14
16
  this.metricsAdapter = metricsAdapter;
15
- const privacyPolicy = new PrivacyPolicyClass();
16
- this.entityLoaderFactory = new EntityLoaderFactory_1.default(tableDataCoordinator.entityConfiguration, entityClass, privacyPolicy, tableDataCoordinator.dataManager, metricsAdapter);
17
- this.entityMutatorFactory = new EntityMutatorFactory_1.default(tableDataCoordinator.entityConfiguration, entityClass, privacyPolicy, mutationValidators, mutationTriggers, this.entityLoaderFactory, tableDataCoordinator.databaseAdapter, metricsAdapter);
17
+ this.privacyPolicy = new entityCompanionDefinition.privacyPolicyClass();
18
+ this.entityLoaderFactory = new EntityLoaderFactory_1.default(this, tableDataCoordinator.dataManager, metricsAdapter);
19
+ this.entityMutatorFactory = new EntityMutatorFactory_1.default(entityCompanionProvider, tableDataCoordinator.entityConfiguration, entityCompanionDefinition.entityClass, this.privacyPolicy, entityCompanionDefinition.mutationValidators ?? [], entityCompanionDefinition.mutationTriggers ?? {}, this.entityLoaderFactory, tableDataCoordinator.databaseAdapter, metricsAdapter);
18
20
  }
19
21
  getLoaderFactory() {
20
22
  return this.entityLoaderFactory;
@@ -1 +1 @@
1
- {"version":3,"file":"EntityCompanion.js","sourceRoot":"","sources":["../src/EntityCompanion.ts"],"names":[],"mappings":";;;;;AACA,gFAAwD;AAGxD,kFAA0D;AAY1D;;GAEG;AACH,MAAqB,eAAe;IA+BlC,YACE,WAOC,EACgB,oBAAyD,EAC1E,kBAAuD,EACvD,kBAMG,EACH,gBAMC,EACgB,cAAqC;QAhBrC,yBAAoB,GAApB,oBAAoB,CAAqC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AAmB,CAOhD,IAAI,EAAE,oBAAoB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAC1D,IAAI,CAAC,oBAAoB,GAAG,IAAI,8BAAoB,CAClD,uBAAuB,EACvB,oBAAoB,CAAC,mBAAmB,EACxC,yBAAyB,CAAC,WAAW,EACrC,IAAI,CAAC,aAAa,EAClB,yBAAyB,CAAC,kBAAkB,IAAI,EAAE,EAClD,yBAAyB,CAAC,gBAAgB,IAAI,EAAE,EAChD,IAAI,CAAC,mBAAmB,EACxB,oBAAoB,CAAC,eAAe,EACpC,cAAc,CACf,CAAC;IACJ,CAAC;IAED,gBAAgB;QAQd,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED,iBAAiB;QAQf,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,uBAAuB;QACrB,OAAO,IAAI,CAAC,oBAAoB,CAAC,uBAAuB,EAAE,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF;AAvGD,kCAuGC"}
@@ -14,12 +14,12 @@ import IEntityMetricsAdapter from './metrics/IEntityMetricsAdapter';
14
14
  * Backing database and transaction type for an entity. The definitions and implementations
15
15
  * are provided by injection in the root EntityCompanionProvider to allow for mocking and sharing.
16
16
  */
17
- export declare type DatabaseAdapterFlavor = string;
17
+ export type DatabaseAdapterFlavor = string;
18
18
  /**
19
19
  * Cache system for an entity. The definitions and implementations are provided by injection
20
20
  * in the root EntityCompanionProvider to allow for mocking and sharing.
21
21
  */
22
- export declare type CacheAdapterFlavor = string;
22
+ export type CacheAdapterFlavor = string;
23
23
  /**
24
24
  * Defines a set interfaces for a entity database adapter flavor. An entity that uses a flavor
25
25
  * will use the specified adapter for database accesses and the specified query context provider
@@ -40,41 +40,33 @@ export interface CacheAdapterFlavorDefinition {
40
40
  * Definition for constructing a companion for an entity. Defines the core set of objects
41
41
  * used to power the entity framework for a particular type of entity.
42
42
  */
43
- export declare class EntityCompanionDefinition<TFields, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TPrivacyPolicy extends EntityPrivacyPolicy<TFields, TID, TViewerContext, TEntity, TSelectedFields>, TSelectedFields extends keyof TFields = keyof TFields> {
43
+ export interface EntityCompanionDefinition<TFields extends object, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TPrivacyPolicy extends EntityPrivacyPolicy<TFields, TID, TViewerContext, TEntity, TSelectedFields>, TSelectedFields extends keyof TFields = keyof TFields> {
44
+ /**
45
+ * The concrete Entity class for which this is the definition.
46
+ */
44
47
  readonly entityClass: IEntityClass<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>;
48
+ /**
49
+ * The EntityConfiguration for this entity.
50
+ */
45
51
  readonly entityConfiguration: EntityConfiguration<TFields>;
52
+ /**
53
+ * The EntityPrivacyPolicy class for this entity.
54
+ */
46
55
  readonly privacyPolicyClass: IPrivacyPolicyClass<TPrivacyPolicy>;
47
- readonly mutationValidators: () => EntityMutationValidator<TFields, TID, TViewerContext, TEntity, TSelectedFields>[];
48
- readonly mutationTriggers: () => EntityMutationTriggerConfiguration<TFields, TID, TViewerContext, TEntity, TSelectedFields>;
49
- readonly entitySelectedFields: TSelectedFields[];
50
- constructor({ entityClass, entityConfiguration, privacyPolicyClass, mutationValidators, mutationTriggers, entitySelectedFields, }: {
51
- /**
52
- * The concrete Entity class for which this is the definition.
53
- */
54
- entityClass: IEntityClass<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>;
55
- /**
56
- * The EntityConfiguration for this entity.
57
- */
58
- entityConfiguration: EntityConfiguration<TFields>;
59
- /**
60
- * The EntityPrivacyPolicy class for this entity.
61
- */
62
- privacyPolicyClass: IPrivacyPolicyClass<TPrivacyPolicy>;
63
- /**
64
- * An optional list of EntityMutationValidator for this entity.
65
- */
66
- mutationValidators?: () => EntityMutationValidator<TFields, TID, TViewerContext, TEntity, TSelectedFields>[];
67
- /**
68
- * An optional list of EntityMutationTrigger for this entity.
69
- */
70
- mutationTriggers?: () => EntityMutationTriggerConfiguration<TFields, TID, TViewerContext, TEntity, TSelectedFields>;
71
- /**
72
- * An optional subset of fields defined in the EntityConfiguration which belong to this entity.
73
- * For use when multiple types of entities are backed by a single table (EntityConfiguration) yet
74
- * only expose a subset of the fields.
75
- */
76
- entitySelectedFields?: TSelectedFields[];
77
- });
56
+ /**
57
+ * An optional list of EntityMutationValidator for this entity.
58
+ */
59
+ readonly mutationValidators?: EntityMutationValidator<TFields, TID, TViewerContext, TEntity, TSelectedFields>[];
60
+ /**
61
+ * An optional list of EntityMutationTrigger for this entity.
62
+ */
63
+ readonly mutationTriggers?: EntityMutationTriggerConfiguration<TFields, TID, TViewerContext, TEntity, TSelectedFields>;
64
+ /**
65
+ * An optional subset of fields defined in the EntityConfiguration which belong to this entity.
66
+ * For use when multiple types of entities are backed by a single table (EntityConfiguration) yet
67
+ * only expose a subset of the fields.
68
+ */
69
+ readonly entitySelectedFields?: TSelectedFields[];
78
70
  }
79
71
  /**
80
72
  * An instance of the Entity framework.
@@ -89,6 +81,7 @@ export default class EntityCompanionProvider {
89
81
  readonly metricsAdapter: IEntityMetricsAdapter;
90
82
  private databaseAdapterFlavors;
91
83
  private cacheAdapterFlavors;
84
+ private readonly companionDefinitionMap;
92
85
  private readonly companionMap;
93
86
  private readonly tableDataCoordinatorMap;
94
87
  /**
@@ -103,9 +96,8 @@ export default class EntityCompanionProvider {
103
96
  * companion is constructed using the configuration provided by the factory.
104
97
  *
105
98
  * @param entityClass - entity class to load
106
- * @param factory - entity companion factory
107
99
  */
108
- getCompanionForEntity<TFields, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TPrivacyPolicy extends EntityPrivacyPolicy<TFields, TID, TViewerContext, TEntity, TSelectedFields>, TSelectedFields extends keyof TFields>(entityClass: IEntityClass<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>, entityCompanionDefinition: EntityCompanionDefinition<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>): EntityCompanion<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>;
100
+ getCompanionForEntity<TFields extends object, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TPrivacyPolicy extends EntityPrivacyPolicy<TFields, TID, TViewerContext, TEntity, TSelectedFields>, TSelectedFields extends keyof TFields>(entityClass: IEntityClass<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>): EntityCompanion<TFields, TID, TViewerContext, TEntity, TPrivacyPolicy, TSelectedFields>;
109
101
  getQueryContextProviderForDatabaseAdaptorFlavor(databaseAdapterFlavor: DatabaseAdapterFlavor): EntityQueryContextProvider;
110
102
  private getTableDataCoordinatorForEntity;
111
103
  }
@@ -3,26 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.EntityCompanionDefinition = void 0;
7
6
  const invariant_1 = __importDefault(require("invariant"));
8
7
  const EntityCompanion_1 = __importDefault(require("./EntityCompanion"));
9
8
  const EntityTableDataCoordinator_1 = __importDefault(require("./internal/EntityTableDataCoordinator"));
10
9
  const maps_1 = require("./utils/collections/maps");
11
- /**
12
- * Definition for constructing a companion for an entity. Defines the core set of objects
13
- * used to power the entity framework for a particular type of entity.
14
- */
15
- class EntityCompanionDefinition {
16
- constructor({ entityClass, entityConfiguration, privacyPolicyClass, mutationValidators = () => [], mutationTriggers = () => ({}), entitySelectedFields = Array.from(entityConfiguration.schema.keys()), }) {
17
- this.entityClass = entityClass;
18
- this.entityConfiguration = entityConfiguration;
19
- this.privacyPolicyClass = privacyPolicyClass;
20
- this.mutationValidators = mutationValidators;
21
- this.mutationTriggers = mutationTriggers;
22
- this.entitySelectedFields = entitySelectedFields;
23
- }
24
- }
25
- exports.EntityCompanionDefinition = EntityCompanionDefinition;
26
10
  /**
27
11
  * An instance of the Entity framework.
28
12
  *
@@ -43,6 +27,7 @@ class EntityCompanionProvider {
43
27
  this.metricsAdapter = metricsAdapter;
44
28
  this.databaseAdapterFlavors = databaseAdapterFlavors;
45
29
  this.cacheAdapterFlavors = cacheAdapterFlavors;
30
+ this.companionDefinitionMap = new Map();
46
31
  this.companionMap = new Map();
47
32
  this.tableDataCoordinatorMap = new Map();
48
33
  }
@@ -51,12 +36,12 @@ class EntityCompanionProvider {
51
36
  * companion is constructed using the configuration provided by the factory.
52
37
  *
53
38
  * @param entityClass - entity class to load
54
- * @param factory - entity companion factory
55
39
  */
56
- getCompanionForEntity(entityClass, entityCompanionDefinition) {
40
+ getCompanionForEntity(entityClass) {
41
+ const entityCompanionDefinition = (0, maps_1.computeIfAbsent)(this.companionDefinitionMap, entityClass.name, () => entityClass.defineCompanionDefinition());
57
42
  const tableDataCoordinator = this.getTableDataCoordinatorForEntity(entityCompanionDefinition.entityConfiguration, entityClass.name);
58
43
  return (0, maps_1.computeIfAbsent)(this.companionMap, entityClass.name, () => {
59
- return new EntityCompanion_1.default(entityCompanionDefinition.entityClass, tableDataCoordinator, entityCompanionDefinition.privacyPolicyClass, entityCompanionDefinition.mutationValidators(), entityCompanionDefinition.mutationTriggers(), this.metricsAdapter);
44
+ return new EntityCompanion_1.default(this, entityCompanionDefinition, tableDataCoordinator, this.metricsAdapter);
60
45
  });
61
46
  }
62
47
  getQueryContextProviderForDatabaseAdaptorFlavor(databaseAdapterFlavor) {
@@ -1 +1 @@
1
- {"version":3,"file":"EntityCompanionProvider.js","sourceRoot":"","sources":["../src/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AS,EACP,2BAA2B,EAC3B,uDAAuD,qBAAqB,EAAE,CAC/E,CAAC;QAEF,OAAO,2BAA2B,CAAC,oBAAoB,CAAC;IAC1D,CAAC;IAEO,gCAAgC,CACtC,mBAAiD,EACjD,eAAuB;QAEvB,OAAO,IAAA,sBAAe,EAAC,IAAI,CAAC,uBAAuB,EAAE,mBAAmB,CAAC,SAAS,EAAE,GAAG,EAAE;YACvF,MAAM,2BAA2B,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CACjE,mBAAmB,CAAC,qBAAqB,CAC1C,CAAC;YACF,IAAA,mBAAS,EACP,2BAA2B,EAC3B,uDAAuD,mBAAmB,CAAC,qBAAqB,EAAE,CACnG,CAAC;YAEF,MAAM,wBAAwB,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAC3D,mBAAmB,CAAC,kBAAkB,CACvC,CAAC;YACF,IAAA,mBAAS,EACP,wBAAwB,EACxB,oDAAoD,mBAAmB,CAAC,kBAAkB,EAAE,CAC7F,CAAC;YAEF,OAAO,IAAI,oCAA0B,CACnC,mBAAmB,EACnB,2BAA2B,CAAC,eAAe,EAC3C,wBAAwB,CAAC,oBAAoB,EAC7C,2BAA2B,CAAC,oBAAoB,EAChD,IAAI,CAAC,cAAc,EACnB,eAAe,CAChB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AApHD,0CAoHC"}
@@ -10,13 +10,13 @@ export default class EntityConfiguration<TFields> {
10
10
  readonly tableName: string;
11
11
  readonly cacheableKeys: ReadonlySet<keyof TFields>;
12
12
  readonly cacheKeyVersion: number;
13
- readonly getInboundEdges: () => IEntityClass<any, any, any, any, any, any>[];
13
+ readonly inboundEdges: IEntityClass<any, any, any, any, any, any>[];
14
14
  readonly schema: ReadonlyMap<keyof TFields, EntityFieldDefinition<any>>;
15
15
  readonly entityToDBFieldsKeyMapping: ReadonlyMap<keyof TFields, string>;
16
16
  readonly dbToEntityFieldsKeyMapping: ReadonlyMap<string, keyof TFields>;
17
17
  readonly databaseAdapterFlavor: DatabaseAdapterFlavor;
18
18
  readonly cacheAdapterFlavor: CacheAdapterFlavor;
19
- constructor({ idField, tableName, schema, getInboundEdges, cacheKeyVersion, databaseAdapterFlavor, cacheAdapterFlavor, }: {
19
+ constructor({ idField, tableName, schema, inboundEdges, cacheKeyVersion, databaseAdapterFlavor, cacheAdapterFlavor, }: {
20
20
  /**
21
21
  * The field used to identify this entity. Must be a unique field in the table.
22
22
  */
@@ -32,7 +32,7 @@ export default class EntityConfiguration<TFields> {
32
32
  /**
33
33
  * List of other entity types that reference this type in EntityFieldDefinition associations.
34
34
  */
35
- getInboundEdges?: () => IEntityClass<any, any, any, any, any, any>[];
35
+ inboundEdges?: IEntityClass<any, any, any, any, any, any>[];
36
36
  /**
37
37
  * Cache key version for this entity type. Should be bumped when a field is added to, removed from, or changed
38
38
  * in this entity and the underlying database table.
@@ -6,13 +6,13 @@ const maps_1 = require("./utils/collections/maps");
6
6
  * cachable fields, field mappings, and types of cache and database adapter.
7
7
  */
8
8
  class EntityConfiguration {
9
- constructor({ idField, tableName, schema, getInboundEdges = () => [], cacheKeyVersion = 0, databaseAdapterFlavor, cacheAdapterFlavor, }) {
9
+ constructor({ idField, tableName, schema, inboundEdges = [], cacheKeyVersion = 0, databaseAdapterFlavor, cacheAdapterFlavor, }) {
10
10
  this.idField = idField;
11
11
  this.tableName = tableName;
12
12
  this.cacheKeyVersion = cacheKeyVersion;
13
13
  this.databaseAdapterFlavor = databaseAdapterFlavor;
14
14
  this.cacheAdapterFlavor = cacheAdapterFlavor;
15
- this.getInboundEdges = getInboundEdges;
15
+ this.inboundEdges = inboundEdges;
16
16
  // external schema is a Record to typecheck that all fields have FieldDefinitions,
17
17
  // but internally the most useful representation is a map for lookups
18
18
  // TODO(wschurman): validate schema
@@ -1 +1 @@
1
- {"version":3,"file":"EntityConfiguration.js","sourceRoot":"","sources":["../src/EntityConfiguration.ts"],"names":[],"mappings":";;AAGA,mDAAwE;AAExE;;;G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AG,CAAC,CAAC,CAAC,CAAC;aACZ;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EACD,IAAI,GAAG,EAAiB,CACzB,CAAC;IACJ,CAAC;IAEO,MAAM,CAAC,iCAAiC,CAC9C,MAA8D;QAE9D,OAAO,IAAA,aAAM,EAAC,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAC7C,CAAC;CACF;AAlGD,sCAkGC"}
@@ -19,7 +19,7 @@ export interface MultiValueFieldEqualityCondition<TFields, N extends keyof TFiel
19
19
  * A single equality operand for use in a selection clause.
20
20
  * See EntityLoader.loadManyByFieldEqualityConjunctionAsync documentation for examples.
21
21
  */
22
- export declare type FieldEqualityCondition<TFields, N extends keyof TFields = keyof TFields> = SingleValueFieldEqualityCondition<TFields, N> | MultiValueFieldEqualityCondition<TFields, N>;
22
+ export type FieldEqualityCondition<TFields, N extends keyof TFields = keyof TFields> = SingleValueFieldEqualityCondition<TFields, N> | MultiValueFieldEqualityCondition<TFields, N>;
23
23
  export declare function isSingleValueFieldEqualityCondition<TFields, N extends keyof TFields = keyof TFields>(condition: FieldEqualityCondition<TFields, N>): condition is SingleValueFieldEqualityCondition<TFields, N>;
24
24
  export interface TableFieldSingleValueEqualityCondition {
25
25
  tableField: string;