@tsed/platform-http 8.38.0-beta.4 → 8.38.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,7 @@ export class PlatformBuilder {
18
18
  #promise;
19
19
  #servers;
20
20
  #listeners;
21
- constructor(settings) {
21
+ constructor(settings = {}) {
22
22
  this.startedAt = new Date();
23
23
  this.current = new Date();
24
24
  this.#listeners = [];
@@ -76,21 +76,18 @@ export class PlatformBuilder {
76
76
  get injector() {
77
77
  return injector();
78
78
  }
79
- static create(module, settings) {
80
- return this.build(module, {
79
+ static create(settings) {
80
+ return new PlatformBuilder({
81
81
  httpsPort: false,
82
82
  httpPort: false,
83
83
  ...settings
84
84
  });
85
85
  }
86
- static build(module, settings) {
87
- return new PlatformBuilder({
88
- rootModule: settings ? module : undefined,
89
- ...(settings ? settings : module)
90
- });
91
- }
92
- static bootstrap(module, settings) {
93
- return this.build(module, settings).bootstrap();
86
+ /**
87
+ * Bootstrap a server application
88
+ */
89
+ static bootstrap(settings) {
90
+ return new PlatformBuilder(settings).bootstrap();
94
91
  }
95
92
  callback(...args) {
96
93
  return this.adapter.app.callback(...args);
@@ -12,13 +12,17 @@ export class PlatformCustom extends FakeAdapter {
12
12
  ];
13
13
  }
14
14
  static create(module, settings = {}) {
15
- return PlatformBuilder.create(module, {
15
+ return new PlatformBuilder({
16
+ rootModule: module,
17
+ httpPort: false,
18
+ httpsPort: false,
16
19
  ...settings,
17
20
  adapter: PlatformCustom
18
21
  });
19
22
  }
20
23
  static bootstrap(module, settings = {}) {
21
- return PlatformBuilder.build(module, {
24
+ return new PlatformBuilder({
25
+ rootModule: module,
22
26
  ...settings,
23
27
  adapter: PlatformCustom
24
28
  }).bootstrap();
@@ -45,7 +45,8 @@ export class PlatformTest extends DITest {
45
45
  const settings = DITest.configure(props);
46
46
  adapter(settings.adapter || adapter());
47
47
  const configuration = defineConfiguration(settings);
48
- instance = await PlatformBuilder.build(configuration.rootModule, configuration).bootstrap();
48
+ const builder = new PlatformBuilder(configuration);
49
+ instance = await builder.bootstrap();
49
50
  await instance.listen(!!listen);
50
51
  };
51
52
  }
@@ -12,7 +12,7 @@ export declare class PlatformBuilder<App = TsED.Application> {
12
12
  #private;
13
13
  protected startedAt: Date;
14
14
  protected current: Date;
15
- protected constructor(settings: Partial<TsED.Configuration>);
15
+ constructor(settings?: Partial<TsED.Configuration>);
16
16
  get name(): string;
17
17
  get rootModule(): any | undefined;
18
18
  get app(): PlatformApplication<App>;
@@ -43,15 +43,11 @@ export declare class PlatformBuilder<App = TsED.Application> {
43
43
  * @deprecated use injector() instead of this method.
44
44
  */
45
45
  get injector(): InjectorService;
46
- static create<App = TsED.Application>(settings: PlatformBuilderSettings<App>): PlatformBuilder<App>;
47
- static create<App = TsED.Application>(module: Type<any>, settings?: PlatformBuilderSettings<App>): PlatformBuilder<App>;
48
- static build<App = TsED.Application>(settings: PlatformBuilderSettings<App>): PlatformBuilder<App>;
49
- static build<App = TsED.Application>(module: Type<any>, settings?: PlatformBuilderSettings<App>): PlatformBuilder<App>;
46
+ static create<App = TsED.Application>(settings?: PlatformBuilderSettings<App>): PlatformBuilder<App>;
50
47
  /**
51
48
  * Bootstrap a server application
52
49
  */
53
- static bootstrap<App = TsED.Application>(settings: PlatformBuilderSettings<App>): Promise<PlatformBuilder<App>>;
54
- static bootstrap<App = TsED.Application>(module: Type<any>, settings?: PlatformBuilderSettings<App>): Promise<PlatformBuilder<App>>;
50
+ static bootstrap<App = TsED.Application>(settings?: PlatformBuilderSettings<App>): Promise<PlatformBuilder<App>>;
55
51
  callback(): (req: IncomingMessage, res: ServerResponse) => void;
56
52
  callback(req: IncomingMessage, res: ServerResponse): void;
57
53
  log(...data: any[]): any;
@@ -8,8 +8,8 @@ export declare class PlatformCustom extends FakeAdapter {
8
8
  new (): {};
9
9
  };
10
10
  }[];
11
- static create(module: Type<any>, settings?: Partial<TsED.Configuration>): PlatformBuilder<any>;
12
- static bootstrap(module: Type<any>, settings?: Partial<TsED.Configuration>): Promise<PlatformBuilder<any>>;
11
+ static create(module: Type<any>, settings?: Partial<TsED.Configuration>): PlatformBuilder<TsED.Application>;
12
+ static bootstrap(module: Type<any>, settings?: Partial<TsED.Configuration>): Promise<PlatformBuilder<TsED.Application>>;
13
13
  afterLoadRoutes(): Promise<any>;
14
14
  beforeLoadRoutes(): Promise<any>;
15
15
  useContext(): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/platform-http",
3
- "version": "8.38.0-beta.4",
3
+ "version": "8.38.0-beta.6",
4
4
  "description": "A TypeScript Framework on top of Express",
5
5
  "keywords": [
6
6
  "Controller",
@@ -70,22 +70,22 @@
70
70
  "test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
71
71
  },
72
72
  "dependencies": {
73
- "@tsed/core": "8.38.0-beta.4",
74
- "@tsed/di": "8.38.0-beta.4",
75
- "@tsed/exceptions": "8.38.0-beta.4",
76
- "@tsed/hooks": "8.38.0-beta.4",
77
- "@tsed/json-mapper": "8.38.0-beta.4",
73
+ "@tsed/core": "8.38.0-beta.6",
74
+ "@tsed/di": "8.38.0-beta.6",
75
+ "@tsed/exceptions": "8.38.0-beta.6",
76
+ "@tsed/hooks": "8.38.0-beta.6",
77
+ "@tsed/json-mapper": "8.38.0-beta.6",
78
78
  "@tsed/logger": "^8.0.0",
79
79
  "@tsed/logger-std": "^8.0.0",
80
- "@tsed/platform-accept-mimes": "8.38.0-beta.4",
81
- "@tsed/platform-exceptions": "8.38.0-beta.4",
82
- "@tsed/platform-middlewares": "8.38.0-beta.4",
83
- "@tsed/platform-multer": "8.38.0-beta.4",
84
- "@tsed/platform-params": "8.38.0-beta.4",
85
- "@tsed/platform-response-filter": "8.38.0-beta.4",
86
- "@tsed/platform-router": "8.38.0-beta.4",
87
- "@tsed/platform-views": "8.38.0-beta.4",
88
- "@tsed/schema": "8.38.0-beta.4",
80
+ "@tsed/platform-accept-mimes": "8.38.0-beta.6",
81
+ "@tsed/platform-exceptions": "8.38.0-beta.6",
82
+ "@tsed/platform-middlewares": "8.38.0-beta.6",
83
+ "@tsed/platform-multer": "8.38.0-beta.6",
84
+ "@tsed/platform-params": "8.38.0-beta.6",
85
+ "@tsed/platform-response-filter": "8.38.0-beta.6",
86
+ "@tsed/platform-router": "8.38.0-beta.6",
87
+ "@tsed/platform-views": "8.38.0-beta.6",
88
+ "@tsed/schema": "8.38.0-beta.6",
89
89
  "@types/json-schema": "7.0.15",
90
90
  "accepts": "^1.3.8",
91
91
  "encodeurl": "^2.0.0",
@@ -93,9 +93,9 @@
93
93
  "uuid": "14.0.0"
94
94
  },
95
95
  "devDependencies": {
96
- "@tsed/barrels": "8.38.0-beta.4",
97
- "@tsed/engines": "8.38.0-beta.4",
98
- "@tsed/typescript": "8.38.0-beta.4",
96
+ "@tsed/barrels": "8.38.0-beta.6",
97
+ "@tsed/engines": "8.38.0-beta.6",
98
+ "@tsed/typescript": "8.38.0-beta.6",
99
99
  "cross-env": "7.0.3",
100
100
  "typescript": "6.0.2",
101
101
  "vitest": "4.1.4"