Closed patroza closed 3 days ago
Sounds reasonable.
Will apply these for now, but instead of a strict true/false, for the near future, I would consider a whitelist of dependencies you want to omit, it will still provide meaningful protection, instead of completely opt out.
Implemented in https://github.com/effect-app/libs/commit/565d6783d2e491636d0f356bd32bd61ab6d728c4
I think we should also consider the request level dependencies like UserProfile
, though they are more obvious anyway.
Right now the DX is:
(we should look at upgrading the controller one too to show the specifically missing dependencies)
I think we can make things nicer for the controller, if we would use an option object like in Service instead of positional args, but it would cause an extra indent for all the action handlers which I’m not really willing to pay. But if I can shave off one, maybe I’ll consider it. Maybe we can use the o_O hack now too though
Got an updated API for controllers, which makes it even more similar to Effect.Service, and has the same benefits of the dependencies error reporting, without adding additional indentation level, with only minor adjustments: https://github.com/effect-app/sample/compare/29762037f9ae03099cf1082f099afce508948f30..2d3da5d50d9c3aa1b1d5faae956618f456656ac0
Playing with a fluent api so we can further condense, and get rid of some of the extra stuff in https://github.com/effect-app/libs/issues/110
Implemented in 565d678
Finalised in https://github.com/effect-app/libs/commit/01f531e80354be77cbc917ff82557e30cbe981b5
Right now, if you miss specifying a dependency, you get an error at the root main function, which is far away from the Service or Controller that uses the dependency. Depending how many changes you did, or what package got updated, you might have a hard time tracking where you are missing the dependency.
e.g
strict: true
, that you can bail out of withstrict: false
. When strict, defining a service should give an error when you did not provide all services. (Mike does not agree)strict: false
We could also leverage
satisfies
somehow. Likesatisfies Layer<any,any,never>