rads-db 3.0.38 → 3.0.39
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.
|
@@ -104,9 +104,14 @@ function getEffectFor(entityName, aggregateRelationField, eventEntityName, schem
|
|
|
104
104
|
events: v.events,
|
|
105
105
|
oldDoc: v.oldAggDoc
|
|
106
106
|
}));
|
|
107
|
-
|
|
107
|
+
const aggregateEffectContext = {
|
|
108
|
+
...context,
|
|
109
|
+
typeName: entityName,
|
|
110
|
+
handle: schema[entityName].handle
|
|
111
|
+
};
|
|
112
|
+
await beforePut(hookItems, ctx, aggregateEffectContext);
|
|
108
113
|
await context.drivers[entityName].putMany(aggs, ctx);
|
|
109
|
-
await afterPut(hookItems, ctx,
|
|
114
|
+
await afterPut(hookItems, ctx, aggregateEffectContext);
|
|
110
115
|
}
|
|
111
116
|
};
|
|
112
117
|
}
|
|
@@ -87,9 +87,10 @@ function getEffectFor(entityName, aggregateRelationField, eventEntityName, schem
|
|
|
87
87
|
async afterPut(context, docs, beforePutResult, ctx) {
|
|
88
88
|
const aggs = beforePutResult.map((d) => d.aggDoc);
|
|
89
89
|
const hookItems = beforePutResult.map((v) => ({ doc: v.aggDoc, events: v.events, oldDoc: v.oldAggDoc }));
|
|
90
|
-
|
|
90
|
+
const aggregateEffectContext = { ...context, typeName: entityName, handle: schema[entityName].handle };
|
|
91
|
+
await beforePut(hookItems, ctx, aggregateEffectContext);
|
|
91
92
|
await context.drivers[entityName].putMany(aggs, ctx);
|
|
92
|
-
await afterPut(hookItems, ctx,
|
|
93
|
+
await afterPut(hookItems, ctx, aggregateEffectContext);
|
|
93
94
|
}
|
|
94
95
|
};
|
|
95
96
|
}
|