@@ -122,7 +122,7 @@ export interface EventHandler {
122122 * })
123123 * }
124124 */
125- export type HttpEventHandler = ( request : HttpRequest , response : HttpResponse ) => void | Promise < void > ;
125+ export type HttpEventHandler = ( request : HttpRequest , response : HttpResponse ) => void ;
126126
127127/**
128128 * HttpRequest is an object used by HttpEventHandler that contains request-specific
@@ -204,7 +204,7 @@ export interface Url {
204204 * })
205205 * }
206206 */
207- export type KafkaEventHandler = ( message : KafkaEventMessage ) => void | Promise < void > ;
207+ export type KafkaEventHandler = ( message : KafkaEventMessage ) => void ;
208208
209209/**
210210 * KafkaEventMessage is an object used by KafkaEventHandler that contains Kafka-specific message data.
@@ -243,7 +243,7 @@ export interface KafkaEventMessage {
243243 * })
244244 * }
245245 */
246- export type LdapEventHandler = ( request : LdapSearchRequest , response : LdapSearchResponse ) => void | Promise < void > ;
246+ export type LdapEventHandler = ( request : LdapSearchRequest , response : LdapSearchResponse ) => void ;
247247
248248/**
249249 * LdapSearchRequest is an object used by LdapEventHandler that contains request-specific data.
@@ -343,7 +343,7 @@ export enum LdapResultStatus {
343343 SizeLimitExceeded = 4 ,
344344}
345345
346- export type SmtpEventHandler = ( record : SmtpEventMessage ) => void | Promise < void > ;
346+ export type SmtpEventHandler = ( record : SmtpEventMessage ) => void ;
347347
348348export interface SmtpEventMessage {
349349 server : string ;
@@ -456,8 +456,57 @@ export interface JSONObject {
456456 [ key : string ] : JSONValue ;
457457}
458458
459+ /**
460+ * Specifies the date-time format defined in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339).
461+ * This constant can be used when defining or validating datetime strings.
462+ *
463+ * @example
464+ * const date = new Date().toISOString()
465+ * if (isValidDate(date, RFC3339)) {
466+ * // do something
467+ * }
468+ */
459469export const RFC3339 = "RFC3339" ;
460470
471+ /**
472+ * Applies a patch object to a target object. Only properties that are explicitly defined in the patch
473+ * are applied. This includes nested objects. Properties marked with `Delete` will be removed.
474+ *
475+ * This function is especially useful when working with generated mock data in Mokapi that you want to override
476+ * or refine with specific values.
477+ *
478+ * https://mokapi.io/docs/javascript-api/mokapi/patch
479+ *
480+ * @param target The original object or value to be patched.
481+ * @param patch The patch object or value. Only defined values are applied; undefined values are ignored. Use `Delete` to remove fields.
482+ * @returns A new object or value with the patch applied.
483+ *
484+ * @example
485+ * const result = patch({ name: "foo", age: 42 }, { name: "bar" })
486+ * // result: { name: "bar", age: 42 }
487+ *
488+ * @example
489+ * const result = patch({ name: "foo", meta: { version: 1 } }, { meta: { version: 2 } })
490+ * // result: { name: "foo", meta: { version: 2 } }
491+ *
492+ * @example
493+ * const result = patch({ name: "foo", age: 42 }, { age: Delete })
494+ * // result: { name: "foo" }
495+ */
461496export function patch ( target : any , patch : any ) : any ;
462497
498+ /**
499+ * Special marker used with the `patch` function to indicate a property should be removed.
500+ *
501+ * When used as a value inside a patch object, the corresponding property will be deleted
502+ * from the result.
503+ *
504+ * This is useful when refining or overriding mock data in a script while keeping validation logic intact.
505+ *
506+ * https://mokapi.io/docs/javascript-api/mokapi/patch#delete
507+ *
508+ * @example
509+ * const result = patch({ name: "foo", age: 42 }, { age: Delete })
510+ * // result: { name: "foo" }
511+ */
463512export const Delete : unique symbol ;
0 commit comments