@antelopejs/api 0.2.0 → 1.0.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/dist/implementations/api/index.d.ts +19 -0
- package/dist/implementations/api/index.js +71 -0
- package/dist/implementations/api/index.js.map +1 -0
- package/dist/index.d.ts +19 -14
- package/dist/index.js +97 -31
- package/dist/index.js.map +1 -1
- package/dist/middlewares/cors.d.ts +3 -3
- package/dist/middlewares/cors.js +50 -36
- package/dist/middlewares/cors.js.map +1 -1
- package/dist/server.d.ts +8 -7
- package/dist/server.js +229 -108
- package/dist/server.js.map +1 -1
- package/dist/test/antelope.test.d.ts +2 -0
- package/dist/test/antelope.test.js +25 -0
- package/dist/test/antelope.test.js.map +1 -0
- package/package.json +19 -36
- package/dist/implementations/api/beta.d.ts +0 -21
- package/dist/implementations/api/beta.js +0 -54
- package/dist/implementations/api/beta.js.map +0 -1
- package/dist/interfaces/api/beta/index.d.ts +0 -116
- package/dist/interfaces/api/beta/index.js +0 -305
- package/dist/interfaces/api/beta/index.js.map +0 -1
- package/dist/interfaces/api-util/dev.d.ts +0 -2
- package/dist/interfaces/api-util/dev.js +0 -20
- package/dist/interfaces/api-util/dev.js.map +0 -1
- package/dist/test/interface/api.d.ts +0 -69
- package/dist/test/interface/api.js +0 -739
- package/dist/test/interface/api.js.map +0 -1
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { RouteHandler } from '@ajs.local/api/beta';
|
|
2
|
-
import { RequestContext } from '../../server';
|
|
3
|
-
declare const classCacheSymbol: unique symbol;
|
|
4
|
-
interface RequestContextDev extends RequestContext {
|
|
5
|
-
[classCacheSymbol]?: Map<any, any>;
|
|
6
|
-
}
|
|
7
|
-
export declare function GetControllerInstance(cl: any, context: RequestContextDev): Promise<any>;
|
|
8
|
-
interface RouteInfo {
|
|
9
|
-
id: string;
|
|
10
|
-
uri: string;
|
|
11
|
-
method: string;
|
|
12
|
-
mode: 'prefix' | 'postfix' | 'handler' | 'websocket';
|
|
13
|
-
priority?: number;
|
|
14
|
-
callbackName: string;
|
|
15
|
-
}
|
|
16
|
-
export declare const routesProxy: {
|
|
17
|
-
register: (id: string, handler: RouteHandler) => void;
|
|
18
|
-
unregister: (id: string) => void;
|
|
19
|
-
getRoutes: () => RouteInfo[];
|
|
20
|
-
};
|
|
21
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.routesProxy = void 0;
|
|
4
|
-
exports.GetControllerInstance = GetControllerInstance;
|
|
5
|
-
const beta_1 = require("@ajs.local/api/beta");
|
|
6
|
-
const server_1 = require("../../server");
|
|
7
|
-
const beta_2 = require("@ajs/core/beta");
|
|
8
|
-
const classCacheSymbol = Symbol();
|
|
9
|
-
const registeredRoutes = new Map();
|
|
10
|
-
async function GetControllerInstance(cl, context) {
|
|
11
|
-
if (!(classCacheSymbol in context)) {
|
|
12
|
-
context[classCacheSymbol] = new Map();
|
|
13
|
-
}
|
|
14
|
-
if (context[classCacheSymbol].has(cl.prototype)) {
|
|
15
|
-
return context[classCacheSymbol].get(cl.prototype);
|
|
16
|
-
}
|
|
17
|
-
const obj = new cl();
|
|
18
|
-
const meta = (0, beta_2.GetMetadata)(cl, beta_1.ControllerMeta);
|
|
19
|
-
await Promise.all(Object.entries(meta.computed_props).map(async ([key, param]) => {
|
|
20
|
-
const val = await (0, beta_1.computeParameter)(context, param, obj);
|
|
21
|
-
obj[key] = val;
|
|
22
|
-
}));
|
|
23
|
-
context[classCacheSymbol].set(cl.prototype, obj);
|
|
24
|
-
return obj;
|
|
25
|
-
}
|
|
26
|
-
exports.routesProxy = {
|
|
27
|
-
register: (id, handler) => {
|
|
28
|
-
registeredRoutes.set(id, handler);
|
|
29
|
-
(0, server_1.registerHandler)('dev/' + id, handler.mode, handler.method, handler.location, async (context) => {
|
|
30
|
-
const thisObj = await GetControllerInstance(handler.proto.constructor, context);
|
|
31
|
-
const params = await Promise.all(handler.parameters.map((param) => (0, beta_1.computeParameter)(context, param, thisObj)));
|
|
32
|
-
return handler.callback.apply(thisObj, params);
|
|
33
|
-
}, handler.priority);
|
|
34
|
-
},
|
|
35
|
-
unregister: (id) => {
|
|
36
|
-
registeredRoutes.delete(id);
|
|
37
|
-
(0, server_1.unregisterHandler)('dev/' + id);
|
|
38
|
-
},
|
|
39
|
-
getRoutes: () => {
|
|
40
|
-
const routes = [];
|
|
41
|
-
registeredRoutes.forEach((handler, id) => {
|
|
42
|
-
routes.push({
|
|
43
|
-
id,
|
|
44
|
-
uri: handler.location,
|
|
45
|
-
method: handler.method,
|
|
46
|
-
mode: handler.mode,
|
|
47
|
-
priority: handler.priority,
|
|
48
|
-
callbackName: handler.callback.name || 'anonymous',
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
return routes;
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=beta.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"beta.js","sourceRoot":"","sources":["../../../src/implementations/api/beta.ts"],"names":[],"mappings":";;;AAWA,sDAoBC;AA/BD,8CAAqF;AACrF,yCAAkF;AAClF,yCAA6C;AAE7C,MAAM,gBAAgB,GAAG,MAAM,EAAE,CAAC;AAClC,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAwB,CAAC;AAMlD,KAAK,UAAU,qBAAqB,CAAC,EAAO,EAAE,OAA0B;IAC7E,IAAI,CAAC,CAAC,gBAAgB,IAAI,OAAO,CAAC,EAAE,CAAC;QACnC,OAAO,CAAC,gBAAgB,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;IACxC,CAAC;IACD,IAAI,OAAO,CAAC,gBAAgB,CAAE,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC;QACjD,OAAO,OAAO,CAAC,gBAAgB,CAAE,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAE,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,OAAO,EAAE,MAAM,CAAC,CAAC;QACjD,CAAC,EACD,OAAO,CAAC,QAAQ,CACjB,CAAC;IACJ,CAAC;IACD,UAAU,EAAE,CAAC,EAAU,EAAE,EAAE;QACzB,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC5B,IAAA,0BAAiB,EAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACjC,CAAC;IACD,SAAS,EAAE,GAAgB,EAAE;QAC3B,MAAM,MAAM,GAAgB,EAAE,CAAC;QAE/B,gBAAgB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE;YACvC,MAAM,CAAC,IAAI,CAAC;gBACV,EAAE;gBACF,GAAG,EAAE,OAAO,CAAC,QAAQ;gBACrB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,IAAI,WAAW;aACnD,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC"}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { RegisteringProxy } from '@ajs/core/beta';
|
|
2
|
-
import { Class } from '@ajs/core/beta/decorators';
|
|
3
|
-
import { IncomingMessage, ServerResponse } from 'http';
|
|
4
|
-
import { PassThrough } from 'stream';
|
|
5
|
-
export declare namespace internal {
|
|
6
|
-
const routesProxy: RegisteringProxy<(id: string, handler: RouteHandler) => void>;
|
|
7
|
-
}
|
|
8
|
-
export type ControllerClass<T = Record<string, any>> = Class<T> & {
|
|
9
|
-
extend: <T extends ControllerClass>(this: T, location: string) => T;
|
|
10
|
-
location: string;
|
|
11
|
-
};
|
|
12
|
-
export declare class HTTPResult {
|
|
13
|
-
private status;
|
|
14
|
-
private body;
|
|
15
|
-
private contentType;
|
|
16
|
-
private stream?;
|
|
17
|
-
private readonly headers;
|
|
18
|
-
static withHeaders(res: any, headers: Record<string, string>, defaultStatus?: number): HTTPResult;
|
|
19
|
-
constructor(status?: number, body?: unknown, type?: string);
|
|
20
|
-
setStatus(status: number): void;
|
|
21
|
-
getStatus(): number;
|
|
22
|
-
setBody(body: any, type?: string): void;
|
|
23
|
-
getBody(): any;
|
|
24
|
-
getContentType(): string;
|
|
25
|
-
addHeader(name: string, value: string): void;
|
|
26
|
-
removeHeader(name: string): void;
|
|
27
|
-
getHeaders(): Record<string, string>;
|
|
28
|
-
getWriteStream(type?: string, status?: number): PassThrough;
|
|
29
|
-
isStream(): boolean;
|
|
30
|
-
sendHeadResponse(res: ServerResponse): void;
|
|
31
|
-
sendResponse(res: ServerResponse, abortStream?: boolean): void;
|
|
32
|
-
}
|
|
33
|
-
export declare enum HandlerPriority {
|
|
34
|
-
HIGHEST = 0,
|
|
35
|
-
HIGH = 1,
|
|
36
|
-
NORMAL = 2,
|
|
37
|
-
LOW = 3,
|
|
38
|
-
LOWEST = 4
|
|
39
|
-
}
|
|
40
|
-
export interface RequestContext {
|
|
41
|
-
rawRequest: IncomingMessage;
|
|
42
|
-
rawResponse: ServerResponse;
|
|
43
|
-
url: URL;
|
|
44
|
-
routeParameters: Record<string, string>;
|
|
45
|
-
body?: unknown;
|
|
46
|
-
response: HTTPResult;
|
|
47
|
-
connection?: unknown;
|
|
48
|
-
}
|
|
49
|
-
export type ParameterProvider = (context: RequestContext) => unknown;
|
|
50
|
-
export type ParameterModifier = (context: RequestContext, previous: unknown) => unknown;
|
|
51
|
-
export interface ComputedParameter {
|
|
52
|
-
provider?: ParameterProvider;
|
|
53
|
-
modifiers: ParameterModifier[];
|
|
54
|
-
}
|
|
55
|
-
export declare function computeParameter(context: RequestContext, param: ComputedParameter | null, obj: unknown): Promise<unknown>;
|
|
56
|
-
export declare class ControllerMeta {
|
|
57
|
-
static key: symbol;
|
|
58
|
-
readonly location: string;
|
|
59
|
-
computed_props: Record<PropertyKey, ComputedParameter>;
|
|
60
|
-
computed_params: Record<PropertyKey, Record<number, ComputedParameter>>;
|
|
61
|
-
constructor(target: {
|
|
62
|
-
location: string;
|
|
63
|
-
});
|
|
64
|
-
inherit(parent: ControllerMeta): void;
|
|
65
|
-
getComputedParameter(key: PropertyKey, param: number | undefined): ComputedParameter;
|
|
66
|
-
setProvider(key: PropertyKey, param: number | undefined, provider: ParameterProvider): void;
|
|
67
|
-
addModifier(key: PropertyKey, param: number | undefined, modifier: ParameterModifier): void;
|
|
68
|
-
getParameterArray(key: PropertyKey): (ComputedParameter | null)[];
|
|
69
|
-
}
|
|
70
|
-
export declare function Controller<T extends object = object>(location: string, base?: Class<T>): ControllerClass<T>;
|
|
71
|
-
export declare const GetControllerInstance: <T>(cl: Class<T>, context: RequestContext) => Promise<T>;
|
|
72
|
-
export type RouteHandlerMode = 'prefix' | 'postfix' | 'handler' | 'websocket';
|
|
73
|
-
export interface RouteHandler {
|
|
74
|
-
mode: RouteHandlerMode;
|
|
75
|
-
method: string;
|
|
76
|
-
location: string;
|
|
77
|
-
callback: (...args: any[]) => any;
|
|
78
|
-
parameters: Array<ComputedParameter | null>;
|
|
79
|
-
properties: Record<string, ComputedParameter>;
|
|
80
|
-
proto: any;
|
|
81
|
-
priority?: HandlerPriority;
|
|
82
|
-
}
|
|
83
|
-
export declare const routesProxy: RegisteringProxy<(id: string, handler: RouteHandler) => void>;
|
|
84
|
-
export declare function RegisterRoute(handler: RouteHandler): number;
|
|
85
|
-
export declare function getRegisteredRoutes(): Array<{
|
|
86
|
-
id: string;
|
|
87
|
-
location: string;
|
|
88
|
-
method: string;
|
|
89
|
-
callbackName: string;
|
|
90
|
-
parameters: Array<ComputedParameter | null>;
|
|
91
|
-
properties: Record<string, ComputedParameter>;
|
|
92
|
-
priority?: HandlerPriority;
|
|
93
|
-
}>;
|
|
94
|
-
export declare function ProcessCallback(target: any, key: PropertyKey, descriptor: PropertyDescriptor, mode: RouteHandlerMode, method: string, location?: string, priority?: HandlerPriority): {
|
|
95
|
-
id: number;
|
|
96
|
-
};
|
|
97
|
-
export declare const Route: (mode: RouteHandlerMode, method: string, location?: string | undefined, priority?: HandlerPriority | undefined) => import("@ajs/core/beta/decorators").MethodDecorator;
|
|
98
|
-
export declare const Delete: (location?: string | undefined, mode?: RouteHandlerMode | undefined) => import("@ajs/core/beta/decorators").MethodDecorator;
|
|
99
|
-
export declare const Get: (location?: string | undefined, mode?: RouteHandlerMode | undefined) => import("@ajs/core/beta/decorators").MethodDecorator;
|
|
100
|
-
export declare const Post: (location?: string | undefined, mode?: RouteHandlerMode | undefined) => import("@ajs/core/beta/decorators").MethodDecorator;
|
|
101
|
-
export declare const Put: (location?: string | undefined, mode?: RouteHandlerMode | undefined) => import("@ajs/core/beta/decorators").MethodDecorator;
|
|
102
|
-
export declare const Prefix: (method: string, location?: string | undefined, priority?: HandlerPriority | undefined) => import("@ajs/core/beta/decorators").MethodDecorator;
|
|
103
|
-
export declare const Postfix: (method: string, location?: string | undefined, priority?: HandlerPriority | undefined) => import("@ajs/core/beta/decorators").MethodDecorator;
|
|
104
|
-
export declare const WebsocketHandler: (location?: string | undefined) => import("@ajs/core/beta/decorators").MethodDecorator;
|
|
105
|
-
export declare function ReadBody(context: RequestContext): Promise<Buffer>;
|
|
106
|
-
export declare function SetParameterProvider(target: any, key: PropertyKey, index: number | undefined, provider: ParameterProvider): void;
|
|
107
|
-
export declare function AddParameterModifier(target: any, key: PropertyKey, index: number | undefined, transformer: ParameterModifier): void;
|
|
108
|
-
export declare const RawBody: () => import("@ajs/core/beta/decorators").PropertyDecorator & import("@ajs/core/beta/decorators").ParameterDecorator;
|
|
109
|
-
export declare const JSONBody: () => import("@ajs/core/beta/decorators").PropertyDecorator & import("@ajs/core/beta/decorators").ParameterDecorator;
|
|
110
|
-
export declare const Parameter: (name: string, source?: "param" | "query" | "header" | undefined) => import("@ajs/core/beta/decorators").PropertyDecorator & import("@ajs/core/beta/decorators").ParameterDecorator;
|
|
111
|
-
export declare const Context: () => import("@ajs/core/beta/decorators").PropertyDecorator & import("@ajs/core/beta/decorators").ParameterDecorator;
|
|
112
|
-
export declare const Result: () => import("@ajs/core/beta/decorators").ParameterDecorator;
|
|
113
|
-
export declare const WriteStream: (type?: string | undefined) => import("@ajs/core/beta/decorators").ParameterDecorator;
|
|
114
|
-
export declare const Transform: (transformer: ParameterModifier) => import("@ajs/core/beta/decorators").PropertyDecorator & import("@ajs/core/beta/decorators").ParameterDecorator;
|
|
115
|
-
export declare const Connection: () => import("@ajs/core/beta/decorators").PropertyDecorator & import("@ajs/core/beta/decorators").ParameterDecorator;
|
|
116
|
-
export declare const MultiParameter: (name: string, source?: "query" | "header" | undefined) => import("@ajs/core/beta/decorators").PropertyDecorator & import("@ajs/core/beta/decorators").ParameterDecorator;
|
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MultiParameter = exports.Connection = exports.Transform = exports.WriteStream = exports.Result = exports.Context = exports.Parameter = exports.JSONBody = exports.RawBody = exports.WebsocketHandler = exports.Postfix = exports.Prefix = exports.Put = exports.Post = exports.Get = exports.Delete = exports.Route = exports.routesProxy = exports.GetControllerInstance = exports.ControllerMeta = exports.HandlerPriority = exports.HTTPResult = exports.internal = void 0;
|
|
7
|
-
exports.computeParameter = computeParameter;
|
|
8
|
-
exports.Controller = Controller;
|
|
9
|
-
exports.RegisterRoute = RegisterRoute;
|
|
10
|
-
exports.getRegisteredRoutes = getRegisteredRoutes;
|
|
11
|
-
exports.ProcessCallback = ProcessCallback;
|
|
12
|
-
exports.ReadBody = ReadBody;
|
|
13
|
-
exports.SetParameterProvider = SetParameterProvider;
|
|
14
|
-
exports.AddParameterModifier = AddParameterModifier;
|
|
15
|
-
const beta_1 = require("@ajs/core/beta");
|
|
16
|
-
const decorators_1 = require("@ajs/core/beta/decorators");
|
|
17
|
-
const stream_1 = require("stream");
|
|
18
|
-
const beta_2 = __importDefault(require("@ajs/logging/beta"));
|
|
19
|
-
var internal;
|
|
20
|
-
(function (internal) {
|
|
21
|
-
internal.routesProxy = new beta_1.RegisteringProxy();
|
|
22
|
-
})(internal || (exports.internal = internal = {}));
|
|
23
|
-
class HTTPResult {
|
|
24
|
-
status = 200;
|
|
25
|
-
body = '';
|
|
26
|
-
contentType = 'text/plain';
|
|
27
|
-
stream;
|
|
28
|
-
headers = {};
|
|
29
|
-
static withHeaders(res, headers, defaultStatus = 200) {
|
|
30
|
-
const result = res instanceof HTTPResult ? res : new HTTPResult(defaultStatus, res);
|
|
31
|
-
for (const [key, val] of Object.entries(headers)) {
|
|
32
|
-
result.addHeader(key, val);
|
|
33
|
-
}
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
constructor(status = 200, body, type) {
|
|
37
|
-
this.setBody(body, type);
|
|
38
|
-
this.setStatus(status);
|
|
39
|
-
}
|
|
40
|
-
setStatus(status) {
|
|
41
|
-
this.status = status;
|
|
42
|
-
if (status === 500) {
|
|
43
|
-
console.error(this.body);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
getStatus() {
|
|
47
|
-
return this.status;
|
|
48
|
-
}
|
|
49
|
-
setBody(body, type) {
|
|
50
|
-
if (body === undefined || typeof body === 'string') {
|
|
51
|
-
this.body = body || '';
|
|
52
|
-
this.contentType = type ?? 'text/plain';
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
this.body = JSON.stringify(body);
|
|
56
|
-
this.contentType = type ?? 'application/json';
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
getBody() {
|
|
60
|
-
return this.body;
|
|
61
|
-
}
|
|
62
|
-
getContentType() {
|
|
63
|
-
return this.contentType;
|
|
64
|
-
}
|
|
65
|
-
addHeader(name, value) {
|
|
66
|
-
this.headers[name] = value;
|
|
67
|
-
}
|
|
68
|
-
removeHeader(name) {
|
|
69
|
-
delete this.headers[name];
|
|
70
|
-
}
|
|
71
|
-
getHeaders() {
|
|
72
|
-
return this.headers;
|
|
73
|
-
}
|
|
74
|
-
getWriteStream(type = 'text/plain', status = 200) {
|
|
75
|
-
if (!this.stream) {
|
|
76
|
-
this.stream = new stream_1.PassThrough();
|
|
77
|
-
}
|
|
78
|
-
this.contentType = type;
|
|
79
|
-
this.status = status;
|
|
80
|
-
this.body = '';
|
|
81
|
-
return this.stream;
|
|
82
|
-
}
|
|
83
|
-
isStream() {
|
|
84
|
-
return !!this.stream;
|
|
85
|
-
}
|
|
86
|
-
sendHeadResponse(res) {
|
|
87
|
-
res.writeHead(this.status, { ...this.headers, 'Content-Type': this.contentType }).end();
|
|
88
|
-
if (this.stream) {
|
|
89
|
-
this.stream.end();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
sendResponse(res, abortStream = false) {
|
|
93
|
-
res.writeHead(this.status, { ...this.headers, 'Content-Type': this.contentType });
|
|
94
|
-
if (this.stream && !abortStream) {
|
|
95
|
-
this.stream.pipe(res);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
res.end(this.body);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
exports.HTTPResult = HTTPResult;
|
|
103
|
-
var HandlerPriority;
|
|
104
|
-
(function (HandlerPriority) {
|
|
105
|
-
HandlerPriority[HandlerPriority["HIGHEST"] = 0] = "HIGHEST";
|
|
106
|
-
HandlerPriority[HandlerPriority["HIGH"] = 1] = "HIGH";
|
|
107
|
-
HandlerPriority[HandlerPriority["NORMAL"] = 2] = "NORMAL";
|
|
108
|
-
HandlerPriority[HandlerPriority["LOW"] = 3] = "LOW";
|
|
109
|
-
HandlerPriority[HandlerPriority["LOWEST"] = 4] = "LOWEST";
|
|
110
|
-
})(HandlerPriority || (exports.HandlerPriority = HandlerPriority = {}));
|
|
111
|
-
async function computeParameter(context, param, obj) {
|
|
112
|
-
if (!param || !param.provider) {
|
|
113
|
-
return undefined;
|
|
114
|
-
}
|
|
115
|
-
let val = await param.provider.apply(obj, [context]);
|
|
116
|
-
for (const modifier of param.modifiers) {
|
|
117
|
-
val = await modifier.apply(obj, [context, val]);
|
|
118
|
-
}
|
|
119
|
-
return val;
|
|
120
|
-
}
|
|
121
|
-
class ControllerMeta {
|
|
122
|
-
static key = Symbol();
|
|
123
|
-
location;
|
|
124
|
-
computed_props = {};
|
|
125
|
-
computed_params = {};
|
|
126
|
-
constructor(target) {
|
|
127
|
-
this.location = target.location;
|
|
128
|
-
}
|
|
129
|
-
inherit(parent) {
|
|
130
|
-
this.computed_props = { ...parent.computed_props, ...this.computed_props };
|
|
131
|
-
this.computed_params = { ...parent.computed_params, ...this.computed_params };
|
|
132
|
-
}
|
|
133
|
-
getComputedParameter(key, param) {
|
|
134
|
-
if (param === undefined) {
|
|
135
|
-
if (!(key in this.computed_props)) {
|
|
136
|
-
this.computed_props[key] = { modifiers: [] };
|
|
137
|
-
}
|
|
138
|
-
return this.computed_props[key];
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
if (!(key in this.computed_params)) {
|
|
142
|
-
this.computed_params[key] = [];
|
|
143
|
-
}
|
|
144
|
-
if (!(param in this.computed_params[key])) {
|
|
145
|
-
this.computed_params[key][param] = { modifiers: [] };
|
|
146
|
-
}
|
|
147
|
-
return this.computed_params[key][param];
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
setProvider(key, param, provider) {
|
|
151
|
-
this.getComputedParameter(key, param).provider = provider;
|
|
152
|
-
}
|
|
153
|
-
addModifier(key, param, modifier) {
|
|
154
|
-
this.getComputedParameter(key, param).modifiers.push(modifier);
|
|
155
|
-
}
|
|
156
|
-
getParameterArray(key) {
|
|
157
|
-
const paramsMap = this.computed_params[key] || {};
|
|
158
|
-
const paramsMax = Object.keys(paramsMap)
|
|
159
|
-
.map((val) => parseInt(val))
|
|
160
|
-
.reduce((a, b) => Math.max(a, b), 0);
|
|
161
|
-
const params = [];
|
|
162
|
-
for (let i = 0; i <= paramsMax; ++i) {
|
|
163
|
-
params[i] = i in paramsMap ? paramsMap[i] : null;
|
|
164
|
-
}
|
|
165
|
-
return params;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
exports.ControllerMeta = ControllerMeta;
|
|
169
|
-
function Controller(location, base) {
|
|
170
|
-
const c = base ? class extends base {
|
|
171
|
-
} : class {
|
|
172
|
-
};
|
|
173
|
-
c.location = location;
|
|
174
|
-
c.extend = function (location) {
|
|
175
|
-
return Controller(this.location + '/' + location, this);
|
|
176
|
-
};
|
|
177
|
-
return c;
|
|
178
|
-
}
|
|
179
|
-
exports.GetControllerInstance = (0, beta_1.InterfaceFunction)();
|
|
180
|
-
exports.routesProxy = new beta_1.RegisteringProxy();
|
|
181
|
-
const routesList = [];
|
|
182
|
-
let nextId = 0;
|
|
183
|
-
function RegisterRoute(handler) {
|
|
184
|
-
const id = nextId++;
|
|
185
|
-
beta_2.default.Debug(`Registered ${handler.method.toUpperCase()} ${handler.location} (${handler.callback.name || 'anonymous'})`);
|
|
186
|
-
exports.routesProxy.register(id.toString(), handler);
|
|
187
|
-
routesList.push({ ...handler, id });
|
|
188
|
-
return id;
|
|
189
|
-
}
|
|
190
|
-
function getRegisteredRoutes() {
|
|
191
|
-
return routesList.map((handler) => ({
|
|
192
|
-
id: handler.id.toString(),
|
|
193
|
-
location: handler.location,
|
|
194
|
-
method: handler.method,
|
|
195
|
-
callbackName: handler.callback.name || 'anonymous',
|
|
196
|
-
parameters: handler.parameters,
|
|
197
|
-
properties: handler.properties,
|
|
198
|
-
priority: handler.priority,
|
|
199
|
-
}));
|
|
200
|
-
}
|
|
201
|
-
function ProcessCallback(target, key, descriptor, mode, method, location, priority) {
|
|
202
|
-
const meta = (0, beta_1.GetMetadata)(target.constructor, ControllerMeta);
|
|
203
|
-
const fullLocation = `${meta.location}/${location ?? key}`.replace(/\/+/g, '/');
|
|
204
|
-
return {
|
|
205
|
-
id: RegisterRoute({
|
|
206
|
-
mode,
|
|
207
|
-
method,
|
|
208
|
-
location: fullLocation,
|
|
209
|
-
callback: descriptor.value,
|
|
210
|
-
parameters: meta.getParameterArray(key),
|
|
211
|
-
properties: meta.computed_props,
|
|
212
|
-
proto: target,
|
|
213
|
-
priority,
|
|
214
|
-
}),
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
exports.Route = (0, decorators_1.MakeMethodDecorator)(ProcessCallback);
|
|
218
|
-
exports.Delete = (0, decorators_1.MakeMethodDecorator)((target, key, descriptor, location, mode = 'handler') => {
|
|
219
|
-
ProcessCallback(target, key, descriptor, mode, 'delete', location);
|
|
220
|
-
});
|
|
221
|
-
exports.Get = (0, decorators_1.MakeMethodDecorator)((target, key, descriptor, location, mode = 'handler') => {
|
|
222
|
-
ProcessCallback(target, key, descriptor, mode, 'get', location);
|
|
223
|
-
});
|
|
224
|
-
exports.Post = (0, decorators_1.MakeMethodDecorator)((target, key, descriptor, location, mode = 'handler') => {
|
|
225
|
-
ProcessCallback(target, key, descriptor, mode, 'post', location);
|
|
226
|
-
});
|
|
227
|
-
exports.Put = (0, decorators_1.MakeMethodDecorator)((target, key, descriptor, location, mode = 'handler') => {
|
|
228
|
-
ProcessCallback(target, key, descriptor, mode, 'put', location);
|
|
229
|
-
});
|
|
230
|
-
exports.Prefix = (0, decorators_1.MakeMethodDecorator)((target, key, descriptor, method, location, priority) => {
|
|
231
|
-
ProcessCallback(target, key, descriptor, 'prefix', method, location, priority);
|
|
232
|
-
});
|
|
233
|
-
exports.Postfix = (0, decorators_1.MakeMethodDecorator)((target, key, descriptor, method, location, priority) => {
|
|
234
|
-
ProcessCallback(target, key, descriptor, 'postfix', method, location, priority);
|
|
235
|
-
});
|
|
236
|
-
exports.WebsocketHandler = (0, decorators_1.MakeMethodDecorator)((target, key, descriptor, location) => {
|
|
237
|
-
ProcessCallback(target, key, descriptor, 'websocket', 'get', location);
|
|
238
|
-
});
|
|
239
|
-
function ReadBody(context) {
|
|
240
|
-
if (context.body === undefined) {
|
|
241
|
-
context.body = new Promise((resolve, reject) => {
|
|
242
|
-
const buffers = [];
|
|
243
|
-
context.rawRequest.on('readable', () => {
|
|
244
|
-
let chunk;
|
|
245
|
-
while ((chunk = context.rawRequest.read())) {
|
|
246
|
-
buffers.push(chunk);
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
context.rawRequest.on('end', () => {
|
|
250
|
-
resolve(Buffer.concat(buffers));
|
|
251
|
-
});
|
|
252
|
-
context.rawRequest.on('error', reject);
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
return context.body;
|
|
256
|
-
}
|
|
257
|
-
function SetParameterProvider(target, key, index, provider) {
|
|
258
|
-
(0, beta_1.GetMetadata)(target.constructor, ControllerMeta).setProvider(key, index, provider);
|
|
259
|
-
}
|
|
260
|
-
function AddParameterModifier(target, key, index, transformer) {
|
|
261
|
-
(0, beta_1.GetMetadata)(target.constructor, ControllerMeta).addModifier(key, index, transformer);
|
|
262
|
-
}
|
|
263
|
-
exports.RawBody = (0, decorators_1.MakeParameterAndPropertyDecorator)((target, key, param) => SetParameterProvider(target, key, param, ReadBody));
|
|
264
|
-
exports.JSONBody = (0, decorators_1.MakeParameterAndPropertyDecorator)((target, key, index) => {
|
|
265
|
-
SetParameterProvider(target, key, index, (ctx) => ReadBody(ctx).then((body) => {
|
|
266
|
-
if (typeof body === 'string' || body instanceof Buffer) {
|
|
267
|
-
return JSON.parse(body.toString());
|
|
268
|
-
}
|
|
269
|
-
throw new Error('Unable to parse JSON: Invalid body type');
|
|
270
|
-
}));
|
|
271
|
-
});
|
|
272
|
-
exports.Parameter = (0, decorators_1.MakeParameterAndPropertyDecorator)((target, key, param, name, source = 'param') => {
|
|
273
|
-
SetParameterProvider(target, key, param, (context) => {
|
|
274
|
-
switch (source) {
|
|
275
|
-
case 'param':
|
|
276
|
-
return context.routeParameters[name];
|
|
277
|
-
case 'query': {
|
|
278
|
-
const val = context.url.searchParams.get(name);
|
|
279
|
-
return val === null ? undefined : val || true;
|
|
280
|
-
}
|
|
281
|
-
case 'header': {
|
|
282
|
-
const val2 = context.rawRequest.headers[name.toLowerCase()];
|
|
283
|
-
return Array.isArray(val2) ? val2[0] : val2;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
exports.Context = (0, decorators_1.MakeParameterAndPropertyDecorator)((target, key, param) => SetParameterProvider(target, key, param, (context) => context));
|
|
289
|
-
exports.Result = (0, decorators_1.MakeParameterDecorator)((target, key, param) => SetParameterProvider(target, key, param, (context) => context.response));
|
|
290
|
-
exports.WriteStream = (0, decorators_1.MakeParameterDecorator)((target, key, param, type) => SetParameterProvider(target, key, param, (context) => context.response.getWriteStream(type)));
|
|
291
|
-
exports.Transform = (0, decorators_1.MakeParameterAndPropertyDecorator)((target, key, param, transformer) => AddParameterModifier(target, key, param, transformer));
|
|
292
|
-
exports.Connection = (0, decorators_1.MakeParameterAndPropertyDecorator)((target, key, param) => SetParameterProvider(target, key, param, (context) => context.connection));
|
|
293
|
-
exports.MultiParameter = (0, decorators_1.MakeParameterAndPropertyDecorator)((target, key, param, name, source = 'query') => {
|
|
294
|
-
SetParameterProvider(target, key, param, (context) => {
|
|
295
|
-
switch (source) {
|
|
296
|
-
case 'query':
|
|
297
|
-
return context.url.searchParams.getAll(name);
|
|
298
|
-
case 'header': {
|
|
299
|
-
const val = context.rawRequest.headers[name.toLowerCase()];
|
|
300
|
-
return Array.isArray(val) ? val : val ? [val] : [];
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
});
|
|
305
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/interfaces/api/beta/index.ts"],"names":[],"mappings":";;;;;;AAwTA,4CASC;AA2GD,gCASC;AA6ED,sCAQC;AAMD,kDAkBC;AAcD,0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B,EAAE,EAAE,CAChH,oBAAoB,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,CAAC,CACtD,CAAC;AA0BW,QAAA,UAAU,GAAG,IAAA,8CAAiC,EAAC,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CACjF,oBAAoB,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAC1E,CAAC;AA8BW,QAAA,cAAc,GAAG,IAAA,8CAAiC,EAC7D,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAY,EAAE,SAA6B,OAAO,EAAE,EAAE;IACzE,oBAAoB,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE;QACnD,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,OAAO;gBACV,OAAO,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC/C,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACd,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;gBAC3D,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACrD,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CACF,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assert = assert;
|
|
4
|
-
exports.assertValidation = assertValidation;
|
|
5
|
-
const beta_1 = require("@ajs/api/beta");
|
|
6
|
-
function assert(condition, code, message) {
|
|
7
|
-
if (!condition) {
|
|
8
|
-
throw new beta_1.HTTPResult(code, message);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
function assertValidation(body, validator, errorFunc, code = 400) {
|
|
12
|
-
try {
|
|
13
|
-
return validator(body);
|
|
14
|
-
}
|
|
15
|
-
catch (e) {
|
|
16
|
-
const errObj = errorFunc ? errorFunc(e) : 'toString' in e ? e.toString() : String(e);
|
|
17
|
-
throw new beta_1.HTTPResult(code, errObj);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=dev.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../src/interfaces/api-util/dev.ts"],"names":[],"mappings":";;AAwBA,wBAIC;AA0BD,4CAYC;AAlED,wCAA2C;AAwB3C,SAAgB,MAAM,CAAI,SAAY,EAAE,IAAY,EAAE,OAAe;IACnE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,iBAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;AACH,CAAC;AA0BD,SAAgB,gBAAgB,CAC9B,IAAa,EACb,SAA+B,EAC/B,SAAiC,EACjC,IAAI,GAAG,GAAG;IAEV,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAAC,OAAO,CAAM,EAAE,CAAC;QAChB,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACrF,MAAM,IAAI,iBAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;AACH,CAAC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { HTTPResult, RequestContext } from '@ajs/api/beta';
|
|
2
|
-
import { PassThrough } from 'stream';
|
|
3
|
-
import WebSocket from 'ws';
|
|
4
|
-
declare const TestRoutingController0_base: import("@ajs/api/beta").ControllerClass<object>;
|
|
5
|
-
export declare class TestRoutingController0 extends TestRoutingController0_base {
|
|
6
|
-
test(): void;
|
|
7
|
-
testPrefixHigh(): void;
|
|
8
|
-
testPrefixLow(): void;
|
|
9
|
-
testPriority(): void;
|
|
10
|
-
testPostfixHigh(): void;
|
|
11
|
-
testPostfixLow(): void;
|
|
12
|
-
testPrefixEarlyReturn(): string;
|
|
13
|
-
testEarlyReturn(): string;
|
|
14
|
-
testOverride(): string;
|
|
15
|
-
testPostfixOverride(): string;
|
|
16
|
-
}
|
|
17
|
-
declare const TestRoutingController1_base: import("@ajs/api/beta").ControllerClass<object>;
|
|
18
|
-
export declare class TestRoutingController1 extends TestRoutingController1_base {
|
|
19
|
-
test(): string;
|
|
20
|
-
testPost(): string;
|
|
21
|
-
testPut(): string;
|
|
22
|
-
testDelete(): string;
|
|
23
|
-
testCustom(): string;
|
|
24
|
-
}
|
|
25
|
-
declare const TestRoutingController2_base: typeof TestRoutingController1;
|
|
26
|
-
export declare class TestRoutingController2 extends TestRoutingController2_base {
|
|
27
|
-
test(): string;
|
|
28
|
-
}
|
|
29
|
-
declare const TestRoutingController3_base: import("@ajs/api/beta").ControllerClass<object>;
|
|
30
|
-
export declare class TestRoutingController3 extends TestRoutingController3_base {
|
|
31
|
-
test(): void;
|
|
32
|
-
}
|
|
33
|
-
declare const TestExecutionController1_base: import("@ajs/api/beta").ControllerClass<object>;
|
|
34
|
-
export declare class TestExecutionController1 extends TestExecutionController1_base {
|
|
35
|
-
prop: string;
|
|
36
|
-
testProperty(): string;
|
|
37
|
-
testParameter(param: string): string;
|
|
38
|
-
}
|
|
39
|
-
declare const TestExecutionController2_base: import("@ajs/api/beta").ControllerClass<object>;
|
|
40
|
-
export declare class TestExecutionController2 extends TestExecutionController2_base {
|
|
41
|
-
testProviderContext(_ctx: RequestContext): void;
|
|
42
|
-
testProviderRawBody(_body: Buffer): void;
|
|
43
|
-
testProviderParameterParam(_param: string): void;
|
|
44
|
-
testProviderParameterHeader(_param: string): void;
|
|
45
|
-
testProviderParameterQuery(_param: string): void;
|
|
46
|
-
testProviderMultiParameterHeader(_params: string[]): void;
|
|
47
|
-
testProviderMultiParameterQuery(_params: string[]): void;
|
|
48
|
-
testProviderWriteStream(param: PassThrough): void;
|
|
49
|
-
testProviderResult(): string;
|
|
50
|
-
testProviderResultPostfix(_res: string): void;
|
|
51
|
-
testModifierTransform(_param: string): void;
|
|
52
|
-
}
|
|
53
|
-
declare const TestExecutionController3_base: import("@ajs/api/beta").ControllerClass<object>;
|
|
54
|
-
export declare class TestExecutionController3 extends TestExecutionController3_base {
|
|
55
|
-
test(): HTTPResult;
|
|
56
|
-
testThrow(): void;
|
|
57
|
-
testStatus(): HTTPResult;
|
|
58
|
-
testHeader(): HTTPResult;
|
|
59
|
-
testBody(): HTTPResult;
|
|
60
|
-
testConsistencyPrefix(res: HTTPResult): void;
|
|
61
|
-
testConsistency(res: HTTPResult): HTTPResult;
|
|
62
|
-
testConsistencyPostfix(res: HTTPResult): void;
|
|
63
|
-
testControllerInstance(ctx: RequestContext): Promise<string>;
|
|
64
|
-
}
|
|
65
|
-
declare const TestWebsocketController1_base: import("@ajs/api/beta").ControllerClass<object>;
|
|
66
|
-
export declare class TestWebsocketController1 extends TestWebsocketController1_base {
|
|
67
|
-
test(connection: WebSocket): void;
|
|
68
|
-
}
|
|
69
|
-
export {};
|