/** * @module RecordBuilder / AccessCheckBuilder * @category Record Builders */ import { JwtConfig, LedgerAccessRule, LedgerMeta, LedgerRecord } from "../../../../types/src"; import { BaseListResponse } from '../types/list-response'; import { BaseRecordBuilder } from './base-record-builder'; /** * A handler for access check on the remote API. */ export type AccessCheckHandler = (record: LedgerRecord, authParams: JwtConfig) => Promise; /** * Implements a builder pattern that allows a more * convenient way to work with ledger records. This * class has functions that simplify construction, * hashing, signing, testing and sending records to * remote ledger instances. * * This builder is intended for sending access checks * to ledger, and will attempt to send it on the API * with the content that was prepared in the builder. * * NOTE: current access check is mutated by this * class, we are not cloning instances intentionally, * and it isn't advised to reuse builder instances when * working with multiple records or mutating objects * passed to this builder in external code. It is * recommended to clone objects in such cases to avoid * unexpected behaviors. */ export declare class AccessCheckBuilder, M extends LedgerMeta = LedgerMeta> extends BaseRecordBuilder { /** * A handler for access check on the remote API. */ protected checkAccess: AccessCheckHandler; /** * Creates new instance of access check builder. * * @param checkAccess function which handles access check on ledger api */ constructor(checkAccess: AccessCheckHandler); /** * Sends the current access check payload to the remote ledger. * * @returns api response with the checked access response * @throws if any method in builder chain fails */ send(): Promise; }