@busy-hour/blaze
Advanced tools
Comparing version 4.0.0-0 to 4.0.0-1
@@ -5,2 +5,9 @@ # Changelog | ||
## [4.0.0-1](https://github.com/Busy-Hour-Studio/blaze/compare/v4.0.0-0...v4.0.0-1) (2024-09-16) | ||
### Bug Fixes | ||
* after hooks result turns to any ([4e8988d](https://github.com/Busy-Hour-Studio/blaze/commit/4e8988d6613e6830b7fb99e021b1d1950ec6fbc7)) | ||
## [4.0.0-0](https://github.com/busy-hour-studio/blaze/compare/v3.4.0...v4.0.0-0) (2024-09-13) | ||
@@ -7,0 +14,0 @@ |
@@ -49,12 +49,11 @@ "use strict"; | ||
function getRestResponse(options) { | ||
const result = options.result; | ||
const { status, headers } = options.ctx; | ||
if (!status) { | ||
return [result, void 0, void 0]; | ||
return [options.result, void 0, void 0]; | ||
} | ||
if ((0, import_common.isEmpty)(headers)) { | ||
return [result, status, void 0]; | ||
return [options.result, status, void 0]; | ||
} | ||
const resHeaders = (0, import_common.mapToObject)(options.ctx.headers); | ||
return [result, status, resHeaders]; | ||
return [options.result, status, resHeaders]; | ||
} | ||
@@ -61,0 +60,0 @@ function handleRestError(options) { |
@@ -27,2 +27,3 @@ "use strict"; | ||
var import_url = require("hono/utils/url"); | ||
var import_BlazeError = require("../../errors/BlazeError"); | ||
function assignOpenAPIRegistry(router, docPath, def) { | ||
@@ -60,3 +61,3 @@ if (!router.openAPIRegistry) | ||
const errorIfNotExhaustive = def; | ||
throw new Error(`Unknown registry type: ${errorIfNotExhaustive}`); | ||
throw new import_BlazeError.BlazeError(`Unknown registry type: ${errorIfNotExhaustive}`); | ||
} | ||
@@ -63,0 +64,0 @@ } |
@@ -22,12 +22,11 @@ // src/utils/helper/rest.ts | ||
function getRestResponse(options) { | ||
const result = options.result; | ||
const { status, headers } = options.ctx; | ||
if (!status) { | ||
return [result, void 0, void 0]; | ||
return [options.result, void 0, void 0]; | ||
} | ||
if (isEmpty(headers)) { | ||
return [result, status, void 0]; | ||
return [options.result, status, void 0]; | ||
} | ||
const resHeaders = mapToObject(options.ctx.headers); | ||
return [result, status, resHeaders]; | ||
return [options.result, status, resHeaders]; | ||
} | ||
@@ -34,0 +33,0 @@ function handleRestError(options) { |
// src/utils/helper/router.ts | ||
import { mergePath } from "hono/utils/url"; | ||
import { BlazeError } from "../../errors/BlazeError.js"; | ||
function assignOpenAPIRegistry(router, docPath, def) { | ||
@@ -35,3 +36,3 @@ if (!router.openAPIRegistry) | ||
const errorIfNotExhaustive = def; | ||
throw new Error(`Unknown registry type: ${errorIfNotExhaustive}`); | ||
throw new BlazeError(`Unknown registry type: ${errorIfNotExhaustive}`); | ||
} | ||
@@ -38,0 +39,0 @@ } |
@@ -8,3 +8,3 @@ import type { BlazeContext } from '../internal'; | ||
export interface AfterHookHandler<R = unknown | void, M extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, P extends RecordUnknown = RecordUnknown, Q extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown> { | ||
(ctx: BlazeContext<M, H, P, Q, B>, res: never): Promise<R>; | ||
(ctx: BlazeContext<M, H, P, Q, B>, res: Random): Promise<R>; | ||
} | ||
@@ -11,0 +11,0 @@ export type AnyAfterHookHandler = AfterHookHandler<Random, Random, Random, Random, Random, Random>; |
import type { StatusCode } from 'hono/utils/http-status'; | ||
import type { BlazeRouter } from '../../router'; | ||
import { Random } from '../../types/helper'; | ||
import type { Method, RestErrorHandlerOption, RestParam, RestResponseHandlerOption, RestRoute } from '../../types/rest'; | ||
@@ -8,3 +9,3 @@ export declare function extractRestPath(restRoute: RestRoute): readonly [null, string] | readonly [Method, string]; | ||
export declare function getRestResponse(options: Omit<RestResponseHandlerOption, 'honoCtx'>): readonly [ | ||
never, | ||
Random, | ||
StatusCode | undefined, | ||
@@ -14,2 +15,2 @@ Record<string, string | string[]> | undefined | ||
export declare function handleRestError(options: RestErrorHandlerOption): Response & import("hono").TypedResponse<never, 500 | 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 | -1, "json">; | ||
export declare function handleRestResponse(options: RestResponseHandlerOption): Response; | ||
export declare function handleRestResponse(options: RestResponseHandlerOption): Response | Promise<Response>; |
@@ -7,3 +7,3 @@ { | ||
"type": "module", | ||
"version": "4.0.0-0", | ||
"version": "4.0.0-1", | ||
"license": "MIT", | ||
@@ -42,2 +42,9 @@ "devDependencies": { | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Busy-Hour-Studio/blaze.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Busy-Hour-Studio/blaze/issues" | ||
}, | ||
"author": "Muhammad Firdaus Sati (https://github.com/krsbx)", | ||
@@ -44,0 +51,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
234408
6189
0
5