milkio 1.0.0-beta.99 → 1.0.1
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/LICENSE +20 -20
- package/action/index.d.ts +4 -5
- package/context/index.d.ts +1 -4
- package/event/index.d.ts +8 -1
- package/exception/index.d.ts +1 -1
- package/execute/index.d.ts +3 -2
- package/index.d.ts +0 -2
- package/index.js +261 -153
- package/meta/index.d.ts +2 -2
- package/package.json +12 -1
- package/stream/index.d.ts +1 -3
- package/types/index.d.ts +1 -0
- package/utils/revive-json-parse.d.ts +1 -0
- package/world/index.d.ts +12 -9
- package/bootstrap/index.d.ts +0 -3
- package/handler/index.d.ts +0 -3
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023 akirarika
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 akirarika
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/action/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { $meta } from "../meta/index.ts";
|
|
2
|
+
import { $context } from "../context/index.ts";
|
|
3
3
|
export type ActionInit = {
|
|
4
|
-
meta?:
|
|
4
|
+
meta?: Record<any, any>;
|
|
5
5
|
handler: (context: $context, params: any) => Promise<unknown>;
|
|
6
6
|
};
|
|
7
7
|
export type Action<ActionInitT extends ActionInit> = {
|
|
8
|
-
$
|
|
9
|
-
meta: ActionInitT["meta"] extends undefined ? {} : ActionInitT["meta"];
|
|
8
|
+
meta?: $meta;
|
|
10
9
|
handler: ActionInitT["handler"];
|
|
11
10
|
};
|
package/context/index.d.ts
CHANGED
|
@@ -3,16 +3,13 @@ export interface $context {
|
|
|
3
3
|
_: MilkioRuntimeInit<MilkioInit>;
|
|
4
4
|
develop: boolean;
|
|
5
5
|
executeId: string;
|
|
6
|
-
emit: MilkioRuntimeInit<MilkioInit>["emit"];
|
|
7
6
|
path: string;
|
|
8
7
|
logger: Logger;
|
|
9
8
|
http: ContextHttp<Record<any, any>>;
|
|
10
9
|
headers: Headers;
|
|
11
10
|
config: Readonly<Awaited<ReturnType<$types["configSchema"]["get"]>>>;
|
|
12
11
|
typia: Readonly<$types["generated"]["typiaSchema"]>;
|
|
13
|
-
call: <Module extends Promise<
|
|
14
|
-
default: Action<any>;
|
|
15
|
-
}>>(module: Module, params: Parameters<Awaited<Module>["default"]["handler"]>[1]) => Promise<ReturnType<Awaited<Module>["default"]["handler"]>>;
|
|
12
|
+
call: <Module extends Promise<Action<any>>>(module: Module, params: Parameters<Awaited<Module>["handler"]>[1]) => Promise<ReturnType<Awaited<Module>["handler"]>>;
|
|
16
13
|
onFinally: (handler: () => void | Promise<void>) => void;
|
|
17
14
|
}
|
|
18
15
|
export interface ContextHttp<ParamsParsed = any> {
|
package/event/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { $context, ContextHttp, Results, Logger, $meta } from "../index.ts";
|
|
2
2
|
export interface $events {
|
|
3
|
+
"*": {
|
|
4
|
+
key: keyof $events;
|
|
5
|
+
value: any;
|
|
6
|
+
};
|
|
3
7
|
"milkio:httpRequest": {
|
|
4
8
|
executeId: string;
|
|
5
9
|
path: string;
|
|
@@ -12,6 +16,7 @@ export interface $events {
|
|
|
12
16
|
logger: Logger;
|
|
13
17
|
http: ContextHttp<Record<string, any>>;
|
|
14
18
|
context: $context;
|
|
19
|
+
success: boolean;
|
|
15
20
|
};
|
|
16
21
|
"milkio:httpNotFound": {
|
|
17
22
|
executeId: string;
|
|
@@ -36,7 +41,9 @@ export interface $events {
|
|
|
36
41
|
};
|
|
37
42
|
}
|
|
38
43
|
export declare function __initEventManager(): {
|
|
39
|
-
on: <Key extends keyof $events, Handler extends (event: $events[Key]) => void>(key: Key, handler: Handler) => () => void;
|
|
44
|
+
on: <Key extends keyof $events, Handler extends (event: $events[Key]) => Promise<void | boolean> | void | boolean>(key: Key, handler: Handler) => () => void;
|
|
40
45
|
off: <Key extends keyof $events, Handler extends (event: $events[Key]) => void>(key: Key, handler: Handler) => void;
|
|
41
46
|
emit: <Key extends keyof $events, Value extends $events[Key]>(key: Key, value: Value) => Promise<void>;
|
|
47
|
+
emitAnyApproved: <Key extends keyof $events, Value extends $events[Key]>(key: Key, value: Value) => Promise<boolean>;
|
|
48
|
+
emitAllApproved: <Key extends keyof $events, Value extends $events[Key]>(key: Key, value: Value) => Promise<boolean>;
|
|
42
49
|
};
|
package/exception/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { MilkioResponseReject, Logger } from "../index.ts";
|
|
2
2
|
export interface $rejectCode {
|
|
3
|
-
FAIL: string;
|
|
4
3
|
REQUEST_FAIL: any;
|
|
5
4
|
NOT_DEVELOP_MODE: string;
|
|
6
5
|
REQUEST_TIMEOUT: {
|
|
@@ -34,6 +33,7 @@ export interface $rejectCode {
|
|
|
34
33
|
};
|
|
35
34
|
INTERNAL_SERVER_ERROR: undefined;
|
|
36
35
|
METHOD_NOT_ALLOWED: undefined;
|
|
36
|
+
NETWORK_ERROR: undefined;
|
|
37
37
|
}
|
|
38
38
|
export declare function reject<Code extends keyof $rejectCode, RejectData extends $rejectCode[Code]>(code: Code, data: RejectData): MilkioRejectError<Code, RejectData>;
|
|
39
39
|
export type MilkioRejectError<Code extends keyof $rejectCode = keyof $rejectCode, RejectData extends $rejectCode[Code] = $rejectCode[Code]> = {
|
package/execute/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { $context, $meta, Logger, Results, GeneratedInit } from "../index.ts";
|
|
2
2
|
export declare function __initExecuter(generated: GeneratedInit, runtime: any): {
|
|
3
3
|
__call: (context: $context, module: {
|
|
4
|
-
|
|
4
|
+
meta: any;
|
|
5
|
+
handler: any;
|
|
5
6
|
}, params?: any) => Promise<any>;
|
|
6
7
|
__execute: (routeSchema: any, options: {
|
|
7
8
|
createdExecuteId: string;
|
|
8
9
|
createdLogger: Logger;
|
|
9
10
|
path: string;
|
|
10
11
|
headers: Record<string, string> | Headers;
|
|
11
|
-
|
|
12
|
+
context: any | undefined;
|
|
12
13
|
} & ({
|
|
13
14
|
params: Record<any, any>;
|
|
14
15
|
paramsType: "raw";
|
package/index.d.ts
CHANGED
|
@@ -3,10 +3,8 @@ export * from "./type-safety/index.ts";
|
|
|
3
3
|
export * from "./types/index.ts";
|
|
4
4
|
export * from "./config/index.ts";
|
|
5
5
|
export * from "./execute/index.ts";
|
|
6
|
-
export * from "./bootstrap/index.ts";
|
|
7
6
|
export * from "./event/index.ts";
|
|
8
7
|
export * from "./flow/index.ts";
|
|
9
|
-
export * from "./handler/index.ts";
|
|
10
8
|
export * from "./world/index.ts";
|
|
11
9
|
export * from "./action/index.ts";
|
|
12
10
|
export * from "./stream/index.ts";
|