diff --git a/packages/protocol/packages/payload/packages/model/src/PayloadValidationFunction.ts b/packages/protocol/packages/payload/packages/model/src/PayloadValidationFunction.ts index fbcb48822b..f2a2932261 100644 --- a/packages/protocol/packages/payload/packages/model/src/PayloadValidationFunction.ts +++ b/packages/protocol/packages/payload/packages/model/src/PayloadValidationFunction.ts @@ -1,6 +1,16 @@ import type { Payload } from './Payload.ts' +/** + * A function that validates the supplied payload synchronously + */ +export type SyncPayloadValidationFunction = (payload: T) => boolean + +/** + * A function that validates the supplied payload asynchronously + */ +export type AsyncPayloadValidationFunction = (payload: T) => Promise + /** * A function that validates the supplied payload */ -export type PayloadValidationFunction = (payload: T) => boolean | Promise +export type PayloadValidationFunction = SyncPayloadValidationFunction | AsyncPayloadValidationFunction