-
-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Context service feature oriented (#9052)
- Loading branch information
Showing
26 changed files
with
131 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/lib/types/stores/context-field-store.ts → ...tures/context/context-field-store-type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
src/lib/db/context-field-store.ts → ...b/features/context/context-field-store.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import type { Db } from '../../db/db'; | ||
import type { IUnleashConfig } from '../../types'; | ||
import ContextService from './context-service'; | ||
import ContextFieldStore from './context-field-store'; | ||
import FeatureStrategiesStore from '../feature-toggle/feature-toggle-strategies-store'; | ||
import { | ||
createEventsService, | ||
createFakeEventsService, | ||
} from '../events/createEventsService'; | ||
import { PrivateProjectChecker } from '../private-project/privateProjectChecker'; | ||
import PrivateProjectStore from '../private-project/privateProjectStore'; | ||
import FakeContextFieldStore from './fake-context-field-store'; | ||
import FakeFeatureStrategiesStore from '../feature-toggle/fakes/fake-feature-strategies-store'; | ||
import { FakePrivateProjectChecker } from '../private-project/fakePrivateProjectChecker'; | ||
|
||
export const createContextService = | ||
(config: IUnleashConfig) => | ||
(db: Db): ContextService => { | ||
const { getLogger, flagResolver, eventBus, isEnterprise } = config; | ||
const contextFieldStore = new ContextFieldStore( | ||
db, | ||
getLogger, | ||
flagResolver, | ||
); | ||
const featureStrategiesStore = new FeatureStrategiesStore( | ||
db, | ||
eventBus, | ||
getLogger, | ||
flagResolver, | ||
); | ||
const eventService = createEventsService(db, config); | ||
const privateProjectStore = new PrivateProjectStore(db, getLogger); | ||
const privateProjectChecker = new PrivateProjectChecker( | ||
{ privateProjectStore }, | ||
{ isEnterprise }, | ||
); | ||
return new ContextService( | ||
{ contextFieldStore, featureStrategiesStore }, | ||
{ | ||
getLogger, | ||
flagResolver, | ||
}, | ||
eventService, | ||
privateProjectChecker, | ||
); | ||
}; | ||
|
||
export const createFakeContextService = ( | ||
config: IUnleashConfig, | ||
): ContextService => { | ||
const { getLogger, flagResolver, eventBus, isEnterprise } = config; | ||
const contextFieldStore = new FakeContextFieldStore(); | ||
const featureStrategiesStore = new FakeFeatureStrategiesStore(); | ||
const eventService = createFakeEventsService(config); | ||
const privateProjectChecker = new FakePrivateProjectChecker(); | ||
return new ContextService( | ||
{ contextFieldStore, featureStrategiesStore }, | ||
{ | ||
getLogger, | ||
flagResolver, | ||
}, | ||
eventService, | ||
privateProjectChecker, | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/lib/features/export-import-toggles/import-context-validation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.