@expo/entity 0.33.0 → 0.34.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 (94) hide show
  1. package/build/Entity.d.ts +6 -6
  2. package/build/Entity.js +6 -29
  3. package/build/Entity.js.map +1 -1
  4. package/build/EntityAssociationLoader.d.ts +8 -8
  5. package/build/EntityAssociationLoader.js +4 -20
  6. package/build/EntityAssociationLoader.js.map +1 -1
  7. package/build/EntityFields.js +3 -2
  8. package/build/EntityFields.js.map +1 -1
  9. package/build/EntityMutationTriggerConfiguration.d.ts +5 -7
  10. package/build/EntityMutationTriggerConfiguration.js +3 -4
  11. package/build/EntityMutationTriggerConfiguration.js.map +1 -1
  12. package/build/EntityQueryContextProvider.d.ts +1 -1
  13. package/build/EntityQueryContextProvider.js +1 -1
  14. package/build/EntityQueryContextProvider.js.map +1 -1
  15. package/build/IEntityCacheAdapterProvider.d.ts +1 -1
  16. package/build/ReadonlyEntity.d.ts +1 -1
  17. package/build/ReadonlyEntity.js +1 -4
  18. package/build/ReadonlyEntity.js.map +1 -1
  19. package/build/ViewerContext.d.ts +2 -2
  20. package/build/ViewerContext.js +3 -3
  21. package/build/ViewerContext.js.map +1 -1
  22. package/build/__tests__/Entity-test.js +13 -13
  23. package/build/__tests__/Entity-test.js.map +1 -1
  24. package/build/__tests__/EntityAssociationLoader-test.js +69 -37
  25. package/build/__tests__/EntityAssociationLoader-test.js.map +1 -1
  26. package/build/__tests__/EntityCommonUseCases-test.js +19 -11
  27. package/build/__tests__/EntityCommonUseCases-test.js.map +1 -1
  28. package/build/__tests__/EntityEdges-test.js +72 -40
  29. package/build/__tests__/EntityEdges-test.js.map +1 -1
  30. package/build/__tests__/EntityFields-test.js +7 -1
  31. package/build/__tests__/EntityFields-test.js.map +1 -1
  32. package/build/__tests__/EntityLoader-constructor-test.js +1 -1
  33. package/build/__tests__/EntityLoader-constructor-test.js.map +1 -1
  34. package/build/__tests__/EntityLoader-test.js +19 -19
  35. package/build/__tests__/EntityLoader-test.js.map +1 -1
  36. package/build/__tests__/EntityMutator-MutationCacheConsistency-test.js +6 -6
  37. package/build/__tests__/EntityMutator-MutationCacheConsistency-test.js.map +1 -1
  38. package/build/__tests__/EntityMutator-test.js +20 -20
  39. package/build/__tests__/EntityMutator-test.js.map +1 -1
  40. package/build/__tests__/EntitySecondaryCacheLoader-test.js +10 -10
  41. package/build/__tests__/EntitySecondaryCacheLoader-test.js.map +1 -1
  42. package/build/__tests__/EntitySelfReferentialEdges-test.js +79 -47
  43. package/build/__tests__/EntitySelfReferentialEdges-test.js.map +1 -1
  44. package/build/__tests__/ReadonlyEntity-test.js +13 -13
  45. package/build/__tests__/ReadonlyEntity-test.js.map +1 -1
  46. package/build/__tests__/ViewerContext-test.js +2 -2
  47. package/build/__tests__/ViewerContext-test.js.map +1 -1
  48. package/build/__tests__/cases/TwoEntitySameTableDisjointRows-test.js +12 -8
  49. package/build/__tests__/cases/TwoEntitySameTableDisjointRows-test.js.map +1 -1
  50. package/build/__tests__/cases/TwoEntitySameTableOverlappingRows-test.js +15 -13
  51. package/build/__tests__/cases/TwoEntitySameTableOverlappingRows-test.js.map +1 -1
  52. package/build/internal/EntityDataManager.js +1 -1
  53. package/build/internal/EntityDataManager.js.map +1 -1
  54. package/build/internal/__tests__/EntityDataManager-test.js +11 -11
  55. package/build/internal/__tests__/EntityDataManager-test.js.map +1 -1
  56. package/build/testfixtures/SimpleTestEntity.d.ts +8 -8
  57. package/build/testfixtures/SimpleTestEntity.js.map +1 -1
  58. package/build/testfixtures/TestEntity.d.ts +12 -12
  59. package/build/testfixtures/TestEntity.js.map +1 -1
  60. package/build/testfixtures/TestEntity2.d.ts +8 -8
  61. package/build/testfixtures/TestEntity2.js.map +1 -1
  62. package/build/testfixtures/TestViewerContext.d.ts +3 -0
  63. package/build/testfixtures/TestViewerContext.js +6 -0
  64. package/build/testfixtures/TestViewerContext.js.map +1 -1
  65. package/package.json +2 -2
  66. package/src/Entity.ts +6 -29
  67. package/src/EntityAssociationLoader.ts +9 -25
  68. package/src/EntityFields.ts +5 -3
  69. package/src/EntityMutationTriggerConfiguration.ts +5 -7
  70. package/src/EntityQueryContextProvider.ts +1 -1
  71. package/src/IEntityCacheAdapterProvider.ts +1 -1
  72. package/src/ReadonlyEntity.ts +1 -4
  73. package/src/ViewerContext.ts +5 -5
  74. package/src/__tests__/Entity-test.ts +43 -27
  75. package/src/__tests__/EntityAssociationLoader-test.ts +168 -86
  76. package/src/__tests__/EntityCommonUseCases-test.ts +36 -18
  77. package/src/__tests__/EntityEdges-test.ts +102 -40
  78. package/src/__tests__/EntityFields-test.ts +7 -1
  79. package/src/__tests__/EntityLoader-constructor-test.ts +1 -1
  80. package/src/__tests__/EntityLoader-test.ts +19 -19
  81. package/src/__tests__/EntityMutator-MutationCacheConsistency-test.ts +19 -16
  82. package/src/__tests__/EntityMutator-test.ts +67 -61
  83. package/src/__tests__/EntitySecondaryCacheLoader-test.ts +20 -11
  84. package/src/__tests__/EntitySelfReferentialEdges-test.ts +115 -47
  85. package/src/__tests__/ReadonlyEntity-test.ts +15 -13
  86. package/src/__tests__/ViewerContext-test.ts +3 -2
  87. package/src/__tests__/cases/TwoEntitySameTableDisjointRows-test.ts +33 -22
  88. package/src/__tests__/cases/TwoEntitySameTableOverlappingRows-test.ts +30 -22
  89. package/src/internal/EntityDataManager.ts +1 -1
  90. package/src/internal/__tests__/EntityDataManager-test.ts +11 -11
  91. package/src/testfixtures/SimpleTestEntity.ts +8 -8
  92. package/src/testfixtures/TestEntity.ts +15 -12
  93. package/src/testfixtures/TestEntity2.ts +8 -8
  94. package/src/testfixtures/TestViewerContext.ts +12 -1
