@busy-hour/blaze
Advanced tools
Comparing version 3.3.0-0 to 3.3.0-1
@@ -5,2 +5,4 @@ # Changelog | ||
## [3.3.0-1](https://github.com/Busy-Hour-Studio/blaze/compare/v3.3.0-0...v3.3.0-1) (2024-06-08) | ||
## [3.3.0-0](https://github.com/Busy-Hour-Studio/blaze/compare/v3.2.0...v3.3.0-0) (2024-06-08) | ||
@@ -7,0 +9,0 @@ |
@@ -37,4 +37,4 @@ "use strict"; | ||
} | ||
// eslint-disable-next-line max-params | ||
async actionHandler(body, params, headers, query) { | ||
async actionHandler(...values) { | ||
const [body, params, headers, query] = values; | ||
const contextRes = await (0, import_common.createContext)({ | ||
@@ -41,0 +41,0 @@ honoCtx: null, |
@@ -15,4 +15,4 @@ // src/utils/setup/action.ts | ||
} | ||
// eslint-disable-next-line max-params | ||
async actionHandler(body, params, headers, query) { | ||
async actionHandler(...values) { | ||
const [body, params, headers, query] = values; | ||
const contextRes = await createContext({ | ||
@@ -19,0 +19,0 @@ honoCtx: null, |
import type { ZodEffects, ZodObject, ZodRawShape } from 'zod'; | ||
import type { Action, ActionValidator } from '../types/action'; | ||
import type { RecordUnknown } from '../types/helper'; | ||
export declare function createActionValidator<H extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, B extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, P extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, Q extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>>(validator: ActionValidator<H, B, P, Q>): ActionValidator<H, B, P, Q>; | ||
export declare function createAction<R, HR, M extends RecordUnknown, H extends ZodObject<ZodRawShape>, B extends ZodObject<ZodRawShape>, P extends ZodObject<ZodRawShape>, Q extends ZodObject<ZodRawShape>>(action: Action<R, HR, M, H, B, P, Q>): Action<R, HR, M, H, B, P, Q, import("..").AcceptedAfterHook<HR, M, B["_output"], P["_output"], H["_output"], Q["_output"]>, import("..").AcceptedBeforeHook<M, B["_output"], P["_output"], H["_output"], Q["_output"]>>; | ||
export declare function createActionValidator<H extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, P extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, Q extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, B extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>>(validator: ActionValidator<H, P, Q, B>): ActionValidator<H, P, Q, B>; | ||
export declare function createAction<R, HR, M extends RecordUnknown, H extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, P extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, Q extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, B extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>>(action: Action<R, HR, M, H, P, Q, B>): Action<R, HR, M, H, P, Q, B, import("..").AcceptedAfterHook<HR, M, H["_output"], P["_output"], Q["_output"], B["_output"]>, import("..").AcceptedBeforeHook<M, H["_output"], P["_output"], Q["_output"], B["_output"]>>; |
import type { RecordString, RecordUnknown } from '../types/helper'; | ||
import type { AfterHookHandler, BeforeHookHandler } from '../types/hooks'; | ||
export declare function createAfterHook<R, M extends RecordUnknown, B extends RecordUnknown, P extends RecordUnknown, H extends RecordString, Q extends RecordUnknown>(hook: AfterHookHandler<R, M, B, P, H, Q>): AfterHookHandler<R, M, B, P, H, Q>; | ||
export declare function createBeforeHook<M extends RecordUnknown, B extends RecordUnknown, P extends RecordUnknown, H extends RecordString, Q extends RecordUnknown>(hook: BeforeHookHandler<M, B, P, H, Q>): BeforeHookHandler<M, B, P, H, Q>; | ||
export declare function createAfterHook<R, M extends RecordUnknown, H extends RecordString, P extends RecordUnknown, Q extends RecordUnknown, B extends RecordUnknown>(hook: AfterHookHandler<R, M, H, P, Q, B>): AfterHookHandler<R, M, H, P, Q, B>; | ||
export declare function createBeforeHook<M extends RecordUnknown, H extends RecordString, P extends RecordUnknown, Q extends RecordUnknown, B extends RecordUnknown>(hook: BeforeHookHandler<M, H, P, Q, B>): BeforeHookHandler<M, H, P, Q, B>; |
import type { StatusCode } from 'hono/utils/http-status'; | ||
import type { ZodEffects, ZodObject, ZodRawShape } from 'zod'; | ||
import type { ContextConstructorOption, CreateContextOption } from '../types/context'; | ||
import type { ContextValidation, RecordString, RecordUnknown, ValidationResult } from '../types/helper'; | ||
import type { RecordString, RecordUnknown, ValidationResult } from '../types/helper'; | ||
import type { ResponseType } from '../types/rest'; | ||
import { BlazeBroker as Broker } from './BlazeBroker'; | ||
export declare class BlazeContext<M extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown, P extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, Q extends RecordUnknown = RecordUnknown> { | ||
export declare class BlazeContext<M extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, P extends RecordUnknown = RecordUnknown, Q extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown> { | ||
private readonly $honoCtx; | ||
@@ -24,3 +24,3 @@ private readonly $meta; | ||
readonly event: Broker['event']; | ||
constructor(options: ContextConstructorOption<M, B, P, H, Q>); | ||
constructor(options: ContextConstructorOption<M, H, P, Q, B>); | ||
get meta(): { | ||
@@ -44,3 +44,3 @@ set<K extends keyof M, V extends M[K]>(key: K, value: V): any; | ||
}; | ||
static create<M extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown, P extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, Q extends RecordUnknown = RecordUnknown, BV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, PV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, HV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, QV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, Validator extends Partial<ContextValidation<BV, PV, HV, QV>> = Partial<ContextValidation<BV, PV, HV, QV>>>(options: CreateContextOption<M, B, P, H, Q, BV, PV, HV, QV, Validator>): Promise<BlazeContext<M, B, P, H, Q>>; | ||
static create<M extends RecordUnknown, H extends RecordString, P extends RecordUnknown, Q extends RecordUnknown, B extends RecordUnknown, HV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, PV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, QV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, BV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>>(options: CreateContextOption<M, H, P, Q, B, HV, PV, QV, BV>): Promise<BlazeContext<M, H, P, Q, B>>; | ||
} |
@@ -7,10 +7,10 @@ import type { ResponseConfig } from '@asteasolutions/zod-to-openapi'; | ||
import type { Middleware, RestParam } from './rest'; | ||
export interface ActionValidator<B extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, P extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, H extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, Q extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>> { | ||
body?: B | null; | ||
export interface ActionValidator<H extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, P extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, Q extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, B extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>> { | ||
header?: H | null; | ||
params?: P | null; | ||
header?: H | null; | ||
query?: Q | null; | ||
body?: B | null; | ||
} | ||
export interface ActionHandler<R = unknown | void, M extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown, P extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, Q extends RecordUnknown = RecordUnknown> { | ||
(ctx: BlazeContext<M, B, P, H, Q>): Promise<R>; | ||
export interface ActionHandler<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>): Promise<R>; | ||
} | ||
@@ -26,10 +26,10 @@ export interface OpenAPIBody { | ||
} | ||
export interface Action<R = unknown | void, HR = unknown | void, M extends RecordUnknown = RecordUnknown, H extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, B extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, P extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, Q extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, AH extends AcceptedAfterHook<HR, M, B['_output'], P['_output'], H['_output'], Q['_output']> = AcceptedAfterHook<HR, M, B['_output'], P['_output'], H['_output'], Q['_output']>, BH extends AcceptedBeforeHook<M, B['_output'], P['_output'], H['_output'], Q['_output']> = AcceptedBeforeHook<M, B['_output'], P['_output'], H['_output'], Q['_output']>> { | ||
export interface Action<R = unknown | void, HR = unknown | void, M extends RecordUnknown = RecordUnknown, H extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, P extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, Q extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, B extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, AH extends AcceptedAfterHook<HR, M, H['_output'], P['_output'], Q['_output'], B['_output']> = AcceptedAfterHook<HR, M, H['_output'], P['_output'], Q['_output'], B['_output']>, BH extends AcceptedBeforeHook<M, H['_output'], P['_output'], Q['_output'], B['_output']> = AcceptedBeforeHook<M, H['_output'], P['_output'], Q['_output'], B['_output']>> { | ||
openapi?: ActionOpenAPI | null; | ||
middlewares?: Middleware[] | null; | ||
validator?: ActionValidator<B, P, H, Q> | null; | ||
handler: ActionHandler<R, M, B['_output'], P['_output'], H['_output'], Q['_output']>; | ||
validator?: ActionValidator<H, P, Q, B> | null; | ||
handler: ActionHandler<R, M, H['_output'], P['_output'], Q['_output'], B['_output']>; | ||
meta?: M | null; | ||
rest?: RestParam | null; | ||
hooks?: ActionHook<BH, AH> | null; | ||
hooks?: ActionHook<AH, BH> | null; | ||
throwOnValidationError?: boolean | null; | ||
@@ -45,5 +45,5 @@ } | ||
export type AnyAction = Action<Random, Random, Random, Random, Random, Random, Random, Random, Random>; | ||
export type AnyValidator = ActionValidator<ZodObject<ZodRawShape>, ZodObject<ZodRawShape>, ZodObject<ZodRawShape>, ZodObject<ZodRawShape>>; | ||
export type AnyValidator = ActionValidator<Random, Random, Random, Random>; | ||
export interface Actions { | ||
[key: string]: AnyAction; | ||
} |
@@ -1,2 +0,2 @@ | ||
export interface ActionEventCallRequest<Headers, Params, Body, Result, Query> { | ||
export interface ActionEventCallRequest<Headers, Params, Query, Body, Result> { | ||
headers: Headers; | ||
@@ -3,0 +3,0 @@ params: Params; |
@@ -5,15 +5,15 @@ import type { Context as HonoCtx } from 'hono'; | ||
import type { ContextValidation, Random, RecordString, RecordUnknown, ValidationResult } from './helper'; | ||
export interface CreateContextOption<M extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown, P extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, Q extends RecordUnknown = RecordUnknown, BV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, PV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, HV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, QV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, V extends ContextValidation<BV, PV, HV, QV> = ContextValidation<BV, PV, HV, QV>> { | ||
export interface CreateContextOption<M extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, P extends RecordUnknown = RecordUnknown, Q extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown, HV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, PV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, QV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, BV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, V extends ContextValidation<HV, PV, QV, BV> = ContextValidation<HV, PV, QV, BV>> { | ||
honoCtx: HonoCtx | null; | ||
meta: M | null; | ||
body: B | null; | ||
headers: H | null; | ||
params: P | null; | ||
headers: H | null; | ||
query: Q | null; | ||
body: B | null; | ||
validator: V | null; | ||
throwOnValidationError: boolean; | ||
} | ||
export interface ContextConstructorOption<M extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown, P extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, Q extends RecordUnknown = RecordUnknown> extends Omit<CreateContextOption<M, B, P, H, Q>, 'validator' | 'throwOnValidationError'> { | ||
export interface ContextConstructorOption<M extends RecordUnknown, H extends RecordString, P extends RecordUnknown, Q extends RecordUnknown, B extends RecordUnknown, HV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, PV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, QV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, BV extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>> extends Omit<CreateContextOption<M, H, P, Q, B, HV, PV, QV, BV>, 'validator' | 'throwOnValidationError'> { | ||
validations: ValidationResult | null; | ||
} | ||
export type AnyContext = BlazeContext<Random, Random, Random, Random, Random>; |
@@ -20,3 +20,3 @@ import type { ZodEffects, ZodObject, ZodRawShape } from 'zod'; | ||
*/ | ||
<R, HR, M extends RecordUnknown, H extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, B extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, P extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, Q extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, AH extends AcceptedAfterHook<HR, M, H['_output'], B['_output'], P['_output']>, BH extends AcceptedBeforeHook<M, H['_output'], B['_output'], P['_output']>>(action: Action<R, HR, M, H, B, P, Q, AH, BH>): Action<R, HR, M, H, B, P, Q, AH, BH>; | ||
<R, HR, M extends RecordUnknown, H extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, P extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, Q extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, B extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, AH extends AcceptedAfterHook<HR, M, H['_output'], P['_output'], Q['_output'], B['_output']>, BH extends AcceptedBeforeHook<M, H['_output'], P['_output'], Q['_output'], B['_output']>>(action: Action<R, HR, M, H, P, Q, B, AH, BH>): Action<R, HR, M, H, P, Q, B, AH, BH>; | ||
/** | ||
@@ -33,3 +33,3 @@ * Create a reuseable validator for actions body, params and headers. | ||
*/ | ||
validator<H extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, B extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, P extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, Q extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>>(validator: ActionValidator<H, B, P, Q>): ActionValidator<H, B, P, Q>; | ||
validator<H extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, P extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, Q extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>, B extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>>(validator: ActionValidator<H, P, Q, B>): ActionValidator<H, P, Q, B>; | ||
/** | ||
@@ -68,3 +68,3 @@ * Create an openai spec for action. | ||
*/ | ||
after<R, M extends RecordUnknown, B extends RecordUnknown, P extends RecordUnknown, H extends RecordString, Q extends RecordUnknown>(hook: AfterHookHandler<R, M, B, P, H, Q>): AfterHookHandler<R, M, B, P, H, Q>; | ||
after<R, M extends RecordUnknown, H extends RecordString, P extends RecordUnknown, Q extends RecordUnknown, B extends RecordUnknown>(hook: AfterHookHandler<R, M, H, P, Q, B>): AfterHookHandler<R, M, H, P, Q, B>; | ||
/** | ||
@@ -82,3 +82,3 @@ * Create a reuseable before hook for the service. | ||
*/ | ||
before<M extends RecordUnknown, B extends RecordUnknown, P extends RecordUnknown, H extends RecordString, Q extends RecordUnknown>(hook: BeforeHookHandler<M, B, P, H, Q>): BeforeHookHandler<M, B, P, H, Q>; | ||
before<M extends RecordUnknown, H extends RecordString, P extends RecordUnknown, Q extends RecordUnknown, B extends RecordUnknown>(hook: BeforeHookHandler<M, H, P, Q, B>): BeforeHookHandler<M, H, P, Q, B>; | ||
}; | ||
@@ -85,0 +85,0 @@ } |
import type { ZodEffects, ZodObject, ZodRawShape } from 'zod'; | ||
import type { BlazeContext } from '../event'; | ||
import type { ActionHandler } from './action'; | ||
import type { Random, RecordUnknown } from './helper'; | ||
import type { Random, RecordString, RecordUnknown } from './helper'; | ||
export interface EventActionHandler { | ||
@@ -14,3 +14,3 @@ name: string; | ||
export interface EventHandler<M extends RecordUnknown = RecordUnknown, P extends RecordUnknown = RecordUnknown> { | ||
(ctx: BlazeContext<M, P>): Promise<void>; | ||
(ctx: BlazeContext<M, RecordString, RecordUnknown, RecordUnknown, P>): Promise<void>; | ||
} | ||
@@ -17,0 +17,0 @@ export interface Event<M extends RecordUnknown = RecordUnknown, P extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>> { |
@@ -6,22 +6,22 @@ import type { Context as HonoContext } from 'hono'; | ||
export type Random = any; | ||
export interface ContextValidation<B extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, P extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, H extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, Q extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>> { | ||
body?: B | null; | ||
export interface ContextValidation<H extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, P extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, Q extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>, B extends ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>> = ZodObject<ZodRawShape>> { | ||
header?: H | null; | ||
params?: P | null; | ||
header?: H | null; | ||
query?: Q | null; | ||
body?: B | null; | ||
} | ||
export interface ValidationResult { | ||
body: boolean; | ||
header: boolean; | ||
params: boolean; | ||
header: boolean; | ||
query: boolean; | ||
body: boolean; | ||
} | ||
export interface ContextData<B extends RecordUnknown = RecordUnknown, P extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, Q extends RecordUnknown = RecordUnknown> { | ||
body: B | null; | ||
export interface ContextData<H extends RecordString = RecordString, P extends RecordUnknown = RecordUnknown, Q extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown> { | ||
headers: H | null; | ||
params: P | null; | ||
headers: H | null; | ||
query: Q | null; | ||
body: B | null; | ||
} | ||
export interface DataValidatorOption<B extends RecordUnknown = RecordUnknown, P extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, Q extends RecordUnknown = RecordUnknown> { | ||
data: ContextData<B, P, H, Q>; | ||
export interface DataValidatorOption<H extends RecordString = RecordString, P extends RecordUnknown = RecordUnknown, Q extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown> { | ||
data: ContextData<H, P, Q, B>; | ||
schema: ZodObject<ZodRawShape> | ZodEffects<ZodObject<ZodRawShape>>; | ||
@@ -28,0 +28,0 @@ honoCtx: HonoContext | null; |
import type { BlazeContext } from '../event'; | ||
import type { Random, RecordString, RecordUnknown } from './helper'; | ||
export interface BeforeHookHandler<M extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown, P extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, Q extends RecordUnknown = RecordUnknown> { | ||
(ctx: BlazeContext<M, B, P, H, Q>): Promise<void> | void; | ||
export interface BeforeHookHandler<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>): Promise<void> | void; | ||
} | ||
export type AnyBeforeHookHandler = BeforeHookHandler<Random, Random, Random, Random, Random>; | ||
export interface AfterHookHandler<R = unknown | void, M extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown, P extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, Q extends RecordUnknown = RecordUnknown> { | ||
(ctx: BlazeContext<M, B, P, H, Q>, res: never): Promise<R>; | ||
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>; | ||
} | ||
export type AnyAfterHookHandler = AfterHookHandler<Random, Random, Random, Random, Random, Random>; | ||
export type AcceptedBeforeHook<M extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown, P extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, Q extends RecordUnknown = RecordUnknown> = BeforeHookHandler<M, B, P, H, Q> | BeforeHookHandler<M, B, P, H, Q>[]; | ||
export type AcceptedBeforeHook<M extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, P extends RecordUnknown = RecordUnknown, Q extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown> = BeforeHookHandler<M, H, P, Q, B> | BeforeHookHandler<M, H, P, Q, B>[]; | ||
export type AnyBeforeHook = AcceptedBeforeHook<Random, Random, Random, Random, Random>; | ||
export type AcceptedAfterHook<R = unknown | void, M extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown, P extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, Q extends RecordUnknown = RecordUnknown> = AfterHookHandler<R, M, B, P, H, Q> | AfterHookHandler<R, M, B, P, H, Q>[]; | ||
export type AcceptedAfterHook<R = unknown | void, M extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, P extends RecordUnknown = RecordUnknown, Q extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown> = AfterHookHandler<R, M, H, P, Q, B> | AfterHookHandler<R, M, H, P, Q, B>[]; | ||
export type AnyAfterHook = AcceptedAfterHook<Random, Random, Random, Random, Random, Random>; | ||
export interface ActionHook<BH extends AcceptedBeforeHook<Random, Random, Random, Random, Random> = AcceptedBeforeHook, AH extends AcceptedAfterHook<Random, Random, Random, Random, Random, Random> = AcceptedAfterHook> { | ||
export interface ActionHook<AH extends AcceptedAfterHook<Random, Random, Random, Random, Random, Random> = AcceptedAfterHook, BH extends AcceptedBeforeHook<Random, Random, Random, Random, Random> = AcceptedBeforeHook> { | ||
after?: AH | null; | ||
before?: BH | null; | ||
after?: AH | null; | ||
} | ||
export type AnyActionHook = ActionHook<Random, Random>; | ||
export interface AfterHookHandlerOption<R = unknown | void, M extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown, P extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, Q extends RecordUnknown = RecordUnknown> { | ||
export interface AfterHookHandlerOption<R = unknown | void, M extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, P extends RecordUnknown = RecordUnknown, Q extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown> { | ||
result: unknown; | ||
hooks: AcceptedAfterHook<R, M, B, P, H, Q>; | ||
blazeCtx: BlazeContext<M, B, P, H, Q>; | ||
hooks: AcceptedAfterHook<R, M, H, P, Q, B>; | ||
blazeCtx: BlazeContext<M, H, P, Q, B>; | ||
} | ||
export interface BeforeHookHandlerOption<M extends RecordUnknown = RecordUnknown, B extends RecordUnknown = RecordUnknown, P extends RecordUnknown = RecordUnknown, H extends RecordString = RecordString, Q extends RecordUnknown = RecordUnknown> { | ||
hooks: AcceptedBeforeHook<M, B, P, H, Q>; | ||
blazeCtx: BlazeContext<M, B, P, H, Q>; | ||
hooks: AcceptedBeforeHook<M, H, P, Q, B>; | ||
blazeCtx: BlazeContext<M, H, P, Q, B>; | ||
} |
import type { Action } from '../../types/action'; | ||
import type { RecordString, RecordUnknown } from '../../types/helper'; | ||
import { Random } from '../../types/helper'; | ||
import type { CreateActionOption } from '../../types/service'; | ||
@@ -9,3 +9,3 @@ export declare class BlazeServiceAction { | ||
constructor(options: CreateActionOption); | ||
actionHandler(body: RecordUnknown, params: RecordUnknown, headers: RecordString, query: RecordUnknown): Promise<import("../../types/action").ActionCallResult<unknown>>; | ||
actionHandler(...values: Random[]): Promise<import("../../types/action").ActionCallResult<unknown>>; | ||
} |
@@ -7,3 +7,3 @@ { | ||
"type": "module", | ||
"version": "3.3.0-0", | ||
"version": "3.3.0-1", | ||
"license": "MIT", | ||
@@ -10,0 +10,0 @@ "devDependencies": { |
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
225918
5816