Commit baf33f0
refactor: move Multi-Provider shared code to core package (#1324)
## Summary
- Consolidates duplicate Multi-Provider code from `server` and `web`
packages into `@openfeature/core` (shared package)
- Uses generics (`TProviderStatus`, `TProvider`) internally to support
both server and web SDKs from a single implementation
## Changes
### Moved to shared package (`@openfeature/core`):
- `BaseEvaluationStrategy` and base strategy classes
- `StatusTracker` for provider status management
- Error utilities (`AggregateError`, `constructAggregateError`)
- Common types (`ProviderEntryInput`, `RegisteredProvider`)
### SDK-specific strategy exports:
- Each SDK exports pre-configured `FirstMatchStrategy`,
`FirstSuccessfulStrategy`, and `ComparisonStrategy` classes
- These wrapper classes have `ProviderStatus` pre-bound, maintaining
backward compatibility
- Users can continue using `new FirstMatchStrategy()` without any
changes
### New tests:
- Added unit tests for `StatusTracker` (event handling, status priority)
- Added unit tests for `constructAggregateError` (including edge cases)
### Documentation:
- Updated Multi-Provider READMEs with clearer custom strategy examples
- Added `BaseEvaluationStrategy` class structure documentation
---------
Signed-off-by: Jonathan Norris <jonathan@taplytics.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>1 parent 238bc50 commit baf33f0
File tree
35 files changed
+1065
-804
lines changed- packages
- server
- src/provider/multi-provider
- strategies
- test
- web
- src/provider/multi-provider
- strategies
- test
35 files changed
+1065
-804
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | | - | |
109 | | - | |
| 108 | + | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | | - | |
| 135 | + | |
137 | 136 | | |
138 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
139 | 140 | | |
140 | 141 | | |
141 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
142 | 148 | | |
143 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
144 | 158 | | |
145 | 159 | | |
146 | 160 | | |
147 | 161 | | |
148 | 162 | | |
149 | | - | |
| 163 | + | |
150 | 164 | | |
151 | 165 | | |
152 | 166 | | |
| |||
161 | 175 | | |
162 | 176 | | |
163 | 177 | | |
164 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
165 | 181 | | |
166 | | - | |
167 | | - | |
168 | | - | |
| 182 | + | |
169 | 183 | | |
170 | | - | |
171 | | - | |
| 184 | + | |
172 | 185 | | |
173 | | - | |
| 186 | + | |
174 | 187 | | |
175 | | - | |
176 | | - | |
| 188 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
Lines changed: 33 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
16 | 20 | | |
17 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
18 | 31 | | |
| 32 | + | |
19 | 33 | | |
20 | 34 | | |
21 | | - | |
| 35 | + | |
22 | 36 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | 37 | | |
28 | 38 | | |
29 | 39 | | |
| |||
35 | 45 | | |
36 | 46 | | |
37 | 47 | | |
38 | | - | |
39 | | - | |
| 48 | + | |
| 49 | + | |
40 | 50 | | |
41 | 51 | | |
42 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
43 | 57 | | |
44 | 58 | | |
45 | | - | |
46 | | - | |
| 59 | + | |
| 60 | + | |
47 | 61 | | |
48 | 62 | | |
49 | 63 | | |
| |||
60 | 74 | | |
61 | 75 | | |
62 | 76 | | |
63 | | - | |
| 77 | + | |
64 | 78 | | |
65 | 79 | | |
66 | 80 | | |
| |||
147 | 161 | | |
148 | 162 | | |
149 | 163 | | |
150 | | - | |
| 164 | + | |
151 | 165 | | |
152 | 166 | | |
153 | 167 | | |
| |||
173 | 187 | | |
174 | 188 | | |
175 | 189 | | |
176 | | - | |
| 190 | + | |
177 | 191 | | |
178 | 192 | | |
179 | 193 | | |
| |||
192 | 206 | | |
193 | 207 | | |
194 | 208 | | |
195 | | - | |
| 209 | + | |
196 | 210 | | |
197 | 211 | | |
198 | 212 | | |
199 | | - | |
| 213 | + | |
200 | 214 | | |
201 | 215 | | |
202 | 216 | | |
| |||
211 | 225 | | |
212 | 226 | | |
213 | 227 | | |
214 | | - | |
| 228 | + | |
215 | 229 | | |
216 | 230 | | |
217 | 231 | | |
218 | 232 | | |
219 | 233 | | |
220 | | - | |
| 234 | + | |
221 | 235 | | |
222 | 236 | | |
223 | 237 | | |
224 | 238 | | |
225 | 239 | | |
226 | | - | |
| 240 | + | |
227 | 241 | | |
228 | 242 | | |
229 | 243 | | |
| |||
Lines changed: 0 additions & 67 deletions
This file was deleted.
Lines changed: 67 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
0 commit comments