mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
fix: Clean up exported types even more
This commit is contained in:
parent
0e526d4283
commit
721baa7657
@ -1,8 +1,6 @@
|
|||||||
import EventEmitter from 'events';
|
import EventEmitter from 'events';
|
||||||
import stoppable, { StoppableServer } from 'stoppable';
|
import stoppable, { StoppableServer } from 'stoppable';
|
||||||
import { promisify } from 'util';
|
import { promisify } from 'util';
|
||||||
import { IUnleash } from './types/core';
|
|
||||||
import { IUnleashConfig, IUnleashOptions } from './types/option';
|
|
||||||
import version from './util/version';
|
import version from './util/version';
|
||||||
import migrator from '../migrator';
|
import migrator from '../migrator';
|
||||||
import getApp from './app';
|
import getApp from './app';
|
||||||
@ -10,17 +8,21 @@ import { createMetricsMonitor } from './metrics';
|
|||||||
import { createStores } from './db';
|
import { createStores } from './db';
|
||||||
import { createServices } from './services';
|
import { createServices } from './services';
|
||||||
import { createConfig } from './create-config';
|
import { createConfig } from './create-config';
|
||||||
import User from './types/user';
|
|
||||||
import { Logger } from './logger';
|
|
||||||
|
|
||||||
import * as permissions from './types/permissions';
|
|
||||||
import AuthenticationRequired from './types/authentication-required';
|
|
||||||
import Controller from './routes/controller';
|
|
||||||
import * as eventType from './types/events';
|
|
||||||
import { addEventHook } from './event-hook';
|
import { addEventHook } from './event-hook';
|
||||||
import registerGracefulShutdown from './util/graceful-shutdown';
|
import registerGracefulShutdown from './util/graceful-shutdown';
|
||||||
import { createDb } from './db/db-pool';
|
import { createDb } from './db/db-pool';
|
||||||
import sessionDb from './middleware/session-db';
|
import sessionDb from './middleware/session-db';
|
||||||
|
// Types
|
||||||
|
import { IUnleash } from './types/core';
|
||||||
|
import { IUnleashConfig, IUnleashOptions } from './types/option';
|
||||||
|
import { IUnleashServices } from './types/services';
|
||||||
|
import User, { IUser } from './types/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';
|
||||||
|
|
||||||
async function createApp(
|
async function createApp(
|
||||||
config: IUnleashConfig,
|
config: IUnleashConfig,
|
||||||
@ -142,14 +144,30 @@ async function create(opts: IUnleashOptions): Promise<IUnleash> {
|
|||||||
}
|
}
|
||||||
return createApp(config, false);
|
return createApp(config, false);
|
||||||
}
|
}
|
||||||
const serverImpl = {
|
|
||||||
|
// Module exports
|
||||||
|
export {
|
||||||
start,
|
start,
|
||||||
create,
|
create,
|
||||||
User,
|
|
||||||
AuthenticationRequired,
|
|
||||||
Controller,
|
|
||||||
permissions,
|
permissions,
|
||||||
eventType,
|
eventType,
|
||||||
|
Controller,
|
||||||
|
AuthenticationRequired,
|
||||||
|
User,
|
||||||
|
LogLevel,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
start,
|
||||||
|
create,
|
||||||
|
};
|
||||||
|
|
||||||
|
export type {
|
||||||
|
Logger,
|
||||||
|
IUnleash,
|
||||||
|
IUnleashOptions,
|
||||||
|
IUnleashConfig,
|
||||||
|
IUser,
|
||||||
|
IUnleashServices,
|
||||||
|
IAuthRequest,
|
||||||
};
|
};
|
||||||
export default serverImpl;
|
|
||||||
module.exports = serverImpl;
|
|
||||||
|
@ -75,7 +75,6 @@ export default class User implements IUser {
|
|||||||
this.seenAt = seenAt;
|
this.seenAt = seenAt;
|
||||||
this.loginAttempts = loginAttempts;
|
this.loginAttempts = loginAttempts;
|
||||||
this.createdAt = createdAt;
|
this.createdAt = createdAt;
|
||||||
this.imageUrl = this.generateImageUrl();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
generateImageUrl(): string {
|
generateImageUrl(): string {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import unleash from './lib/server-impl';
|
import { start } from './lib/server-impl';
|
||||||
import { createConfig } from './lib/create-config';
|
import { createConfig } from './lib/create-config';
|
||||||
import { LogLevel } from './lib/logger';
|
import { LogLevel } from './lib/logger';
|
||||||
|
|
||||||
process.nextTick(async () => {
|
process.nextTick(async () => {
|
||||||
try {
|
try {
|
||||||
await unleash.start(
|
await start(
|
||||||
createConfig({
|
createConfig({
|
||||||
db: {
|
db: {
|
||||||
user: 'unleash_user',
|
user: 'unleash_user',
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
import unleash from './lib/server-impl';
|
import * as unleash from './lib/server-impl';
|
||||||
|
|
||||||
unleash.start();
|
unleash.start();
|
||||||
|
Loading…
Reference in New Issue
Block a user