-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fetch entity statement chains #8
Conversation
berendsliedrecht
commented
Jul 12, 2024
•
edited
Loading
edited
- feat: fetch entity statement chain
c80e1e9
to
af980ea
Compare
entityConfigurations, | ||
}: FetchEntityStatementChainOptions) => { | ||
// The trust anchors (i.e. the last item of the list) entity configuration will be used instead of a statement issued by a superior | ||
const statements = [entityConfigurations[entityConfigurations.length - 1]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we check/ensure tbis array is non empty?
I think enabling noUncheckedIndexAccess or whatever it is called in TS compilerOptioms might be good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added it which did not help here (but some other places it did) so I just added a check manually that it is non-empty.
const results = await Promise.allSettled(promises) | ||
for (const res of results) { | ||
if (res.status === 'fulfilled') { | ||
statements.push(res.value) | ||
} else { | ||
throw new OpenIdFederationError(ErrorCode.Validation, res.reason) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it fails when one fails, we can just use Promise.all right?
Would be good to pass an abort signal to the fetch methods so you can cancel all promises instantly when one fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a ticket for the abort signal. Optimalization for later I'd say.
af980ea
to
69b2d45
Compare
Signed-off-by: Berend Sliedrecht <sliedrecht@berend.io>
69b2d45
to
77b3e3c
Compare