@kalutskii/foundation 0.4.2 → 0.4.3
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/dist/index.d.ts +1 -3
- package/dist/index.js +0 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -45,8 +45,6 @@ declare function failure({ status, error }: {
|
|
|
45
45
|
declare function fetchSafely<TResult extends APIContractResult<unknown>>(fetcher: () => Promise<TResult>): Promise<FetchResult<APIContractData<TResult>>>;
|
|
46
46
|
/** Resolves an APIContractResult fetcher, throwing an error if the result is an APIError. */
|
|
47
47
|
declare function fetchAndThrow<TResult extends APIContractResult<unknown>>(fetcher: () => Promise<TResult>): Promise<APIContractData<TResult>>;
|
|
48
|
-
/** Pure type guard to check if a response is an APIContractResult. */
|
|
49
|
-
declare function isAPIResponse<TResponseData extends object>(responseData: TResponseData): responseData is TResponseData & APIContractResult<unknown>;
|
|
50
48
|
|
|
51
49
|
/**
|
|
52
50
|
* Global error handler for Hono framework. Catches all exceptions thrown in route handlers and middlewares.
|
|
@@ -214,4 +212,4 @@ declare class ZodJWTService<TPayloadOrSchema> {
|
|
|
214
212
|
verifyOrThrow(token: string, secret: string): Promise<Payload<TPayloadOrSchema>>;
|
|
215
213
|
}
|
|
216
214
|
|
|
217
|
-
export { type APIContractData, type APIContractError, type APIContractResult, type APIError, type APISuccess, EXCEPTION_STATUS_CODES, type ExceptionStatusCode, type FetchResult, type JWTServiceOptions, type JWTSignOptions, type Payload, type PayloadSchema, SUCCESS_STATUS_CODES, type SerializeDates, type SuccessStatusCode, type XOR, ZodJWTService, asQueryBoolean, asQueryNumber, failure, fetchAndThrow, fetchSafely, formatTime, generateRandomString, getColoredHTTPStatus, getFormattedDate, getFormattedTime, getUTCOffset, getZonedTime, honoLoggingHandler,
|
|
215
|
+
export { type APIContractData, type APIContractError, type APIContractResult, type APIError, type APISuccess, EXCEPTION_STATUS_CODES, type ExceptionStatusCode, type FetchResult, type JWTServiceOptions, type JWTSignOptions, type Payload, type PayloadSchema, SUCCESS_STATUS_CODES, type SerializeDates, type SuccessStatusCode, type XOR, ZodJWTService, asQueryBoolean, asQueryNumber, failure, fetchAndThrow, fetchSafely, formatTime, generateRandomString, getColoredHTTPStatus, getFormattedDate, getFormattedTime, getUTCOffset, getZonedTime, honoLoggingHandler, log, onHandlerError, respond, safeExecute, success };
|
package/dist/index.js
CHANGED
|
@@ -23,12 +23,6 @@ async function fetchAndThrow(fetcher) {
|
|
|
23
23
|
throw new Error(response.error);
|
|
24
24
|
return response.data;
|
|
25
25
|
}
|
|
26
|
-
function isAPIResponse(responseData) {
|
|
27
|
-
if (!("kind" in responseData) || !("status" in responseData))
|
|
28
|
-
return false;
|
|
29
|
-
const { kind, status } = responseData;
|
|
30
|
-
return (kind === "data" || kind === "error") && (typeof status === "number" || typeof status === "string");
|
|
31
|
-
}
|
|
32
26
|
|
|
33
27
|
// src/hono/hono.execution.ts
|
|
34
28
|
import { HTTPException } from "hono/http-exception";
|
|
@@ -229,7 +223,6 @@ export {
|
|
|
229
223
|
getUTCOffset,
|
|
230
224
|
getZonedTime,
|
|
231
225
|
honoLoggingHandler,
|
|
232
|
-
isAPIResponse,
|
|
233
226
|
log,
|
|
234
227
|
onHandlerError,
|
|
235
228
|
respond,
|