2023-09-11 12:28:43 +02:00
|
|
|
import { IUnleashConfig, IUnleashStores } from '../types';
|
2021-03-11 22:51:58 +01:00
|
|
|
|
2021-04-27 09:16:44 +02:00
|
|
|
import EventStore from './event-store';
|
2023-10-11 09:38:57 +02:00
|
|
|
import FeatureToggleStore from '../features/feature-toggle/feature-toggle-store';
|
2021-04-27 09:16:44 +02:00
|
|
|
import FeatureTypeStore from './feature-type-store';
|
|
|
|
import StrategyStore from './strategy-store';
|
|
|
|
import ClientInstanceStore from './client-instance-store';
|
|
|
|
import ClientApplicationsStore from './client-applications-store';
|
|
|
|
import ContextFieldStore from './context-field-store';
|
|
|
|
import SettingStore from './setting-store';
|
|
|
|
import UserStore from './user-store';
|
|
|
|
import ProjectStore from './project-store';
|
|
|
|
import TagStore from './tag-store';
|
2023-11-29 11:44:56 +01:00
|
|
|
import TagTypeStore from '../features/tag-type/tag-type-store';
|
2021-04-27 09:16:44 +02:00
|
|
|
import AddonStore from './addon-store';
|
|
|
|
import { ApiTokenStore } from './api-token-store';
|
|
|
|
import SessionStore from './session-store';
|
|
|
|
import { AccessStore } from './access-store';
|
|
|
|
import { ResetTokenStore } from './reset-token-store';
|
2021-06-07 11:11:42 +02:00
|
|
|
import UserFeedbackStore from './user-feedback-store';
|
2023-10-11 09:38:57 +02:00
|
|
|
import FeatureStrategyStore from '../features/feature-toggle/feature-toggle-strategies-store';
|
2023-10-12 13:58:23 +02:00
|
|
|
import FeatureToggleClientStore from '../features/client-feature-toggles/client-feature-toggle-store';
|
2023-12-01 12:41:46 +01:00
|
|
|
import EnvironmentStore from '../features/project-environments/environment-store';
|
2021-07-07 10:46:50 +02:00
|
|
|
import FeatureTagStore from './feature-tag-store';
|
2021-08-12 15:04:37 +02:00
|
|
|
import { FeatureEnvironmentStore } from './feature-environment-store';
|
2021-10-08 10:09:22 +02:00
|
|
|
import { ClientMetricsStoreV2 } from './client-metrics-store-v2';
|
2021-11-09 11:52:02 +01:00
|
|
|
import UserSplashStore from './user-splash-store';
|
2022-01-13 11:14:17 +01:00
|
|
|
import RoleStore from './role-store';
|
2022-03-29 14:59:14 +02:00
|
|
|
import SegmentStore from './segment-store';
|
2022-07-21 16:23:56 +02:00
|
|
|
import GroupStore from './group-store';
|
2022-09-16 09:54:27 +02:00
|
|
|
import PatStore from './pat-store';
|
2022-09-14 14:29:12 +02:00
|
|
|
import { PublicSignupTokenStore } from './public-signup-token-store';
|
2022-11-29 16:06:08 +01:00
|
|
|
import { FavoriteFeaturesStore } from './favorite-features-store';
|
2022-11-30 12:41:53 +01:00
|
|
|
import { FavoriteProjectsStore } from './favorite-projects-store';
|
2023-01-18 17:08:07 +01:00
|
|
|
import { AccountStore } from './account-store';
|
2023-01-26 16:13:15 +01:00
|
|
|
import ProjectStatsStore from './project-stats-store';
|
2023-01-30 09:02:44 +01:00
|
|
|
import { Db } from './db';
|
2023-02-21 10:15:57 +01:00
|
|
|
import { ImportTogglesStore } from '../features/export-import-toggles/import-toggles-store';
|
2023-09-15 14:52:54 +02:00
|
|
|
import PrivateProjectStore from '../features/private-project/privateProjectStore';
|
2023-09-19 13:01:38 +02:00
|
|
|
import { DependentFeaturesStore } from '../features/dependent-features/dependent-features-store';
|
2023-10-09 10:54:00 +02:00
|
|
|
import LastSeenStore from '../services/client-metrics/last-seen/last-seen-store';
|
2023-12-14 14:45:36 +01:00
|
|
|
import FeatureSearchStore from '../features/feature-search/feature-search-store';
|
2016-11-04 09:03:13 +01:00
|
|
|
|
2021-04-22 10:07:10 +02:00
|
|
|
export const createStores = (
|
|
|
|
config: IUnleashConfig,
|
2023-01-30 09:02:44 +01:00
|
|
|
db: Db,
|
2021-04-22 10:07:10 +02:00
|
|
|
): IUnleashStores => {
|
2021-12-09 21:02:58 +01:00
|
|
|
const { getLogger, eventBus } = config;
|
2019-04-30 21:14:23 +02:00
|
|
|
const eventStore = new EventStore(db, getLogger);
|
2016-11-05 10:16:48 +01:00
|
|
|
|
|
|
|
return {
|
|
|
|
eventStore,
|
2023-10-18 16:34:42 +02:00
|
|
|
featureToggleStore: new FeatureToggleStore(
|
|
|
|
db,
|
|
|
|
eventBus,
|
|
|
|
getLogger,
|
|
|
|
config.flagResolver,
|
|
|
|
),
|
2020-08-06 11:18:52 +02:00
|
|
|
featureTypeStore: new FeatureTypeStore(db, getLogger),
|
2021-01-18 12:32:19 +01:00
|
|
|
strategyStore: new StrategyStore(db, getLogger),
|
2021-08-12 15:04:37 +02:00
|
|
|
clientApplicationsStore: new ClientApplicationsStore(
|
|
|
|
db,
|
|
|
|
eventBus,
|
|
|
|
getLogger,
|
|
|
|
),
|
2019-08-04 11:10:51 +02:00
|
|
|
clientInstanceStore: new ClientInstanceStore(db, eventBus, getLogger),
|
2023-05-05 10:10:54 +02:00
|
|
|
clientMetricsStoreV2: new ClientMetricsStoreV2(
|
|
|
|
db,
|
|
|
|
getLogger,
|
|
|
|
config.flagResolver,
|
|
|
|
),
|
2023-06-06 12:59:41 +02:00
|
|
|
contextFieldStore: new ContextFieldStore(
|
|
|
|
db,
|
|
|
|
getLogger,
|
|
|
|
config.flagResolver,
|
|
|
|
),
|
2020-04-13 22:38:46 +02:00
|
|
|
settingStore: new SettingStore(db, getLogger),
|
2020-05-12 23:05:26 +02:00
|
|
|
userStore: new UserStore(db, getLogger),
|
2023-01-18 17:08:07 +01:00
|
|
|
accountStore: new AccountStore(db, getLogger),
|
2022-11-30 12:41:53 +01:00
|
|
|
projectStore: new ProjectStore(
|
|
|
|
db,
|
|
|
|
eventBus,
|
|
|
|
getLogger,
|
|
|
|
config.flagResolver,
|
|
|
|
),
|
2021-01-18 12:32:19 +01:00
|
|
|
tagStore: new TagStore(db, eventBus, getLogger),
|
|
|
|
tagTypeStore: new TagTypeStore(db, eventBus, getLogger),
|
2021-01-19 10:42:45 +01:00
|
|
|
addonStore: new AddonStore(db, eventBus, getLogger),
|
2022-08-26 08:22:42 +02:00
|
|
|
accessStore: new AccessStore(db, eventBus, getLogger),
|
2021-03-29 19:58:11 +02:00
|
|
|
apiTokenStore: new ApiTokenStore(db, eventBus, getLogger),
|
2021-04-16 15:29:23 +02:00
|
|
|
resetTokenStore: new ResetTokenStore(db, eventBus, getLogger),
|
2021-04-27 09:16:44 +02:00
|
|
|
sessionStore: new SessionStore(db, eventBus, getLogger),
|
2021-06-07 11:11:42 +02:00
|
|
|
userFeedbackStore: new UserFeedbackStore(db, eventBus, getLogger),
|
2021-07-07 10:46:50 +02:00
|
|
|
featureStrategiesStore: new FeatureStrategyStore(
|
|
|
|
db,
|
|
|
|
eventBus,
|
|
|
|
getLogger,
|
2022-11-15 11:24:36 +01:00
|
|
|
config.flagResolver,
|
2021-07-07 10:46:50 +02:00
|
|
|
),
|
2023-10-12 13:58:23 +02:00
|
|
|
clientFeatureToggleStore: new FeatureToggleClientStore(
|
2021-09-13 10:23:57 +02:00
|
|
|
db,
|
|
|
|
eventBus,
|
|
|
|
getLogger,
|
2023-07-14 13:25:31 +02:00
|
|
|
config.flagResolver,
|
2021-09-13 10:23:57 +02:00
|
|
|
),
|
2021-07-07 10:46:50 +02:00
|
|
|
environmentStore: new EnvironmentStore(db, eventBus, getLogger),
|
|
|
|
featureTagStore: new FeatureTagStore(db, eventBus, getLogger),
|
2021-08-12 15:04:37 +02:00
|
|
|
featureEnvironmentStore: new FeatureEnvironmentStore(
|
|
|
|
db,
|
|
|
|
eventBus,
|
|
|
|
getLogger,
|
|
|
|
),
|
2021-11-09 11:52:02 +01:00
|
|
|
userSplashStore: new UserSplashStore(db, eventBus, getLogger),
|
2022-01-13 11:14:17 +01:00
|
|
|
roleStore: new RoleStore(db, eventBus, getLogger),
|
2023-05-26 13:37:00 +02:00
|
|
|
segmentStore: new SegmentStore(
|
|
|
|
db,
|
|
|
|
eventBus,
|
|
|
|
getLogger,
|
|
|
|
config.flagResolver,
|
|
|
|
),
|
2022-07-21 16:23:56 +02:00
|
|
|
groupStore: new GroupStore(db),
|
2022-09-14 14:29:12 +02:00
|
|
|
publicSignupTokenStore: new PublicSignupTokenStore(
|
|
|
|
db,
|
|
|
|
eventBus,
|
|
|
|
getLogger,
|
|
|
|
),
|
2022-09-16 09:54:27 +02:00
|
|
|
patStore: new PatStore(db, getLogger),
|
2022-11-29 16:06:08 +01:00
|
|
|
favoriteFeaturesStore: new FavoriteFeaturesStore(
|
|
|
|
db,
|
|
|
|
eventBus,
|
|
|
|
getLogger,
|
|
|
|
),
|
2022-11-30 12:41:53 +01:00
|
|
|
favoriteProjectsStore: new FavoriteProjectsStore(
|
|
|
|
db,
|
|
|
|
eventBus,
|
|
|
|
getLogger,
|
|
|
|
),
|
2023-01-26 16:13:15 +01:00
|
|
|
projectStatsStore: new ProjectStatsStore(db, eventBus, getLogger),
|
2023-02-16 08:08:51 +01:00
|
|
|
importTogglesStore: new ImportTogglesStore(db),
|
2023-09-15 14:52:54 +02:00
|
|
|
privateProjectStore: new PrivateProjectStore(db, getLogger),
|
2023-09-19 13:01:38 +02:00
|
|
|
dependentFeaturesStore: new DependentFeaturesStore(db),
|
2023-10-09 10:54:00 +02:00
|
|
|
lastSeenStore: new LastSeenStore(db, eventBus, getLogger),
|
2023-12-14 14:45:36 +01:00
|
|
|
featureSearchStore: new FeatureSearchStore(db, eventBus, getLogger),
|
2016-11-05 10:16:48 +01:00
|
|
|
};
|
|
|
|
};
|
2021-04-22 10:07:10 +02:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
createStores,
|
|
|
|
};
|