milkio 1.0.0-beta.15 → 1.0.0-beta.150

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/action/index.d.ts CHANGED
@@ -1,11 +1,10 @@
1
- import type { $context, $meta } from "../index.ts";
2
- export declare function action<ActionInitT extends ActionInit>(init: ActionInitT): Action<ActionInitT>;
1
+ import { MilkioMeta } from "../meta/index.ts";
2
+ import { MilkioContext } from "../context/index.ts";
3
3
  export type ActionInit = {
4
- meta?: $meta;
5
- handler: (context: $context, params: any) => Promise<unknown>;
4
+ meta?: Record<any, any>;
5
+ handler: (context: MilkioContext, params: any) => Promise<unknown>;
6
6
  };
7
7
  export type Action<ActionInitT extends ActionInit> = {
8
- $milkioType: "action";
9
- meta: ActionInitT["meta"] extends undefined ? {} : ActionInitT["meta"];
8
+ meta?: MilkioMeta;
10
9
  handler: ActionInitT["handler"];
11
10
  };
@@ -1,5 +1,5 @@
1
1
  import type { MilkioHttpRequest, MilkioHttpResponse, $types, Logger, Action, MilkioRuntimeInit, MilkioInit } from "../index.ts";
2
- export interface $context {
2
+ export interface MilkioContext {
3
3
  _: MilkioRuntimeInit<MilkioInit>;
4
4
  develop: boolean;
5
5
  executeId: string;
@@ -7,10 +7,10 @@ export interface $context {
7
7
  path: string;
8
8
  logger: Logger;
9
9
  http: ContextHttp<Record<any, any>>;
10
+ headers: Headers;
10
11
  config: Readonly<Awaited<ReturnType<$types["configSchema"]["get"]>>>;
11
- call: <Module extends Promise<{
12
- default: Action<any>;
13
- }>>(module: Module, params: Parameters<Awaited<Module>["default"]["handler"]>[1]) => Promise<ReturnType<Awaited<Module>["default"]["handler"]>>;
12
+ typia: Readonly<$types["generated"]["typiaSchema"]>;
13
+ call: <Module extends Promise<Action<any>>>(module: Module, params: Parameters<Awaited<Module>["handler"]>[1]) => Promise<ReturnType<Awaited<Module>["handler"]>>;
14
14
  onFinally: (handler: () => void | Promise<void>) => void;
15
15
  }
16
16
  export interface ContextHttp<ParamsParsed = any> {
@@ -27,4 +27,4 @@ export interface ContextHttp<ParamsParsed = any> {
27
27
  request: MilkioHttpRequest;
28
28
  response: MilkioHttpResponse;
29
29
  }
30
- export type ContextCreatedHandler = (context: $context) => Promise<void> | void;
30
+ export type ContextCreatedHandler = (context: MilkioContext) => Promise<void> | void;
package/event/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
- import type { $context, ContextHttp, Results, Logger, $meta } from "../index.ts";
1
+ import type { MilkioContext, ContextHttp, Results, Logger, MilkioMeta } 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;
@@ -11,7 +15,8 @@ export interface $events {
11
15
  path: string;
12
16
  logger: Logger;
13
17
  http: ContextHttp<Record<string, any>>;
14
- context: $context;
18
+ context: MilkioContext;
19
+ success: boolean;
15
20
  };
16
21
  "milkio:httpNotFound": {
17
22
  executeId: string;
@@ -23,15 +28,15 @@ export interface $events {
23
28
  executeId: string;
24
29
  path: string;
25
30
  logger: Logger;
26
- meta: $meta;
27
- context: $context;
31
+ meta: MilkioMeta;
32
+ context: MilkioContext;
28
33
  };
29
34
  "milkio:executeAfter": {
30
35
  executeId: string;
31
36
  path: string;
32
37
  logger: Logger;
33
- meta: $meta;
34
- context: $context;
38
+ meta: MilkioMeta;
39
+ context: MilkioContext;
35
40
  results: Results<any>;
36
41
  };
37
42
  }
@@ -33,6 +33,7 @@ export interface $rejectCode {
33
33
  expected: string;
34
34
  };
35
35
  INTERNAL_SERVER_ERROR: undefined;
36
+ METHOD_NOT_ALLOWED: undefined;
36
37
  }
37
38
  export declare function reject<Code extends keyof $rejectCode, RejectData extends $rejectCode[Code]>(code: Code, data: RejectData): MilkioRejectError<Code, RejectData>;
38
39
  export type MilkioRejectError<Code extends keyof $rejectCode = keyof $rejectCode, RejectData extends $rejectCode[Code] = $rejectCode[Code]> = {
@@ -1,2 +1,2 @@
1
- export type ExecuteIdGenerator = (request?: Request) => string | Promise<string>;
1
+ export type ExecuteIdGenerator = (headers?: Headers) => string | Promise<string>;
2
2
  export declare function defineDefaultExecuteIdGenerator(): () => string;
@@ -1,14 +1,15 @@
1
- import type { $context, $meta, Logger, Results, GeneratedInit } from "../index.ts";
1
+ import type { MilkioContext, MilkioMeta, Logger, Results, GeneratedInit } from "../index.ts";
2
2
  export declare function __initExecuter(generated: GeneratedInit, runtime: any): {
3
- __call: (context: $context, module: {
4
- default: any;
3
+ __call: (context: MilkioContext, module: {
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
- mixinContext: Record<any, any> | undefined;
12
+ context: any | undefined;
12
13
  } & ({
13
14
  params: Record<any, any>;
14
15
  paramsType: "raw";
@@ -20,8 +21,8 @@ export declare function __initExecuter(generated: GeneratedInit, runtime: any):
20
21
  headers: Headers;
21
22
  params: Record<any, unknown>;
22
23
  results: Results<any>;
23
- context: $context;
24
- meta: Readonly<$meta>;
24
+ context: MilkioContext;
25
+ meta: Readonly<MilkioMeta>;
25
26
  type: "action" | "stream";
26
27
  emptyResult: boolean;
27
28
  resultsTypeSafety: boolean;
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
+ export * from "./utils/part.ts";
1
2
  export * from "./type-safety/index.ts";
2
- export * from "@southern-aurora/tson";
3
3
  export * from "./types/index.ts";
4
4
  export * from "./config/index.ts";
5
5
  export * from "./execute/index.ts";
@@ -8,9 +8,9 @@ export * from "./event/index.ts";
8
8
  export * from "./flow/index.ts";
9
9
  export * from "./handler/index.ts";
10
10
  export * from "./world/index.ts";
11
- export * from "./command/index.ts";
12
11
  export * from "./action/index.ts";
13
12
  export * from "./stream/index.ts";
13
+ export * from "./typia/index.ts";
14
14
  export * from "./logger/index.ts";
15
15
  export * from "./context/index.ts";
16
16
  export * from "./meta/index.ts";