package/build/Entity.d.ts CHANGED
@@ -30,26 +30,26 @@ export default abstract class Entity<TFields extends object, TID extends NonNull
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 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>;
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 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>;
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 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>>;
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 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>;
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 extends object, TID extends NonNull
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 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>;
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,7 +76,7 @@ export default abstract class Entity<TFields extends object, TID extends NonNull
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 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>;
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.
package/build/Entity.js CHANGED
@@ -30,10 +30,7 @@ class Entity extends ReadonlyEntity_1.default {
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(viewerContext, queryContext = viewerContext
34
- .getViewerScopedEntityCompanionForClass(this)
35
- .getQueryContextProvider()
36
- .getQueryContext()) {
33
+ static creator(viewerContext, queryContext) {
37
34
  return viewerContext
38
35
  .getViewerScopedEntityCompanionForClass(this)
39
36
  .getMutatorFactory()
@@ -45,11 +42,7 @@ class Entity extends ReadonlyEntity_1.default {
45
42
  * @param queryContext - query context in which to perform the update
46
43
  * @returns mutator for updating existingEntity
47
44
  */
48
- static updater(existingEntity, queryContext = existingEntity
49
- .getViewerContext()
50
- .getViewerScopedEntityCompanionForClass(this)
51
- .getQueryContextProvider()
52
- .getQueryContext()) {
45
+ static updater(existingEntity, queryContext) {
53
46
  return existingEntity
54
47
  .getViewerContext()
55
48
  .getViewerScopedEntityCompanionForClass(this)
@@ -61,11 +54,7 @@ class Entity extends ReadonlyEntity_1.default {
61
54
  * @param existingEntity - entity to delete
62
55
  * @param queryContext - query context in which to perform the delete
63
56
  */
64
- static deleteAsync(existingEntity, queryContext = existingEntity
65
- .getViewerContext()
66
- .getViewerScopedEntityCompanionForClass(this)
67
- .getQueryContextProvider()
68
- .getQueryContext()) {
57
+ static deleteAsync(existingEntity, queryContext) {
69
58
  return existingEntity
70
59
  .getViewerContext()
71
60
  .getViewerScopedEntityCompanionForClass(this)
@@ -78,11 +67,7 @@ class Entity extends ReadonlyEntity_1.default {
78
67
  * @param existingEntity - entity to delete
79
68
  * @param queryContext - query context in which to perform the delete
80
69
  */
81
- static enforceDeleteAsync(existingEntity, queryContext = existingEntity
82
- .getViewerContext()
83
- .getViewerScopedEntityCompanionForClass(this)
84
- .getQueryContextProvider()
85
- .getQueryContext()) {
70
+ static enforceDeleteAsync(existingEntity, queryContext) {
86
71
  return existingEntity
87
72
  .getViewerContext()
88
73
  .getViewerScopedEntityCompanionForClass(this)
@@ -106,11 +91,7 @@ class Entity extends ReadonlyEntity_1.default {
106
91
  * @param existingEntity - entity loaded by viewer
107
92
  * @param queryContext - query context in which to perform the check
108
93
  */
109
- static async canViewerUpdateAsync(existingEntity, queryContext = existingEntity
110
- .getViewerContext()
111
- .getViewerScopedEntityCompanionForClass(this)
112
- .getQueryContextProvider()
113
- .getQueryContext()) {
94
+ static async canViewerUpdateAsync(existingEntity, queryContext) {
114
95
  const companion = existingEntity
115
96
  .getViewerContext()
116
97
  .getViewerScopedEntityCompanionForClass(this);
@@ -127,11 +108,7 @@ class Entity extends ReadonlyEntity_1.default {
127
108
  * @param existingEntity - entity loaded by viewer
128
109
  * @param queryContext - query context in which to perform the check
129
110
  */
130
- static async canViewerDeleteAsync(existingEntity, queryContext = existingEntity
131
- .getViewerContext()
132
- .getViewerScopedEntityCompanionForClass(this)
133
- .getQueryContextProvider()
134
- .getQueryContext()) {
111
+ static async canViewerDeleteAsync(existingEntity, queryContext) {
135
112
  const companion = existingEntity
136
113
  .getViewerContext()
137
114
  .getViewerScopedEntityCompanionForClass(this);
@@ -1 +1 @@
1
- {"version":3,"file":"Entity.js","sourceRoot":"","sources":["../src/Entity.ts"],"names":[],"mappings":";;;;;AAAA,2CAAoD;AAMpD,sEAA8C;AAG9C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAA8B,MAK5B,SAAQ,wBAA6D;IACrE;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAuBZ,aAA+B,EAC/B,eAAmC,aAAa;SAC7C,sCAAsC,CAAC,IAAI,CAAC;SAC5C,uBAAuB,EAAE;SACzB,eAAe,EAAE;QAEpB,OAAO,aAAa;aACjB,sCAAsC,CAAC,IAAI,CAAC;aAC5C,iBAAiB,EAAE;aACnB,SAAS,CAAC,YAAY,CAAC,CAAC;IAC7B,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAsBZ,cAAwB,EACxB,eAAmC,cAAc;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CACF,CAAC;QACF,OAAO,gBAAgB,CAAC,EAAE,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAsB/B,cAAwB,EACxB,YAAgC;QAEhC,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;AAxQD,yBAwQC"}
@@ -19,7 +19,7 @@ export default class EntityAssociationLoader<TFields extends object, TID extends
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 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>>;
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 extends object, TID extends
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 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>[]>;
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 extends object, TID extends
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 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>;
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,7 +47,7 @@ export default class EntityAssociationLoader<TFields extends object, TID extends
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 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>[]>;
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.
@@ -56,7 +56,7 @@ export default class EntityAssociationLoader<TFields extends object, TID extends
56
56
  */
57
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
- ], queryContext?: EntityQueryContext): Promise<Result<TEntity2> | null>;
59
+ ], queryContext: EntityQueryContext): Promise<Result<TEntity2> | null>;
60
60
  /**
61
61
  * Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each
62
62
  * fold step, load an associated entity identified by a field value of the current fold value.
@@ -66,7 +66,7 @@ export default class EntityAssociationLoader<TFields extends object, TID extends
66
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
- ], queryContext?: EntityQueryContext): Promise<Result<TEntity3> | null>;
69
+ ], queryContext: EntityQueryContext): Promise<Result<TEntity3> | null>;
70
70
  /**
71
71
  * Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each
72
72
  * fold step, load an associated entity identified by a field value of the current fold value.
@@ -77,14 +77,14 @@ export default class EntityAssociationLoader<TFields extends object, TID extends
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>
80
- ], queryContext?: EntityQueryContext): Promise<Result<TEntity4> | null>;
80
+ ], queryContext: EntityQueryContext): Promise<Result<TEntity4> | null>;
81
81
  /**
82
82
  * Load an associated entity by folding a sequence of EntityLoadThroughDirective. At each
83
83
  * fold step, load an associated entity identified by a field value of the current fold value.
84
84
  * @param loadDirectives - associated entity load directives instructing each step of the fold
85
85
  * @param queryContext - query context in which to perform the loads
86
86
  */
87
- loadAssociatedEntityThroughAsync(loadDirectives: EntityLoadThroughDirective<TViewerContext, any, any, any, any, any, any, any>[], queryContext?: EntityQueryContext): Promise<Result<ReadonlyEntity<any, any, any, any>> | null>;
87
+ loadAssociatedEntityThroughAsync(loadDirectives: EntityLoadThroughDirective<TViewerContext, any, any, any, any, any, any, any>[], queryContext: EntityQueryContext): Promise<Result<ReadonlyEntity<any, any, any, any>> | null>;
88
88
  }
89
89
  /**
90
90
  * Instruction for each step of a load-associated-through method.
@@ -17,11 +17,7 @@ class EntityAssociationLoader {
17
17
  * @param associatedEntityClass - class of the associated entity
18
18
  * @param queryContext - query context in which to perform the load
19
19
  */
20
- async loadAssociatedEntityAsync(fieldIdentifyingAssociatedEntity, associatedEntityClass, queryContext = this.entity
21
- .getViewerContext()
22
- .getViewerScopedEntityCompanionForClass(associatedEntityClass)
23
- .getQueryContextProvider()
24
- .getQueryContext()) {
20
+ async loadAssociatedEntityAsync(fieldIdentifyingAssociatedEntity, associatedEntityClass, queryContext) {
25
21
  const associatedEntityID = this.entity.getField(fieldIdentifyingAssociatedEntity);
26
22
  if (!associatedEntityID) {
27
23
  return (0, results_1.result)(null);
@@ -42,11 +38,7 @@ class EntityAssociationLoader {
42
38
  * @param associatedEntityFieldContainingThisID - field of associated entity which contains the ID of this entity
43
39
  * @param queryContext - query context in which to perform the load
44
40
  */
45
- async loadManyAssociatedEntitiesAsync(associatedEntityClass, associatedEntityFieldContainingThisID, queryContext = this.entity
46
- .getViewerContext()
47
- .getViewerScopedEntityCompanionForClass(associatedEntityClass)
48
- .getQueryContextProvider()
49
- .getQueryContext()) {
41
+ async loadManyAssociatedEntitiesAsync(associatedEntityClass, associatedEntityFieldContainingThisID, queryContext) {
50
42
  const thisID = this.entity.getID();
51
43
  const loader = this.entity
52
44
  .getViewerContext()
@@ -63,11 +55,7 @@ class EntityAssociationLoader {
63
55
  * @param associatedEntityLookupByField - field of associated entity with which to look up the associated entity
64
56
  * @param queryContext - query context in which to perform the load
65
57
  */
66
- async loadAssociatedEntityByFieldEqualingAsync(fieldIdentifyingAssociatedEntity, associatedEntityClass, associatedEntityLookupByField, queryContext = this.entity
67
- .getViewerContext()
68
- .getViewerScopedEntityCompanionForClass(associatedEntityClass)
69
- .getQueryContextProvider()
70
- .getQueryContext()) {
58
+ async loadAssociatedEntityByFieldEqualingAsync(fieldIdentifyingAssociatedEntity, associatedEntityClass, associatedEntityLookupByField, queryContext) {
71
59
  const associatedFieldValue = this.entity.getField(fieldIdentifyingAssociatedEntity);
72
60
  if (!associatedFieldValue) {
73
61
  return null;
@@ -87,11 +75,7 @@ class EntityAssociationLoader {
87
75
  * @param associatedEntityLookupByField - field of associated entities with which to look up the associated entities
88
76
  * @param queryContext - query context in which to perform the load
89
77
  */
90
- async loadManyAssociatedEntitiesByFieldEqualingAsync(fieldIdentifyingAssociatedEntity, associatedEntityClass, associatedEntityLookupByField, queryContext = this.entity
91
- .getViewerContext()
92
- .getViewerScopedEntityCompanionForClass(associatedEntityClass)
93
- .getQueryContextProvider()
94
- .getQueryContext()) {
78
+ async loadManyAssociatedEntitiesByFieldEqualingAsync(fieldIdentifyingAssociatedEntity, associatedEntityClass, associatedEntityLookupByField, queryContext) {
95
79
  const associatedFieldValue = this.entity.getField(fieldIdentifyingAssociatedEntity);
96
80
  if (!associatedFieldValue) {
97
81
  return [];
@@ -1 +1 @@
1
- {"version":3,"file":"EntityAssociationLoader.js","sourceRoot":"","sources":["../src/EntityAssociationLoader.ts"],"names":[],"mappings":";;AAA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AAyE,CAAC;YAC9E,IAAI,6BAA6B,EAAE;gBACjC,sBAAsB,GAAG,MAAM,aAAa;qBACzC,iBAAiB,EAAE;qBACnB,wCAAwC,CACvC,gCAAgC,EAChC,qBAAqB,EACrB,6BAA6B,EAC7B,YAAY,CACb,CAAC;aACL;iBAAM;gBACL,MAAM,2BAA2B,GAAG,MAAM,aAAa;qBACpD,iBAAiB,EAAE;qBACnB,yBAAyB,CACxB,gCAAgC,EAChC,qBAAqB,EACrB,YAAY,CACb,CAAC;gBAEJ,IAAI,2BAA2B,CAAC,EAAE,IAAI,2BAA2B,CAAC,KAAK,KAAK,IAAI,EAAE;oBAChF,sBAAsB,GAAG,IAAI,CAAC;iBAC/B;qBAAM;oBACL,sBAAsB,GAAG,2BAA2B,CAAC;iBACtD;aACF;YAED,IAAI,CAAC,sBAAsB,EAAE;gBAC3B,OAAO,IAAI,CAAC;aACb;YAED,IAAI,CAAC,sBAAsB,CAAC,EAAE,EAAE;gBAC9B,OAAO,IAAA,gBAAM,EAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;aAC9C;YACD,aAAa,GAAG,sBAAsB,CAAC,KAAK,CAAC;SAC9C;QACD,OAAO,IAAA,gBAAM,EAAC,aAAa,CAAC,CAAC;IAC/B,CAAC;CACF;AA/bD,0CA+bC"}
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EnumField = exports.JSONObjectField = exports.StringArrayField = exports.FloatField = exports.IntField = exports.BooleanField = exports.DateField = exports.UUIDField = exports.StringField = void 0;
4
- const uuid_1 = require("uuid");
5
4
  const EntityFieldDefinition_1 = require("./EntityFieldDefinition");
5
+ // Use our own regex since the `uuid` package doesn't support validating UUIDv6/7/8 yet
6
+ const UUID_REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
6
7
  /**
7
8
  * EntityFieldDefinition for a column with a JS string type.
8
9
  */
@@ -18,7 +19,7 @@ exports.StringField = StringField;
18
19
  */
19
20
  class UUIDField extends StringField {
20
21
  validateInputValueInternal(value) {
21
- return (0, uuid_1.validate)(value);
22
+ return super.validateInputValueInternal(value) && UUID_REGEX.test(value);
22
23
  }
23
24
  }
24
25
  exports.UUIDField = UUIDField;
@@ -1 +1 @@
1
- {"version":3,"file":"EntityFields.js","sourceRoot":"","sources":["../src/EntityFields.ts"],"names":[],"mappings":";;;AAAA,+BAAgD;AAEhD,mEAAgE;AAEhE;;GAEG;AACH,MAAa,WAAY,SAAQ,6CAA6B;IAClD,0BAA0B,CAAC,KAAa;QAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;IACnC,CAAC;CACF;AAJD,kCAIC;AAED;;;GAGG;AACH,MAAa,SAAU,SAAQ,WAAW;IACrB,0BAA0B,CAAC,KAAa;QACzD,OAAO,IAAA,eAAY,EAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;CACF;AAJD,8BAIC;AAED;;GAEG;AACH,MAAa,SAAU,SAAQ,6CAA2B;IAC9C,0BAA0B,CAAC,KAAW;QAC9C,OAAO,KAAK,YAAY,IAAI,CAAC;IAC/B,CAAC;CACF;AAJD,8BAIC;AAED;;GAEG;AACH,MAAa,YAAa,SAAQ,6CAA8B;IACpD,0BAA0B,CAAC,KAAc;QACjD,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC;IACpC,CAAC;CACF;AAJD,oCAIC;AAED;;;GAGG;AACH,MAAa,QAAS,SAAQ,6CAA6B;IAC/C,0BAA0B,CAAC,KAAa;QAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9D,CAAC;CACF;AAJD,4BAIC;AAED;;;GAGG;AACH,MAAa,UAAW,SAAQ,6CAA6B;IACjD,0BAA0B,CAAC,KAAa;QAChD,O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figuration<TFields extends obje
40
40
  */
41
41
  afterAll?: EntityMutationTrigger<TFields, TID, TViewerContext, TEntity, TSelectedFields>[];
42
42
  /**
43
- * Trigger set that runs after committing the transaction unless one is supplied
44
- * after any mutation (create, update, delete). If the call to the mutation is wrapped in a transaction,
45
- * this too will be within the transaction.
43
+ * Trigger set that runs after committing the mutation transaction. If the call to the mutation is wrapped in a transaction, these
44
+ * will be run after the wrapping transaction is completed.
46
45
  */
47
46
  afterCommit?: EntityNonTransactionalMutationTrigger<TFields, TID, TViewerContext, TEntity, TSelectedFields>[];
48
47
  }
49
48
  /**
50
- * A trigger is a way to specify entity mutation operation side-effects that run within the
51
- * same transaction as the mutation itself. The one exception is afterCommit, which will run within
52
- * the transaction if a transaction is supplied.
49
+ * A transactional trigger is a way to specify entity mutation operation side-effects that run within the
50
+ * same transaction as the mutation itself.
53
51
  */
54
52
  export declare abstract class EntityMutationTrigger<TFields extends object, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TSelectedFields extends keyof TFields = keyof TFields> {
55
53
  abstract executeAsync(viewerContext: TViewerContext, queryContext: EntityTransactionalQueryContext, entity: TEntity, mutationInfo: EntityTriggerMutationInfo<TFields, TID, TViewerContext, TEntity, TSelectedFields>): Promise<void>;
56
54
  }
57
55
  /**
58
56
  * A non-transactional trigger is like a EntityMutationTrigger but used for afterCommit triggers
59
- * since they explicitly occur outside of the transaction.
57
+ * since they run after the transaction is committed.
60
58
  */
61
59
  export declare abstract class EntityNonTransactionalMutationTrigger<TFields extends object, TID extends NonNullable<TFields[TSelectedFields]>, TViewerContext extends ViewerContext, TEntity extends ReadonlyEntity<TFields, TID, TViewerContext, TSelectedFields>, TSelectedFields extends keyof TFields = keyof TFields> {
62
60
  abstract executeAsync(viewerContext: TViewerContext, entity: TEntity, mutationInfo: EntityTriggerMutationInfo<TFields, TID, TViewerContext, TEntity, TSelectedFields>): Promise<void>;
@@ -2,16 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EntityNonTransactionalMutationTrigger = exports.EntityMutationTrigger = void 0;
4
4
  /**
5
- * A trigger is a way to specify entity mutation operation side-effects that run within the
6
- * same transaction as the mutation itself. The one exception is afterCommit, which will run within
7
- * the transaction if a transaction is supplied.
5
+ * A transactional trigger is a way to specify entity mutation operation side-effects that run within the
6
+ * same transaction as the mutation itself.
8
7
  */
9
8
  class EntityMutationTrigger {
10
9
  }
11
10
  exports.EntityMutationTrigger = EntityMutationTrigger;
12
11
  /**
13
12
  * A non-transactional trigger is like a EntityMutationTrigger but used for afterCommit triggers
14
- * since they explicitly occur outside of the transaction.
13
+ * since they run after the transaction is committed.
15
14
  */
16
15
  class EntityNonTransactionalMutationTrigger {
17
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EntityMutationTriggerConfiguration.js","sourceRoot":"","sources":["../src/EntityMutationTriggerConfiguration.ts"],"names":[],"mappings":";;;AAkEA;;;;GAIG;AACH,MAAsB,qBAAqB;CAa1C;AAbD,sDAaC;AAED;;;GAGG;AACH,MAAsB,qCAAqC;CAY1D;AAZD,sFAYC"}
1
+ {"version":3,"file":"EntityMutationTriggerConfiguration.js","sourceRoot":"","sources":["../src/EntityMutationTriggerConfiguration.ts"],"names":[],"mappings":";;;AAiEA;;;GAGG;AACH,MAAsB,qBAAqB;CAa1C;AAbD,sDAaC;AAED;;;GAGG;AACH,MAAsB,qCAAqC;CAY1D;AAZD,sFAYC"}
@@ -6,7 +6,7 @@ export default abstract class EntityQueryContextProvider {
6
6
  /**
7
7
  * Vend a regular (non-transactional) entity query context.
8
8
  */
9
- getQueryContext(): EntityNonTransactionalQueryContext;
9
+ getNonTransactionalQueryContext(): EntityNonTransactionalQueryContext;
10
10
  /**
11
11
  * Get the query interface for constructing a query context.
12
12
  */
@@ -8,7 +8,7 @@ class EntityQueryContextProvider {
8
8
  /**
9
9
  * Vend a regular (non-transactional) entity query context.
10
10
  */
11
- getQueryContext() {
11
+ getNonTransactionalQueryContext() {
12
12
  return new EntityQueryContext_1.EntityNonTransactionalQueryContext(this.getQueryInterface(), this);
13
13
  }
14
14
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"EntityQueryContextProvider.js","sourceRoot":"","sources":["../src/EntityQueryContextProvider.ts"],"names":[],"mappings":";;AAAA,6DAK8B;AAE9B;;GAEG;AACH,MAA8B,0BAA0B;IACtD;;OAEG;IACI,eAAe;QACpB,OAAO,IAAI,uDAAkC,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,CAAC,CAAC;IAChF,CAAC;IAkBD;;;OAGG;IACH,KAAK,CAAC,qBAAqB,CACzB,gBAA+E,EAC/E,iBAAqC;QAErC,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAEtE,iBAAiB,CAAC,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE;YAC5C,MAAM,YAAY,GAAG,IAAI,oDAA+B,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;YAC/E,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,YAAY,CAAC,CAAC;YACpD,MAAM,YAAY,CAAC,0BAA0B,EAAE,CAAC;YAChD,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,MAAM,YAAY,CAAC,2BAA2B,EAAE,CAAC;QACjD,OAAO,aAAa,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,2BAA2B,CAC/B,iBAAkD,EAClD,gBAA0F;QAE1F,MAAM,CAAC,aAAa,EAAE,iBAAiB,CAAC,GAAG,MAAM,IAAI,CAAC,6BAA6B,CAEjF,iBAAiB,CAAC,iBAAiB,EAAE,CAAC,CAAC,KAAK,EAAE,mBAAmB,EAAE,EAAE;YACrE,MAAM,iBAAiB,GAAG,IAAI,0DAAqC,CACjE,mBAAmB,EACnB,iBAAiB,EACjB,IAAI,CACL,CAAC;YACF,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;YACzD,MAAM,iBAAiB,CAAC,0BAA0B,EAAE,CAAC;YACrD,OAAO,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QACH,wHAAwH;QACxH,iBAAiB,CAAC,mCAAmC,EAAE,CAAC;QACxD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AAtED,6CAsEC"}
1
+ {"version":3,"file":"EntityQueryContextProvider.js","sourceRoot":"","sources":["../src/EntityQueryContextProvider.ts"],"names":[],"mappings":";;AAAA,6DAK8B;AAE9B;;GAEG;AACH,MAA8B,0BAA0B;IACtD;;OAEG;IACI,+BAA+B;QACpC,OAAO,IAAI,uDAAkC,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,CAAC,CAAC;IAChF,CAAC;IAkBD;;;OAGG;IACH,KAAK,CAAC,qBAAqB,CACzB,gBAA+E,EAC/E,iBAAqC;QAErC,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAEtE,iBAAiB,CAAC,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE;YAC5C,MAAM,YAAY,GAAG,IAAI,oDAA+B,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;YAC/E,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,YAAY,CAAC,CAAC;YACpD,MAAM,YAAY,CAAC,0BAA0B,EAAE,CAAC;YAChD,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,MAAM,YAAY,CAAC,2BAA2B,EAAE,CAAC;QACjD,OAAO,aAAa,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,2BAA2B,CAC/B,iBAAkD,EAClD,gBAA0F;QAE1F,MAAM,CAAC,aAAa,EAAE,iBAAiB,CAAC,GAAG,MAAM,IAAI,CAAC,6BAA6B,CAEjF,iBAAiB,CAAC,iBAAiB,EAAE,CAAC,CAAC,KAAK,EAAE,mBAAmB,EAAE,EAAE;YACrE,MAAM,iBAAiB,GAAG,IAAI,0DAAqC,CACjE,mBAAmB,EACnB,iBAAiB,EACjB,IAAI,CACL,CAAC;YACF,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;YACzD,MAAM,iBAAiB,CAAC,0BAA0B,EAAE,CAAC;YACrD,OAAO,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QACH,wHAAwH;QACxH,iBAAiB,CAAC,mCAAmC,EAAE,CAAC;QACxD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF;AAtED,6CAsEC"}
@@ -6,7 +6,7 @@ import IEntityCacheAdapter from './IEntityCacheAdapter';
6
6
  */
7
7
  export default interface IEntityCacheAdapterProvider {
8
8
  /**
9
- * Vend a cache adapter.
9
+ * Vend a cache adapter for an entity configuration.
10
10
  */
11
11
  getCacheAdapter<TFields>(entityConfiguration: EntityConfiguration<TFields>): IEntityCacheAdapter<TFields>;
12
12
  }
@@ -70,5 +70,5 @@ export default abstract class ReadonlyEntity<TFields extends object, TID extends
70
70
  * @param viewerContext - viewer context of loading user
71
71
  * @param queryContext - query context in which to perform the load
72
72
  */
73
- static loader<TMFields extends object, TMID extends NonNullable<TMFields[TMSelectedFields]>, TMViewerContext extends ViewerContext, TMViewerContext2 extends TMViewerContext, TMEntity extends ReadonlyEntity<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): EntityLoader<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>;
73
+ static loader<TMFields extends object, TMID extends NonNullable<TMFields[TMSelectedFields]>, TMViewerContext extends ViewerContext, TMViewerContext2 extends TMViewerContext, TMEntity extends ReadonlyEntity<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): EntityLoader<TMFields, TMID, TMViewerContext, TMEntity, TMPrivacyPolicy, TMSelectedFields>;
74
74
  }
@@ -84,10 +84,7 @@ class ReadonlyEntity {
84
84
  * @param viewerContext - viewer context of loading user
85
85
  * @param queryContext - query context in which to perform the load
86
86
  */
87
- static loader(viewerContext, queryContext = viewerContext
88
- .getViewerScopedEntityCompanionForClass(this)
89
- .getQueryContextProvider()
90
- .getQueryContext()) {
87
+ static loader(viewerContext, queryContext) {
91
88
  return viewerContext
92
89
  .getViewerScopedEntityCompanionForClass(this)
93
90
  .getLoaderFactory()
@@ -1 +1 @@
1
- {"version":3,"file":"ReadonlyEntity.js","sourceRoot":"","sources":["../src/ReadonlyEntity.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAGlC,wFAAgE;AAMhE;;;;;;;GAOG;AACH,MAA8B,cAAc;IAW1C;;;;;;;;;;;;;OAaG;IACH,YAAY,EACV,aAAa,EACb,EAAE,EACF,cAAc,EACd,cAAc,GAMf;QACC,IAAA,mBAAS,EAAC,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,SAAS,EAAE,qBAAqB,CAAC,CAAC;QAElE,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,cAAc,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,EAAE,CAAC,CAAC;IAC3D,CAAC;CACF;AA5ID,iCA4IC"}
@@ -1,7 +1,7 @@
1
1
  import { IEntityClass } from './Entity';
2
2
  import EntityCompanionProvider, { DatabaseAdapterFlavor } from './EntityCompanionProvider';
3
3
  import EntityPrivacyPolicy from './EntityPrivacyPolicy';
4
- import { EntityQueryContext, EntityTransactionalQueryContext, TransactionConfig } from './EntityQueryContext';
4
+ import { EntityNonTransactionalQueryContext, EntityTransactionalQueryContext, TransactionConfig } from './EntityQueryContext';
5
5
  import ReadonlyEntity from './ReadonlyEntity';
6
6
  import ViewerScopedEntityCompanion from './ViewerScopedEntityCompanion';
7
7
  /**
@@ -20,7 +20,7 @@ export default class ViewerContext {
20
20
  * Get the regular (non-transactional) query context for a database adaptor flavor.
21
21
  * @param databaseAdaptorFlavor - database adaptor flavor
22
22
  */
23
- getQueryContextForDatabaseAdaptorFlavor(databaseAdaptorFlavor: DatabaseAdapterFlavor): EntityQueryContext;
23
+ getNonTransactionalQueryContextForDatabaseAdaptorFlavor(databaseAdaptorFlavor: DatabaseAdapterFlavor): EntityNonTransactionalQueryContext;
24
24
  /**
25
25
  * Run a transaction of specified database adaptor flavor and execute the provided
26
26
  * transaction-scoped closure within the transaction.
@@ -25,10 +25,10 @@ class ViewerContext {
25
25
  * Get the regular (non-transactional) query context for a database adaptor flavor.
26
26
  * @param databaseAdaptorFlavor - database adaptor flavor
27
27
  */
28
- getQueryContextForDatabaseAdaptorFlavor(databaseAdaptorFlavor) {
28
+ getNonTransactionalQueryContextForDatabaseAdaptorFlavor(databaseAdaptorFlavor) {
29
29
  return this.entityCompanionProvider
30
30
  .getQueryContextProviderForDatabaseAdaptorFlavor(databaseAdaptorFlavor)
31
- .getQueryContext();
31
+ .getNonTransactionalQueryContext();
32
32
  }
33
33
  /**
34
34
  * Run a transaction of specified database adaptor flavor and execute the provided
@@ -39,7 +39,7 @@ class ViewerContext {
39
39
  async runInTransactionForDatabaseAdaptorFlavorAsync(databaseAdaptorFlavor, transactionScope, transactionConfig) {
40
40
  return await this.entityCompanionProvider
41
41
  .getQueryContextProviderForDatabaseAdaptorFlavor(databaseAdaptorFlavor)
42
- .getQueryContext()
42
+ .getNonTransactionalQueryContext()
43
43
  .runInTransactionIfNotInTransactionAsync(transactionScope, transactionConfig);
44
44
  }
45
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ViewerContext.js","sourceRoot":"","sources":["../src/ViewerContext.ts"],"names":[],"mappings":";;;;;AAUA,gHAAwF;AAExF;;;;;GAKG;AACH,MAAqB,aAAa;IAGhC,YAA4B,uBAAgD;QAAhD,4BAAuB,GAAvB,uBAAuB,CAAyB;QAC1E,IAAI,CAAC,mCAAmC,GAAG,IAAI,6CAAmC,CAChF,uBAAuB,EACvB,IAAI,CACL,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED,sCAAsC,CAcpC,WAOC;QASD,OAAO,IAAI,CAAC,mCAAmC,CAAC,iCAAiC,CAAC,WAAW,CAAC,CAAC;IACjG,CAAC;IAED;;;OAGG;IACH,uCAAuC,CACrC,qBAA4C;QAE5C,OAAO,IAAI,CAAC,uBAAuB;aAChC,+CAA+C,CAAC,qBAAqB,CAAC;aACtE,eAAe,EAAE,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,6CAA6C,CACjD,qBAA4C,EAC5C,gBAAqF,EACrF,iBAAqC;QAErC,OAAO,MAAM,IAAI,CAAC,uBAAuB;aACtC,+CAA+C,CAAC,qBAAqB,CAAC;aACtE,eAAe,EAAE;aACjB,uCAAuC,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAClF,CAAC;CACF;AA3ED,gCA2EC"}
1
+ {"version":3,"file":"ViewerContext.js","sourceRoot":"","sources":["../src/ViewerContext.ts"],"names":[],"mappings":";;;;;AAUA,gHAAwF;AAExF;;;;;GAKG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