milkio 1.3.70 → 1.3.72
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/failure/index.d.ts +121 -0
- package/index.d.ts +1 -1
- package/index.js +1827 -1515
- package/listener/index.d.ts +3 -0
- package/package.json +1 -1
- package/types/index.d.ts +3 -4
- package/world/index.d.ts +11 -1
- package/exception/index.d.ts +0 -48
package/listener/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Mixin, GeneratedInit } from "../index.ts";
|
|
2
2
|
import type { __initExecuter } from "../execute/index.ts";
|
|
3
3
|
export type MilkioHttpRequest = Request;
|
|
4
|
+
/** HTTP request body size limit used when the runtime does not configure one: 10KB. */
|
|
5
|
+
export declare const DEFAULT_BODY_LIMIT: number;
|
|
4
6
|
export type MilkioHttpResponse = Mixin<ResponseInit, {
|
|
5
7
|
body: string | ReadableStream<Uint8Array> | Uint8Array | ArrayBuffer | Blob | null;
|
|
6
8
|
status: number;
|
|
@@ -8,6 +10,7 @@ export type MilkioHttpResponse = Mixin<ResponseInit, {
|
|
|
8
10
|
}>;
|
|
9
11
|
export declare function __initListener(generated: GeneratedInit, runtime: any, executer: ReturnType<typeof __initExecuter>): {
|
|
10
12
|
port: any;
|
|
13
|
+
bodyLimit: any;
|
|
11
14
|
fetch: (options: {
|
|
12
15
|
request: MilkioHttpRequest;
|
|
13
16
|
envMode?: string;
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MilkioFailureWire } from "../failure/index.ts";
|
|
2
2
|
export interface $types {
|
|
3
3
|
[key: string]: Record<any, any>;
|
|
4
4
|
}
|
|
@@ -47,11 +47,10 @@ export interface ExecuteResultsOption {
|
|
|
47
47
|
}
|
|
48
48
|
export type ExecuteActionResults<Path extends keyof Generated["routeSchema"], Generated extends $types["generated"] = $types["generated"]> = Generated["routeSchema"][Path]["result"];
|
|
49
49
|
export type ExecuteStreamResults<Path extends keyof Generated["routeSchema"], Generated extends $types["generated"] = $types["generated"]> = GeneratorGeneric<Generated["routeSchema"][Path]["result"]>;
|
|
50
|
-
export interface
|
|
50
|
+
export interface MilkioResponseFailure {
|
|
51
51
|
success: false;
|
|
52
|
-
code: Code;
|
|
53
|
-
reject: $rejectCode[Code];
|
|
54
52
|
executeId: string;
|
|
53
|
+
error: MilkioFailureWire;
|
|
55
54
|
}
|
|
56
55
|
export interface MilkioResponseSuccess<Path extends keyof Generated["routeSchema"], Generated extends $types["generated"] = $types["generated"]> {
|
|
57
56
|
success: true;
|
package/world/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type $types, __initListener, __initEventManager, type ExecuteId, type Logger, type Mixin, type GeneratedInit, type Ping, type LoggerSubmittingHandler, type LoggerInsertingHandler, type CorsConfig } from "../index.ts";
|
|
1
|
+
import { type $types, __initListener, __initEventManager, type ExecuteId, type Logger, type Mixin, type GeneratedInit, type Ping, type LoggerSubmittingHandler, type LoggerInsertingHandler, type CorsConfig, type MilkioFaultReport } from "../index.ts";
|
|
2
2
|
export interface MilkioInit {
|
|
3
3
|
port: number;
|
|
4
4
|
develop: boolean;
|
|
@@ -6,12 +6,22 @@ export interface MilkioInit {
|
|
|
6
6
|
accessKey?: string;
|
|
7
7
|
http?: {
|
|
8
8
|
cors?: CorsConfig;
|
|
9
|
+
/**
|
|
10
|
+
* HTTP request body size limit in bytes. Only applies to HTTP requests;
|
|
11
|
+
* the message/worker path has no raw body and is never limited.
|
|
12
|
+
* @default 10240 (10KB)
|
|
13
|
+
*/
|
|
14
|
+
bodyLimit?: number;
|
|
15
|
+
/** Alias of `bodyLimit`. */
|
|
16
|
+
maxBodySize?: number;
|
|
9
17
|
};
|
|
10
18
|
ignorePathLevel?: number;
|
|
11
19
|
realIp?: (headers: Headers) => string;
|
|
12
20
|
executeId?: (headers: Headers) => string | Promise<string>;
|
|
13
21
|
onLoggerSubmitting?: LoggerSubmittingHandler;
|
|
14
22
|
onLoggerInserting?: LoggerInsertingHandler;
|
|
23
|
+
/** called only for fault-level failures (unexpected/internal); never for fail (business rejections) */
|
|
24
|
+
onError?: (report: MilkioFaultReport) => void;
|
|
15
25
|
bootstraps?: Array<(world: any) => Promise<void> | void>;
|
|
16
26
|
}
|
|
17
27
|
export type MilkioRuntimeInit<T extends MilkioInit> = Mixin<T, {
|
package/exception/index.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { MilkioResponseReject, Logger } from "../index.ts";
|
|
2
|
-
export interface $rejectCode {
|
|
3
|
-
REQUEST_FAIL: any;
|
|
4
|
-
NOT_DEVELOP_MODE: string;
|
|
5
|
-
REQUEST_TIMEOUT: {
|
|
6
|
-
timeout: number;
|
|
7
|
-
message: string;
|
|
8
|
-
};
|
|
9
|
-
NOT_FOUND: {
|
|
10
|
-
path: string;
|
|
11
|
-
};
|
|
12
|
-
PARAMS_TYPE_INCORRECT: {
|
|
13
|
-
path: string;
|
|
14
|
-
expected: string;
|
|
15
|
-
value: any;
|
|
16
|
-
message: string;
|
|
17
|
-
} | null;
|
|
18
|
-
RESULTS_TYPE_INCORRECT: {
|
|
19
|
-
path: string;
|
|
20
|
-
expected: string;
|
|
21
|
-
value: any;
|
|
22
|
-
message: string;
|
|
23
|
-
} | null;
|
|
24
|
-
UNACCEPTABLE: {
|
|
25
|
-
expected: string;
|
|
26
|
-
message: string;
|
|
27
|
-
};
|
|
28
|
-
PARAMS_TYPE_NOT_SUPPORTED: {
|
|
29
|
-
expected: string;
|
|
30
|
-
contentType: string | null;
|
|
31
|
-
params: string;
|
|
32
|
-
};
|
|
33
|
-
RESULTS_TYPE_NOT_SUPPORTED: {
|
|
34
|
-
expected: string;
|
|
35
|
-
};
|
|
36
|
-
INTERNAL_SERVER_ERROR: undefined;
|
|
37
|
-
METHOD_NOT_ALLOWED: undefined;
|
|
38
|
-
NETWORK_ERROR: undefined;
|
|
39
|
-
}
|
|
40
|
-
export declare function reject(code: string, data?: any): MilkioRejectError<any, any>;
|
|
41
|
-
export declare function raise(obj: Record<string, any>): MilkioRejectError<any, any>;
|
|
42
|
-
export type MilkioRejectError<Code extends keyof $rejectCode = keyof $rejectCode, RejectData extends $rejectCode[Code] = $rejectCode[Code]> = {
|
|
43
|
-
code: Code;
|
|
44
|
-
data: RejectData;
|
|
45
|
-
stack: string;
|
|
46
|
-
$milkioReject: true;
|
|
47
|
-
};
|
|
48
|
-
export declare function exceptionHandler(executeId: string, logger: Logger, error: MilkioRejectError<any, any> | any): MilkioResponseReject;
|