[FEATURE] Implement domain scoping
Overview
A domain is an identifier that logically binds clients with providers, allowing multiple providers to be used simultaneously within a single application.
Domains were added to the spec in the following PR: https://github.com/open-feature/spec/pull/229
Tasks
### Tasks
- [ ] [Requirement 1.1.3](https://openfeature.dev/specification/sections/flag-evaluation#requirement-113): The API MUST provide a function to bind a given provider to one or more clients using a domain. If the domain already has a bound provider, it is overwritten with the new mapping.
- [ ] [Requirement 1.1.6](https://openfeature.dev/specification/sections/flag-evaluation#requirement-116): The API MUST provide a function for creating a client which accepts `domain`
- [ ] [Requirement 1.2.2](https://openfeature.dev/specification/sections/flag-evaluation#requirement-122): The client interface MUST define a metadata member or accessor, containing an immutable domain field or accessor of type string, which corresponds to the domain value supplied during client creation.
- [ ] [Requirement 3.2.2.3](https://openfeature.dev/specification/sections/evaluation-context#conditional-requirement-3223): The API MUST have a method for setting evaluation context for a domain.
- [ ] [Requirement 3.2.2.4](https://openfeature.dev/specification/sections/evaluation-context#conditional-requirement-3224): The API MUST have a mechanism to manage evaluation context for an associated domain.
- [ ] Update the `named provider` section of the readme to `domain`. See the JS SDK readme for an example: https://github.com/open-feature/js-sdk/tree/main/packages/server#domains
Reference implementations
Support was added in the JS SDK here and the Python SDK here.
[!NOTE] Some SDKs support
named clientswhich predatedomains. Thedomainterm is intended to clarify intended behavior.
I can pick this one up
@jarebudev Feel free. This is honestly mostly done in Java, the problem is we don't use the "domain" term. Right now we use "name" or "clientName" instead... I think all the functionality is there but poorly named. For example, this method just needs it's param and doc updated (name should be domain).
If your interested in taking it on I will assign.
Yeh I can work on this. When I first looked at it there didn't appear to be a huge amount of change needed for this as you say mostly a tidy-up.
@jarebudev :pray: assigned
as a fyi - had some other things to work on which had taken up my time. Should get a PR in this week.