feat: Add afterFind trigger to authentication adapters (#8444)

This commit is contained in:
Daniel
2023-03-06 11:35:15 +11:00
committed by GitHub
parent 87cab09b6a
commit c793bb88e7
6 changed files with 95 additions and 4 deletions

View File

@@ -223,6 +223,9 @@ RestQuery.prototype.execute = function (executeOptions) {
.then(() => {
return this.runAfterFindTrigger();
})
.then(() => {
return this.handleAuthAdapters();
})
.then(() => {
return this.response;
});
@@ -842,6 +845,15 @@ RestQuery.prototype.runAfterFindTrigger = function () {
});
};
RestQuery.prototype.handleAuthAdapters = async function () {
if (this.className !== '_User' || this.findOptions.explain) {
return;
}
await Promise.all(
this.response.results.map(result => this.config.authDataManager.runAfterFind(result.authData))
);
};
// Adds included values to the response.
// Path is a list of field names.
// Returns a promise for an augmented response.