Skip to content

Commit

Permalink
fix(import): making all imports relative and removing baseUrl (#5847)
Browse files Browse the repository at this point in the history
Co-authored-by: Simon Hornby <liquidwicked64@gmail.com>
  • Loading branch information
bassrock and sighphyre committed Jan 17, 2024
1 parent 60813ac commit 1392b10
Show file tree
Hide file tree
Showing 94 changed files with 158 additions and 152 deletions.
4 changes: 2 additions & 2 deletions src/lib/db/access-store.test.ts
@@ -1,8 +1,8 @@
import dbInit, { ITestDb } from '../../test/e2e/helpers/database-init';
import getLogger from '../../test/fixtures/no-logger';
import { PermissionRef } from 'lib/services/access-service';
import { PermissionRef } from '../services/access-service';
import { AccessStore } from './access-store';
import { BadDataError } from '../../lib/error';
import { BadDataError } from '../error';

let db: ITestDb;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/db/access-store.ts
Expand Up @@ -25,7 +25,7 @@ import {
IdPermissionRef,
NamePermissionRef,
PermissionRef,
} from 'lib/services/access-service';
} from '../services/access-service';
import { inTransaction } from './transaction';
import BadDataError from '../error/bad-data-error';

Expand Down
6 changes: 3 additions & 3 deletions src/lib/db/project-stats-store.ts
Expand Up @@ -3,13 +3,13 @@ import { Logger, LogProvider } from '../logger';
import metricsHelper from '../util/metrics-helper';
import { DB_TIME } from '../metric-events';
import EventEmitter from 'events';
import { IProjectStats } from 'lib/services/project-service';
import { IProjectStats } from '../services/project-service';
import {
ICreateEnabledDates,
IProjectStatsStore,
} from 'lib/types/stores/project-stats-store-type';
} from '../types/stores/project-stats-store-type';
import { Db } from './db';
import { DoraFeaturesSchema } from 'lib/openapi';
import { DoraFeaturesSchema } from '../openapi';

const TABLE = 'project_stats';

Expand Down
8 changes: 4 additions & 4 deletions src/lib/db/role-store.ts
@@ -1,16 +1,16 @@
import EventEmitter from 'events';
import { Logger, LogProvider } from '../logger';
import NotFoundError from '../error/notfound-error';
import { ICustomRole } from 'lib/types/model';
import { ICustomRole } from '../types/model';
import {
ICustomRoleInsert,
ICustomRoleUpdate,
IRoleStore,
} from 'lib/types/stores/role-store';
import { IRole, IUserRole } from 'lib/types/stores/access-store';
} from '../types/stores/role-store';
import { IRole, IUserRole } from '../types/stores/access-store';
import { Db } from './db';
import { PROJECT_ROLE_TYPES, ROOT_ROLE_TYPES } from '../util';
import { RoleSchema } from 'lib/openapi';
import { RoleSchema } from '../openapi';

