milkio 0.0.18 → 0.0.20

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.
@@ -148,7 +148,7 @@ export function defineHttpHandler(app: MilkioApp, options: ExecuteHttpServerOpti
148
148
 
149
149
  // @ts-ignore
150
150
  // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression, @typescript-eslint/no-explicit-any
151
- response.body = `${response.body ?? ""}${result}`
151
+ if (!response.body) response.body = result
152
152
 
153
153
  // before response middleware
154
154
  const middlewareResponse = {
@@ -166,7 +166,7 @@ export function defineHttpHandler(app: MilkioApp, options: ExecuteHttpServerOpti
166
166
  status: response.status,
167
167
  responseHeaders: response.headers,
168
168
  // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
169
- body: response.body || "",
169
+ body: response.body?.toString() ?? "",
170
170
  timeout: new Date().getTime()
171
171
  })
172
172
 
@@ -186,8 +186,7 @@ export type MilkioHTTPRequest = {
186
186
  export type MilkioHTTPResponse = Mixin<
187
187
  ResponseInit,
188
188
  {
189
- //
190
- body: string;
189
+ body: string | BodyInit;
191
190
  status: number;
192
191
  headers: Record<string, string>;
193
192
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "milkio",
3
3
  "type": "module",
4
4
  "module": "index.ts",
5
- "version": "0.0.18",
5
+ "version": "0.0.20",
6
6
  "peerDependencies": {
7
7
  "typescript": "^5.4.2"
8
8
  },
@@ -97,7 +97,7 @@ import type * as <%= utils.camel(path.slice(0, -3).replaceAll('/', '$')) %> from
97
97
  type ParamsT = Parameters<typeof <%= utils.camel(path.replaceAll('/', '$').slice(0, -${3})) %>['api']['action']>[0];
98
98
  export const validateParams = async (params: any) => typia.misc.validatePrune<ParamsT>(params);
99
99
  type ResultsT = Awaited<ReturnType<typeof <%= utils.camel(path.replaceAll('/', '$').slice(0, -${3})) %>['api']['action']>>;
100
- export const validateResults = async (results: any) => { _validate(typia.validate<TSONEncode<ExecuteResultSuccess<ResultsT>>>(results)); return typia.json.stringify<TSONEncode<ExecuteResultSuccess<ResultsT>>>(results); };
100
+ export const validateResults = async (results: any) => { _validate(typia.validate<TSONEncode<ExecuteResultSuccess<ResultsT> | ExecuteResultFail>>(results)); return typia.json.stringify<TSONEncode<ExecuteResultSuccess<ResultsT>>>(results); };
101
101
  export const randParams = async () => typia.random<ParamsT>();
102
102
  `.trim()
103
103
  // export const paramsSchema = typia.json.application<[{ data: ParamsT }], "swagger">();
package/templates/api.ts CHANGED
@@ -8,7 +8,7 @@ await createTemplate(async (tools) => {
8
8
  import { defineApi, defineApiTest } from "milkio"
9
9
 
10
10
  /**
11
- * ${tools.name} ${tools.src()}
11
+ * ${tools.name}
12
12
  */
13
13
  export const api = defineApi({
14
14
  meta: {