@expo/entity 0.17.0 → 0.21.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 (215) hide show
  1. package/build/EnforcingEntityLoader.js +2 -2
  2. package/build/EnforcingEntityLoader.js.map +1 -1
  3. package/build/Entity.js +8 -2
  4. package/build/Entity.js.map +1 -1
  5. package/build/EntityAssociationLoader.js +3 -3
  6. package/build/EntityAssociationLoader.js.map +1 -1
  7. package/build/EntityCompanion.d.ts +5 -0
  8. package/build/EntityCompanion.js +8 -1
  9. package/build/EntityCompanion.js.map +1 -1
  10. package/build/EntityCompanionProvider.d.ts +1 -1
  11. package/build/EntityCompanionProvider.js +5 -5
  12. package/build/EntityCompanionProvider.js.map +1 -1
  13. package/build/EntityConfiguration.d.ts +1 -1
  14. package/build/EntityConfiguration.js +3 -3
  15. package/build/EntityConfiguration.js.map +1 -1
  16. package/build/EntityDatabaseAdapter.d.ts +4 -4
  17. package/build/EntityDatabaseAdapter.js +13 -13
  18. package/build/EntityDatabaseAdapter.js.map +1 -1
  19. package/build/EntityFieldDefinition.d.ts +77 -0
  20. package/build/EntityFieldDefinition.js +53 -0
  21. package/build/EntityFieldDefinition.js.map +1 -0
  22. package/build/EntityFields.d.ts +1 -77
  23. package/build/EntityFields.js +13 -61
  24. package/build/EntityFields.js.map +1 -1
  25. package/build/EntityLoader.d.ts +3 -1
  26. package/build/EntityLoader.js +19 -15
  27. package/build/EntityLoader.js.map +1 -1
  28. package/build/EntityLoaderFactory.d.ts +3 -1
  29. package/build/EntityLoaderFactory.js +3 -2
  30. package/build/EntityLoaderFactory.js.map +1 -1
  31. package/build/EntityMutationInfo.d.ts +26 -0
  32. package/build/EntityMutationInfo.js +10 -0
  33. package/build/EntityMutationInfo.js.map +1 -0
  34. package/build/EntityMutationTriggerConfiguration.d.ts +4 -4
  35. package/build/EntityMutationValidator.d.ts +3 -3
  36. package/build/EntityMutationValidator.js.map +1 -1
  37. package/build/EntityMutator.d.ts +5 -16
  38. package/build/EntityMutator.js +62 -58
  39. package/build/EntityMutator.js.map +1 -1
  40. package/build/EntityPrivacyPolicy.d.ts +5 -4
  41. package/build/EntityPrivacyPolicy.js +60 -12
  42. package/build/EntityPrivacyPolicy.js.map +1 -1
  43. package/build/EntityQueryContext.d.ts +24 -0
  44. package/build/EntityQueryContext.js +43 -0
  45. package/build/EntityQueryContext.js.map +1 -1
  46. package/build/EntityQueryContextProvider.js +1 -0
  47. package/build/EntityQueryContextProvider.js.map +1 -1
  48. package/build/EntitySecondaryCacheLoader.js +2 -2
  49. package/build/EntitySecondaryCacheLoader.js.map +1 -1
  50. package/build/ReadonlyEntity.js +3 -4
  51. package/build/ReadonlyEntity.js.map +1 -1
  52. package/build/ViewerScopedEntityCompanion.d.ts +5 -0
  53. package/build/ViewerScopedEntityCompanion.js +6 -0
  54. package/build/ViewerScopedEntityCompanion.js.map +1 -1
  55. package/build/__tests__/EnforcingEntityLoader-test.js +82 -82
  56. package/build/__tests__/EnforcingEntityLoader-test.js.map +1 -1
  57. package/build/__tests__/Entity-test.js +6 -6
  58. package/build/__tests__/Entity-test.js.map +1 -1
  59. package/build/__tests__/EntityAssociationLoader-test.js +40 -40
  60. package/build/__tests__/EntityAssociationLoader-test.js.map +1 -1
  61. package/build/__tests__/EntityCommonUseCases-test.js +11 -11
  62. package/build/__tests__/EntityCommonUseCases-test.js.map +1 -1
  63. package/build/__tests__/EntityCompanion-test.js +3 -3
  64. package/build/__tests__/EntityCompanion-test.js.map +1 -1
  65. package/build/__tests__/EntityCompanionProvider-test.js +1 -1
  66. package/build/__tests__/EntityCompanionProvider-test.js.map +1 -1
  67. package/build/__tests__/EntityDatabaseAdapter-test.js +12 -12
  68. package/build/__tests__/EntityDatabaseAdapter-test.js.map +1 -1
  69. package/build/__tests__/EntityEdges-test.js +103 -6
  70. package/build/__tests__/EntityEdges-test.js.map +1 -1
  71. package/build/__tests__/EntityFields-test.js +18 -27
  72. package/build/__tests__/EntityFields-test.js.map +1 -1
  73. package/build/__tests__/EntityLoader-constructor-test.d.ts +22 -0
  74. package/build/__tests__/EntityLoader-constructor-test.js +111 -0
  75. package/build/__tests__/EntityLoader-constructor-test.js.map +1 -0
  76. package/build/__tests__/EntityLoader-test.js +72 -64
  77. package/build/__tests__/EntityLoader-test.js.map +1 -1
  78. package/build/__tests__/EntityMutator-MutationCacheConsistency-test.d.ts +1 -0
  79. package/build/__tests__/EntityMutator-MutationCacheConsistency-test.js +81 -0
  80. package/build/__tests__/EntityMutator-MutationCacheConsistency-test.js.map +1 -0
  81. package/build/__tests__/EntityMutator-test.js +116 -114
  82. package/build/__tests__/EntityMutator-test.js.map +1 -1
  83. package/build/__tests__/EntityPrivacyPolicy-test.js +143 -67
  84. package/build/__tests__/EntityPrivacyPolicy-test.js.map +1 -1
  85. package/build/__tests__/EntityQueryContext-test.d.ts +1 -0
  86. package/build/__tests__/EntityQueryContext-test.js +56 -0
  87. package/build/__tests__/EntityQueryContext-test.js.map +1 -0
  88. package/build/__tests__/EntitySecondaryCacheLoader-test.js +15 -15
  89. package/build/__tests__/EntitySecondaryCacheLoader-test.js.map +1 -1
  90. package/build/__tests__/EntitySelfReferentialEdges-test.js +13 -12
  91. package/build/__tests__/EntitySelfReferentialEdges-test.js.map +1 -1
  92. package/build/__tests__/ReadonlyEntity-test.js +11 -11
  93. package/build/__tests__/ReadonlyEntity-test.js.map +1 -1
  94. package/build/__tests__/ViewerContext-test.js +2 -2
  95. package/build/__tests__/ViewerContext-test.js.map +1 -1
  96. package/build/__tests__/ViewerScopedEntityCompanion-test.js +2 -2
  97. package/build/__tests__/ViewerScopedEntityCompanion-test.js.map +1 -1
  98. package/build/__tests__/ViewerScopedEntityCompanionProvider-test.js +2 -2
  99. package/build/__tests__/ViewerScopedEntityCompanionProvider-test.js.map +1 -1
  100. package/build/__tests__/ViewerScopedEntityLoaderFactory-test.js +5 -5
  101. package/build/__tests__/ViewerScopedEntityLoaderFactory-test.js.map +1 -1
  102. package/build/__tests__/ViewerScopedEntityMutatorFactory-test.js +5 -5
  103. package/build/__tests__/ViewerScopedEntityMutatorFactory-test.js.map +1 -1
  104. package/build/__tests__/cases/TwoEntitySameTableDisjointRows-test.js +5 -5
  105. package/build/__tests__/cases/TwoEntitySameTableDisjointRows-test.js.map +1 -1
  106. package/build/__tests__/cases/TwoEntitySameTableOverlappingRows-test.js +2 -2
  107. package/build/__tests__/cases/TwoEntitySameTableOverlappingRows-test.js.map +1 -1
  108. package/build/__tests__/entityUtils-test.js +21 -21
  109. package/build/__tests__/entityUtils-test.js.map +1 -1
  110. package/build/index.d.ts +3 -0
  111. package/build/index.js +5 -1
  112. package/build/index.js.map +1 -1
  113. package/build/internal/EntityDataManager.js +8 -7
  114. package/build/internal/EntityDataManager.js.map +1 -1
  115. package/build/internal/EntityFieldTransformationUtils.js +2 -2
  116. package/build/internal/EntityFieldTransformationUtils.js.map +1 -1
  117. package/build/internal/ReadThroughEntityCache.js +4 -4
  118. package/build/internal/ReadThroughEntityCache.js.map +1 -1
  119. package/build/internal/__tests__/EntityDataManager-test.js +17 -17
  120. package/build/internal/__tests__/EntityDataManager-test.js.map +1 -1
  121. package/build/internal/__tests__/EntityFieldTransformationUtils-test.js +8 -8
  122. package/build/internal/__tests__/EntityFieldTransformationUtils-test.js.map +1 -1
  123. package/build/internal/__tests__/ReadThroughEntityCache-test.js +48 -48
  124. package/build/internal/__tests__/ReadThroughEntityCache-test.js.map +1 -1
  125. package/build/metrics/EntityMetricsUtils.js +1 -1
  126. package/build/metrics/EntityMetricsUtils.js.map +1 -1
  127. package/build/metrics/IEntityMetricsAdapter.d.ts +16 -0
  128. package/build/metrics/IEntityMetricsAdapter.js +6 -1
  129. package/build/metrics/IEntityMetricsAdapter.js.map +1 -1
  130. package/build/metrics/NoOpEntityMetricsAdapter.d.ts +2 -1
  131. package/build/metrics/NoOpEntityMetricsAdapter.js +1 -0
  132. package/build/metrics/NoOpEntityMetricsAdapter.js.map +1 -1
  133. package/build/rules/__tests__/AlwaysAllowPrivacyPolicyRule-test.js +4 -4
  134. package/build/rules/__tests__/AlwaysAllowPrivacyPolicyRule-test.js.map +1 -1
  135. package/build/rules/__tests__/AlwaysDenyPrivacyPolicyRule-test.js +4 -4
  136. package/build/rules/__tests__/AlwaysDenyPrivacyPolicyRule-test.js.map +1 -1
  137. package/build/rules/__tests__/AlwaysSkipPrivacyPolicyRule-test.js +4 -4
  138. package/build/rules/__tests__/AlwaysSkipPrivacyPolicyRule-test.js.map +1 -1
  139. package/build/testfixtures/DateIDTestEntity.js.map +1 -1
  140. package/build/testfixtures/SimpleTestEntity.js.map +1 -1
  141. package/build/testfixtures/TestEntity.d.ts +5 -5
  142. package/build/testfixtures/TestEntity.js +2 -2
  143. package/build/testfixtures/TestEntity.js.map +1 -1
  144. package/build/testfixtures/TestEntity2.d.ts +5 -5
  145. package/build/testfixtures/TestEntity2.js.map +1 -1
  146. package/build/testfixtures/TestEntityNumberKey.js.map +1 -1
  147. package/build/utils/collections/__tests__/maps-test.js +13 -13
  148. package/build/utils/collections/__tests__/maps-test.js.map +1 -1
  149. package/build/utils/collections/maps.js +1 -1
  150. package/build/utils/collections/maps.js.map +1 -1
  151. package/build/utils/testing/PrivacyPolicyRuleTestUtils.d.ts +6 -6
  152. package/build/utils/testing/PrivacyPolicyRuleTestUtils.js +1 -1
  153. package/build/utils/testing/PrivacyPolicyRuleTestUtils.js.map +1 -1
  154. package/build/utils/testing/StubCacheAdapter.js +1 -1
  155. package/build/utils/testing/StubCacheAdapter.js.map +1 -1
  156. package/build/utils/testing/StubDatabaseAdapter.js +6 -6
  157. package/build/utils/testing/StubDatabaseAdapter.js.map +1 -1
  158. package/build/utils/testing/__tests__/StubDatabaseAdapter-test.js +9 -9
  159. package/build/utils/testing/__tests__/StubDatabaseAdapter-test.js.map +1 -1
  160. package/build/utils/testing/describeFieldTestCase.d.ts +2 -0
  161. package/build/utils/testing/describeFieldTestCase.js +18 -0
  162. package/build/utils/testing/describeFieldTestCase.js.map +1 -0
  163. package/package.json +2 -1
  164. package/src/Entity.ts +10 -2
  165. package/src/EntityAssociationLoader.ts +1 -1
  166. package/src/EntityCompanion.ts +10 -2
  167. package/src/EntityCompanionProvider.ts +5 -9
  168. package/src/EntityConfiguration.ts +1 -1
  169. package/src/EntityDatabaseAdapter.ts +10 -8
  170. package/src/EntityFieldDefinition.ts +124 -0
  171. package/src/EntityFields.ts +2 -125
  172. package/src/EntityLoader.ts +12 -4
  173. package/src/EntityLoaderFactory.ts +5 -2
  174. package/src/EntityMutationInfo.ts +47 -0
  175. package/src/EntityMutationTriggerConfiguration.ts +5 -5
  176. package/src/EntityMutationValidator.ts +10 -4
  177. package/src/EntityMutator.ts +98 -76
  178. package/src/EntityPrivacyPolicy.ts +77 -19
  179. package/src/EntityQueryContext.ts +54 -0
  180. package/src/EntityQueryContextProvider.ts +1 -0
  181. package/src/ReadonlyEntity.ts +3 -2
  182. package/src/ViewerScopedEntityCompanion.ts +8 -0
  183. package/src/__tests__/Entity-test.ts +8 -8
  184. package/src/__tests__/EntityCommonUseCases-test.ts +4 -4
  185. package/src/__tests__/EntityEdges-test.ts +169 -14
  186. package/src/__tests__/EntityFields-test.ts +2 -21
  187. package/src/__tests__/EntityLoader-constructor-test.ts +177 -0
  188. package/src/__tests__/EntityLoader-test.ts +39 -11
  189. package/src/__tests__/EntityMutator-MutationCacheConsistency-test.ts +105 -0
  190. package/src/__tests__/EntityMutator-test.ts +140 -133
  191. package/src/__tests__/EntityPrivacyPolicy-test.ts +215 -78
  192. package/src/__tests__/EntityQueryContext-test.ts +82 -0
  193. package/src/__tests__/EntitySecondaryCacheLoader-test.ts +7 -9
  194. package/src/__tests__/EntitySelfReferentialEdges-test.ts +6 -5
  195. package/src/__tests__/ViewerContext-test.ts +7 -6
  196. package/src/__tests__/ViewerScopedEntityCompanion-test.ts +11 -10
  197. package/src/__tests__/ViewerScopedEntityMutatorFactory-test.ts +4 -3
  198. package/src/__tests__/cases/TwoEntitySameTableDisjointRows-test.ts +6 -6
  199. package/src/__tests__/cases/TwoEntitySameTableOverlappingRows-test.ts +4 -4
  200. package/src/index.ts +3 -0
  201. package/src/internal/EntityDataManager.ts +2 -1
  202. package/src/internal/__tests__/EntityDataManager-test.ts +2 -2
  203. package/src/internal/__tests__/ReadThroughEntityCache-test.ts +15 -13
  204. package/src/metrics/EntityMetricsUtils.ts +56 -50
  205. package/src/metrics/IEntityMetricsAdapter.ts +23 -0
  206. package/src/metrics/NoOpEntityMetricsAdapter.ts +2 -0
  207. package/src/testfixtures/DateIDTestEntity.ts +4 -4
  208. package/src/testfixtures/SimpleTestEntity.ts +4 -4
  209. package/src/testfixtures/TestEntity.ts +4 -4
  210. package/src/testfixtures/TestEntity2.ts +4 -4
  211. package/src/testfixtures/TestEntityNumberKey.ts +4 -4
  212. package/src/utils/testing/StubDatabaseAdapter.ts +2 -2
  213. package/src/utils/testing/__tests__/StubDatabaseAdapter-test.ts +1 -1
  214. package/src/utils/testing/describeFieldTestCase.ts +21 -0
  215. package/CHANGELOG.md +0 -252
