SolidLabResearch / SolidLabLib.js

🧫 A library of helper functions for developing Solid apps in TypeScript/JavaScript.
https://SolidLabResearch.github.io/SolidLabLib.js/
MIT License
2 stars 1 forks source link

Add getIdps function #10

Open RubenVerborgh opened 1 year ago

RubenVerborgh commented 1 year ago

There is no bound on the number of IDPs a person can have; the fact that it is currently often 1 is random. Let's also add a getIdps (and getIdentityProviders https://github.com/SolidLabResearch/SolidLabLib.js/issues/9) function that returns an array (with limit? or async iterator?); then getIdp just takes the first of that.

I wonder if we want to anticipate on the generic problem that some lists can be slow/long/infinite, and expose both getIdentityProviders (async iterator) and getIdentityProviderList(limit = 10) (array). Where we have a generic function getIdentityProviderList = generatorToArray(getIdentityProviders), and we reuse generatorToArray.

rubensworks commented 1 year ago

We could also just return an AsyncIterator in getIdentityProviderList, which would then expose the toArray() method with optional limit.

RubenVerborgh commented 1 year ago

Ah right, you were thinking AsyncIterator; I was thinking native asynchronous iterator. Either is fine with me.

rubensworks commented 1 year ago

Ok, let's go with AsyncIterator then for now.

Once we implement https://github.com/RubenVerborgh/AsyncIterator/issues/89, we'll get the best of both worlds :-)