@tsed/platform-koa 8.0.0-rc.6 → 8.0.1
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.
|
@@ -2,7 +2,7 @@ import KoaRouter from "@koa/router";
|
|
|
2
2
|
import { catchAsyncError, isFunction } from "@tsed/core";
|
|
3
3
|
import { constant, inject, runInContext } from "@tsed/di";
|
|
4
4
|
import { PlatformExceptions } from "@tsed/platform-exceptions";
|
|
5
|
-
import { adapter, application, createContext, PlatformAdapter, PlatformBuilder, PlatformHandler, PlatformRequest, PlatformResponse } from "@tsed/platform-http";
|
|
5
|
+
import { adapter, application, createContext, Platform, PlatformAdapter, PlatformApplication, PlatformBuilder, PlatformHandler, PlatformRequest, PlatformResponse } from "@tsed/platform-http";
|
|
6
6
|
import { PlatformHandlerType } from "@tsed/platform-router";
|
|
7
7
|
import Koa from "koa";
|
|
8
8
|
import koaBodyParser from "koa-bodyparser";
|
|
@@ -31,22 +31,24 @@ KoaRouter.prototype.match = function match(...args) {
|
|
|
31
31
|
export class PlatformKoa extends PlatformAdapter {
|
|
32
32
|
constructor() {
|
|
33
33
|
super(...arguments);
|
|
34
|
+
this.NAME = "koa";
|
|
34
35
|
this.providers = [
|
|
35
36
|
{
|
|
36
|
-
|
|
37
|
+
token: PlatformResponse,
|
|
37
38
|
useClass: PlatformKoaResponse
|
|
38
39
|
},
|
|
39
40
|
{
|
|
40
|
-
|
|
41
|
+
token: PlatformRequest,
|
|
41
42
|
useClass: PlatformKoaRequest
|
|
42
43
|
},
|
|
43
44
|
{
|
|
44
|
-
|
|
45
|
+
token: PlatformHandler,
|
|
45
46
|
useClass: PlatformKoaHandler
|
|
46
|
-
}
|
|
47
|
+
},
|
|
48
|
+
{ token: PlatformApplication },
|
|
49
|
+
{ token: Platform }
|
|
47
50
|
];
|
|
48
51
|
}
|
|
49
|
-
static { this.NAME = "koa"; }
|
|
50
52
|
/**
|
|
51
53
|
* Create new serverless application. In this mode, the component scan are disab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,EAAE,CAAC;YACxB,CAAC;SACF,CAAC;IACJ,CAAC;IAED,SAAS,CAAC,OAA+B;QACvC,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,CAAC,QAAgB,EAAE,OAA+B;QACvD,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAED,UAAU,CAAC,CAAyC,EAAE,oBAAyB,EAAE;QAC/E,MAAM,IAAI,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACxC,IAAI,MAAM,GAAQ,aAAa,CAAC;QAEhC,IAAI,OAAO,GAAY,EAAE,CAAC;QAE1B,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,MAAM,GAAG,IAAI,CAAC;YACd,OAAO,GAAG,EAAE,CAAC;QACf,CAAC;QAED,OAAO,MAAM,CAAC,EAAC,GAAG,OAAO,EAAE,GAAG,iBAAiB,EAAC,CAAC,CAAC;IACpD,CAAC;CACF;AAED,OAAO,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
import { Type } from "@tsed/core";
|
|
4
|
-
import { PlatformAdapter, PlatformBuilder, PlatformHandler, PlatformMulter, PlatformMulterSettings, PlatformRequest, PlatformResponse, PlatformStaticsOptions } from "@tsed/platform-http";
|
|
4
|
+
import { Platform, PlatformAdapter, PlatformApplication, PlatformBuilder, PlatformHandler, PlatformMulter, PlatformMulterSettings, PlatformRequest, PlatformResponse, PlatformStaticsOptions } from "@tsed/platform-http";
|
|
5
5
|
import { PlatformHandlerMetadata, PlatformLayer } from "@tsed/platform-router";
|
|
6
6
|
import Koa, { Context, Next } from "koa";
|
|
7
7
|
import send from "koa-send";
|
|
@@ -23,29 +23,35 @@ declare global {
|
|
|
23
23
|
* @koa
|
|
24
24
|
*/
|
|
25
25
|
export declare class PlatformKoa extends PlatformAdapter<Koa> {
|
|
26
|
-
|
|
26
|
+
readonly NAME = "koa";
|
|
27
27
|
readonly providers: ({
|
|
28
|
-
|
|
28
|
+
token: typeof PlatformResponse;
|
|
29
29
|
useClass: typeof PlatformKoaResponse;
|
|
30
30
|
} | {
|
|
31
|
-
|
|
31
|
+
token: typeof PlatformRequest;
|
|
32
32
|
useClass: typeof PlatformKoaRequest;
|
|
33
33
|
} | {
|
|
34
|
-
|
|
34
|
+
token: typeof PlatformHandler;
|
|
35
35
|
useClass: typeof PlatformKoaHandler;
|
|
36
|
+
} | {
|
|
37
|
+
token: typeof PlatformApplication;
|
|
38
|
+
useClass?: undefined;
|
|
39
|
+
} | {
|
|
40
|
+
token: typeof Platform;
|
|
41
|
+
useClass?: undefined;
|
|
36
42
|
})[];
|
|
37
43
|
/**
|
|
38
44
|
* Create new serverless application. In this mode, the component scan are disabled.
|
|
39
45
|
* @param module
|
|
40
46
|
* @param settings
|
|
41
47
|
*/
|
|
42
|
-
static create(module: Type<any>, settings?: Partial<TsED.Configuration>): PlatformBuilder<
|
|
48
|
+
static create(module: Type<any>, settings?: Partial<TsED.Configuration>): PlatformBuilder<TsED.Application>;
|
|
43
49
|
/**
|
|
44
50
|
* Bootstrap a server application
|
|
45
51
|
* @param module
|
|
46
52
|
* @param settings
|
|
47
53
|
*/
|
|
48
|
-
static bootstrap(module: Type<any>, settings?: Partial<TsED.Configuration>): Promise<PlatformBuilder<
|
|
54
|
+
static bootstrap(module: Type<any>, settings?: Partial<TsED.Configuration>): Promise<PlatformBuilder<TsED.Application>>;
|
|
49
55
|
onInit(): void;
|
|
50
56
|
mapLayers(layers: PlatformLayer[]): void;
|
|
51
57
|
mapHandler(handler: Function, metadata: PlatformHandlerMetadata): (koaContext: Koa.Context, next: Koa.Next) => Promise<any>;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tsed/platform-koa",
|
|
3
3
|
"description": "Koa package for Ts.ED framework",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "8.0.
|
|
5
|
+
"version": "8.0.1",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
7
|
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"repository": "https://github.com/tsedio/tsed",
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@koa/cors": "5.0.0",
|
|
56
|
-
"@tsed/barrels": "8.0.
|
|
57
|
-
"@tsed/core": "8.0.
|
|
58
|
-
"@tsed/di": "8.0.
|
|
59
|
-
"@tsed/platform-http": "8.0.
|
|
60
|
-
"@tsed/platform-test-sdk": "8.0.
|
|
61
|
-
"@tsed/typescript": "8.0.
|
|
56
|
+
"@tsed/barrels": "8.0.1",
|
|
57
|
+
"@tsed/core": "8.0.1",
|
|
58
|
+
"@tsed/di": "8.0.1",
|
|
59
|
+
"@tsed/platform-http": "8.0.1",
|
|
60
|
+
"@tsed/platform-test-sdk": "8.0.1",
|
|
61
|
+
"@tsed/typescript": "8.0.1",
|
|
62
62
|
"@types/koa": "2.15.0",
|
|
63
63
|
"@types/koa-bodyparser": "4.3.12",
|
|
64
64
|
"@types/koa-compose": "3.2.8",
|
|
@@ -86,13 +86,13 @@
|
|
|
86
86
|
"tslib": "2.7.0"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
-
"@tsed/core": "8.0.
|
|
90
|
-
"@tsed/di": "8.0.
|
|
91
|
-
"@tsed/json-mapper": "8.0.
|
|
89
|
+
"@tsed/core": "8.0.1",
|
|
90
|
+
"@tsed/di": "8.0.1",
|
|
91
|
+
"@tsed/json-mapper": "8.0.1",
|
|
92
92
|
"@tsed/logger": ">=6.7.5",
|
|
93
|
-
"@tsed/openspec": "8.0.
|
|
94
|
-
"@tsed/platform-http": "8.0.
|
|
95
|
-
"@tsed/schema": "8.0.
|
|
93
|
+
"@tsed/openspec": "8.0.1",
|
|
94
|
+
"@tsed/platform-http": "8.0.1",
|
|
95
|
+
"@tsed/schema": "8.0.1",
|
|
96
96
|
"cross-env": "7.0.3",
|
|
97
97
|
"koa": ">=2.13.0",
|
|
98
98
|
"koa-bodyparser": ">=4.3.0",
|
|
@@ -127,8 +127,5 @@
|
|
|
127
127
|
"multer": {
|
|
128
128
|
"optional": false
|
|
129
129
|
}
|
|
130
|
-
},
|
|
131
|
-
"publishConfig": {
|
|
132
|
-
"tag": "rc"
|
|
133
130
|
}
|
|
134
131
|
}
|