milkio 1.0.0-alpha.29 → 1.0.0-alpha.30
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/config/index.ts +1 -1
- package/execute/index.ts +2 -2
- package/package.json +1 -1
- package/world/index.ts +6 -1
package/config/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ export const config = <ConfigDefaultT extends ConfigDefault, ConfigEnvironmentsT
|
|
|
4
4
|
return [def, envs];
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const __getConfig = async <Namespace extends keyof $types["generated"]["configSchema"]>(generated: GeneratedInit, env: Record<any, any>, envMode: string, namespace: Namespace) => {
|
|
8
8
|
if (generated.configSchema[namespace][1] && envMode in generated.configSchema[namespace][1]) {
|
|
9
9
|
return {
|
|
10
10
|
...(await generated.configSchema[namespace][0](env)),
|
package/execute/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import typia, { type IValidation } from "typia";
|
|
2
2
|
import { TSON } from "@southern-aurora/tson";
|
|
3
|
-
import { reject, type $context, type $meta, type Logger, type Results, type GeneratedInit,
|
|
3
|
+
import { reject, type $context, type $meta, type Logger, type Results, type GeneratedInit, __getConfig } from "..";
|
|
4
4
|
import { headersToJSON } from "../utils/headers-to-json";
|
|
5
5
|
|
|
6
6
|
export const __initExecuter = (generated: GeneratedInit, runtime: any) => {
|
|
@@ -70,7 +70,7 @@ export const __initExecuter = (generated: GeneratedInit, runtime: any) => {
|
|
|
70
70
|
path: options.path,
|
|
71
71
|
logger: options.createdLogger,
|
|
72
72
|
executeId: options.createdExecuteId,
|
|
73
|
-
getConfig: (namespace: string) =>
|
|
73
|
+
getConfig: (namespace: string) => __getConfig(generated, env, envMode, namespace),
|
|
74
74
|
call: (module: any, options: any) => __call(context, module, options),
|
|
75
75
|
} as unknown as $context;
|
|
76
76
|
const results: Results<any> = { value: undefined };
|
package/package.json
CHANGED
package/world/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __initCommander, __initListener, __initExecuter, __initEventManager, type ExecuteId, type Logger, type Mixin, type GeneratedInit, type Ping, type LoggerSubmittingHandler, type LoggerInsertingHandler, type $context } from "..";
|
|
1
|
+
import { __initCommander, __initListener, __initExecuter, __initEventManager, type ExecuteId, type Logger, type Mixin, type GeneratedInit, type Ping, type LoggerSubmittingHandler, type LoggerInsertingHandler, type $context, $types, __getConfig } from "..";
|
|
2
2
|
import { defineDefaultExecuteIdGenerator } from "../execute/execute-id-generator";
|
|
3
3
|
|
|
4
4
|
export type MilkioInit = {
|
|
@@ -54,6 +54,8 @@ export const createWorld = async <MilkioOptions extends MilkioInit>(generated: G
|
|
|
54
54
|
const executer = __initExecuter(generated, _);
|
|
55
55
|
const commander = __initCommander(generated, _);
|
|
56
56
|
const listener = __initListener(generated, _, executer);
|
|
57
|
+
// functions
|
|
58
|
+
const getConfig = (namespace: keyof $types["generated"]["configSchema"], env: Record<any, any>, envMode: string) => __getConfig(generated, env, envMode, namespace);
|
|
57
59
|
|
|
58
60
|
// Initialize the app
|
|
59
61
|
const app = {
|
|
@@ -66,6 +68,8 @@ export const createWorld = async <MilkioOptions extends MilkioInit>(generated: G
|
|
|
66
68
|
commander,
|
|
67
69
|
// listener
|
|
68
70
|
listener,
|
|
71
|
+
// functions
|
|
72
|
+
getConfig,
|
|
69
73
|
};
|
|
70
74
|
|
|
71
75
|
runtime.app = app;
|
|
@@ -84,4 +88,5 @@ export type MilkioWorld<MilkioOptions extends MilkioInit = MilkioInit> = {
|
|
|
84
88
|
commander: Awaited<ReturnType<typeof __initCommander>>;
|
|
85
89
|
// listener
|
|
86
90
|
listener: Awaited<ReturnType<typeof __initListener>>;
|
|
91
|
+
getConfig: <Namespace extends keyof $types["generated"]["configSchema"]>(namespace: Namespace, env: Record<any, any>, envMode: string) => Promise<Readonly<Awaited<ReturnType<$types["generated"]["configSchema"][Namespace][0]>>>>;
|
|
87
92
|
};
|