@celljs/mvc 3.7.8 → 3.9.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/esm/common/constants.d.ts +1 -0
- package/esm/common/constants.js +2 -0
- package/esm/common/constants.js.map +1 -0
- package/esm/common/index.d.ts +1 -0
- package/esm/common/index.js +2 -0
- package/esm/common/index.js.map +1 -0
- package/esm/node/annotation/body.d.ts +6 -0
- package/esm/node/annotation/body.js +15 -0
- package/esm/node/annotation/body.js.map +1 -0
- package/esm/node/annotation/catch.d.ts +9 -0
- package/esm/node/annotation/catch.js +18 -0
- package/esm/node/annotation/catch.js.map +1 -0
- package/esm/node/annotation/controller.d.ts +14 -0
- package/esm/node/annotation/controller.js +29 -0
- package/esm/node/annotation/controller.js.map +1 -0
- package/esm/node/annotation/cookie.d.ts +15 -0
- package/esm/node/annotation/cookie.js +24 -0
- package/esm/node/annotation/cookie.js.map +1 -0
- package/esm/node/annotation/file.d.ts +2 -0
- package/esm/node/annotation/file.js +6 -0
- package/esm/node/annotation/file.js.map +1 -0
- package/esm/node/annotation/header.d.ts +15 -0
- package/esm/node/annotation/header.js +24 -0
- package/esm/node/annotation/header.js.map +1 -0
- package/esm/node/annotation/html.d.ts +2 -0
- package/esm/node/annotation/html.js +6 -0
- package/esm/node/annotation/html.js.map +1 -0
- package/esm/node/annotation/index.d.ts +16 -0
- package/esm/node/annotation/index.js +17 -0
- package/esm/node/annotation/index.js.map +1 -0
- package/esm/node/annotation/json.d.ts +2 -0
- package/esm/node/annotation/json.js +6 -0
- package/esm/node/annotation/json.js.map +1 -0
- package/esm/node/annotation/method.d.ts +23 -0
- package/esm/node/annotation/method.js +42 -0
- package/esm/node/annotation/method.js.map +1 -0
- package/esm/node/annotation/param.d.ts +6 -0
- package/esm/node/annotation/param.js +15 -0
- package/esm/node/annotation/param.js.map +1 -0
- package/esm/node/annotation/query.d.ts +6 -0
- package/esm/node/annotation/query.js +15 -0
- package/esm/node/annotation/query.js.map +1 -0
- package/esm/node/annotation/req.d.ts +5 -0
- package/esm/node/annotation/req.js +13 -0
- package/esm/node/annotation/req.js.map +1 -0
- package/esm/node/annotation/res.d.ts +5 -0
- package/esm/node/annotation/res.js +13 -0
- package/esm/node/annotation/res.js.map +1 -0
- package/esm/node/annotation/session.d.ts +15 -0
- package/esm/node/annotation/session.js +24 -0
- package/esm/node/annotation/session.js.map +1 -0
- package/esm/node/annotation/text.d.ts +2 -0
- package/esm/node/annotation/text.js +6 -0
- package/esm/node/annotation/text.js.map +1 -0
- package/esm/node/annotation/view.d.ts +12 -0
- package/esm/node/annotation/view.js +10 -0
- package/esm/node/annotation/view.js.map +1 -0
- package/esm/node/constants.d.ts +17 -0
- package/esm/node/constants.js +18 -0
- package/esm/node/constants.js.map +1 -0
- package/esm/node/error/error-handler.d.ts +9 -0
- package/esm/node/error/error-handler.js +39 -0
- package/esm/node/error/error-handler.js.map +1 -0
- package/esm/node/error/index.d.ts +1 -0
- package/esm/node/error/index.js +2 -0
- package/esm/node/error/index.js.map +1 -0
- package/esm/node/handler/handler-adapter.d.ts +21 -0
- package/esm/node/handler/handler-adapter.js +119 -0
- package/esm/node/handler/handler-adapter.js.map +1 -0
- package/esm/node/handler/handler-protocol.d.ts +37 -0
- package/esm/node/handler/handler-protocol.js +4 -0
- package/esm/node/handler/handler-protocol.js.map +1 -0
- package/esm/node/handler/index.d.ts +5 -0
- package/esm/node/handler/index.js +6 -0
- package/esm/node/handler/index.js.map +1 -0
- package/esm/node/handler/route-builder.d.ts +28 -0
- package/esm/node/handler/route-builder.js +122 -0
- package/esm/node/handler/route-builder.js.map +1 -0
- package/esm/node/handler/route-metadata-matcher.d.ts +8 -0
- package/esm/node/handler/route-metadata-matcher.js +57 -0
- package/esm/node/handler/route-metadata-matcher.js.map +1 -0
- package/esm/node/handler/route-provider.d.ts +10 -0
- package/esm/node/handler/route-provider.js +41 -0
- package/esm/node/handler/route-provider.js.map +1 -0
- package/esm/node/index.d.ts +5 -0
- package/esm/node/index.js +6 -0
- package/esm/node/index.js.map +1 -0
- package/esm/node/module.d.ts +3 -0
- package/esm/node/module.js +4 -0
- package/esm/node/module.js.map +1 -0
- package/esm/node/resolver/index.d.ts +7 -0
- package/esm/node/resolver/index.js +8 -0
- package/esm/node/resolver/index.js.map +1 -0
- package/esm/node/resolver/method-args-resolver-provider.d.ts +7 -0
- package/esm/node/resolver/method-args-resolver-provider.js +32 -0
- package/esm/node/resolver/method-args-resolver-provider.js.map +1 -0
- package/esm/node/resolver/method-args-resolver.d.ts +34 -0
- package/esm/node/resolver/method-args-resolver.js +149 -0
- package/esm/node/resolver/method-args-resolver.js.map +1 -0
- package/esm/node/resolver/resolver-protocol.d.ts +14 -0
- package/esm/node/resolver/resolver-protocol.js +4 -0
- package/esm/node/resolver/resolver-protocol.js.map +1 -0
- package/esm/node/resolver/response-resolver-provider.d.ts +7 -0
- package/esm/node/resolver/response-resolver-provider.js +32 -0
- package/esm/node/resolver/response-resolver-provider.js.map +1 -0
- package/esm/node/resolver/response-resolver.d.ts +13 -0
- package/esm/node/resolver/response-resolver.js +64 -0
- package/esm/node/resolver/response-resolver.js.map +1 -0
- package/esm/node/resolver/view-resolver-provider.d.ts +7 -0
- package/esm/node/resolver/view-resolver-provider.js +32 -0
- package/esm/node/resolver/view-resolver-provider.js.map +1 -0
- package/esm/node/resolver/view-resolver.d.ts +7 -0
- package/esm/node/resolver/view-resolver.js +41 -0
- package/esm/node/resolver/view-resolver.js.map +1 -0
- package/esm/node/view/file-view.d.ts +17 -0
- package/esm/node/view/file-view.js +81 -0
- package/esm/node/view/file-view.js.map +1 -0
- package/esm/node/view/html-view.d.ts +10 -0
- package/esm/node/view/html-view.js +50 -0
- package/esm/node/view/html-view.js.map +1 -0
- package/esm/node/view/index.d.ts +6 -0
- package/esm/node/view/index.js +7 -0
- package/esm/node/view/index.js.map +1 -0
- package/esm/node/view/json-view-template-renderer.d.ts +5 -0
- package/esm/node/view/json-view-template-renderer.js +36 -0
- package/esm/node/view/json-view-template-renderer.js.map +1 -0
- package/esm/node/view/json-view.d.ts +10 -0
- package/esm/node/view/json-view.js +36 -0
- package/esm/node/view/json-view.js.map +1 -0
- package/esm/node/view/text-view.d.ts +9 -0
- package/esm/node/view/text-view.js +29 -0
- package/esm/node/view/text-view.js.map +1 -0
- package/esm/node/view/view-protocol.d.ts +11 -0
- package/esm/node/view/view-protocol.js +3 -0
- package/esm/node/view/view-protocol.js.map +1 -0
- package/esm/node/view/view-provider.d.ts +7 -0
- package/esm/node/view/view-provider.js +32 -0
- package/esm/node/view/view-provider.js.map +1 -0
- package/esm/package.json +3 -0
- package/lib/node/annotation/body.js.map +1 -1
- package/lib/node/annotation/catch.js.map +1 -1
- package/lib/node/annotation/controller.js.map +1 -1
- package/lib/node/annotation/cookie.js.map +1 -1
- package/lib/node/annotation/file.js.map +1 -1
- package/lib/node/annotation/header.js.map +1 -1
- package/lib/node/annotation/html.js.map +1 -1
- package/lib/node/annotation/json.js.map +1 -1
- package/lib/node/annotation/method.d.ts +2 -2
- package/lib/node/annotation/method.d.ts.map +1 -1
- package/lib/node/annotation/method.js.map +1 -1
- package/lib/node/annotation/param.js.map +1 -1
- package/lib/node/annotation/query.js.map +1 -1
- package/lib/node/annotation/req.js.map +1 -1
- package/lib/node/annotation/res.js.map +1 -1
- package/lib/node/annotation/session.js.map +1 -1
- package/lib/node/annotation/text.js.map +1 -1
- package/lib/node/annotation/view.js.map +1 -1
- package/lib/node/constants.d.ts.map +1 -1
- package/lib/node/error/error-handler.d.ts.map +1 -1
- package/lib/node/error/error-handler.js.map +1 -1
- package/lib/node/handler/handler-adapter.d.ts.map +1 -1
- package/lib/node/handler/handler-adapter.js.map +1 -1
- package/lib/node/handler/route-builder.d.ts.map +1 -1
- package/lib/node/handler/route-builder.js.map +1 -1
- package/lib/node/handler/route-metadata-matcher.d.ts.map +1 -1
- package/lib/node/handler/route-metadata-matcher.js.map +1 -1
- package/lib/node/handler/route-provider.d.ts.map +1 -1
- package/lib/node/handler/route-provider.js.map +1 -1
- package/lib/node/module.d.ts.map +1 -1
- package/lib/node/module.js.map +1 -1
- package/lib/node/resolver/method-args-resolver-provider.d.ts.map +1 -1
- package/lib/node/resolver/method-args-resolver-provider.js.map +1 -1
- package/lib/node/resolver/method-args-resolver.d.ts.map +1 -1
- package/lib/node/resolver/method-args-resolver.js.map +1 -1
- package/lib/node/resolver/response-resolver-provider.d.ts.map +1 -1
- package/lib/node/resolver/response-resolver-provider.js.map +1 -1
- package/lib/node/resolver/response-resolver.d.ts.map +1 -1
- package/lib/node/resolver/response-resolver.js.map +1 -1
- package/lib/node/resolver/view-resolver-provider.d.ts.map +1 -1
- package/lib/node/resolver/view-resolver-provider.js.map +1 -1
- package/lib/node/resolver/view-resolver.d.ts.map +1 -1
- package/lib/node/resolver/view-resolver.js.map +1 -1
- package/lib/node/view/file-view.d.ts.map +1 -1
- package/lib/node/view/file-view.js.map +1 -1
- package/lib/node/view/html-view.d.ts.map +1 -1
- package/lib/node/view/html-view.js +6 -3
- package/lib/node/view/html-view.js.map +1 -1
- package/lib/node/view/json-view-template-renderer.d.ts.map +1 -1
- package/lib/node/view/json-view-template-renderer.js.map +1 -1
- package/lib/node/view/json-view.d.ts.map +1 -1
- package/lib/node/view/json-view.js.map +1 -1
- package/lib/node/view/text-view.d.ts.map +1 -1
- package/lib/node/view/text-view.js.map +1 -1
- package/lib/node/view/view-provider.d.ts.map +1 -1
- package/lib/node/view/view-provider.js.map +1 -1
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.js +5 -2
- package/lib/package.spec.js.map +1 -1
- package/package.json +63 -11
- package/src/node/view/html-view.ts +3 -3
- package/src/package.spec.ts +1 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MVC_PATH = "cell.mvc.path";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './constants.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface BodyMetadata {
|
|
2
|
+
name?: string;
|
|
3
|
+
parameterIndex: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function Body(name?: string): ParameterDecorator;
|
|
6
|
+
export declare function applyBodyDecorator(target: any, targetKey: string | symbol | undefined, parameterIndex: number, name?: string): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { METADATA_KEY } from '../constants.js';
|
|
2
|
+
export function Body(name) {
|
|
3
|
+
return (t, tk, i) => {
|
|
4
|
+
applyBodyDecorator(t, tk, i, name);
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export function applyBodyDecorator(target, targetKey, parameterIndex, name) {
|
|
8
|
+
if (!targetKey) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const metadatas = Reflect.getOwnMetadata(METADATA_KEY.controllerBody, target.constructor, targetKey) || [];
|
|
12
|
+
metadatas.push({ name, parameterIndex });
|
|
13
|
+
Reflect.defineMetadata(METADATA_KEY.controllerBody, metadatas, target.constructor, targetKey);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body.js","sourceRoot":"","sources":["../../../src/node/annotation/body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAO5C,MAAM,UAAU,IAAI,CAAC,IAAa;IAC9B,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;QAChB,kBAAkB,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAW,EAAE,SAAsC,EAAG,cAAsB,EAAE,IAAa;IAC1H,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,OAAO;IACX,CAAC;IACD,MAAM,SAAS,GAAmB,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;IAC3H,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IACzC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,cAAc,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAClG,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ErrorType } from '@celljs/core';
|
|
2
|
+
export interface CatchMetadata {
|
|
3
|
+
errorTypes: ErrorType[];
|
|
4
|
+
target: any;
|
|
5
|
+
key: string | symbol;
|
|
6
|
+
descriptor: TypedPropertyDescriptor<any>;
|
|
7
|
+
}
|
|
8
|
+
export declare function Catch(errorTypes: ErrorType | ErrorType[]): MethodDecorator;
|
|
9
|
+
export declare function applyCatchDecorator(target: any, key: string | symbol, descriptor: TypedPropertyDescriptor<any>, errorTypes: ErrorType[]): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { METADATA_KEY } from '../constants.js';
|
|
2
|
+
export function Catch(errorTypes) {
|
|
3
|
+
return (t, k, d) => {
|
|
4
|
+
applyCatchDecorator(t, k, d, Array.isArray(errorTypes) ? errorTypes : [errorTypes]);
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export function applyCatchDecorator(target, key, descriptor, errorTypes) {
|
|
8
|
+
const metadata = { errorTypes, target, key, descriptor };
|
|
9
|
+
let metadataList = [];
|
|
10
|
+
if (!Reflect.hasOwnMetadata(METADATA_KEY.controllerCatch, target.constructor)) {
|
|
11
|
+
Reflect.defineMetadata(METADATA_KEY.controllerCatch, metadataList, target.constructor);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
metadataList = Reflect.getOwnMetadata(METADATA_KEY.controllerCatch, target.constructor);
|
|
15
|
+
}
|
|
16
|
+
metadataList.push(metadata);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=catch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catch.js","sourceRoot":"","sources":["../../../src/node/annotation/catch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAU5C,MAAM,UAAU,KAAK,CAAC,UAAmC;IACrD,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE;QACf,mBAAmB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAE,UAAU,CAAE,CAAC,CAAC;IAC1F,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAW,EAAE,GAAoB,EAAE,UAAwC,EAAE,UAAuB;IACpI,MAAM,QAAQ,GAAkB,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;IACxE,IAAI,YAAY,GAAoB,EAAE,CAAC;IAEvC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5E,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,eAAe,EAAE,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAC3F,CAAC;SAAM,CAAC;QACJ,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAC5F,CAAC;IACD,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentOption } from '@celljs/core';
|
|
2
|
+
export declare const CONTROLLER: unique symbol;
|
|
3
|
+
export declare const CONTROLLER_TAG = "Controller";
|
|
4
|
+
export interface ControllerOption extends ComponentOption {
|
|
5
|
+
path?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ControllerMetadata {
|
|
8
|
+
path: string;
|
|
9
|
+
target: any;
|
|
10
|
+
}
|
|
11
|
+
export type PathOrControllerOption = string | ControllerOption;
|
|
12
|
+
export declare function Controller(pathOrOption?: PathOrControllerOption): ClassDecorator;
|
|
13
|
+
export declare function parseControllerOption(target: any, pathOrOption?: PathOrControllerOption): ControllerOption;
|
|
14
|
+
export declare function applyControllerDecorator(option: ControllerOption, target: any): ControllerMetadata;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { METADATA_KEY } from '../constants.js';
|
|
2
|
+
import { AnnotationUtil, Component, parseComponentOption } from '@celljs/core';
|
|
3
|
+
import { AOP_POINTCUT } from '@celljs/web';
|
|
4
|
+
export const CONTROLLER = Symbol('Controller');
|
|
5
|
+
export const CONTROLLER_TAG = 'Controller';
|
|
6
|
+
export function Controller(pathOrOption) {
|
|
7
|
+
return function (target) {
|
|
8
|
+
const option = parseControllerOption(target, pathOrOption);
|
|
9
|
+
applyControllerDecorator(option, target);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function parseControllerOption(target, pathOrOption) {
|
|
13
|
+
const option = AnnotationUtil.getValueOrOption(pathOrOption, 'path');
|
|
14
|
+
const parsed = parseComponentOption(target, option);
|
|
15
|
+
if (option.proxy === undefined) {
|
|
16
|
+
parsed.proxy = true;
|
|
17
|
+
}
|
|
18
|
+
parsed.sysTags.push(AOP_POINTCUT, CONTROLLER_TAG);
|
|
19
|
+
parsed.path = parsed.path || '';
|
|
20
|
+
parsed.id.push(CONTROLLER);
|
|
21
|
+
return parsed;
|
|
22
|
+
}
|
|
23
|
+
export function applyControllerDecorator(option, target) {
|
|
24
|
+
const metadata = { path: option.path, target };
|
|
25
|
+
Reflect.defineMetadata(METADATA_KEY.controller, metadata, target);
|
|
26
|
+
Component(option)(target);
|
|
27
|
+
return metadata;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/node/annotation/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAgC,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC7G,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;AAa3C,MAAM,UAAU,UAAU,CAAC,YAAqC;IAC5D,OAAO,UAAU,MAAM;QACnB,MAAM,MAAM,GAAG,qBAAqB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC3D,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAW,EAAE,YAAqC;IACpF,MAAM,MAAM,GAAG,cAAc,CAAC,gBAAgB,CAAmB,YAAY,EAAE,MAAM,CAAC,CAAC;IACvF,MAAM,MAAM,GAAqB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtE,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;IACxB,CAAC;IACD,MAAM,CAAC,OAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IACnD,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IAC/B,MAAM,CAAC,EAAyB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,MAAwB,EAAE,MAAW;IAC1E,MAAM,QAAQ,GAAuB,EAAE,IAAI,EAAE,MAAM,CAAC,IAAK,EAAE,MAAM,EAAE,CAAC;IACpE,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAClE,SAAS,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;IAC1B,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface RequestCookieMetadata {
|
|
2
|
+
name?: string;
|
|
3
|
+
parameterIndex: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ResponseCookieMetadata {
|
|
6
|
+
name: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CookieDecorator {
|
|
10
|
+
(name?: string): ParameterDecorator;
|
|
11
|
+
(name: string, value: string): MethodDecorator;
|
|
12
|
+
}
|
|
13
|
+
export declare const Cookie: CookieDecorator;
|
|
14
|
+
export declare function applyRequestCookieDecorator(target: any, targetKey: string | symbol, parameterIndex: number, name?: string): void;
|
|
15
|
+
export declare function applyResponseCookieDecorator(target: any, targetKey: string | symbol, descriptor: PropertyDescriptor, name: string, value: string): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { METADATA_KEY } from '../constants.js';
|
|
2
|
+
export const Cookie = function (name, value) {
|
|
3
|
+
if (name && value) {
|
|
4
|
+
return (t, tk, d) => {
|
|
5
|
+
applyResponseCookieDecorator(t, tk, d, name, value);
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
return (t, tk, i) => {
|
|
10
|
+
applyRequestCookieDecorator(t, tk, i, name);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export function applyRequestCookieDecorator(target, targetKey, parameterIndex, name) {
|
|
15
|
+
const metadatas = Reflect.getOwnMetadata(METADATA_KEY.controllerRequestCookie, target.constructor, targetKey) || [];
|
|
16
|
+
metadatas.push({ name, parameterIndex });
|
|
17
|
+
Reflect.defineMetadata(METADATA_KEY.controllerRequestCookie, metadatas, target.constructor, targetKey);
|
|
18
|
+
}
|
|
19
|
+
export function applyResponseCookieDecorator(target, targetKey, descriptor, name, value) {
|
|
20
|
+
const metadatas = Reflect.getOwnMetadata(METADATA_KEY.controllerResponseCookie, target.constructor, targetKey) || [];
|
|
21
|
+
metadatas.push({ name, value });
|
|
22
|
+
Reflect.defineMetadata(METADATA_KEY.controllerResponseCookie, metadatas, target.constructor, targetKey);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=cookie.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cookie.js","sourceRoot":"","sources":["../../../src/node/annotation/cookie.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAkB5C,MAAM,CAAC,MAAM,MAAM,GAAoB,UAAU,IAAa,EAAE,KAAc;IAC1E,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,CAAM,EAAE,EAAmB,EAAE,CAAqB,EAAE,EAAE;YAC1D,4BAA4B,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACxD,CAAC,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,CAAM,EAAE,EAAU,EAAE,CAAS,EAAE,EAAE;YACrC,2BAA2B,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC,CAAC;IACN,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,UAAU,2BAA2B,CAAC,MAAW,EAAE,SAA0B,EAAE,cAAsB,EAAE,IAAa;IACtH,MAAM,SAAS,GAA4B,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,uBAAuB,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;IAC7I,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IACzC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,uBAAuB,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAC3G,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,MAAW,EAAE,SAA0B,EAAE,UAA8B,EAAE,IAAY,EAAE,KAAa;IAC7I,MAAM,SAAS,GAA6B,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,wBAAwB,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;IAC/I,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAG,CAAC,CAAC;IACjC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,wBAAwB,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/node/annotation/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AAErC,MAAM,UAAU,IAAI,CAAC,IAAa;IAC9B,OAAO,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface RequestHeaderMetadata {
|
|
2
|
+
name?: string;
|
|
3
|
+
parameterIndex: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ResponseHeaderMetadata {
|
|
6
|
+
name: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
export interface HeaderDecorator {
|
|
10
|
+
(name?: string): ParameterDecorator;
|
|
11
|
+
(name: string, value: string): MethodDecorator;
|
|
12
|
+
}
|
|
13
|
+
export declare const Header: HeaderDecorator;
|
|
14
|
+
export declare function applyRequestHeaderDecorator(target: any, targetKey: string | symbol, parameterIndex: number, name?: string): void;
|
|
15
|
+
export declare function applyResponseHeaderDecorator(target: any, targetKey: string | symbol, descriptor: PropertyDescriptor, name: string, value: string): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { METADATA_KEY } from '../constants.js';
|
|
2
|
+
export const Header = function (name, value) {
|
|
3
|
+
if (name && value) {
|
|
4
|
+
return (t, tk, d) => {
|
|
5
|
+
applyResponseHeaderDecorator(t, tk, d, name, value);
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
return (t, tk, i) => {
|
|
10
|
+
applyRequestHeaderDecorator(t, tk, i, name);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export function applyRequestHeaderDecorator(target, targetKey, parameterIndex, name) {
|
|
15
|
+
const metadatas = Reflect.getOwnMetadata(METADATA_KEY.controllerRequestHeader, target.constructor, targetKey) || [];
|
|
16
|
+
metadatas.push({ name, parameterIndex });
|
|
17
|
+
Reflect.defineMetadata(METADATA_KEY.controllerRequestHeader, metadatas, target.constructor, targetKey);
|
|
18
|
+
}
|
|
19
|
+
export function applyResponseHeaderDecorator(target, targetKey, descriptor, name, value) {
|
|
20
|
+
const metadatas = Reflect.getOwnMetadata(METADATA_KEY.controllerResponseHeader, target.constructor, targetKey) || [];
|
|
21
|
+
metadatas.push({ name, value });
|
|
22
|
+
Reflect.defineMetadata(METADATA_KEY.controllerResponseHeader, metadatas, target.constructor, targetKey);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../../src/node/annotation/header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAkB5C,MAAM,CAAC,MAAM,MAAM,GAAoB,UAAU,IAAa,EAAE,KAAc;IAC1E,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,CAAM,EAAE,EAAmB,EAAE,CAAqB,EAAE,EAAE;YAC1D,4BAA4B,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACxD,CAAC,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,CAAM,EAAE,EAAmB,EAAE,CAAS,EAAE,EAAE;YAC9C,2BAA2B,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC,CAAC;IACN,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,UAAU,2BAA2B,CAAC,MAAW,EAAE,SAA0B,EAAE,cAAsB,EAAE,IAAa;IACtH,MAAM,SAAS,GAA4B,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,uBAAuB,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;IAC7I,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IACzC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,uBAAuB,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAC3G,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,MAAW,EAAE,SAA0B,EAAE,UAA8B,EAAE,IAAY,EAAE,KAAa;IAC7I,MAAM,SAAS,GAA6B,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,wBAAwB,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;IAC/I,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAG,CAAC,CAAC;IACjC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,wBAAwB,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAC5G,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../../src/node/annotation/html.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AAErC,MAAM,UAAU,IAAI,CAAC,IAAa;IAC9B,OAAO,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './body.js';
|
|
2
|
+
export * from './controller.js';
|
|
3
|
+
export * from './header.js';
|
|
4
|
+
export * from './method.js';
|
|
5
|
+
export * from './param.js';
|
|
6
|
+
export * from './query.js';
|
|
7
|
+
export * from './view.js';
|
|
8
|
+
export * from './cookie.js';
|
|
9
|
+
export * from './session.js';
|
|
10
|
+
export * from './catch.js';
|
|
11
|
+
export * from './file.js';
|
|
12
|
+
export * from './text.js';
|
|
13
|
+
export * from './json.js';
|
|
14
|
+
export * from './html.js';
|
|
15
|
+
export * from './req.js';
|
|
16
|
+
export * from './res.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './body.js';
|
|
2
|
+
export * from './controller.js';
|
|
3
|
+
export * from './header.js';
|
|
4
|
+
export * from './method.js';
|
|
5
|
+
export * from './param.js';
|
|
6
|
+
export * from './query.js';
|
|
7
|
+
export * from './view.js';
|
|
8
|
+
export * from './cookie.js';
|
|
9
|
+
export * from './session.js';
|
|
10
|
+
export * from './catch.js';
|
|
11
|
+
export * from './file.js';
|
|
12
|
+
export * from './text.js';
|
|
13
|
+
export * from './json.js';
|
|
14
|
+
export * from './html.js';
|
|
15
|
+
export * from './req.js';
|
|
16
|
+
export * from './res.js';
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/annotation/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/node/annotation/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AAErC,MAAM,UAAU,IAAI;IAChB,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type StrOrRegex = string | RegExp;
|
|
2
|
+
export type RouteOptions = StrOrRegex | {
|
|
3
|
+
path: StrOrRegex;
|
|
4
|
+
} | ({
|
|
5
|
+
options: Object;
|
|
6
|
+
path: StrOrRegex;
|
|
7
|
+
} & Object);
|
|
8
|
+
export interface MethodMetadata {
|
|
9
|
+
options: RouteOptions;
|
|
10
|
+
target: any;
|
|
11
|
+
method: string;
|
|
12
|
+
key: string | symbol;
|
|
13
|
+
descriptor: TypedPropertyDescriptor<any>;
|
|
14
|
+
}
|
|
15
|
+
export declare function Get(options?: RouteOptions): MethodDecorator;
|
|
16
|
+
export declare function Post(options?: RouteOptions): MethodDecorator;
|
|
17
|
+
export declare function Put(options?: RouteOptions): MethodDecorator;
|
|
18
|
+
export declare function Patch(options?: RouteOptions): MethodDecorator;
|
|
19
|
+
export declare function Head(options?: RouteOptions): MethodDecorator;
|
|
20
|
+
export declare function Delete(options?: RouteOptions): MethodDecorator;
|
|
21
|
+
export declare function Options(options?: RouteOptions): MethodDecorator;
|
|
22
|
+
export declare function All(options?: RouteOptions): MethodDecorator;
|
|
23
|
+
export declare const Method: (options?: RouteOptions, ...methods: string[]) => MethodDecorator;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { METADATA_KEY } from '../constants.js';
|
|
2
|
+
import { HttpMethod } from '@celljs/http';
|
|
3
|
+
export function Get(options) {
|
|
4
|
+
return Method(options, HttpMethod.GET);
|
|
5
|
+
}
|
|
6
|
+
export function Post(options) {
|
|
7
|
+
return Method(options, HttpMethod.POST);
|
|
8
|
+
}
|
|
9
|
+
export function Put(options) {
|
|
10
|
+
return Method(options, HttpMethod.PUT);
|
|
11
|
+
}
|
|
12
|
+
export function Patch(options) {
|
|
13
|
+
return Method(options, HttpMethod.PATCH);
|
|
14
|
+
}
|
|
15
|
+
export function Head(options) {
|
|
16
|
+
return Method(options, HttpMethod.HEAD);
|
|
17
|
+
}
|
|
18
|
+
export function Delete(options) {
|
|
19
|
+
return Method(options, HttpMethod.DELETE);
|
|
20
|
+
}
|
|
21
|
+
export function Options(options) {
|
|
22
|
+
return Method(options, HttpMethod.OPTIONS);
|
|
23
|
+
}
|
|
24
|
+
export function All(options) {
|
|
25
|
+
return Method(options, HttpMethod.GET, HttpMethod.DELETE, HttpMethod.HEAD, HttpMethod.PATCH, HttpMethod.POST, HttpMethod.PUT, HttpMethod.TRACE, HttpMethod.OPTIONS);
|
|
26
|
+
}
|
|
27
|
+
export const Method = function (options = '', ...methods) {
|
|
28
|
+
return function (target, key, descriptor) {
|
|
29
|
+
let metadataList = [];
|
|
30
|
+
if (!Reflect.hasOwnMetadata(METADATA_KEY.controllerMethod, target.constructor)) {
|
|
31
|
+
Reflect.defineMetadata(METADATA_KEY.controllerMethod, metadataList, target.constructor);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
metadataList = Reflect.getOwnMetadata(METADATA_KEY.controllerMethod, target.constructor);
|
|
35
|
+
}
|
|
36
|
+
for (const method of methods) {
|
|
37
|
+
const metadata = { options, method, target, key, descriptor };
|
|
38
|
+
metadataList.push(metadata);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=method.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method.js","sourceRoot":"","sources":["../../../src/node/annotation/method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAa1C,MAAM,UAAU,GAAG,CAAC,OAAsB;IACtC,OAAO,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,OAAsB;IACvC,OAAO,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,OAAsB;IACtC,OAAO,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,OAAsB;IACxC,OAAO,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,OAAsB;IACvC,OAAO,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,OAAsB;IACzC,OAAO,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,OAAsB;IAC1C,OAAO,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,OAAsB;IACtC,OAAO,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;AACxK,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,OAAO,GAAiB,EAAE,EAAE,GAAG,OAAiB;IAC5E,OAAO,UAAU,MAAM,EAAE,GAAG,EAAE,UAAU;QACpC,IAAI,YAAY,GAAqB,EAAE,CAAC;QAExC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,gBAAgB,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;YAC7E,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,gBAAgB,EAAE,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAC5F,CAAC;aAAM,CAAC;YACJ,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,gBAAgB,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAC7F,CAAC;QACD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,QAAQ,GAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC;YAC9E,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC;IACL,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface ParamMetadata {
|
|
2
|
+
name?: string;
|
|
3
|
+
parameterIndex: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function Param(name?: string): ParameterDecorator;
|
|
6
|
+
export declare function applyParamDecorator(target: any, targetKey: string | symbol | undefined, parameterIndex: number, name?: string): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { METADATA_KEY } from '../constants.js';
|
|
2
|
+
export function Param(name) {
|
|
3
|
+
return (t, tk, i) => {
|
|
4
|
+
applyParamDecorator(t, tk, i, name);
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export function applyParamDecorator(target, targetKey, parameterIndex, name) {
|
|
8
|
+
if (!targetKey) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const metadatas = Reflect.getOwnMetadata(METADATA_KEY.controllerParam, target.constructor, targetKey) || [];
|
|
12
|
+
metadatas.push({ name, parameterIndex });
|
|
13
|
+
Reflect.defineMetadata(METADATA_KEY.controllerParam, metadatas, target.constructor, targetKey);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=param.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"param.js","sourceRoot":"","sources":["../../../src/node/annotation/param.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAO5C,MAAM,UAAU,KAAK,CAAC,IAAa;IAC/B,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;QAChB,mBAAmB,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAW,EAAE,SAAsC,EAAE,cAAsB,EAAE,IAAa;IAC1H,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,OAAO;IACX,CAAC;IACD,MAAM,SAAS,GAAoB,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;IAC7H,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IACzC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,eAAe,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface QueryMetadata {
|
|
2
|
+
name?: string;
|
|
3
|
+
parameterIndex: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function Query(name?: string): ParameterDecorator;
|
|
6
|
+
export declare function applyQueryDecorator(target: any, targetKey: string | symbol | undefined, parameterIndex: number, name?: string): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { METADATA_KEY } from '../constants.js';
|
|
2
|
+
export function Query(name) {
|
|
3
|
+
return (t, tk, i) => {
|
|
4
|
+
applyQueryDecorator(t, tk, i, name);
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export function applyQueryDecorator(target, targetKey, parameterIndex, name) {
|
|
8
|
+
if (!targetKey) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const metadatas = Reflect.getOwnMetadata(METADATA_KEY.controllerQuery, target.constructor, targetKey) || [];
|
|
12
|
+
metadatas.push({ name, parameterIndex });
|
|
13
|
+
Reflect.defineMetadata(METADATA_KEY.controllerQuery, metadatas, target.constructor, targetKey);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/node/annotation/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAO5C,MAAM,UAAU,KAAK,CAAC,IAAa;IAC/B,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;QAChB,mBAAmB,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAW,EAAE,SAAsC,EAAE,cAAsB,EAAE,IAAa;IAC1H,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,OAAO;IACX,CAAC;IACD,MAAM,SAAS,GAAoB,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;IAC7H,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IACzC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,eAAe,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { METADATA_KEY } from '../constants.js';
|
|
2
|
+
export function Req() {
|
|
3
|
+
return (t, tk, i) => {
|
|
4
|
+
applyRequestDecorator(t, tk, i);
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export function applyRequestDecorator(target, targetKey, parameterIndex) {
|
|
8
|
+
if (!targetKey) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
Reflect.defineMetadata(METADATA_KEY.controllerRequest, { parameterIndex }, target.constructor, targetKey);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=req.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"req.js","sourceRoot":"","sources":["../../../src/node/annotation/req.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAM5C,MAAM,UAAU,GAAG;IACf,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;QAChB,qBAAqB,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAW,EAAE,SAAsC,EAAE,cAAsB;IAC7G,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,OAAO;IACX,CAAC;IACD,OAAO,CAAC,cAAc,CAClB,YAAY,CAAC,iBAAiB,EAC9B,EAAE,cAAc,EAAqB,EACrC,MAAM,CAAC,WAAW,EAClB,SAAS,CACZ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { METADATA_KEY } from '../constants.js';
|
|
2
|
+
export function Res() {
|
|
3
|
+
return (t, tk, i) => {
|
|
4
|
+
applyResponseDecorator(t, tk, i);
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export function applyResponseDecorator(target, targetKey, parameterIndex) {
|
|
8
|
+
if (!targetKey) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
Reflect.defineMetadata(METADATA_KEY.controllerResponse, { parameterIndex }, target.constructor, targetKey);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=res.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"res.js","sourceRoot":"","sources":["../../../src/node/annotation/res.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAM5C,MAAM,UAAU,GAAG;IACf,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE;QAChB,sBAAsB,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,MAAW,EAAE,SAAsC,EAAE,cAAsB;IAC9G,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,OAAO;IACX,CAAC;IACD,OAAO,CAAC,cAAc,CAClB,YAAY,CAAC,kBAAkB,EAC/B,EAAE,cAAc,EAAsB,EACtC,MAAM,CAAC,WAAW,EAClB,SAAS,CACZ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface RequestSessionMetadata {
|
|
2
|
+
name?: string;
|
|
3
|
+
parameterIndex: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ResponseSessionMetadata {
|
|
6
|
+
name: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SessionDecorator {
|
|
10
|
+
(name?: string): ParameterDecorator;
|
|
11
|
+
(name: string, value: string): MethodDecorator;
|
|
12
|
+
}
|
|
13
|
+
export declare const Session: SessionDecorator;
|
|
14
|
+
export declare function applyRequestSessionDecorator(target: any, targetKey: string | symbol, parameterIndex: number, name?: string): void;
|
|
15
|
+
export declare function applyResponseSessionDecorator(target: any, targetKey: string | symbol, descriptor: PropertyDescriptor, name: string, value: string): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { METADATA_KEY } from '../constants.js';
|
|
2
|
+
export const Session = function (name, value) {
|
|
3
|
+
if (name && value) {
|
|
4
|
+
return (t, tk, d) => {
|
|
5
|
+
applyResponseSessionDecorator(t, tk, d, name, value);
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
return (t, tk, i) => {
|
|
10
|
+
applyRequestSessionDecorator(t, tk, i, name);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export function applyRequestSessionDecorator(target, targetKey, parameterIndex, name) {
|
|
15
|
+
const metadatas = Reflect.getOwnMetadata(METADATA_KEY.controllerRequestSession, target.constructor, targetKey) || [];
|
|
16
|
+
metadatas.push({ name, parameterIndex });
|
|
17
|
+
Reflect.defineMetadata(METADATA_KEY.controllerRequestSession, metadatas, target.constructor, targetKey);
|
|
18
|
+
}
|
|
19
|
+
export function applyResponseSessionDecorator(target, targetKey, descriptor, name, value) {
|
|
20
|
+
const metadatas = Reflect.getOwnMetadata(METADATA_KEY.controllerResponseSession, target.constructor, targetKey) || [];
|
|
21
|
+
metadatas.push({ name, value });
|
|
22
|
+
Reflect.defineMetadata(METADATA_KEY.controllerResponseSession, metadatas, target.constructor, targetKey);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/node/annotation/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAkB5C,MAAM,CAAC,MAAM,OAAO,GAAqB,UAAU,IAAa,EAAE,KAAc;IAC5E,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,CAAM,EAAE,EAAmB,EAAE,CAAqB,EAAE,EAAE;YAC1D,6BAA6B,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QACzD,CAAC,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,CAAM,EAAE,EAAmB,EAAE,CAAS,EAAE,EAAE;YAC9C,4BAA4B,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QACjD,CAAC,CAAC;IACN,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,UAAU,4BAA4B,CAAC,MAAW,EAAE,SAA0B,EAAE,cAAsB,EAAE,IAAa;IACvH,MAAM,SAAS,GAA6B,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,wBAAwB,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;IAC/I,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IACzC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,wBAAwB,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAC5G,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,MAAW,EAAE,SAA0B,EAAE,UAA8B,EAAE,IAAY,EAAE,KAAa;IAC9I,MAAM,SAAS,GAA8B,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,yBAAyB,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC;IACjJ,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAG,CAAC,CAAC;IACjC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,yBAAyB,EAAE,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAC7G,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/node/annotation/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC;AAErC,MAAM,UAAU,IAAI;IAChB,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ViewMetadata {
|
|
2
|
+
viewName: string;
|
|
3
|
+
metadata?: {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export declare function View(viewName: string, metadata?: {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}): MethodDecorator;
|
|
10
|
+
export declare function applyViewDecorator(target: any, targetKey: string | symbol, descriptor: TypedPropertyDescriptor<any>, viewName: string, metadata?: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { METADATA_KEY } from '../constants.js';
|
|
2
|
+
export function View(viewName, metadata) {
|
|
3
|
+
return (t, k, d) => {
|
|
4
|
+
applyViewDecorator(t, k, d, viewName, metadata);
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export function applyViewDecorator(target, targetKey, descriptor, viewName, metadata) {
|
|
8
|
+
Reflect.defineMetadata(METADATA_KEY.controllerView, { viewName, metadata }, target.constructor, targetKey);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../src/node/annotation/view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAO5C,MAAM,UAAU,IAAI,CAAC,QAAgB,EAAE,QAAiC;IACpE,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE;QACf,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAW,EAAE,SAA0B,EAAE,UAAwC,EAAE,QAAgB,EAAE,QAAiC;IACrK,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAC/G,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const METADATA_KEY: {
|
|
2
|
+
controller: string;
|
|
3
|
+
controllerMethod: string;
|
|
4
|
+
controllerParam: string;
|
|
5
|
+
controllerRequestHeader: string;
|
|
6
|
+
controllerResponseHeader: string;
|
|
7
|
+
controllerRequestCookie: string;
|
|
8
|
+
controllerResponseCookie: string;
|
|
9
|
+
controllerRequestSession: string;
|
|
10
|
+
controllerResponseSession: string;
|
|
11
|
+
controllerQuery: string;
|
|
12
|
+
controllerBody: string;
|
|
13
|
+
controllerView: string;
|
|
14
|
+
controllerCatch: string;
|
|
15
|
+
controllerRequest: string;
|
|
16
|
+
controllerResponse: string;
|
|
17
|
+
};
|