diff --git a/src/lib/error/index.ts b/src/lib/error/index.ts new file mode 100644 index 0000000000..e7224c6d97 --- /dev/null +++ b/src/lib/error/index.ts @@ -0,0 +1,38 @@ +import BadDataError from './bad-data-error'; +import BaseError from './base-error'; +import { UNIQUE_CONSTRAINT_VIOLATION, FOREIGN_KEY_VIOLATION } from './db-error'; +import DisabledError from './disabled-error'; +import FeatureHasTagError from './feature-has-tag-error'; +import IncompatibleProjectError from './incompatible-project-error'; +import InvalidOperationError from './invalid-operation-error'; +import InvalidTokenError from './invalid-token-error'; +import MinimumOneEnvironmentError from './minimum-one-environment-error'; +import NameExistsError from './name-exists-error'; +import NoAccessError from './no-access-error'; +import { OperationDeniedError } from './operation-denied-error'; +import UserTokenError from './used-token-error'; +import RoleInUseError from './role-in-use-error'; +import ProjectWithoutOwnerError from './project-without-owner-error'; +import PasswordUndefinedError from './password-undefined'; +import PasswordMismatchError from './password-mismatch'; + +export { + BadDataError, + BaseError, + UNIQUE_CONSTRAINT_VIOLATION, + FOREIGN_KEY_VIOLATION, + DisabledError, + FeatureHasTagError, + IncompatibleProjectError, + InvalidOperationError, + InvalidTokenError, + MinimumOneEnvironmentError, + NameExistsError, + NoAccessError, + OperationDeniedError, + UserTokenError, + RoleInUseError, + ProjectWithoutOwnerError, + PasswordUndefinedError, + PasswordMismatchError, +}; diff --git a/src/lib/internals.ts b/src/lib/internals.ts new file mode 100644 index 0000000000..985024012c --- /dev/null +++ b/src/lib/internals.ts @@ -0,0 +1,15 @@ +export * from './logger'; +export * from './metrics'; +export * from './event-hook'; +export * from './metric-events'; +export * from './default-custom-auth-deny-all'; +export * from './addons'; +export * from './db'; +export * from './middleware'; +export * from './openapi'; +export * from './proxy'; +export * from './routes'; +export * from './services'; +export * from './types'; +export * from './util'; +export * from './error'; diff --git a/src/lib/middleware/index.ts b/src/lib/middleware/index.ts new file mode 100644 index 0000000000..31b68401ff --- /dev/null +++ b/src/lib/middleware/index.ts @@ -0,0 +1,13 @@ +export * from './api-token-middleware'; +export * from './conditional-middleware'; +export * from './content_type_checker'; +export * from './cors-origin-middleware'; +export * from './demo-authentication'; +export * from './no-authentication'; +export * from './oss-authentication'; +export * from './pat-middleware'; +export * from './rbac-middleware'; +export * from './request-logger'; +export * from './response-time-metrics'; +export * from './secure-headers'; +export * from './session-db'; diff --git a/src/lib/middleware/secure-headers.ts b/src/lib/middleware/secure-headers.ts index 45a8532a31..982e5d944e 100644 --- a/src/lib/middleware/secure-headers.ts +++ b/src/lib/middleware/secure-headers.ts @@ -1,6 +1,6 @@ import helmet from 'helmet'; import { RequestHandler } from 'express'; -import { IUnleashConfig } from '../types/option'; +import { IUnleashConfig } from '../types'; import { hoursToSeconds } from 'date-fns'; const secureHeaders: (config: IUnleashConfig) => RequestHandler = (config) => { diff --git a/src/lib/openapi/index.ts b/src/lib/openapi/index.ts index 3be259752d..3b1bdbc873 100644 --- a/src/lib/openapi/index.ts +++ b/src/lib/openapi/index.ts @@ -1,129 +1,130 @@ import { OpenAPIV3 } from 'openapi-types'; -import { addonParameterSchema } from './spec/addon-parameter-schema'; -import { addonSchema } from './spec/addon-schema'; -import { addonsSchema } from './spec/addons-schema'; -import { addonTypeSchema } from './spec/addon-type-schema'; -import { apiTokenSchema } from './spec/api-token-schema'; -import { apiTokensSchema } from './spec/api-tokens-schema'; -import { applicationSchema } from './spec/application-schema'; -import { applicationsSchema } from './spec/applications-schema'; -import { changePasswordSchema } from './spec/change-password-schema'; -import { clientApplicationSchema } from './spec/client-application-schema'; -import { clientFeatureSchema } from './spec/client-feature-schema'; -import { clientFeaturesQuerySchema } from './spec/client-features-query-schema'; -import { clientFeaturesSchema } from './spec/client-features-schema'; -import { clientMetricsSchema } from './spec/client-metrics-schema'; -import { cloneFeatureSchema } from './spec/clone-feature-schema'; -import { constraintSchema } from './spec/constraint-schema'; -import { contextFieldSchema } from './spec/context-field-schema'; -import { contextFieldsSchema } from './spec/context-fields-schema'; -import { createApiTokenSchema } from './spec/create-api-token-schema'; -import { createFeatureSchema } from './spec/create-feature-schema'; -import { createFeatureStrategySchema } from './spec/create-feature-strategy-schema'; -import { createInvitedUserSchema } from './spec/create-invited-user-schema'; -import { createUserSchema } from './spec/create-user-schema'; -import { dateSchema } from './spec/date-schema'; -import { edgeTokenSchema } from './spec/edge-token-schema'; -import { emailSchema } from './spec/email-schema'; -import { environmentSchema } from './spec/environment-schema'; -import { environmentProjectSchema } from './spec/environment-project-schema'; -import { environmentsSchema } from './spec/environments-schema'; -import { environmentsProjectSchema } from './spec/environments-project-schema'; -import { eventSchema } from './spec/event-schema'; -import { eventsSchema } from './spec/events-schema'; -import { featureEnvironmentMetricsSchema } from './spec/feature-environment-metrics-schema'; -import { featureEnvironmentSchema } from './spec/feature-environment-schema'; -import { featureEventsSchema } from './spec/feature-events-schema'; -import { featureMetricsSchema } from './spec/feature-metrics-schema'; -import { featureSchema } from './spec/feature-schema'; -import { featuresSchema } from './spec/features-schema'; -import { featureStrategySchema } from './spec/feature-strategy-schema'; -import { featureStrategySegmentSchema } from './spec/feature-strategy-segment-schema'; -import { featureTagSchema } from './spec/feature-tag-schema'; -import { featureTypeSchema } from './spec/feature-type-schema'; -import { featureTypesSchema } from './spec/feature-types-schema'; -import { featureUsageSchema } from './spec/feature-usage-schema'; -import { featureVariantsSchema } from './spec/feature-variants-schema'; -import { feedbackSchema } from './spec/feedback-schema'; -import { groupSchema } from './spec/group-schema'; -import { groupsSchema } from './spec/groups-schema'; -import { groupUserModelSchema } from './spec/group-user-model-schema'; -import { healthCheckSchema } from './spec/health-check-schema'; -import { healthOverviewSchema } from './spec/health-overview-schema'; -import { healthReportSchema } from './spec/health-report-schema'; -import { idSchema } from './spec/id-schema'; +import { + addonParameterSchema, + addonSchema, + addonsSchema, + addonTypeSchema, + apiTokenSchema, + apiTokensSchema, + applicationSchema, + applicationsSchema, + changePasswordSchema, + clientApplicationSchema, + clientFeatureSchema, + clientFeaturesQuerySchema, + clientFeaturesSchema, + clientMetricsSchema, + cloneFeatureSchema, + constraintSchema, + contextFieldSchema, + contextFieldsSchema, + createApiTokenSchema, + createFeatureSchema, + createFeatureStrategySchema, + createInvitedUserSchema, + createUserSchema, + dateSchema, + edgeTokenSchema, + emailSchema, + environmentProjectSchema, + environmentSchema, + environmentsProjectSchema, + environmentsSchema, + eventSchema, + eventsSchema, + featureEnvironmentMetricsSchema, + featureEnvironmentSchema, + featureEventsSchema, + featureMetricsSchema, + featureSchema, + featuresSchema, + featureStrategySchema, + featureStrategySegmentSchema, + featureTagSchema, + featureTypeSchema, + featureTypesSchema, + featureUsageSchema, + featureVariantsSchema, + feedbackSchema, + groupSchema, + groupsSchema, + groupUserModelSchema, + healthCheckSchema, + healthOverviewSchema, + healthReportSchema, + idSchema, + instanceAdminStatsSchema, + legalValueSchema, + loginSchema, + meSchema, + nameSchema, + overrideSchema, + parametersSchema, + passwordSchema, + patchesSchema, + patchSchema, + patSchema, + patsSchema, + permissionSchema, + playgroundConstraintSchema, + playgroundFeatureSchema, + playgroundRequestSchema, + playgroundResponseSchema, + playgroundSegmentSchema, + playgroundStrategySchema, + profileSchema, + projectEnvironmentSchema, + projectSchema, + projectsSchema, + proxyClientSchema, + proxyFeatureSchema, + proxyFeaturesSchema, + proxyMetricsSchema, + publicSignupTokenCreateSchema, + publicSignupTokenSchema, + publicSignupTokensSchema, + publicSignupTokenUpdateSchema, + resetPasswordSchema, + roleSchema, + sdkContextSchema, + searchEventsSchema, + segmentSchema, + setStrategySortOrderSchema, + setUiConfigSchema, + sortOrderSchema, + splashSchema, + stateSchema, + strategiesSchema, + strategySchema, + tagSchema, + tagsSchema, + tagTypeSchema, + tagTypesSchema, + tagWithVersionSchema, + tokenUserSchema, + uiConfigSchema, + updateApiTokenSchema, + updateFeatureSchema, + updateFeatureStrategySchema, + updateTagTypeSchema, + updateUserSchema, + upsertContextFieldSchema, + upsertStrategySchema, + userSchema, + usersGroupsBaseSchema, + usersSchema, + usersSearchSchema, + validateEdgeTokensSchema, + validatePasswordSchema, + validateTagTypeSchema, + variantSchema, + variantsSchema, + versionSchema, +} from './spec'; import { IServerOption } from '../types'; -import { legalValueSchema } from './spec/legal-value-schema'; -import { loginSchema } from './spec/login-schema'; -import { mapValues } from '../util/map-values'; -import { meSchema } from './spec/me-schema'; -import { nameSchema } from './spec/name-schema'; -import { omitKeys } from '../util/omit-keys'; -import { openApiTags } from './util/openapi-tags'; -import { overrideSchema } from './spec/override-schema'; -import { parametersSchema } from './spec/parameters-schema'; -import { passwordSchema } from './spec/password-schema'; -import { patchesSchema } from './spec/patches-schema'; -import { patchSchema } from './spec/patch-schema'; -import { patSchema } from './spec/pat-schema'; -import { patsSchema } from './spec/pats-schema'; -import { permissionSchema } from './spec/permission-schema'; -import { playgroundConstraintSchema } from './spec/playground-constraint-schema'; -import { playgroundFeatureSchema } from './spec/playground-feature-schema'; -import { playgroundRequestSchema } from './spec/playground-request-schema'; -import { playgroundResponseSchema } from './spec/playground-response-schema'; -import { playgroundSegmentSchema } from './spec/playground-segment-schema'; -import { playgroundStrategySchema } from './spec/playground-strategy-schema'; -import { profileSchema } from './spec/profile-schema'; -import { projectEnvironmentSchema } from './spec/project-environment-schema'; -import { projectSchema } from './spec/project-schema'; -import { projectsSchema } from './spec/projects-schema'; -import { proxyClientSchema } from './spec/proxy-client-schema'; -import { proxyFeatureSchema } from './spec/proxy-feature-schema'; -import { proxyFeaturesSchema } from './spec/proxy-features-schema'; -import { proxyMetricsSchema } from './spec/proxy-metrics-schema'; -import { publicSignupTokenCreateSchema } from './spec/public-signup-token-create-schema'; -import { publicSignupTokenSchema } from './spec/public-signup-token-schema'; -import { publicSignupTokensSchema } from './spec/public-signup-tokens-schema'; -import { publicSignupTokenUpdateSchema } from './spec/public-signup-token-update-schema'; -import { resetPasswordSchema } from './spec/reset-password-schema'; -import { roleSchema } from './spec/role-schema'; -import { sdkContextSchema } from './spec/sdk-context-schema'; -import { searchEventsSchema } from './spec/search-events-schema'; -import { segmentSchema } from './spec/segment-schema'; -import { setStrategySortOrderSchema } from './spec/set-strategy-sort-order-schema'; -import { setUiConfigSchema } from './spec/set-ui-config-schema'; -import { sortOrderSchema } from './spec/sort-order-schema'; -import { splashSchema } from './spec/splash-schema'; -import { stateSchema } from './spec/state-schema'; -import { strategiesSchema } from './spec/strategies-schema'; -import { strategySchema } from './spec/strategy-schema'; -import { tagSchema } from './spec/tag-schema'; -import { tagsSchema } from './spec/tags-schema'; -import { tagTypeSchema } from './spec/tag-type-schema'; -import { tagTypesSchema } from './spec/tag-types-schema'; -import { tagWithVersionSchema } from './spec/tag-with-version-schema'; -import { tokenUserSchema } from './spec/token-user-schema'; -import { uiConfigSchema } from './spec/ui-config-schema'; -import { updateApiTokenSchema } from './spec/update-api-token-schema'; -import { updateFeatureSchema } from './spec/update-feature-schema'; -import { updateFeatureStrategySchema } from './spec/update-feature-strategy-schema'; -import { updateTagTypeSchema } from './spec/update-tag-type-schema'; -import { updateUserSchema } from './spec/update-user-schema'; -import { upsertContextFieldSchema } from './spec/upsert-context-field-schema'; -import { upsertStrategySchema } from './spec/upsert-strategy-schema'; +import { mapValues, omitKeys } from '../util'; +import { openApiTags } from './util'; import { URL } from 'url'; -import { userSchema } from './spec/user-schema'; -import { usersGroupsBaseSchema } from './spec/users-groups-base-schema'; -import { usersSchema } from './spec/users-schema'; -import { usersSearchSchema } from './spec/users-search-schema'; -import { validateEdgeTokensSchema } from './spec/validate-edge-tokens-schema'; -import { validatePasswordSchema } from './spec/validate-password-schema'; -import { validateTagTypeSchema } from './spec/validate-tag-type-schema'; -import { variantSchema } from './spec/variant-schema'; -import { variantsSchema } from './spec/variants-schema'; -import { versionSchema } from './spec/version-schema'; -import { instanceAdminStatsSchema } from './spec/instance-admin-stats-schema'; import apiVersion from '../util/version'; // All schemas in `openapi/spec` should be listed here. @@ -312,3 +313,6 @@ export const createOpenApiSchema = ({ tags: openApiTags, }; }; + +export * from './util'; +export * from './spec'; diff --git a/src/lib/openapi/spec/index.ts b/src/lib/openapi/spec/index.ts new file mode 100644 index 0000000000..279bcffbb6 --- /dev/null +++ b/src/lib/openapi/spec/index.ts @@ -0,0 +1,121 @@ +export * from './id-schema'; +export * from './me-schema'; +export * from './pat-schema'; +export * from './tag-schema'; +export * from './date-schema'; +export * from './name-schema'; +export * from './pats-schema'; +export * from './role-schema'; +export * from './tags-schema'; +export * from './user-schema'; +export * from './addon-schema'; +export * from './email-schema'; +export * from './event-schema'; +export * from './group-schema'; +export * from './login-schema'; +export * from './patch-schema'; +export * from './state-schema'; +export * from './users-schema'; +export * from './addons-schema'; +export * from './events-schema'; +export * from './groups-schema'; +export * from './splash-schema'; +export * from './feature-schema'; +export * from './patches-schema'; +export * from './profile-schema'; +export * from './project-schema'; +export * from './segment-schema'; +export * from './variant-schema'; +export * from './version-schema'; +export * from './features-schema'; +export * from './feedback-schema'; +export * from './override-schema'; +export * from './password-schema'; +export * from './projects-schema'; +export * from './strategy-schema'; +export * from './tag-type-schema'; +export * from './variants-schema'; +export * from './api-token-schema'; +export * from './tag-types-schema'; +export * from './ui-config-schema'; +export * from './addon-type-schema'; +export * from './api-tokens-schema'; +export * from './constraint-schema'; +export * from './edge-token-schema'; +export * from './parameters-schema'; +export * from './permission-schema'; +export * from './sort-order-schema'; +export * from './strategies-schema'; +export * from './token-user-schema'; +export * from './application-schema'; +export * from './create-user-schema'; +export * from './environment-schema'; +export * from './feature-tag-schema'; +export * from './legal-value-schema'; +export * from './sdk-context-schema'; +export * from './update-user-schema'; +export * from './applications-schema'; +export * from './environments-schema'; +export * from './feature-type-schema'; +export * from './health-check-schema'; +export * from './proxy-client-schema'; +export * from './users-search-schema'; +export * from './clone-feature-schema'; +export * from './context-field-schema'; +export * from './feature-types-schema'; +export * from './feature-usage-schema'; +export * from './health-report-schema'; +export * from './proxy-feature-schema'; +export * from './proxy-metrics-schema'; +export * from './search-events-schema'; +export * from './set-ui-config-schema'; +export * from './client-feature-schema'; +export * from './client-metrics-schema'; +export * from './context-fields-schema'; +export * from './create-feature-schema'; +export * from './feature-events-schema'; +export * from './proxy-features-schema'; +export * from './reset-password-schema'; +export * from './update-feature-schema'; +export * from './addon-parameter-schema'; +export * from './change-password-schema'; +export * from './client-features-schema'; +export * from './feature-metrics-schema'; +export * from './health-overview-schema'; +export * from './update-tag-type-schema'; +export * from './upsert-strategy-schema'; +export * from './create-api-token-schema'; +export * from './export-query-parameters'; +export * from './feature-strategy-schema'; +export * from './feature-variants-schema'; +export * from './group-user-model-schema'; +export * from './tag-with-version-schema'; +export * from './update-api-token-schema'; +export * from './users-groups-base-schema'; +export * from './validate-password-schema'; +export * from './validate-tag-type-schema'; +export * from './client-application-schema'; +export * from './playground-feature-schema'; +export * from './playground-request-schema'; +export * from './playground-segment-schema'; +export * from './create-invited-user-schema'; +export * from './environment-project-schema'; +export * from './feature-environment-schema'; +export * from './playground-response-schema'; +export * from './playground-strategy-schema'; +export * from './project-environment-schema'; +export * from './public-signup-token-schema'; +export * from './environments-project-schema'; +export * from './instance-admin-stats-schema'; +export * from './public-signup-tokens-schema'; +export * from './upsert-context-field-schema'; +export * from './validate-edge-tokens-schema'; +export * from './client-features-query-schema'; +export * from './playground-constraint-schema'; +export * from './create-feature-strategy-schema'; +export * from './set-strategy-sort-order-schema'; +export * from './update-feature-strategy-schema'; +export * from './feature-strategy-segment-schema'; +export * from './public-signup-token-create-schema'; +export * from './public-signup-token-update-schema'; +export * from './feature-environment-metrics-schema'; diff --git a/src/lib/openapi/util/index.ts b/src/lib/openapi/util/index.ts new file mode 100644 index 0000000000..0bf810c70f --- /dev/null +++ b/src/lib/openapi/util/index.ts @@ -0,0 +1,5 @@ +export * from './api-operation'; +export * from './create-request-schema'; +export * from './create-response-schema'; +export * from './openapi-tags'; +export * from './standard-responses'; diff --git a/src/lib/proxy/index.ts b/src/lib/proxy/index.ts new file mode 100644 index 0000000000..1a2a5ebe7b --- /dev/null +++ b/src/lib/proxy/index.ts @@ -0,0 +1,2 @@ +export * from './create-context'; +export * from './proxy-repository'; diff --git a/src/lib/server-impl.ts b/src/lib/server-impl.ts index fe481ccf43..512dc86f7e 100644 --- a/src/lib/server-impl.ts +++ b/src/lib/server-impl.ts @@ -12,18 +12,21 @@ import registerGracefulShutdown from './util/graceful-shutdown'; import { createDb } from './db/db-pool'; import sessionDb from './middleware/session-db'; // Types -import { IUnleash } from './types/core'; -import { IUnleashConfig, IUnleashOptions, IAuthType } from './types/option'; -import { IUnleashServices } from './types/services'; +import { + IAuthType, + IUnleash, + IUnleashConfig, + IUnleashOptions, + IUnleashServices, + RoleName, +} from './types'; + import User, { IUser } from './types/user'; import ApiUser from './types/api-user'; import { Logger, LogLevel } from './logger'; import AuthenticationRequired from './types/authentication-required'; import Controller from './routes/controller'; import { IAuthRequest } from './routes/unleash-types'; -import * as permissions from './types/permissions'; -import * as eventType from './types/events'; -import { RoleName } from './types/model'; import { SimpleAuthSettings } from './types/settings/simple-auth-settings'; import { Knex } from 'knex'; @@ -161,12 +164,14 @@ async function create(opts: IUnleashOptions): Promise { return createApp(config, false); } -// Module exports +export default { + start, + create, +}; + export { start, create, - permissions, - eventType, Controller, AuthenticationRequired, User, @@ -177,11 +182,6 @@ export { Knex, }; -export default { - start, - create, -}; - export type { Logger, IUnleash, diff --git a/src/lib/services/index.ts b/src/lib/services/index.ts index 4dfb8ad960..f0b3bdd4a4 100644 --- a/src/lib/services/index.ts +++ b/src/lib/services/index.ts @@ -166,6 +166,42 @@ export const createServices = ( }; }; -module.exports = { - createServices, +export { + FeatureTypeService, + EventService, + HealthService, + ProjectService, + StateService, + ClientInstanceService, + ClientMetricsServiceV2, + TagTypeService, + TagService, + StrategyService, + AddonService, + ContextService, + VersionService, + EmailService, + AccessService, + ApiTokenService, + UserService, + ResetTokenService, + SettingService, + SessionService, + UserFeedbackService, + FeatureToggleService, + EnvironmentService, + FeatureTagService, + ProjectHealthService, + UserSplashService, + SegmentService, + OpenApiService, + ClientSpecService, + PlaygroundService, + GroupService, + ProxyService, + EdgeService, + PatService, + PublicSignupTokenService, + LastSeenService, + InstanceStatsService, }; diff --git a/src/lib/types/index.ts b/src/lib/types/index.ts index 8fd7319616..21e022addf 100644 --- a/src/lib/types/index.ts +++ b/src/lib/types/index.ts @@ -1,3 +1,21 @@ export * from './services'; -export * from './stores'; export * from './option'; +export * from './api-user'; +export * from './authentication-required'; +export * from './core'; +export * from './environment'; +export * from './experimental'; +export * from './group'; +export * from './model'; +export * from './mutable'; +export * from './no-auth-user'; +export * from './option'; +export * from './partial'; +export * from './project'; +export * from './query'; +export * from './saved'; +export * from './serialize-dates'; +export * from './user'; +export * from './permissions'; +export * from './events'; +export * from './stores'; diff --git a/src/lib/types/stores.ts b/src/lib/types/stores.ts index 0d49d40af6..2ee05af156 100644 --- a/src/lib/types/stores.ts +++ b/src/lib/types/stores.ts @@ -61,3 +61,36 @@ export interface IUnleashStores { patStore: IPatStore; publicSignupTokenStore: IPublicSignupTokenStore; } + +export { + IAccessStore, + IAddonStore, + IApiTokenStore, + IClientApplicationsStore, + IClientInstanceStore, + IClientMetricsStoreV2, + IContextFieldStore, + IEnvironmentStore, + IEventStore, + IFeatureEnvironmentStore, + IFeatureStrategiesStore, + IFeatureTagStore, + IFeatureToggleClientStore, + IFeatureToggleStore, + IFeatureTypeStore, + IGroupStore, + IPatStore, + IProjectStore, + IPublicSignupTokenStore, + IResetTokenStore, + IRoleStore, + ISegmentStore, + ISessionStore, + ISettingStore, + IStrategyStore, + ITagStore, + ITagTypeStore, + IUserFeedbackStore, + IUserSplashStore, + IUserStore, +}; diff --git a/src/lib/util/index.ts b/src/lib/util/index.ts new file mode 100644 index 0000000000..f1ffabae8b --- /dev/null +++ b/src/lib/util/index.ts @@ -0,0 +1,32 @@ +export * from './timer'; +export * from './semver'; +export * from './version'; +export * from './is-email'; +export * from './segments'; +export * from './anonymise'; +export * from './constants'; +export * from './isDefined'; +export * from './omit-keys'; +export * from './random-id'; +export * from './snakeCase'; +export * from './map-values'; +export * from './time-utils'; +export * from './collect-ids'; +export * from './parseEnvVar'; +export * from './rewriteHTML'; +export * from './extract-user'; +export * from './flag-resolver'; +export * from './metrics-helper'; +export * from './validateOrigin'; +export * from './anyEventEmitter'; +export * from './format-base-uri'; +export * from './load-index-html'; +export * from './findPublicFolder'; +export * from './generateImageUrl'; +export * from './ensureStringValue'; +export * from './graceful-shutdown'; +export * from './validateJsonString'; +export * from './arraysHaveSameItems'; +export * from './constantTimeCompare'; +export * from './collapseHourlyMetrics'; +export * from './offline-unleash-client'; diff --git a/src/lib/util/omit-keys.ts b/src/lib/util/omit-keys.ts index e61b726696..66207ec4b1 100644 --- a/src/lib/util/omit-keys.ts +++ b/src/lib/util/omit-keys.ts @@ -1,4 +1,4 @@ -interface OmitKeys { +export interface OmitKeys { (obj: T, ...keys: K): { [K2 in Exclude]: T[K2]; }; diff --git a/src/server.ts b/src/server.ts index f0fdec1334..c65006a476 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1,7 +1,7 @@ -import * as unleash from './lib/server-impl'; +import { start } from './lib/server-impl'; try { - unleash.start(); + start(); } catch (error) { // eslint-disable-next-line no-console console.error(error); diff --git a/src/test/e2e/api/admin/project/features.auth.e2e.test.ts b/src/test/e2e/api/admin/project/features.auth.e2e.test.ts index afa29f0c7b..5cb19fb772 100644 --- a/src/test/e2e/api/admin/project/features.auth.e2e.test.ts +++ b/src/test/e2e/api/admin/project/features.auth.e2e.test.ts @@ -1,9 +1,8 @@ import dbInit, { ITestDb } from '../../../helpers/database-init'; import { IUnleashTest, setupAppWithAuth } from '../../../helpers/test-helper'; import getLogger from '../../../../fixtures/no-logger'; -import { DEFAULT_ENV } from '../../../../../lib/util/constants'; -import { RoleName } from '../../../../../lib/server-impl'; -import { CREATE_FEATURE_STRATEGY } from '../../../../../lib/types/permissions'; +import { DEFAULT_ENV } from '../../../../../lib/util'; +import { RoleName, CREATE_FEATURE_STRATEGY } from '../../../../../lib/types'; let app: IUnleashTest; let db: ITestDb;