@@ -14,12 +14,16 @@ import { v4 as uuidv4 } from 'uuid';
14
14
 
15
15
  import EntityDatabaseAdapter from '../EntityDatabaseAdapter';
16
16
  import EntityLoaderFactory from '../EntityLoaderFactory';
17
+ import {
18
+ EntityMutationType,
19
+ EntityTriggerMutationInfo,
20
+ EntityValidatorMutationInfo,
21
+ } from '../EntityMutationInfo';
17
22
  import EntityMutationTriggerConfiguration, {
18
23
  EntityMutationTrigger,
19
24
  EntityNonTransactionalMutationTrigger,
20
25
  } from '../EntityMutationTriggerConfiguration';
21
26
  import EntityMutationValidator from '../EntityMutationValidator';
22
- import { EntityMutationInfo, EntityMutationType } from '../EntityMutator';
23
27
  import EntityMutatorFactory from '../EntityMutatorFactory';
24
28
  import { EntityTransactionalQueryContext, EntityQueryContext } from '../EntityQueryContext';
25
29
  import ViewerContext from '../ViewerContext';
@@ -53,7 +57,7 @@ class TestMutationTrigger extends EntityMutationTrigger<
53
57
  _viewerContext: ViewerContext,
54
58
  _queryContext: EntityQueryContext,
