@busy-hour/blaze
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -5,2 +5,9 @@ # Changelog | ||
## [3.0.2](https://github.com/Busy-Hour-Studio/blaze/compare/v3.0.1...v3.0.2) (2024-05-01) | ||
### Bug Fixes | ||
* remove utility types ([87b00e0](https://github.com/Busy-Hour-Studio/blaze/commit/87b00e01632062fc79d3a03f2ee6d6fd286286d6)) | ||
## [3.0.1](https://github.com/Busy-Hour-Studio/blaze/compare/v3.0.0...v3.0.1) (2024-04-23) | ||
@@ -7,0 +14,0 @@ |
import './types/validator'; | ||
export type { Action, ActionHandler, ActionOpenAPI, ActionValidator, Actions, OpenAPIBody, } from './types/action'; | ||
export type { ActionCallRecord, ActionEventCallRequest, EventCallRecord, ExtractActionHandler, ExtractActionValidator, ExtractEventValidator, } from './types/common'; | ||
export type { ActionCallRecord, ActionEventCallRequest, EventCallRecord, } from './types/common'; | ||
export type { Event, Events } from './types/event'; | ||
@@ -5,0 +5,0 @@ export type { AcceptedAfterHook, AcceptedBeforeHook, ActionHook, } from './types/hooks'; |
@@ -1,12 +0,2 @@ | ||
import { z } from 'zod'; | ||
import { Action, Actions, ActionValidator } from './action'; | ||
import { Event, Events } from './event'; | ||
import { Random, RecordUnknown } from './helper'; | ||
import { Service } from './service'; | ||
type AnyAction = Action<RecordUnknown, Random, Random, Random>; | ||
type AnyEvent = Event<RecordUnknown, Random>; | ||
export type ExtractActionValidator<DefinedService extends Service, ActionName extends keyof DefinedService['actions'], ValidationName extends keyof ActionValidator, DefaultType = ValidationName extends 'body' ? unknown : RecordUnknown> = NonNullable<DefinedService['actions']> extends Actions ? NonNullable<DefinedService['actions'][ActionName]> extends AnyAction ? NonNullable<DefinedService['actions'][ActionName]['validator']> extends ActionValidator<Random, Random, Random> ? NonNullable<DefinedService['actions'][ActionName]['validator'][ValidationName]> extends z.ZodObject<z.ZodRawShape> ? z.infer<DefinedService['actions'][ActionName]['validator'][ValidationName]> : DefaultType : DefaultType : DefaultType : DefaultType; | ||
export type ExtractActionHandler<DefinedService extends Service, ActionName extends keyof DefinedService['actions']> = NonNullable<DefinedService['actions']> extends Actions ? NonNullable<DefinedService['actions'][ActionName]> extends AnyAction ? Awaited<ReturnType<DefinedService['actions'][ActionName]['handler']>> : unknown : unknown; | ||
export type ExtractEventValidator<DefinedService extends Service, EventName extends keyof DefinedService['events']> = NonNullable<DefinedService['events']> extends Events ? NonNullable<DefinedService['events'][EventName]> extends AnyEvent ? NonNullable<DefinedService['events'][EventName]['validator']> extends z.ZodObject<z.ZodRawShape> ? z.infer<DefinedService['events'][EventName]['validator']> : unknown : unknown : unknown; | ||
export type ActionEventCallRequest<Headers extends RecordUnknown = RecordUnknown, Params extends RecordUnknown = RecordUnknown, Body extends RecordUnknown = RecordUnknown, Result = unknown> = { | ||
export interface ActionEventCallRequest<Headers, Params, Body, Result> { | ||
headers: Headers; | ||
@@ -16,10 +6,3 @@ params: Params; | ||
result: Result; | ||
}; | ||
export type ServiceNameExtractor<T extends Service> = NonNullable<T['version']> extends number ? NonNullable<T['name']> extends string ? `v${T['version']}.${T['name']}` : `v${T['version']}` : NonNullable<T['name']> extends string ? `${T['name']}` : never; | ||
export type ActionsExtractor<T extends Service> = { | ||
[A in keyof T['actions'] as `${ServiceNameExtractor<T>}.${A extends string ? A : never}`]: ActionEventCallRequest<ExtractActionValidator<T, A, 'header'>, ExtractActionValidator<T, A, 'params'>, ExtractActionValidator<T, A, 'body'>, ExtractActionHandler<T, A>>; | ||
}; | ||
export type EventsExtractor<T extends Service> = { | ||
[E in keyof T['events'] as `${ServiceNameExtractor<T>}.${E extends string ? E : never}`]: ActionEventCallRequest<Record<string, unknown>, Record<string, unknown>, ExtractEventValidator<T, E>, unknown>; | ||
}; | ||
} | ||
export interface ActionCallRecord { | ||
@@ -29,2 +12,1 @@ } | ||
} | ||
export {}; |
@@ -7,3 +7,3 @@ { | ||
"type": "module", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"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
10
189544
4924