Metadata
- Source
- FLUID-5938
- Type
- Improvement
- Priority
- Major
- Status
- Open
- Resolution
- N/A
- Assignee
- Antranig Basman
- Reporter
- Antranig Basman
- Created
2016-08-03T14:31:57.672-0400 - Updated
2019-07-30T10:21:32.443-0400 - Versions
- N/A
- Fixed Versions
- N/A
- Component
-
- Framework
Description
A useful general-purpose promise utility was developed as part of the GPII testing infrastructure named gpii.test.settleStructure - it will accept an arbitrary data structure containing promises and return a promise for the resulting structure with each promise replaced by its resolved value, or a rejection if any promise rejects.
As well as representing a generally useful idiom (this appeared in the framework in CSpace days as the "deferred fetch expander) this operates a helpfully complementary idiom to fluid.promise sequence in that all of the promises are operated in parallel.
Currently held at https://github.com/GPII/universal/blob/master/gpii/node_modules/testing/src/Testing.js#L42
Comments
-
Antranig Basman commented
2019-07-30T10:21:32.443-0400 Note that the gpii.test.settleStructure implementation is currently not quite written suitably - rather than reject the entire structure at the first rejection, it should instead honour the general "settle" concept by proceeding to resolve all remaining promises and then produce a summary of those which rejected, with a structure such as
{ isError: true, rejectedPaths: [ .... list of paths holding individual rejections ...], structure: <the settled structure with original promises replaced by resolved payloads > }