ApprovalRegistry
Defined in: src/mft/approvals.ts:64
In-memory approval registry.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ApprovalRegistry(): ApprovalRegistry;Returns
Section titled “Returns”ApprovalRegistry
Methods
Section titled “Methods”approve()
Section titled “approve()”approve( id: string, input?: { reason?: string; resolvedBy?: string;}, now?: Date): ApprovalRequest;Defined in: src/mft/approvals.ts:118
Approves a pending request.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id | string | Approval id to resolve. |
input | { reason?: string; resolvedBy?: string; } | Optional reviewer identifier and reason. |
input.reason? | string | - |
input.resolvedBy? | string | - |
now | Date | Reference clock used to stamp resolvedAt. |
Returns
Section titled “Returns”The updated approval record.
create()
Section titled “create()”create(input: { id: string; metadata?: Record<string, unknown>; routeId: string;}, now?: Date): { request: ApprovalRequest; settled: Promise<ApprovalRequest>;};Defined in: src/mft/approvals.ts:76
Creates a new request and returns a promise that resolves when the request
transitions out of "pending" state.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
input | { id: string; metadata?: Record<string, unknown>; routeId: string; } | Request seed (id, routeId, optional metadata). |
input.id | string | - |
input.metadata? | Record<string, unknown> | - |
input.routeId | string | - |
now | Date | Reference clock used to stamp requestedAt. |
Returns
Section titled “Returns”{ request: ApprovalRequest; settled: Promise<ApprovalRequest>;}The created request and a promise tracking its resolution.
| Name | Type | Defined in |
|---|---|---|
request | ApprovalRequest | src/mft/approvals.ts:79 |
settled | Promise<ApprovalRequest> | src/mft/approvals.ts:79 |
get(id: string): | ApprovalRequest | undefined;Defined in: src/mft/approvals.ts:149
Looks up a request by id.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
id | string |
Returns
Section titled “Returns”| ApprovalRequest
| undefined
list()
Section titled “list()”list(): ApprovalRequest[];Defined in: src/mft/approvals.ts:159
Lists every request ever created.
Returns
Section titled “Returns”listPending()
Section titled “listPending()”listPending(): ApprovalRequest[];Defined in: src/mft/approvals.ts:154
Lists pending requests in insertion order.
Returns
Section titled “Returns”reject()
Section titled “reject()”reject( id: string, input?: { reason?: string; resolvedBy?: string;}, now?: Date): ApprovalRequest;Defined in: src/mft/approvals.ts:134
Rejects a pending request.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
id | string | Approval id to resolve. |
input | { reason?: string; resolvedBy?: string; } | Optional reviewer identifier and reason. |
input.reason? | string | - |
input.resolvedBy? | string | - |
now | Date | Reference clock used to stamp resolvedAt. |
Returns
Section titled “Returns”The updated approval record.