1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: rename services

This commit is contained in:
Ivar Conradi Østhus 2021-12-09 21:50:06 +01:00
parent cf70da71c9
commit bf1223e07d
15 changed files with 76 additions and 78 deletions

View File

@ -3,7 +3,7 @@ import Controller from '../controller';
import { IUnleashConfig } from '../../types/option';
import { IUnleashServices } from '../../types/services';
import { Logger } from '../../logger';
import ClientMetricsServiceV2 from '../../services/client-metrics/client-metrics-service-v2';
import ClientMetricsServiceV2 from '../../services/client-metrics/metrics-service-v2';
class ClientMetricsController extends Controller {
private logger: Logger;

View File

@ -4,7 +4,7 @@ import { UPDATE_APPLICATION } from '../../types/permissions';
import { IUnleashConfig } from '../../types/option';
import { IUnleashServices } from '../../types/services';
import { Logger } from '../../logger';
import ClientInstanceService from '../../services/client-metrics/client-instance-service';
import ClientInstanceService from '../../services/client-metrics/instance-service';
class MetricsController extends Controller {
private logger: Logger;

View File

@ -2,7 +2,7 @@ import supertest from 'supertest';
import createStores from '../../../test/fixtures/store';
import getApp from '../../app';
import { createTestConfig } from '../../../test/config/test-config';
import { clientMetricsSchema } from '../../services/client-metrics/client-metrics-schema';
import { clientMetricsSchema } from '../../services/client-metrics/schema';
import { createServices } from '../../services';
import { IUnleashStores } from '../../types';
import { IUnleashOptions } from '../../server-impl';

View File

@ -2,12 +2,12 @@ import { Response } from 'express';
import Controller from '../controller';
import { IUnleashServices } from '../../types';
import { IUnleashConfig } from '../../types/option';
import ClientInstanceService from '../../services/client-metrics/client-instance-service';
import ClientInstanceService from '../../services/client-metrics/instance-service';
import { Logger } from '../../logger';
import { IAuthRequest } from '../unleash-types';
import ApiUser from '../../types/api-user';
import { ALL } from '../../types/models/api-token';
import ClientMetricsServiceV2 from '../../services/client-metrics/client-metrics-service-v2';
import ClientMetricsServiceV2 from '../../services/client-metrics/metrics-service-v2';
import { User } from '../../server-impl';
import { IClientApp } from '../../types/model';
import { NONE } from '../../types/permissions';

View File

@ -3,7 +3,7 @@ import Controller from '../controller';
import { IUnleashServices } from '../../types';
import { IUnleashConfig } from '../../types/option';
import { Logger } from '../../logger';
import ClientInstanceService from '../../services/client-metrics/client-instance-service';
import ClientInstanceService from '../../services/client-metrics/instance-service';
import { IAuthRequest, User } from '../../server-impl';
import { IClientApp } from '../../types/model';
import ApiUser from '../../types/api-user';

View File

@ -1,27 +0,0 @@
import joi from 'joi';
const countSchema = joi
.object()
.options({ stripUnknown: true })
.keys({
yes: joi.number().min(0).empty('').default(0),
no: joi.number().min(0).empty('').default(0),
variants: joi.object().pattern(joi.string(), joi.number().min(0)),
});
export const clientMetricsSchema = joi
.object()
.options({ stripUnknown: true })
.keys({
environment: joi.string().optional(),
appName: joi.string().required(),
instanceId: joi.string().required(),
bucket: joi
.object()
.required()
.keys({
start: joi.date().required(),
stop: joi.date().required(),
toggles: joi.object().pattern(/.*/, countSchema),
}),
});

View File

@ -1,4 +1,4 @@
import ClientInstanceService from './client-instance-service';
import ClientInstanceService from './instance-service';
import getLogger from '../../../test/fixtures/no-logger';
import { IClientApp } from '../../types/model';
import { secondsToMilliseconds } from 'date-fns';

View File

@ -1,4 +1,4 @@
import { applicationSchema } from './metrics-schema';
import { applicationSchema } from './schema';
import { APPLICATION_CREATED } from '../../types/events';
import { IApplication } from './models';
import { IUnleashStores } from '../../types/stores';
@ -13,11 +13,11 @@ import { IStrategyStore } from '../../types/stores/strategy-store';
import { IClientInstanceStore } from '../../types/stores/client-instance-store';
import { IApplicationQuery } from '../../types/query';
import { IClientApp } from '../../types/model';
import { clientRegisterSchema } from './register-schema';
import { clientRegisterSchema } from './schema';
import { minutesToMilliseconds, secondsToMilliseconds } from 'date-fns';
import { IClientMetricsStoreV2 } from '../../types/stores/client-metrics-store-v2';
import { clientMetricsSchema } from './client-metrics-schema';
import { clientMetricsSchema } from './schema';
export default class ClientInstanceService {
apps = {};

View File

@ -1,18 +0,0 @@
import joi from 'joi';
export const applicationSchema = joi
.object()
.options({ stripUnknown: false })
.keys({
appName: joi.string().required(),
sdkVersion: joi.string().optional(),
strategies: joi
.array()
.optional()
.items(joi.string(), joi.any().strip()),
description: joi.string().allow('').optional(),
url: joi.string().allow('').optional(),
color: joi.string().allow('').optional(),
icon: joi.string().allow('').optional(),
announced: joi.boolean().optional().default(false),
});

View File

@ -7,7 +7,7 @@ import {
IClientMetricsEnv,
IClientMetricsStoreV2,
} from '../../types/stores/client-metrics-store-v2';
import { clientMetricsSchema } from './client-metrics-schema';
import { clientMetricsSchema } from './schema';
import { hoursToMilliseconds, minutesToMilliseconds } from 'date-fns';
import { IFeatureToggleStore } from '../../types/stores/feature-toggle-store';
import EventEmitter from 'events';

View File

@ -1,17 +0,0 @@
import joi from 'joi';
export const clientRegisterSchema = joi
.object()
.options({ stripUnknown: true })
.keys({
appName: joi.string().required(),
instanceId: joi.string().required(),
sdkVersion: joi.string().optional(),
strategies: joi
.array()
.required()
.items(joi.string(), joi.any().strip()),
started: joi.date().required(),
interval: joi.number().required(),
environment: joi.string().optional(),
});

View File

@ -0,0 +1,60 @@
import joi from 'joi';
const countSchema = joi
.object()
.options({ stripUnknown: true })
.keys({
yes: joi.number().min(0).empty('').default(0),
no: joi.number().min(0).empty('').default(0),
variants: joi.object().pattern(joi.string(), joi.number().min(0)),
});
export const clientMetricsSchema = joi
.object()
.options({ stripUnknown: true })
.keys({
environment: joi.string().optional(),
appName: joi.string().required(),
instanceId: joi.string().required(),
bucket: joi
.object()
.required()
.keys({
start: joi.date().required(),
stop: joi.date().required(),
toggles: joi.object().pattern(/.*/, countSchema),
}),
});
export const applicationSchema = joi
.object()
.options({ stripUnknown: false })
.keys({
appName: joi.string().required(),
sdkVersion: joi.string().optional(),
strategies: joi
.array()
.optional()
.items(joi.string(), joi.any().strip()),
description: joi.string().allow('').optional(),
url: joi.string().allow('').optional(),
color: joi.string().allow('').optional(),
icon: joi.string().allow('').optional(),
announced: joi.boolean().optional().default(false),
});
export const clientRegisterSchema = joi
.object()
.options({ stripUnknown: true })
.keys({
appName: joi.string().required(),
instanceId: joi.string().required(),
sdkVersion: joi.string().optional(),
strategies: joi
.array()
.required()
.items(joi.string(), joi.any().strip()),
started: joi.date().required(),
interval: joi.number().required(),
environment: joi.string().optional(),
});

View File

@ -7,8 +7,8 @@ import HealthService from './health-service';
import ProjectService from './project-service';
import StateService from './state-service';
import ClientInstanceService from './client-metrics/client-instance-service';
import ClientMetricsServiceV2 from './client-metrics/client-metrics-service-v2';
import ClientInstanceService from './client-metrics/instance-service';
import ClientMetricsServiceV2 from './client-metrics/metrics-service-v2';
import TagTypeService from './tag-type-service';
import TagService from './tag-service';
import StrategyService from './strategy-service';

View File

@ -5,7 +5,7 @@ import StateService from '../services/state-service';
import StrategyService from '../services/strategy-service';
import TagTypeService from '../services/tag-type-service';
import TagService from '../services/tag-service';
import ClientInstanceService from '../services/client-metrics/client-instance-service';
import ClientInstanceService from '../services/client-metrics/instance-service';
import ContextService from '../services/context-service';
import VersionService from '../services/version-service';
import { ApiTokenService } from '../services/api-token-service';
@ -22,7 +22,7 @@ import FeatureToggleService from '../services/feature-toggle-service';
import EnvironmentService from '../services/environment-service';
import FeatureTagService from '../services/feature-tag-service';
import ProjectHealthService from '../services/project-health-service';
import ClientMetricsServiceV2 from '../services/client-metrics/client-metrics-service-v2';
import ClientMetricsServiceV2 from '../services/client-metrics/metrics-service-v2';
import UserSplashService from '../services/user-splash-service';
export interface IUnleashServices {

View File

@ -1,4 +1,4 @@
import ClientInstanceService from '../../../lib/services/client-metrics/client-instance-service';
import ClientInstanceService from '../../../lib/services/client-metrics/instance-service';
import { IClientApp } from '../../../lib/types/model';
import { secondsToMilliseconds } from 'date-fns';