@tsed/platform-koa 7.79.3 → 7.80.0
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.
- package/lib/cjs/utils/multer.js +1 -24
- package/lib/cjs/utils/multer.js.map +1 -1
- package/lib/esm/services/PlatformKoaHandler.js +1 -1
- package/lib/types-esm/components/PlatformKoa.d.ts +58 -0
- package/lib/types-esm/decorators/ctx.d.ts +19 -0
- package/lib/types-esm/decorators/state.d.ts +38 -0
- package/lib/types-esm/index.d.ts +13 -0
- package/lib/types-esm/interfaces/PlatformKoaSettings.d.ts +15 -0
- package/lib/types-esm/interfaces/interfaces.d.ts +15 -0
- package/lib/types-esm/middlewares/staticsMiddleware.d.ts +6 -0
- package/lib/types-esm/services/PlatformKoaHandler.d.ts +6 -0
- package/lib/types-esm/services/PlatformKoaRequest.d.ts +31 -0
- package/lib/types-esm/services/PlatformKoaResponse.d.ts +51 -0
- package/lib/types-esm/utils/multer.d.ts +4 -0
- package/package.json +25 -21
- package/vitest.config.mts +21 -0
- package/jest.config.js +0 -20
- package/lib/cjs/package.json +0 -3
- package/lib/esm/package.json +0 -3
- package/tsconfig.esm.json +0 -51
package/lib/cjs/utils/multer.js
CHANGED
|
@@ -1,32 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.getMulter = void 0;
|
|
27
4
|
const util_1 = require("util");
|
|
28
5
|
let multer;
|
|
29
|
-
|
|
6
|
+
import("multer").then(({ default: m }) => (multer = m));
|
|
30
7
|
/**
|
|
31
8
|
* @ignore
|
|
32
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multer.js","sourceRoot":"","sources":["../../../src/utils/multer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"multer.js","sourceRoot":"","sources":["../../../src/utils/multer.ts"],"names":[],"mappings":";;;AACA,+BAA+B;AAE/B,IAAI,MAAW,CAAC;AAChB,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,EAAC,OAAO,EAAE,CAAC,EAAC,EAAE,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;AAEtD;;GAEG;AACH,SAAS,mBAAmB,CAAC,UAAe;IAC1C,OAAO,KAAK,EAAE,OAAoB,EAAE,EAAE;QACpC,MAAM,GAAG,GAAQ,OAAO,CAAC,GAAG,CAAC;QAE7B,MAAM,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;QAEnC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE;YACjC,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;gBAChB,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBAChC,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACxB,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;aACrB;QACH,CAAC,CAAC;QAEF,IAAI,SAAS,IAAI,GAAG,EAAE;YACpB,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE;gBAChB,GAAG,CAAC,OAAO,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC;gBAChC,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC;aACrB;YAED,UAAU,CAAC,MAAM,CAAC,CAAC;YACnB,UAAU,CAAC,OAAO,CAAC,CAAC;SACrB;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,MAAW,EAAE,IAAY;IAC5C,uBAAuB;IACvB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO;IAE1B,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAExB,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,KAAK,CAAC,GAAG,IAAW;QAC1C,MAAM,UAAU,GAAQ,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtD,OAAO,mBAAmB,CAAC,IAAA,gBAAS,EAAC,UAAU,CAAC,CAAC,CAAC;IACpD,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,SAAS,CAAC,OAAY;IACpC,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE1B,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACtB,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACxB,WAAW,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACzB,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACvB,WAAW,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAEzB,OAAO,CAAC,CAAC;AACX,CAAC;AAVD,8BAUC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PlatformHandler } from "@tsed/common";
|
|
2
|
-
import "./PlatformKoaRequest
|
|
2
|
+
import "./PlatformKoaRequest";
|
|
3
3
|
export class PlatformKoaHandler extends PlatformHandler {
|
|
4
4
|
onRequest(handler, $ctx) {
|
|
5
5
|
if (!(($ctx.error instanceof Error && !$ctx.handlerMetadata.hasErrorParam) || ($ctx.handlerMetadata.hasErrorParam && !$ctx.error))) {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { PlatformAdapter, PlatformBuilder, PlatformHandler, PlatformMulter, PlatformMulterSettings, PlatformRequest, PlatformResponse, PlatformStaticsOptions } from "@tsed/common";
|
|
2
|
+
import { Type } from "@tsed/core";
|
|
3
|
+
import { PlatformHandlerMetadata, PlatformLayer } from "@tsed/platform-router";
|
|
4
|
+
import Koa, { Context, Next } from "koa";
|
|
5
|
+
import send from "koa-send";
|
|
6
|
+
import { PlatformKoaHandler } from "../services/PlatformKoaHandler.js";
|
|
7
|
+
import { PlatformKoaRequest } from "../services/PlatformKoaRequest.js";
|
|
8
|
+
import { PlatformKoaResponse } from "../services/PlatformKoaResponse.js";
|
|
9
|
+
declare global {
|
|
10
|
+
namespace TsED {
|
|
11
|
+
interface Application extends Koa {
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
namespace TsED {
|
|
15
|
+
interface StaticsOptions extends send.SendOptions {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @platform
|
|
21
|
+
* @koa
|
|
22
|
+
*/
|
|
23
|
+
export declare class PlatformKoa extends PlatformAdapter<Koa> {
|
|
24
|
+
static readonly NAME = "koa";
|
|
25
|
+
readonly providers: ({
|
|
26
|
+
provide: typeof PlatformResponse;
|
|
27
|
+
useClass: typeof PlatformKoaResponse;
|
|
28
|
+
} | {
|
|
29
|
+
provide: typeof PlatformRequest;
|
|
30
|
+
useClass: typeof PlatformKoaRequest;
|
|
31
|
+
} | {
|
|
32
|
+
provide: typeof PlatformHandler;
|
|
33
|
+
useClass: typeof PlatformKoaHandler;
|
|
34
|
+
})[];
|
|
35
|
+
/**
|
|
36
|
+
* Create new serverless application. In this mode, the component scan are disabled.
|
|
37
|
+
* @param module
|
|
38
|
+
* @param settings
|
|
39
|
+
*/
|
|
40
|
+
static create(module: Type<any>, settings?: Partial<TsED.Configuration>): PlatformBuilder<Koa<Koa.DefaultState, Koa.DefaultContext>>;
|
|
41
|
+
/**
|
|
42
|
+
* Bootstrap a server application
|
|
43
|
+
* @param module
|
|
44
|
+
* @param settings
|
|
45
|
+
*/
|
|
46
|
+
static bootstrap(module: Type<any>, settings?: Partial<TsED.Configuration>): Promise<PlatformBuilder<Koa<Koa.DefaultState, Koa.DefaultContext>>>;
|
|
47
|
+
onInit(): void;
|
|
48
|
+
mapLayers(layers: PlatformLayer[]): void;
|
|
49
|
+
mapHandler(handler: Function, metadata: PlatformHandlerMetadata): (koaContext: Koa.Context, next: Koa.Next) => Promise<any>;
|
|
50
|
+
useContext(): this;
|
|
51
|
+
createApp(): {
|
|
52
|
+
app: any;
|
|
53
|
+
callback(): any;
|
|
54
|
+
};
|
|
55
|
+
multipart(options: PlatformMulterSettings): PlatformMulter;
|
|
56
|
+
statics(endpoint: string, options: PlatformStaticsOptions): any;
|
|
57
|
+
bodyParser(type: "json" | "urlencoded" | "raw" | "text", additionalOptions?: any): any;
|
|
58
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Context } from "koa";
|
|
2
|
+
/**
|
|
3
|
+
* Return the original Koa context.
|
|
4
|
+
* @decorator
|
|
5
|
+
* @operation
|
|
6
|
+
* @input
|
|
7
|
+
* @koa
|
|
8
|
+
*/
|
|
9
|
+
export declare function KoaCtx(): ParameterDecorator;
|
|
10
|
+
/**
|
|
11
|
+
* Return the original Koa context.
|
|
12
|
+
* @decorator
|
|
13
|
+
* @operation
|
|
14
|
+
* @input
|
|
15
|
+
* @koa
|
|
16
|
+
*/
|
|
17
|
+
export declare function Ctx(): ParameterDecorator;
|
|
18
|
+
export type Ctx = Context;
|
|
19
|
+
export type KoaCtx = Context;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State return the value from koa.ctx.state object.
|
|
3
|
+
*
|
|
4
|
+
* #### Example
|
|
5
|
+
*
|
|
6
|
+
* ```typescript
|
|
7
|
+
* * @Middleware()
|
|
8
|
+
* class StateMiddleware {
|
|
9
|
+
* use(@State() state: any) {
|
|
10
|
+
* // set some on locals
|
|
11
|
+
* state.user = "user"
|
|
12
|
+
* }
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* @Controller('/')
|
|
16
|
+
* @UseBefore(StateMiddleware)
|
|
17
|
+
* class MyCtrl {
|
|
18
|
+
* @Get('/')
|
|
19
|
+
* @View('home.ejs') // will use locals and returned data to render the page
|
|
20
|
+
* get(@State('user') user: any) {
|
|
21
|
+
* console.log('user', user);
|
|
22
|
+
*
|
|
23
|
+
* return {
|
|
24
|
+
* description: 'Hello world'
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @param expression The path of the property to get.
|
|
31
|
+
* @decorator
|
|
32
|
+
* @operation
|
|
33
|
+
* @input
|
|
34
|
+
* @response
|
|
35
|
+
* @koa
|
|
36
|
+
*/
|
|
37
|
+
export declare function State(expression: string): ParameterDecorator;
|
|
38
|
+
export declare function State(): ParameterDecorator;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by @tsed/barrels.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./components/PlatformKoa.js";
|
|
5
|
+
export * from "./decorators/ctx.js";
|
|
6
|
+
export * from "./decorators/state.js";
|
|
7
|
+
export * from "./interfaces/interfaces.js";
|
|
8
|
+
export * from "./interfaces/PlatformKoaSettings.js";
|
|
9
|
+
export * from "./middlewares/staticsMiddleware.js";
|
|
10
|
+
export * from "./services/PlatformKoaHandler.js";
|
|
11
|
+
export * from "./services/PlatformKoaRequest.js";
|
|
12
|
+
export * from "./services/PlatformKoaResponse.js";
|
|
13
|
+
export * from "./utils/multer.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="koa__router" />
|
|
2
|
+
import type { RouterOptions } from "@koa/router";
|
|
3
|
+
import type { Middleware } from "koa";
|
|
4
|
+
import type { Options } from "koa-bodyparser";
|
|
5
|
+
export interface PlatformKoaSettings {
|
|
6
|
+
/**
|
|
7
|
+
* Koa router options
|
|
8
|
+
*/
|
|
9
|
+
router?: RouterOptions;
|
|
10
|
+
/**
|
|
11
|
+
* Body parser options
|
|
12
|
+
* @param opts
|
|
13
|
+
*/
|
|
14
|
+
bodyParser?: ((opts?: Options) => Middleware) | Options;
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import Koa from "koa";
|
|
2
|
+
import { PlatformKoaSettings } from "./PlatformKoaSettings.js";
|
|
3
|
+
export * from "./PlatformKoaSettings.js";
|
|
4
|
+
declare global {
|
|
5
|
+
namespace TsED {
|
|
6
|
+
interface Configuration {
|
|
7
|
+
/**
|
|
8
|
+
* Configuration related to Koa platform application.
|
|
9
|
+
*/
|
|
10
|
+
koa: PlatformKoaSettings;
|
|
11
|
+
}
|
|
12
|
+
interface NextFunction extends Koa.Next {
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PlatformContext, PlatformHandler, PlatformParamsCallback } from "@tsed/common";
|
|
2
|
+
import "./PlatformKoaRequest";
|
|
3
|
+
export declare class PlatformKoaHandler extends PlatformHandler {
|
|
4
|
+
onRequest(handler: PlatformParamsCallback, $ctx: PlatformContext): Promise<any>;
|
|
5
|
+
flush($ctx: PlatformContext): Promise<void>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import "@koa/router";
|
|
3
|
+
import { PlatformContext, PlatformRequest } from "@tsed/common";
|
|
4
|
+
import Koa from "koa";
|
|
5
|
+
declare module "koa" {
|
|
6
|
+
interface Request {
|
|
7
|
+
id: string;
|
|
8
|
+
$ctx: PlatformContext;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
declare global {
|
|
12
|
+
namespace TsED {
|
|
13
|
+
interface Request extends Koa.Request {
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @platform
|
|
19
|
+
* @koa
|
|
20
|
+
*/
|
|
21
|
+
export declare class PlatformKoaRequest extends PlatformRequest<Koa.Request> {
|
|
22
|
+
get ctx(): Koa.Context;
|
|
23
|
+
get protocol(): string;
|
|
24
|
+
get host(): string;
|
|
25
|
+
get secure(): boolean;
|
|
26
|
+
get cookies(): {
|
|
27
|
+
[p: string]: any;
|
|
28
|
+
};
|
|
29
|
+
get session(): any;
|
|
30
|
+
getReq(): import("http").IncomingMessage;
|
|
31
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { PlatformResponse } from "@tsed/common";
|
|
4
|
+
import { ServerResponse } from "http";
|
|
5
|
+
import Koa from "koa";
|
|
6
|
+
declare global {
|
|
7
|
+
namespace TsED {
|
|
8
|
+
interface Response extends Koa.Response {
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @platform
|
|
14
|
+
* @koa
|
|
15
|
+
*/
|
|
16
|
+
export declare class PlatformKoaResponse extends PlatformResponse<Koa.Response> {
|
|
17
|
+
get ctx(): Koa.Context;
|
|
18
|
+
get statusCode(): number;
|
|
19
|
+
get locals(): Koa.DefaultState;
|
|
20
|
+
/**
|
|
21
|
+
* Return the Node.js response object
|
|
22
|
+
*/
|
|
23
|
+
getRes(): ServerResponse;
|
|
24
|
+
hasStatus(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Sets the HTTP status for the response.
|
|
27
|
+
*
|
|
28
|
+
* @param status
|
|
29
|
+
*/
|
|
30
|
+
status(status: number): this;
|
|
31
|
+
/**
|
|
32
|
+
* Set `Content-Type` response header with `type` through `mime.lookup()`
|
|
33
|
+
* when it does not contain "/", or set the Content-Type to `type` otherwise.
|
|
34
|
+
*
|
|
35
|
+
* Examples:
|
|
36
|
+
*
|
|
37
|
+
* res.type('.html');
|
|
38
|
+
* res.type('html');
|
|
39
|
+
* res.type('json');
|
|
40
|
+
* res.type('application/json');
|
|
41
|
+
* res.type('png');
|
|
42
|
+
*/
|
|
43
|
+
contentType(contentType: string): this;
|
|
44
|
+
getHeaders(): import("http").OutgoingHttpHeaders;
|
|
45
|
+
stream(data: any): this;
|
|
46
|
+
getBody(): any;
|
|
47
|
+
cookie(name: string, value: string | null, opts?: TsED.SetCookieOpts): this;
|
|
48
|
+
protected json(data: any): this;
|
|
49
|
+
protected buffer(data: Buffer): this;
|
|
50
|
+
protected end(data?: string | Buffer): void;
|
|
51
|
+
}
|
package/package.json
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-koa",
|
|
3
|
-
"version": "7.79.3",
|
|
4
3
|
"description": "Koa package for Ts.ED framework",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"version": "7.80.0",
|
|
5
6
|
"source": "./src/index.ts",
|
|
6
7
|
"main": "./lib/cjs/index.js",
|
|
7
8
|
"module": "./lib/esm/index.js",
|
|
8
9
|
"typings": "./lib/types/index.d.ts",
|
|
9
10
|
"exports": {
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./lib/types/index.d.ts",
|
|
13
|
+
"import": "./lib/esm/index.js",
|
|
14
|
+
"default": "./lib/cjs/index.js"
|
|
15
|
+
}
|
|
14
16
|
},
|
|
15
17
|
"scripts": {
|
|
16
18
|
"build": "yarn barrels && yarn build:ts",
|
|
17
19
|
"barrels": "barrels",
|
|
18
20
|
"start": "ts-node test/app/index.ts",
|
|
19
|
-
"test": "
|
|
20
|
-
"build:ts": "tsc --build tsconfig.json
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"build:ts": "tsc --build tsconfig.json",
|
|
23
|
+
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
21
24
|
},
|
|
22
25
|
"keywords": [
|
|
23
26
|
"Koa",
|
|
@@ -50,12 +53,12 @@
|
|
|
50
53
|
"repository": "https://github.com/tsedio/tsed",
|
|
51
54
|
"devDependencies": {
|
|
52
55
|
"@koa/cors": "5.0.0",
|
|
53
|
-
"@tsed/barrels": "7.
|
|
54
|
-
"@tsed/common": "7.
|
|
55
|
-
"@tsed/core": "7.
|
|
56
|
-
"@tsed/di": "7.
|
|
57
|
-
"@tsed/platform-test-sdk": "7.
|
|
58
|
-
"@tsed/typescript": "7.
|
|
56
|
+
"@tsed/barrels": "7.80.0",
|
|
57
|
+
"@tsed/common": "7.80.0",
|
|
58
|
+
"@tsed/core": "7.80.0",
|
|
59
|
+
"@tsed/di": "7.80.0",
|
|
60
|
+
"@tsed/platform-test-sdk": "7.80.0",
|
|
61
|
+
"@tsed/typescript": "7.80.0",
|
|
59
62
|
"@types/koa": "2.15.0",
|
|
60
63
|
"@types/koa-bodyparser": "4.3.12",
|
|
61
64
|
"@types/koa-compose": "3.2.8",
|
|
@@ -66,13 +69,14 @@
|
|
|
66
69
|
"@types/koa-session": "6.4.5",
|
|
67
70
|
"@types/koa__router": "12.0.4",
|
|
68
71
|
"eslint": "^8.57.0",
|
|
69
|
-
"jest": "^29.7.0",
|
|
70
72
|
"koa": "2.15.3",
|
|
71
73
|
"koa-bodyparser": "4.4.1",
|
|
72
74
|
"koa-compress": "5.1.1",
|
|
73
75
|
"koa-override": "3.0.0",
|
|
74
76
|
"koa-qs": "^3.0.0",
|
|
75
|
-
"koa-session": "6.4.0"
|
|
77
|
+
"koa-session": "6.4.0",
|
|
78
|
+
"typescript": "4.9.5",
|
|
79
|
+
"vitest": "2.0.4"
|
|
76
80
|
},
|
|
77
81
|
"dependencies": {
|
|
78
82
|
"@koa/router": "^12.0.1",
|
|
@@ -83,13 +87,13 @@
|
|
|
83
87
|
"tslib": "2.6.1"
|
|
84
88
|
},
|
|
85
89
|
"peerDependencies": {
|
|
86
|
-
"@tsed/common": "7.
|
|
87
|
-
"@tsed/core": "7.
|
|
88
|
-
"@tsed/di": "7.
|
|
89
|
-
"@tsed/json-mapper": "7.
|
|
90
|
+
"@tsed/common": "7.80.0",
|
|
91
|
+
"@tsed/core": "7.80.0",
|
|
92
|
+
"@tsed/di": "7.80.0",
|
|
93
|
+
"@tsed/json-mapper": "7.80.0",
|
|
90
94
|
"@tsed/logger": ">=6.7.5",
|
|
91
|
-
"@tsed/openspec": "7.
|
|
92
|
-
"@tsed/schema": "7.
|
|
95
|
+
"@tsed/openspec": "7.80.0",
|
|
96
|
+
"@tsed/schema": "7.80.0",
|
|
93
97
|
"koa": ">=2.13.0",
|
|
94
98
|
"koa-bodyparser": ">=4.3.0",
|
|
95
99
|
"koa-compress": ">=5.0.1",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import {presets} from "@tsed/vitest/presets";
|
|
3
|
+
import {defineConfig} from "vitest/config";
|
|
4
|
+
|
|
5
|
+
export default defineConfig(
|
|
6
|
+
{
|
|
7
|
+
...presets,
|
|
8
|
+
test: {
|
|
9
|
+
...presets.test,
|
|
10
|
+
coverage: {
|
|
11
|
+
...presets.test.coverage,
|
|
12
|
+
thresholds: {
|
|
13
|
+
statements: 0,
|
|
14
|
+
branches: 0,
|
|
15
|
+
functions: 0,
|
|
16
|
+
lines: 0
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
);
|
package/jest.config.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
// For a detailed explanation regarding each configuration property, visit:
|
|
2
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
3
|
-
const config = require("@tsed/jest-config");
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
...config,
|
|
7
|
-
roots: ["<rootDir>/src", "<rootDir>/test"],
|
|
8
|
-
moduleNameMapper: {
|
|
9
|
-
...config.moduleNameMapper,
|
|
10
|
-
"^@tsed/platform-koa$": "<rootDir>/src/index.ts"
|
|
11
|
-
},
|
|
12
|
-
coverageThreshold: {
|
|
13
|
-
global: {
|
|
14
|
-
statements: 99.49,
|
|
15
|
-
branches: 95.87,
|
|
16
|
-
functions: 100,
|
|
17
|
-
lines: 99.49
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
};
|
package/lib/cjs/package.json
DELETED
package/lib/esm/package.json
DELETED
package/tsconfig.esm.json
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@tsed/typescript/tsconfig.node.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"baseUrl": ".",
|
|
5
|
-
"module": "ES2020",
|
|
6
|
-
"rootDir": "src",
|
|
7
|
-
"outDir": "./lib/esm",
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"declarationDir": "./lib/types",
|
|
10
|
-
"composite": true,
|
|
11
|
-
"noEmit": false
|
|
12
|
-
},
|
|
13
|
-
"include": ["src", "src/**/*.json"],
|
|
14
|
-
"exclude": [
|
|
15
|
-
"node_modules",
|
|
16
|
-
"test",
|
|
17
|
-
"lib",
|
|
18
|
-
"benchmark",
|
|
19
|
-
"coverage",
|
|
20
|
-
"spec",
|
|
21
|
-
"**/*.benchmark.ts",
|
|
22
|
-
"**/*.spec.ts",
|
|
23
|
-
"keys",
|
|
24
|
-
"jest.config.js",
|
|
25
|
-
"**/__mock__/**",
|
|
26
|
-
"webpack.config.js"
|
|
27
|
-
],
|
|
28
|
-
"references": [
|
|
29
|
-
{
|
|
30
|
-
"path": "../common"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"path": "../../core"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"path": "../../di"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"path": "../../specs/json-mapper"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"path": "../../specs/openspec"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"path": "../../specs/schema"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"path": "../platform-test-sdk"
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
}
|