55
59
  _entity: TestEntity,
56
- _mutationInfo: EntityMutationInfo<
60
+ _mutationInfo: EntityTriggerMutationInfo<
57
61
  TestFields,
58
62
  string,
59
63
  ViewerContext,
@@ -95,7 +99,13 @@ const verifyValidatorCounts = (
95
99
  keyof TestFields
96
100
  >[],
97
101
  expectedCalls: number,
98
- mutationInfo: EntityMutationInfo<TestFields, string, ViewerContext, TestEntity, keyof TestFields>
102
+ mutationInfo: EntityValidatorMutationInfo<
103
+ TestFields,
104
+ string,
105
+ ViewerContext,
106
+ TestEntity,
107
+ keyof TestFields
108
+ >
99
109
  ): void => {
100
110
  for (const validator of mutationValidatorSpies) {
101
111
  verify(
@@ -125,15 +135,15 @@ const setUpMutationTriggerSpies = (
125
135
  keyof TestFields
126
136
  > => {
127
137
  return {
128
- beforeCreate: [spy(mutationTriggers.beforeCreate![0])],
129
- afterCreate: [spy(mutationTriggers.afterCreate![0])],
130
- beforeUpdate: [spy(mutationTriggers.beforeUpdate![0])],
131
- afterUpdate: [spy(mutationTriggers.afterUpdate![0])],
132
- beforeDelete: [spy(mutationTriggers.beforeDelete![0])],
133
- afterDelete: [spy(mutationTriggers.afterDelete![0])],
134
- beforeAll: [spy(mutationTriggers.beforeAll![0])],
135
- afterAll: [spy(mutationTriggers.afterAll![0])],
136
- afterCommit: [spy(mutationTriggers.afterCommit![0])],
138
+ beforeCreate: [spy(mutationTriggers.beforeCreate![0]!)],
139
+ afterCreate: [spy(mutationTriggers.afterCreate![0]!)],
140
+ beforeUpdate: [spy(mutationTriggers.beforeUpdate![0]!)],
141
+ afterUpdate: [spy(mutationTriggers.afterUpdate![0]!)],
142
+ beforeDelete: [spy(mutationTriggers.beforeDelete![0]!)],
143
+ afterDelete: [spy(mutationTriggers.afterDelete![0]!)],
144
+ beforeAll: [spy(mutationTriggers.beforeAll![0]!)],
145
+ afterAll: [spy(mutationTriggers.afterAll![0]!)],
146
+ afterCommit: [spy(mutationTriggers.afterCommit![0]!)],
137
147
  };
138
148
  };
139
149
 
@@ -164,7 +174,13 @@ const verifyTriggerCounts = (
164
174
  >,
165
175
  boolean
166
176
  >,
167
- mutationInfo: EntityMutationInfo<TestFields, string, ViewerContext, TestEntity, keyof TestFields>
177
+ mutationInfo: EntityTriggerMutationInfo<
178
+ TestFields,
179
+ string,
180
+ ViewerContext,
181
+ TestEntity,
182
+ keyof TestFields
183
+ >
168
184
  ): void => {
169
185
  Object.keys(executed).forEach((s) => {
170
186
  if ((executed as any)[s]) {
@@ -189,7 +205,7 @@ const verifyTriggerCounts = (
189
205
  });
190
206
 
191
207
  verify(
192
- mutationTriggerSpies.beforeAll![0].executeAsync(
208
+ mutationTriggerSpies.beforeAll![0]!.executeAsync(
193
209
  viewerContext,
194
210
  anyOfClass(EntityTransactionalQueryContext),
195
211
  anyOfClass(TestEntity),
@@ -198,7 +214,7 @@ const verifyTriggerCounts = (
198
214
  ).once();
199
215
 
200
216
  verify(
201
- mutationTriggerSpies.afterAll![0].executeAsync(
217
+ mutationTriggerSpies.afterAll![0]!.executeAsync(
202
218
  viewerContext,
203
219
  anyOfClass(EntityTransactionalQueryContext),
204
220
  anyOfClass(TestEntity),
@@ -207,7 +223,7 @@ const verifyTriggerCounts = (
207
223
  ).once();
208
224
 
209
225
  verify(
210
- mutationTriggerSpies.afterCommit![0].executeAsync(
226
+ mutationTriggerSpies.afterCommit![0]!.executeAsync(
211
227
  viewerContext,
212
228
  anyOfClass(TestEntity),
213
229
  deepEqual(mutationInfo)
@@ -297,7 +313,8 @@ const createEntityMutatorFactory = (
297
313
  testEntityConfiguration,
298
314
  TestEntity,
299
315
  privacyPolicy,
300
- dataManager
316
+ dataManager,
317
+ metricsAdapter
301
318
  );
302
319
  const entityMutatorFactory = new EntityMutatorFactory(
303
320
  testEntityConfiguration,
@@ -388,7 +405,8 @@ describe(EntityMutatorFactory, () => {
388
405
  spiedPrivacyPolicy.authorizeCreateAsync(
389
406
  viewerContext,
390
407
  anyOfClass(EntityTransactionalQueryContext),
391
- anyOfClass(TestEntity)
408
+ anyOfClass(TestEntity),
409
+ anything()
392
410
  )
393
411
  ).once();
394
412
  });
@@ -527,28 +545,25 @@ describe(EntityMutatorFactory, () => {
527
545
 
528
546
  const id1 = uuidv4();
529
547
  const id2 = uuidv4();
530
- const {
531
- privacyPolicy,
532
- entityMutatorFactory,
533
- entityLoaderFactory,
534
- } = createEntityMutatorFactory([
535
- {
536
- customIdField: id1,
537
- stringField: 'huh',
538
- testIndexedField: '3',
539
- intField: 3,
540
- dateField: new Date(),
541
- nullableField: null,
542
- },
543
- {
544
- customIdField: id2,
545
- stringField: 'huh',
546
- testIndexedField: '4',
547
- intField: 3,
548
- dateField: new Date(),
549
- nullableField: null,
550
- },
551
- ]);
548
+ const { privacyPolicy, entityMutatorFactory, entityLoaderFactory } =
549
+ createEntityMutatorFactory([
550
+ {
551
+ customIdField: id1,
552
+ stringField: 'huh',
553
+ testIndexedField: '3',
554
+ intField: 3,
555
+ dateField: new Date(),
556
+ nullableField: null,
557
+ },
558
+ {
559
+ customIdField: id2,
560
+ stringField: 'huh',
561
+ testIndexedField: '4',
562
+ intField: 3,
563
+ dateField: new Date(),
564
+ nullableField: null,
565
+ },
566
+ ]);
552
567
 
553
568
  const spiedPrivacyPolicy = spy(privacyPolicy);
554
569
 
@@ -565,7 +580,8 @@ describe(EntityMutatorFactory, () => {
565
580
  spiedPrivacyPolicy.authorizeUpdateAsync(
566
581
  viewerContext,
567
582
  anyOfClass(EntityTransactionalQueryContext),
568
- anyOfClass(TestEntity)
583
+ anyOfClass(TestEntity),
584
+ anything()
569
585
  )
570
586
  ).once();
571
587
  });
@@ -576,28 +592,25 @@ describe(EntityMutatorFactory, () => {
576
592
 
577
593
  const id1 = uuidv4();
578
594
  const id2 = uuidv4();
579
- const {
580
- mutationTriggers,
581
- entityMutatorFactory,
582
- entityLoaderFactory,
583
- } = createEntityMutatorFactory([
584
- {
585
- customIdField: id1,
586
- stringField: 'huh',
587
- testIndexedField: '3',
588
- intField: 3,
589
- dateField: new Date(),
590
- nullableField: null,
591
- },
592
- {
593
- customIdField: id2,
594
- stringField: 'huh',
595
- testIndexedField: '4',
596
- intField: 3,
597
- dateField: new Date(),
598
- nullableField: null,
599
- },
600
- ]);
595
+ const { mutationTriggers, entityMutatorFactory, entityLoaderFactory } =
596
+ createEntityMutatorFactory([
597
+ {
598
+ customIdField: id1,
599
+ stringField: 'huh',
600
+ testIndexedField: '3',
601
+ intField: 3,
602
+ dateField: new Date(),
603
+ nullableField: null,
604
+ },
605
+ {
606
+ customIdField: id2,
607
+ stringField: 'huh',
608
+ testIndexedField: '4',
609
+ intField: 3,
610
+ dateField: new Date(),
611
+ nullableField: null,
612
+ },
613
+ ]);
601
614
 
602
615
  const triggerSpies = setUpMutationTriggerSpies(mutationTriggers);
603
616
 
@@ -630,28 +643,25 @@ describe(EntityMutatorFactory, () => {
630
643
 
631
644
  const id1 = uuidv4();
632
645
  const id2 = uuidv4();
633
- const {
634
- mutationValidators,
635
- entityMutatorFactory,
636
- entityLoaderFactory,
637
- } = createEntityMutatorFactory([
638
- {
639
- customIdField: id1,
640
- stringField: 'huh',
641
- testIndexedField: '3',
642
- intField: 3,
643
- dateField: new Date(),
644
- nullableField: null,
645
- },
646
- {
647
- customIdField: id2,
648
- stringField: 'huh',
649
- testIndexedField: '4',
650
- intField: 3,
651
- dateField: new Date(),
652
- nullableField: null,
653
- },
654
- ]);
646
+ const { mutationValidators, entityMutatorFactory, entityLoaderFactory } =
647
+ createEntityMutatorFactory([
648
+ {
649
+ customIdField: id1,
650
+ stringField: 'huh',
651
+ testIndexedField: '3',
652
+ intField: 3,
653
+ dateField: new Date(),
654
+ nullableField: null,
655
+ },
656
+ {
657
+ customIdField: id2,
658
+ stringField: 'huh',
659
+ testIndexedField: '4',
660
+ intField: 3,
661
+ dateField: new Date(),
662
+ nullableField: null,
663
+ },
664
+ ]);
655
665
 
656
666
  const validatorSpies = setUpMutationValidatorSpies(mutationValidators);
657
667
 
@@ -707,20 +717,17 @@ describe(EntityMutatorFactory, () => {
707
717
  const queryContext = StubQueryContextProvider.getQueryContext();
708
718
 
709
719
  const id1 = uuidv4();
710
- const {
711
- privacyPolicy,
712
- entityMutatorFactory,
713
- entityLoaderFactory,
714
- } = createEntityMutatorFactory([
715
- {
716
- customIdField: id1,
717
- stringField: 'huh',
718
- testIndexedField: '3',
719
- intField: 3,
720
- dateField: new Date(),
721
- nullableField: null,
722
- },
723
- ]);
720
+ const { privacyPolicy, entityMutatorFactory, entityLoaderFactory } =
721
+ createEntityMutatorFactory([
722
+ {
723
+ customIdField: id1,
724
+ stringField: 'huh',
725
+ testIndexedField: '3',
726
+ intField: 3,
727
+ dateField: new Date(),
728
+ nullableField: null,
729
+ },
730
+ ]);
724
731
 
725
732
  const spiedPrivacyPolicy = spy(privacyPolicy);
726
733
 
@@ -734,7 +741,8 @@ describe(EntityMutatorFactory, () => {
734
741
  spiedPrivacyPolicy.authorizeDeleteAsync(
735
742
  viewerContext,
736
743
  anyOfClass(EntityTransactionalQueryContext),
737
- anyOfClass(TestEntity)
744
+ anyOfClass(TestEntity),
745
+ anything()
738
746
  )
739
747
  ).once();
740
748
  });
@@ -744,20 +752,17 @@ describe(EntityMutatorFactory, () => {
744
752
  const queryContext = StubQueryContextProvider.getQueryContext();
745
753
 
746
754
  const id1 = uuidv4();
747
- const {
748
- mutationTriggers,
749
- entityMutatorFactory,
750
- entityLoaderFactory,
751
- } = createEntityMutatorFactory([
752
- {
753
- customIdField: id1,
754
- stringField: 'huh',
755
- testIndexedField: '3',
756
- intField: 3,
757
- dateField: new Date(),
758
- nullableField: null,
759
- },
760
- ]);
755
+ const { mutationTriggers, entityMutatorFactory, entityLoaderFactory } =
756
+ createEntityMutatorFactory([
757
+ {
758
+ customIdField: id1,
759
+ stringField: 'huh',
760
+ testIndexedField: '3',
761
+ intField: 3,
762
+ dateField: new Date(),
763
+ nullableField: null,
764
+ },
765
+ ]);
761
766
 
762
767
  const triggerSpies = setUpMutationTriggerSpies(mutationTriggers);
763
768
 
@@ -778,7 +783,7 @@ describe(EntityMutatorFactory, () => {
778
783
  beforeDelete: true,
779
784
  afterDelete: true,
780
785
  },
781
- { type: EntityMutationType.DELETE }
786
+ { type: EntityMutationType.DELETE, cascadingDeleteCause: null }
782
787
  );
783
788
  });
784
789
 
@@ -787,20 +792,17 @@ describe(EntityMutatorFactory, () => {
787
792
  const queryContext = StubQueryContextProvider.getQueryContext();
788
793
 
789
794
  const id1 = uuidv4();
790
- const {
791
- mutationValidators,
792
- entityMutatorFactory,
793
- entityLoaderFactory,
794
- } = createEntityMutatorFactory([
795
- {
796
- customIdField: id1,
797
- stringField: 'huh',
798
- testIndexedField: '3',
799
- intField: 3,
800
- dateField: new Date(),
801
- nullableField: null,
802
- },
803
- ]);
795
+ const { mutationValidators, entityMutatorFactory, entityLoaderFactory } =
796
+ createEntityMutatorFactory([
797
+ {
798
+ customIdField: id1,
799
+ stringField: 'huh',
800
+ testIndexedField: '3',
801
+ intField: 3,
802
+ dateField: new Date(),
803
+ nullableField: null,
804
+ },
805
+ ]);
804
806
 
805
807
  const validatorSpies = setUpMutationValidatorSpies(mutationValidators);
806
808
 
@@ -810,7 +812,9 @@ describe(EntityMutatorFactory, () => {
810
812
 
811
813
  await entityMutatorFactory.forDelete(existingEntity, queryContext).enforceDeleteAsync();
812
814
 
813
- verifyValidatorCounts(viewerContext, validatorSpies, 0, { type: EntityMutationType.DELETE });
815
+ verifyValidatorCounts(viewerContext, validatorSpies, 0, {
816
+ type: EntityMutationType.DELETE as any,
817
+ });
814
818
  });
815
819
  });
816
820
 
@@ -912,21 +916,24 @@ describe(EntityMutatorFactory, () => {
912
916
  privacyPolicyMock.authorizeCreateAsync(
913
917
  viewerContext,
914
918
  anyOfClass(EntityTransactionalQueryContext),
915
- anyOfClass(SimpleTestEntity)
919
+ anyOfClass(SimpleTestEntity),
920
+ anything()
916
921
  )
917
922
  ).thenReject(rejectionError);
918
923
  when(
919
924
  privacyPolicyMock.authorizeUpdateAsync(
920
925
  viewerContext,
921
926
  anyOfClass(EntityTransactionalQueryContext),
922
- anyOfClass(SimpleTestEntity)
927
+ anyOfClass(SimpleTestEntity),
928
+ anything()
923
929
  )
924
930
  ).thenReject(rejectionError);
925
931
  when(
926
932
  privacyPolicyMock.authorizeDeleteAsync(
927
933
  viewerContext,
928
934
  anyOfClass(EntityTransactionalQueryContext),
929
- anyOfClass(SimpleTestEntity)
935
+ anyOfClass(SimpleTestEntity),
936
+ anything()
930
937
  )
931
938
  ).thenReject(rejectionError);
932
939