const T = {
ROLE_USER: 'role_user',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/db/transaction.ts
@@ -1,5 +1,5 @@
import { Knex } from 'knex';
import { IUnleashConfig } from 'lib/server-impl';
import { IUnleashConfig } from '../server-impl';

export type KnexTransaction = Knex.Transaction;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/domain/project-health/project-health.test.ts
@@ -1,5 +1,5 @@
import { subDays } from 'date-fns';
import type { IFeatureType } from 'lib/types/stores/feature-type-store';
import type { IFeatureType } from '../../types/stores/feature-type-store';
import {
calculateProjectHealth,
calculateHealthRating,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/domain/project-health/project-health.ts
@@ -1,6 +1,6 @@
import { hoursToMilliseconds } from 'date-fns';
import type { IProjectHealthReport } from 'lib/types';
import type { IFeatureType } from 'lib/types/stores/feature-type-store';
import type { IProjectHealthReport } from '../../types';
import type { IFeatureType } from '../../types/stores/feature-type-store';

type IPartialFeatures = Array<{
stale?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/features/access/createAccessService.ts
@@ -1,4 +1,4 @@
import { Db, IUnleashConfig } from 'lib/server-impl';
import { Db, IUnleashConfig } from '../../server-impl';
import GroupStore from '../../db/group-store';
import { AccountStore } from '../../db/account-store';
import RoleStore from '../../db/role-store';
Expand Down
@@ -1,4 +1,4 @@
import { Db, IUnleashConfig } from 'lib/server-impl';
import { Db, IUnleashConfig } from '../../server-impl';
import { ChangeRequestAccessReadModel } from './sql-change-request-access-read-model';
import { createAccessService } from '../access/createAccessService';
import { FakeChangeRequestAccessReadModel } from './fake-change-request-access-read-model';
Expand Down
@@ -1,4 +1,4 @@
import { IUser } from 'lib/server-impl';
import { IUser } from '../../server-impl';
import dbInit, { ITestDb } from '../../../test/e2e/helpers/database-init';
import getLogger from '../../../test/fixtures/no-logger';
import { IChangeRequestSegmentUsageReadModel } from './change-request-segment-usage-read-model';
Expand Down
@@ -1,4 +1,4 @@
import { Db } from 'lib/server-impl';
import { Db } from '../../server-impl';
import { ChangeRequestSegmentUsageReadModel } from './sql-change-request-segment-usage-read-model';
import { FakeChangeRequestSegmentUsageReadModel } from './fake-change-request-segment-usage-read-model';
import { IChangeRequestSegmentUsageReadModel } from './change-request-segment-usage-read-model';
Expand Down
Expand Up @@ -43,7 +43,7 @@ import {
createFakePrivateProjectChecker,
createPrivateProjectChecker,
} from '../private-project/createPrivateProjectChecker';
import { DeferredServiceFactory } from 'lib/db/transaction';
import { DeferredServiceFactory } from '../../db/transaction';
import { DependentFeaturesReadModel } from '../dependent-features/dependent-features-read-model';
import { FakeDependentFeaturesReadModel } from '../dependent-features/fake-dependent-features-read-model';
import {
Expand Down
@@ -1,4 +1,4 @@
import { IFeatureOverview } from 'lib/types';
import { IFeatureOverview } from '../../types';
import {
IFeatureSearchParams,
IQueryParam,
Expand Down
Expand Up @@ -10,7 +10,7 @@ import {
IFeatureToggleQuery,
IFeatureTypeCount,
IVariant,
} from 'lib/types/model';
} from '../../../types/model';
import { LastSeenInput } from '../../metrics/last-seen/last-seen-service';
import {
EnvironmentFeatureNames,
Expand Down
6 changes: 3 additions & 3 deletions src/lib/features/feature-toggle/feature-toggle-service.ts
Expand Up @@ -86,8 +86,8 @@ import {
validateSemver,
validateString,
} from '../../util/validators/constraint-types';
import { IContextFieldStore } from 'lib/types/stores/context-field-store';
import { SetStrategySortOrderSchema } from 'lib/openapi/spec/set-strategy-sort-order-schema';
import { IContextFieldStore } from '../../types/stores/context-field-store';
import { SetStrategySortOrderSchema } from '../../openapi/spec/set-strategy-sort-order-schema';
import {
getDefaultStrategy,
getProjectDefaultStrategy,
Expand All @@ -96,7 +96,7 @@ import { AccessService } from '../../services/access-service';
import { IUser } from '../../server-impl';
import { IFeatureProjectUserParams } from './feature-toggle-controller';
import { unique } from '../../util/unique';
import { ISegmentService } from 'lib/segments/segment-service-interface';
import { ISegmentService } from '../../segments/segment-service-interface';
import { IChangeRequestAccessReadModel } from '../change-request-access-service/change-request-access-read-model';
import { checkFeatureFlagNamesAgainstPattern } from '../feature-naming-pattern/feature-naming-validation';
import { IPrivateProjectChecker } from '../private-project/privateProjectCheckerType';
Expand Down
@@ -1,5 +1,5 @@
import { IFeatureStrategiesStore } from 'lib/features/feature-toggle/types/feature-toggle-strategies-store-type';
import { IFeatureToggleStore } from 'lib/features/feature-toggle/types/feature-toggle-store-type';
import { IFeatureStrategiesStore } from '../../../features/feature-toggle/types/feature-toggle-strategies-store-type';
import { IFeatureToggleStore } from '../../../features/feature-toggle/types/feature-toggle-store-type';
import dbInit, { ITestDb } from '../../../../test/e2e/helpers/database-init';
import getLogger from '../../../../test/fixtures/no-logger';
import { IUnleashStores } from '../../../types';
Expand Down
Expand Up @@ -26,7 +26,10 @@ import { v4 as uuidv4 } from 'uuid';
import supertest from 'supertest';
import { randomId } from '../../../util/random-id';
import { DEFAULT_PROJECT } from '../../../types';
import { FeatureStrategySchema, SetStrategySortOrderSchema } from 'lib/openapi';
import {
FeatureStrategySchema,
SetStrategySortOrderSchema,
} from '../../../openapi';
import { ForbiddenError } from '../../../error';

let app: IUnleashTest;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/features/instance-stats/getActiveUsers.ts
@@ -1,4 +1,4 @@
import { type Db } from 'lib/server-impl';
import { type Db } from '../../server-impl';

export type GetActiveUsers = () => Promise<{
last7: number;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/features/instance-stats/getProductionChanges.ts
@@ -1,4 +1,4 @@
import { type Db } from 'lib/server-impl';
import { type Db } from '../../server-impl';

export type GetProductionChanges = () => Promise<{
last30: number;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/features/maintenance/maintenance-controller.ts
Expand Up @@ -15,8 +15,8 @@ import {
MaintenanceSchema,
maintenanceSchema,
} from '../../openapi/spec/maintenance-schema';
import MaintenanceService from 'lib/features/maintenance/maintenance-service';
import { ToggleMaintenanceSchema } from 'lib/openapi/spec/toggle-maintenance-schema';
import MaintenanceService from '../../features/maintenance/maintenance-service';
import { ToggleMaintenanceSchema } from '../../openapi/spec/toggle-maintenance-schema';

export default class MaintenanceController extends Controller {
private maintenanceService: MaintenanceService;
Expand Down
Expand Up @@ -5,7 +5,7 @@ import getLogger from '../../../../test/fixtures/no-logger';
import createStores from '../../../../test/fixtures/store';
import EventEmitter from 'events';
import { LastSeenService } from '../last-seen/last-seen-service';
import { IClientMetricsStoreV2, IUnleashConfig } from 'lib/types';
import { IClientMetricsStoreV2, IUnleashConfig } from '../../../../lib/types';
import { endOfDay, startOfHour, subDays, subHours } from 'date-fns';
import { IClientMetricsEnv } from './client-metrics-store-v2-type';

Expand Down
Expand Up @@ -19,7 +19,7 @@ import {
generateHourBuckets,
HourBucket,
} from '../../../util/time-utils';
import { ClientMetricsSchema } from 'lib/openapi';
import { ClientMetricsSchema } from '../../../../lib/openapi';
import { nameSchema } from '../../../schema/feature-schema';

export default class ClientMetricsServiceV2 {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/features/metrics/shared/schema.ts
@@ -1,5 +1,5 @@
import joi from 'joi';
import { IMetricsBucket } from 'lib/types';
import { IMetricsBucket } from '../../../types';

const countSchema = joi
.object()
Expand Down
2 changes: 1 addition & 1 deletion src/lib/features/playground/feature-evaluator/client.ts
Expand Up @@ -9,7 +9,7 @@ import {
} from './variant';
import { Context } from './context';
import { SegmentForEvaluation } from './strategy/strategy';
import { PlaygroundStrategySchema } from 'lib/openapi/spec/playground-strategy-schema';
import { PlaygroundStrategySchema } from '../../../openapi/spec/playground-strategy-schema';
import { playgroundStrategyEvaluation } from '../../../openapi/spec/playground-strategy-schema';

export type StrategyEvaluationResult = Pick<
Expand Down
@@ -1,5 +1,5 @@
import { PlaygroundConstraintSchema } from 'lib/openapi/spec/playground-constraint-schema';
import { PlaygroundSegmentSchema } from 'lib/openapi/spec/playground-segment-schema';
import { PlaygroundConstraintSchema } from '../../../../openapi/spec/playground-constraint-schema';
import { PlaygroundSegmentSchema } from '../../../../openapi/spec/playground-segment-schema';
import { StrategyEvaluationResult } from '../client';
import { Constraint, operators } from '../constraint';
import { Context } from '../context';
Expand Down
6 changes: 3 additions & 3 deletions src/lib/features/playground/offline-unleash-client.ts
@@ -1,8 +1,8 @@
import { SdkContextSchema } from 'lib/openapi/spec/sdk-context-schema';
import { SdkContextSchema } from '../../openapi/spec/sdk-context-schema';
import { InMemStorageProvider, FeatureEvaluator } from './feature-evaluator';
import { FeatureConfigurationClient } from 'lib/features/feature-toggle/types/feature-toggle-strategies-store-type';
import { FeatureConfigurationClient } from '../../features/feature-toggle/types/feature-toggle-strategies-store-type';
import { Segment } from './feature-evaluator/strategy/strategy';
import { ISegment } from 'lib/types/model';
import { ISegment } from '../../types/model';
import { serializeDates } from '../../types/serialize-dates';
import { Operator } from './feature-evaluator/constraint';
import { FeatureInterface } from 'unleash-client/lib/feature';
Expand Down
16 changes: 8 additions & 8 deletions src/lib/features/playground/playground-service.ts
@@ -1,25 +1,25 @@
import FeatureToggleService from '../feature-toggle/feature-toggle-service';
import { SdkContextSchema } from 'lib/openapi/spec/sdk-context-schema';
import { IUnleashServices } from 'lib/types/services';
import { SdkContextSchema } from '../../openapi/spec/sdk-context-schema';
import { IUnleashServices } from '../../types/services';
import { ALL } from '../../types/models/api-token';
import { PlaygroundFeatureSchema } from 'lib/openapi/spec/playground-feature-schema';
import { PlaygroundFeatureSchema } from '../../openapi/spec/playground-feature-schema';
import { Logger } from '../../logger';
import { IFlagResolver, ISegment, IUnleashConfig } from 'lib/types';
import { IFlagResolver, ISegment, IUnleashConfig } from '../../types';
import { offlineUnleashClient } from './offline-unleash-client';
import { FeatureInterface } from 'lib/features/playground/feature-evaluator/feature';
import { FeatureInterface } from '../../features/playground/feature-evaluator/feature';
import {
EvaluatedPlaygroundStrategy,
FeatureStrategiesEvaluationResult,
} from 'lib/features/playground/feature-evaluator/client';
import { ISegmentService } from 'lib/segments/segment-service-interface';
} from '../../features/playground/feature-evaluator/client';
import { ISegmentService } from '../../segments/segment-service-interface';
import { FeatureConfigurationClient } from '../feature-toggle/types/feature-toggle-strategies-store-type';
import { generateObjectCombinations } from './generateObjectCombinations';
import groupBy from 'lodash.groupby';
import { omitKeys } from '../../util';
import { AdvancedPlaygroundFeatureSchema } from '../../openapi';
import { AdvancedPlaygroundEnvironmentFeatureSchema } from '../../openapi/spec/advanced-playground-environment-feature-schema';
import { validateQueryComplexity } from './validateQueryComplexity';
import { playgroundStrategyEvaluation } from 'lib/openapi';
import { playgroundStrategyEvaluation } from '../../openapi';
import { IPrivateProjectChecker } from '../private-project/privateProjectCheckerType';
import { getDefaultVariant } from './feature-evaluator/variant';

Expand Down
2 changes: 1 addition & 1 deletion src/lib/features/playground/playground-view-model.ts
Expand Up @@ -4,7 +4,7 @@ import {
PlaygroundRequestSchema,
PlaygroundResponseSchema,
PlaygroundStrategySchema,
} from 'lib/openapi';
} from '../../openapi';
import {
AdvancedPlaygroundFeatureEvaluationResult,
PlaygroundFeatureEvaluationResult,
Expand Down
@@ -1,4 +1,4 @@
import { Db, IUnleashConfig } from 'lib/server-impl';
import { Db, IUnleashConfig } from '../../server-impl';
import PrivateProjectStore from './privateProjectStore';
import { PrivateProjectChecker } from './privateProjectChecker';
import { FakePrivateProjectChecker } from './fakePrivateProjectChecker';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/features/project-environments/environment-service.ts
Expand Up @@ -17,9 +17,9 @@ import { BadDataError, UNIQUE_CONSTRAINT_VIOLATION } from '../../error';
import NameExistsError from '../../error/name-exists-error';
import { sortOrderSchema } from '../../services/state-schema';
import NotFoundError from '../../error/notfound-error';
import { IProjectStore } from 'lib/types/stores/project-store';
import { IProjectStore } from '../../types/stores/project-store';
import MinimumOneEnvironmentError from '../../error/minimum-one-environment-error';
import { IFlagResolver } from 'lib/types/experimental';
import { IFlagResolver } from '../../types/experimental';
import { CreateFeatureStrategySchema } from '../../openapi';
import EventService from '../../services/event-service';

Expand Down
2 changes: 1 addition & 1 deletion src/lib/features/project/createProjectService.ts
@@ -1,4 +1,4 @@
import { Db, IUnleashConfig } from 'lib/server-impl';
import { Db, IUnleashConfig } from '../../server-impl';
import EventStore from '../../db/event-store';
import GroupStore from '../../db/group-store';
import { AccountStore } from '../../db/account-store';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/features/segment/createSegmentService.ts
@@ -1,4 +1,4 @@
import { Db, IUnleashConfig } from 'lib/server-impl';
import { Db, IUnleashConfig } from '../../server-impl';
import { EventService, SegmentService } from '../../services';
import FakeEventStore from '../../../test/fixtures/fake-event-store';
import { ISegmentService } from '../../segments/segment-service-interface';
Expand Down
4 changes: 2 additions & 2 deletions src/lib/middleware/api-token-middleware.test.ts
Expand Up @@ -6,8 +6,8 @@ import { ALL, ApiTokenType } from '../types/models/api-token';
import apiTokenMiddleware, {
TOKEN_TYPE_ERROR_MESSAGE,
} from './api-token-middleware';
import { ApiTokenService } from 'lib/services';
import { IUnleashConfig } from 'lib/types';
import { ApiTokenService } from '../services';
import { IUnleashConfig } from '../types';

let config: IUnleashConfig;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/middleware/api-token-middleware.ts
@@ -1,7 +1,7 @@
import { ApiTokenType } from '../types/models/api-token';
import { IUnleashConfig } from '../types/option';
import { IApiRequest, IAuthRequest } from '../routes/unleash-types';
import { IUnleashServices } from 'lib/server-impl';
import { IUnleashServices } from '../server-impl';

const isClientApi = ({ path }) => {
return path && path.indexOf('/api/client') > -1;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/middleware/demo-authentication.ts
Expand Up @@ -4,8 +4,8 @@ import { IUnleashServices } from '../types/services';
import { IUnleashConfig } from '../types/option';
import ApiUser from '../types/api-user';
import { ApiTokenType } from '../types/models/api-token';
import { IAuthRequest } from 'lib/server-impl';
import { IApiRequest } from 'lib/routes/unleash-types';
import { IAuthRequest } from '../server-impl';
import { IApiRequest } from '../routes/unleash-types';
import { encrypt } from '../util';

function demoAuthentication(
Expand Down
2 changes: 1 addition & 1 deletion src/lib/middleware/no-authentication.test.ts
@@ -1,4 +1,4 @@
import { IAuthRequest } from 'lib/routes/unleash-types';
import { IAuthRequest } from '../routes/unleash-types';
import supertest from 'supertest';
import express from 'express';
import noAuthentication from './no-authentication';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/middleware/response-time-metrics.ts
Expand Up @@ -2,7 +2,7 @@ import * as responseTime from 'response-time';
import EventEmitter from 'events';
import { REQUEST_TIME } from '../metric-events';
import { IFlagResolver } from '../types/experimental';
import { InstanceStatsService } from 'lib/services';
import { InstanceStatsService } from '../services';

// eslint-disable-next-line @typescript-eslint/naming-convention
const _responseTime = responseTime.default;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/routes/admin-api/addon.ts
Expand Up @@ -22,7 +22,7 @@ import {
emptyResponse,
getStandardResponses,
} from '../../openapi/util/standard-responses';
import { AddonCreateUpdateSchema } from 'lib/openapi/spec/addon-create-update-schema';
import { AddonCreateUpdateSchema } from '../../openapi/spec/addon-create-update-schema';

type AddonServices = Pick<IUnleashServices, 'addonService' | 'openApiService'>;

Expand Down
8 changes: 4 additions & 4 deletions src/lib/routes/admin-api/config.ts
Expand Up @@ -4,8 +4,8 @@ import { IUnleashServices } from '../../types/services';
import { IAuthType, IUnleashConfig } from '../../types/option';
import version from '../../util/version';
import Controller from '../controller';
import VersionService from 'lib/services/version-service';
import SettingService from 'lib/services/setting-service';
import VersionService from '../../services/version-service';
import SettingService from '../../services/setting-service';
import {
simpleAuthSettingsKey,
SimpleAuthSettings,
Expand All @@ -24,8 +24,8 @@ import { extractUsername } from '../../util/extract-user';
import NotFoundError from '../../error/notfound-error';
import { SetUiConfigSchema } from '../../openapi/spec/set-ui-config-schema';
import { createRequestSchema } from '../../openapi/util/create-request-schema';
import { ProxyService } from 'lib/services';
import MaintenanceService from 'lib/features/maintenance/maintenance-service';
import { ProxyService } from '../../services';
import MaintenanceService from '../../features/maintenance/maintenance-service';

class ConfigController extends Controller {
private versionService: VersionService;
Expand Down

0 comments on commit 1392b10

Please sign in to comment.