1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

refactor: playground in feature oriented architecture (#3942)

This commit is contained in:
Mateusz Kwasniewski 2023-06-09 12:55:54 +02:00 committed by GitHub
parent 51ade2f830
commit 0101491a83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 28 additions and 28 deletions

View File

@ -10,7 +10,7 @@ import {
import { Context } from './context';
import { SegmentForEvaluation } from './strategy/strategy';
import { PlaygroundStrategySchema } from 'lib/openapi/spec/playground-strategy-schema';
import { playgroundStrategyEvaluation } from '../../openapi/spec/playground-strategy-schema';
import { playgroundStrategyEvaluation } from '../../../openapi/spec/playground-strategy-schema';
export type StrategyEvaluationResult = Pick<
PlaygroundStrategySchema,

View File

@ -1,4 +1,4 @@
import { IStrategyConfig } from '../../types';
import { IStrategyConfig } from '../../../types';
import { FeatureStrategiesEvaluationResult } from './client';
import { Context } from './context';

View File

@ -5,6 +5,6 @@ import { ClientFeaturesResponse } from './feature';
import InMemStorageProvider from './repository/storage-provider-in-mem';
// exports
export { Strategy } from './strategy/index';
export { Strategy } from './strategy';
export { Context, Variant, FeatureEvaluator, InMemStorageProvider };
export type { ClientFeaturesResponse, FeatureEvaluatorConfig };

View File

@ -1,4 +1,4 @@
import { playgroundStrategyEvaluation } from '../../../openapi/spec/playground-strategy-schema';
import { playgroundStrategyEvaluation } from '../../../../openapi/spec/playground-strategy-schema';
import { StrategyEvaluationResult } from '../client';
import { Constraint } from '../constraint';
import { Context } from '../context';

View File

@ -9,7 +9,7 @@ import {
InMemStorageProvider as InMemStorageProviderNode,
} from 'unleash-client';
import { once } from 'events';
import { playgroundStrategyEvaluation } from '../openapi/spec/playground-strategy-schema';
import { playgroundStrategyEvaluation } from '../../openapi/spec/playground-strategy-schema';
export const offlineUnleashClientNode = async ({
features,

View File

@ -3,7 +3,7 @@ import { InMemStorageProvider, FeatureEvaluator } from './feature-evaluator';
import { FeatureConfigurationClient } from 'lib/types/stores/feature-strategies-store';
import { Segment } from './feature-evaluator/strategy/strategy';
import { ISegment } from 'lib/types/model';
import { serializeDates } from '../../lib/types/serialize-dates';
import { serializeDates } from '../../types/serialize-dates';
import { Operator } from './feature-evaluator/constraint';
import { FeatureInterface } from 'unleash-client/lib/feature';
import { PayloadType } from 'unleash-client';

View File

@ -1,13 +1,13 @@
import FeatureToggleService from './feature-toggle-service';
import FeatureToggleService from '../../services/feature-toggle-service';
import { SdkContextSchema } from 'lib/openapi/spec/sdk-context-schema';
import { IUnleashServices } from 'lib/types/services';
import { ALL } from '../../lib/types/models/api-token';
import { ALL } from '../../types/models/api-token';
import { PlaygroundFeatureSchema } from 'lib/openapi/spec/playground-feature-schema';
import { Logger } from '../logger';
import { Logger } from '../../logger';
import { IUnleashConfig } from 'lib/types';
import { offlineUnleashClient } from '../util/offline-unleash-client';
import { FeatureInterface } from 'lib/util/feature-evaluator/feature';
import { FeatureStrategiesEvaluationResult } from 'lib/util/feature-evaluator/client';
import { offlineUnleashClient } from './offline-unleash-client';
import { FeatureInterface } from 'lib/features/playground/feature-evaluator/feature';
import { FeatureStrategiesEvaluationResult } from 'lib/features/playground/feature-evaluator/client';
import { ISegmentService } from 'lib/segments/segment-service-interface';
export class PlaygroundService {

View File

@ -10,9 +10,9 @@ import getApp from '../../app';
import {
playgroundRequestSchema,
PlaygroundRequestSchema,
} from '../../../lib/openapi/spec/playground-request-schema';
} from '../../openapi/spec/playground-request-schema';
import { generate as generateRequest } from '../../../lib/openapi/spec/playground-request-schema.test';
import { generate as generateRequest } from '../../openapi/spec/playground-request-schema.test';
import { clientFeatures } from '../../../test/arbitraries.test';
async function getSetup() {

View File

@ -2,18 +2,18 @@ import { Request, Response } from 'express';
import { IUnleashConfig } from '../../types/option';
import { IUnleashServices } from '../../types/services';
import { NONE } from '../../types/permissions';
import Controller from '../controller';
import Controller from '../../routes/controller';
import { OpenApiService } from '../../services/openapi-service';
import { createResponseSchema } from '../../openapi/util/create-response-schema';
import { endpointDescriptions } from '../../openapi/endpoint-descriptions';
import { getStandardResponses } from '../../../lib/openapi/util/standard-responses';
import { createRequestSchema } from '../../../lib/openapi/util/create-request-schema';
import { getStandardResponses } from '../../openapi/util/standard-responses';
import { createRequestSchema } from '../../openapi/util/create-request-schema';
import {
PlaygroundResponseSchema,
playgroundResponseSchema,
} from '../../../lib/openapi/spec/playground-response-schema';
import { PlaygroundRequestSchema } from '../../../lib/openapi/spec/playground-request-schema';
import { PlaygroundService } from '../../../lib/services/playground-service';
} from '../../openapi/spec/playground-response-schema';
import { PlaygroundRequestSchema } from '../../openapi/spec/playground-request-schema';
import { PlaygroundService } from './playground-service';
export default class PlaygroundController extends Controller {
private openApiService: OpenApiService;

View File

@ -7,7 +7,7 @@ import { IUnleashConfig, IUnleashServices, IUnleashStores } from '../types';
import {
mapFeaturesForClient,
mapSegmentsForClient,
} from '../util/offline-unleash-client';
} from '../features/playground/offline-unleash-client';
import { ALL_ENVS, ALL_PROJECTS } from '../util/constants';
import { UnleashEvents } from 'unleash-client';
import { Logger } from '../logger';

View File

@ -5,7 +5,7 @@ import { FeatureTypeController } from './feature-type';
import ArchiveController from './archive';
import StrategyController from './strategy';
import EventController from './event';
import PlaygroundController from './playground';
import PlaygroundController from '../../features/playground/playground';
import MetricsController from './metrics';
import UserController from './user/user';
import ConfigController from './config';

View File

@ -76,7 +76,7 @@ import { SetStrategySortOrderSchema } from 'lib/openapi/spec/set-strategy-sort-o
import {
getDefaultStrategy,
getProjectDefaultStrategy,
} from '../util/feature-evaluator/helpers';
} from '../features/playground/feature-evaluator/helpers';
import { AccessService } from './access-service';
import { User } from '../server-impl';
import NoAccessError from '../error/no-access-error';

View File

@ -29,7 +29,7 @@ import UserSplashService from './user-splash-service';
import { SegmentService } from './segment-service';
import { OpenApiService } from './openapi-service';
import { ClientSpecService } from './client-spec-service';
import { PlaygroundService } from './playground-service';
import { PlaygroundService } from '../features/playground/playground-service';
import { GroupService } from './group-service';
import { ProxyService } from './proxy-service';
import EdgeService from './edge-service';

View File

@ -26,7 +26,7 @@ import ClientMetricsServiceV2 from '../services/client-metrics/metrics-service-v
import UserSplashService from '../services/user-splash-service';
import { OpenApiService } from '../services/openapi-service';
import { ClientSpecService } from '../services/client-spec-service';
import { PlaygroundService } from 'lib/services/playground-service';
import { PlaygroundService } from 'lib/features/playground/playground-service';
import { GroupService } from '../services/group-service';
import { ProxyService } from '../services/proxy-service';
import EdgeService from '../services/edge-service';

View File

@ -29,4 +29,4 @@ export * from './validateJsonString';
export * from './arraysHaveSameItems';
export * from './constantTimeCompare';
export * from './collapseHourlyMetrics';
export * from './offline-unleash-client';
export * from '../features/playground/offline-unleash-client';

View File

@ -1,4 +1,4 @@
import { PlaygroundService } from '../../../lib/services/playground-service';
import { PlaygroundService } from '../../../lib/features/playground/playground-service';
import {
clientFeaturesAndSegments,
commonISOTimestamp,
@ -12,7 +12,7 @@ import FeatureToggleService from '../../../lib/services/feature-toggle-service';
import { SegmentService } from '../../../lib/services/segment-service';
import { FeatureToggle, ISegment, WeightType } from '../../../lib/types/model';
import { PlaygroundFeatureSchema } from '../../../lib/openapi/spec/playground-feature-schema';
import { offlineUnleashClientNode } from '../../../lib/util/offline-unleash-client.test';
import { offlineUnleashClientNode } from '../../../lib/features/playground/offline-unleash-client.test';
import { ClientFeatureSchema } from 'lib/openapi/spec/client-feature-schema';
import { SdkContextSchema } from 'lib/openapi/spec/sdk-context-schema';
import { SegmentSchema } from 'lib/openapi/spec/segment-schema';