@tsed/platform-koa 6.95.6 → 6.95.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/platform-koa",
3
- "version": "6.95.6",
3
+ "version": "6.95.10",
4
4
  "description": "Koa package for Ts.ED framework",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -49,10 +49,10 @@
49
49
  "repository": "https://github.com/tsedio/tsed",
50
50
  "devDependencies": {
51
51
  "@koa/cors": "3.1.0",
52
- "@tsed/common": "6.95.6",
53
- "@tsed/core": "6.95.6",
54
- "@tsed/di": "6.95.6",
55
- "@tsed/platform-test-utils": "6.95.6",
52
+ "@tsed/common": "6.95.10",
53
+ "@tsed/core": "6.95.10",
54
+ "@tsed/di": "6.95.10",
55
+ "@tsed/platform-test-utils": "6.95.10",
56
56
  "@types/koa": "2.11.3",
57
57
  "@types/koa-bodyparser": "4.3.0",
58
58
  "@types/koa-compose": "3.2.5",
@@ -77,13 +77,13 @@
77
77
  "tslib": "2.2.0"
78
78
  },
79
79
  "peerDependencies": {
80
- "@tsed/common": "^6.95.6",
81
- "@tsed/core": "^6.95.6",
82
- "@tsed/di": "^6.95.6",
83
- "@tsed/json-mapper": "^6.95.6",
80
+ "@tsed/common": "^6.95.10",
81
+ "@tsed/core": "^6.95.10",
82
+ "@tsed/di": "^6.95.10",
83
+ "@tsed/json-mapper": "^6.95.10",
84
84
  "@tsed/logger": ">=6.0.0",
85
- "@tsed/openspec": "^6.95.6",
86
- "@tsed/schema": "^6.95.6",
85
+ "@tsed/openspec": "^6.95.10",
86
+ "@tsed/schema": "^6.95.10",
87
87
  "koa": ">=2.13.0",
88
88
  "koa-bodyparser": ">=4.3.0",
89
89
  "koa-compress": ">=5.0.1",
@@ -1,45 +0,0 @@
1
- /// <reference types="koa__router" />
2
- import KoaRouter from "@koa/router";
3
- import { PlatformAdapter, PlatformApplication, PlatformBuilder, PlatformHandler, PlatformRequest, PlatformResponse, PlatformRouter } from "@tsed/common";
4
- import { Type } from "@tsed/core";
5
- import Koa from "koa";
6
- import { PlatformKoaApplication, PlatformKoaHandler, PlatformKoaRequest, PlatformKoaResponse, PlatformKoaRouter } from "../services";
7
- /**
8
- * @platform
9
- * @koa
10
- */
11
- export declare class PlatformKoa implements PlatformAdapter<Koa, KoaRouter> {
12
- private platform;
13
- readonly providers: ({
14
- provide: typeof PlatformResponse;
15
- useClass: typeof PlatformKoaResponse;
16
- } | {
17
- provide: typeof PlatformRequest;
18
- useClass: typeof PlatformKoaRequest;
19
- } | {
20
- provide: typeof PlatformHandler;
21
- useClass: typeof PlatformKoaHandler;
22
- } | {
23
- provide: typeof PlatformRouter;
24
- useClass: typeof PlatformKoaRouter;
25
- } | {
26
- provide: typeof PlatformApplication;
27
- useClass: typeof PlatformKoaApplication;
28
- })[];
29
- constructor(platform: PlatformBuilder<Koa, KoaRouter>);
30
- /**
31
- * Create new serverless application. In this mode, the component scan are disabled.
32
- * @param module
33
- * @param settings
34
- */
35
- static create(module: Type<any>, settings?: Partial<TsED.Configuration>): PlatformBuilder<Koa<Koa.DefaultState, Koa.DefaultContext>, KoaRouter<any, {}>>;
36
- /**
37
- * Bootstrap a server application
38
- * @param module
39
- * @param settings
40
- */
41
- static bootstrap(module: Type<any>, settings?: Partial<TsED.Configuration>): Promise<PlatformBuilder<Koa<Koa.DefaultState, Koa.DefaultContext>, KoaRouter<any, {}>>>;
42
- onInit(): void;
43
- useRouter(): this;
44
- useContext(): this;
45
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * Specify the behavior of the router controller.
3
- *
4
- * ```typescript
5
- * @Controller("/")
6
- * @CaseSensitive(true)
7
- * class MyCtrl {
8
- *
9
- * }
10
- * ```
11
- *
12
- * Property | Description | Default
13
- * ---|---|---
14
- * CaseSensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.
15
- * Strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.
16
- *
17
- * @returns {Function}
18
- * @decorator
19
- * @koa
20
- * @param sensitive
21
- */
22
- export declare function CaseSensitive(sensitive: boolean): Function;
@@ -1,19 +0,0 @@
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 declare type Ctx = Context;
19
- export declare type KoaCtx = Context;
@@ -1,5 +0,0 @@
1
- export * from "./routerSettings";
2
- export * from "./caseSensitive";
3
- export * from "./strict";
4
- export * from "./state";
5
- export * from "./ctx";
@@ -1,24 +0,0 @@
1
- /// <reference types="koa__router" />
2
- import { RouterOptions } from "@koa/router";
3
- /**
4
- * Specify the behavior of the router controller.
5
- *
6
- * ```typescript
7
- * @Controller("/")
8
- * @RouterSettings({sensitive: true})
9
- * class MyCtrl {
10
- *
11
- * }
12
- * ```
13
- *
14
- * Property | Description | Default
15
- * ---|---|---
16
- * sensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.
17
- * strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.
18
- *
19
- * @returns {(target:any)=>void}
20
- * @decorator
21
- * @param routerOptions
22
- * @koa
23
- */
24
- export declare function RouterSettings(routerOptions: RouterOptions): Function;
@@ -1,38 +0,0 @@
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;
@@ -1,23 +0,0 @@
1
- /**
2
- * Specify the behavior of the router controller.
3
- *
4
- * ```typescript
5
- * @Controller("/")
6
- * @Strict(true)
7
- * class MyCtrl {
8
- *
9
- * }
10
- * ```
11
- *
12
- * Property | Description | Default
13
- * ---|---|---
14
- * CaseSensitive | Enable case sensitivity. | Disabled by default, treating “/Foo” and “/foo” as the same.
15
- * MergeParams | Preserve the req.params values from the parent router. If the parent and the child have conflicting param names, the child’s value take precedence. | false
16
- * Strict | Enable strict routing. | Disabled by default, “/foo” and “/foo/” are treated the same by the router.
17
- *
18
- * @param strict
19
- * @returns {Function}
20
- * @decorator
21
- * @koa
22
- */
23
- export declare function Strict(strict: boolean): Function;
@@ -1,4 +0,0 @@
1
- export * from "./interfaces";
2
- export * from "./decorators";
3
- export * from "./services";
4
- export * from "./components/PlatformKoa";
@@ -1,8 +0,0 @@
1
- /// <reference types="koa__router" />
2
- import { RouterOptions } from "@koa/router";
3
- export interface PlatformKoaSettings {
4
- /**
5
- * Global configuration for the Express.Router. See express [documentation](http://expressjs.com/en/api.html#express.router).
6
- */
7
- router: RouterOptions;
8
- }
@@ -1,15 +0,0 @@
1
- import Koa from "koa";
2
- import { PlatformKoaSettings } from "./PlatformKoaSettings";
3
- export * from "./PlatformKoaSettings";
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
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * @ignore
3
- * @param ctx
4
- * @param next
5
- */
6
- export declare function resourceNotFoundMiddleware(ctx: any, next: any): Promise<void>;
@@ -1,6 +0,0 @@
1
- import { PlatformStaticsOptions } from "@tsed/common";
2
- /**
3
- * @ignore
4
- * @param options
5
- */
6
- export declare function staticsMiddleware(options: PlatformStaticsOptions): any;
@@ -1,22 +0,0 @@
1
- /// <reference types="koa__router" />
2
- import KoaRouter from "@koa/router";
3
- import { Configuration, PlatformApplication, PlatformHandler } from "@tsed/common";
4
- import Koa from "koa";
5
- import { PlatformKoaRouter } from "./PlatformKoaRouter";
6
- declare global {
7
- namespace TsED {
8
- interface Application extends Koa {
9
- }
10
- }
11
- }
12
- /**
13
- * @platform
14
- * @express
15
- */
16
- export declare class PlatformKoaApplication extends PlatformKoaRouter implements PlatformApplication<Koa, KoaRouter> {
17
- app: Koa;
18
- rawApp: Koa;
19
- constructor(platformHandler: PlatformHandler, configuration: Configuration);
20
- getApp(): Koa;
21
- callback(): any;
22
- }
@@ -1,10 +0,0 @@
1
- import { HandlerMetadata, OnRequestOptions, PlatformContext, PlatformHandler } from "@tsed/common";
2
- import "./PlatformKoaRequest";
3
- export declare class PlatformKoaHandler extends PlatformHandler {
4
- flush(data: any, ctx: PlatformContext): Promise<void>;
5
- protected createRawHandler(metadata: HandlerMetadata): any;
6
- protected onRequest(requestOptions: OnRequestOptions): Promise<any>;
7
- protected onError(error: unknown, requestOptions: OnRequestOptions): any;
8
- protected onCtxRequest(requestOptions: OnRequestOptions): Promise<any>;
9
- protected throwError(error: any, $ctx: PlatformContext): void;
10
- }
@@ -1,34 +0,0 @@
1
- /// <reference types="node" />
2
- import "@koa/router";
3
- import { IncomingEvent, PlatformContext, PlatformRequest } from "@tsed/common";
4
- import { IncomingMessage } from "http";
5
- import Koa from "koa";
6
- declare module "koa" {
7
- interface Request {
8
- id: string;
9
- $ctx: PlatformContext;
10
- }
11
- }
12
- declare global {
13
- namespace TsED {
14
- interface Request extends Koa.Request {
15
- }
16
- }
17
- }
18
- /**
19
- * @platform
20
- * @koa
21
- */
22
- export declare class PlatformKoaRequest extends PlatformRequest<Koa.Request> {
23
- #private;
24
- constructor(event: IncomingEvent, $ctx: PlatformContext);
25
- get protocol(): string;
26
- get host(): string;
27
- get secure(): boolean;
28
- get cookies(): {
29
- [p: string]: any;
30
- };
31
- get session(): any;
32
- getReq(): IncomingMessage;
33
- destroy(): void;
34
- }
@@ -1,57 +0,0 @@
1
- /// <reference types="node" />
2
- import { IncomingEvent, PlatformContext, PlatformResponse } from "@tsed/common";
3
- import { ServerResponse } from "http";
4
- import Koa from "koa";
5
- declare global {
6
- namespace TsED {
7
- interface Response extends Koa.Response {
8
- }
9
- }
10
- }
11
- /**
12
- * @platform
13
- * @koa
14
- */
15
- export declare class PlatformKoaResponse extends PlatformResponse<Koa.Response> {
16
- #private;
17
- constructor(event: IncomingEvent, $ctx: PlatformContext);
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(): any;
45
- /**
46
- * Send any data to your consumer.
47
- *
48
- * This method accept a ReadableStream, a plain object, boolean, string, number, null and undefined data.
49
- * It choose the better way to send the data.
50
- *
51
- * @param data
52
- */
53
- body(data: any): this;
54
- getBody(): any;
55
- redirect(status: number, url: string): this;
56
- location(location: string): this;
57
- }
@@ -1,22 +0,0 @@
1
- /// <reference types="koa__router" />
2
- import KoaRouter from "@koa/router";
3
- import { RouterOptions as KoaRouterOptions } from "@koa/router";
4
- import { PlatformHandler, PlatformMulter, PlatformMulterSettings, PlatformRouter, PlatformStaticsOptions } from "@tsed/common";
5
- import { Configuration } from "@tsed/di";
6
- import send from "koa-send";
7
- declare global {
8
- namespace TsED {
9
- interface Router extends KoaRouter {
10
- }
11
- interface RouterOptions extends KoaRouterOptions {
12
- }
13
- interface StaticsOptions extends send.SendOptions {
14
- }
15
- }
16
- }
17
- export declare class PlatformKoaRouter extends PlatformRouter<KoaRouter> {
18
- constructor(platform: PlatformHandler, configuration: Configuration, routerOptions: any);
19
- callback(): KoaRouter.Middleware<any, {}>[];
20
- multer(options: PlatformMulterSettings): PlatformMulter;
21
- statics(path: string, options: PlatformStaticsOptions): this;
22
- }
@@ -1,5 +0,0 @@
1
- export * from "./PlatformKoaApplication";
2
- export * from "./PlatformKoaHandler";
3
- export * from "./PlatformKoaRouter";
4
- export * from "./PlatformKoaRequest";
5
- export * from "./PlatformKoaResponse";
@@ -1,4 +0,0 @@
1
- /**
2
- * @ignore
3
- */
4
- export declare function getMulter(options: any): any;