Skip to content

Commit 0f1f28b

Browse files
committed
doc: update TypeScript definition documentation
1 parent 3c1f8bb commit 0f1f28b

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

npm/types/index.d.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import "./mustache";
1010
import "./yaml";
1111
import "./encoding";
1212
import "./mail";
13+
import "./file"
1314

1415
/**
1516
* Attaches an event handler for the given event.
@@ -158,7 +159,7 @@ export interface HttpRequest {
158159
readonly querystring: any;
159160

160161
/** Name of the API, as defined in the OpenAPI `info.title` field */
161-
readonly api: string
162+
readonly api: string;
162163

163164
/** Path value specified by the OpenAPI path */
164165
readonly key: string;
@@ -167,7 +168,7 @@ export interface HttpRequest {
167168
readonly operationId: string;
168169

169170
/** Returns a string representing this HttpRequest object. */
170-
toString(): string
171+
toString(): string;
171172
}
172173

173174
/**
@@ -441,10 +442,11 @@ export type DateLayout =
441442
| "RFC3339Nano";
442443

443444
/**
444-
* EventArgs object contains additional arguments for an event handler.
445+
* EventArgs provides optional configuration for an event handler.
445446
* https://mokapi.io/docs/javascript-api/mokapi/on
446447
*
447-
* Use this to customize how the event appears in the dashboard or to control tracking.
448+
* Use this object to control how the event is tracked, labeled,
449+
* and ordered in the execution pipeline.
448450
*
449451
* @example
450452
* export default function() {
@@ -458,16 +460,32 @@ export type DateLayout =
458460
*/
459461
export interface EventArgs {
460462
/**
461-
* Adds or overrides existing tags used to label the event in dashboard
463+
* Adds or overrides tags used to label this event in the dashboard.
464+
* Tags can be used for filtering, grouping, or ownership attribution.
462465
*/
463466
tags?: { [key: string]: string };
464467

465468
/**
466-
* Set to `true` to enable tracking of this event handler in the dashboard.
467-
* Set to `false` to disable tracking. If omitted, Mokapi checks the response
468-
* object to determine if the handler changed it, and tracks it accordingly.
469+
* Controls whether this event handler is tracked in the dashboard.
470+
*
471+
* - true: always track this handler
472+
* - false: never track this handler
473+
* - undefined: Mokapi determines tracking automatically based on
474+
* whether the response object was modified by the handler
469475
*/
470476
track?: boolean;
477+
478+
/**
479+
* Defines the execution order of the event handler.
480+
*
481+
* Handlers with higher priority values run first.
482+
* Handlers with lower priority values run later.
483+
*
484+
* Use negative priorities (e.g. -1) to run a handler after
485+
* the response has been fully populated by other handlers,
486+
* such as for logging or recording purposes.
487+
*/
488+
priority?: number;
471489
}
472490

473491
/**

0 commit comments

Comments
 (0)