Release 0.3.0
API reference
Functions and types from the 0.3.0 package declarations. Each entry shows its import path and links to the release source.
AmountAllowance@1hubengineering/verifier
type AmountAllowance = {
readonly type: "fixed";
readonly maxMinor: number;
} | {
readonly type: "percentage";
readonly percent: string;
};
AmountCheck@1hubengineering/verifier
type AmountCheck = Exclude<CheckFinding, {
status: "SKIPPED";
}> & {
readonly field: "amountMinor";
readonly rule: "exact" | "within_tolerance";
readonly expected: number;
readonly actual: number | null;
readonly details: AmountCheckDetails;
};
AmountCheckDetails@1hubengineering/verifier
interface AmountCheckDetails {
readonly policy: AmountPolicy;
readonly differenceMinor: number | null;
readonly minimumAcceptedMinor: number;
readonly maximumAcceptedMinor: number;
readonly exactMatch: boolean | null;
readonly toleranceApplied: boolean;
readonly direction: "UNDERPAID" | "OVERPAID" | null;
}
AmountPolicy@1hubengineering/verifier
type AmountPolicy = {
readonly mode: "exact";
} | {
readonly mode: "tolerance";
readonly underpayment?: AmountAllowance;
readonly overpayment?: AmountAllowance;
/** Maximum percentage of the expected principal allowed in either direction. Defaults to 10%. */
readonly maxPercent?: string;
};
CheckField@1hubengineering/verifier
type CheckField = "provider" | "transactionId" | "paymentStatus" | "amountMinor" | "currency" | "recipientName" | "recipientAccount" | "invoiceReference" | "transactionTime" | "paymentType";
CheckRule@1hubengineering/verifier
type CheckRule = "exact" | "within_tolerance" | "normalized_name" | "account_last4" | "successful_status" | "present_identifier" | "time_window";
CheckStatus@1hubengineering/verifier
type CheckStatus = CheckFinding["status"];
DiagnosticDetails@1hubengineering/verifier
type DiagnosticDetails = Readonly<Record<string, JsonValue>>;
EtbMinorUnits@1hubengineering/verifier
type EtbMinorUnits = number & {
readonly __etbMinorUnits: unique symbol;
};
EvidenceField@1hubengineering/verifier
type EvidenceField = "provider" | "currency" | "transactionId" | "status" | "amountMinor" | "recipientName" | "recipientAccountLast4" | "reference" | "transactionAt" | "paymentType";
IncompleteEvidenceCode@1hubengineering/verifier
type IncompleteEvidenceCode = "REQUIRED_FIELD_MISSING" | "INVALID_RECEIPT_FIELD" | "AMBIGUOUS_RECEIPT_FIELD";
InvalidInputResult@1hubengineering/verifier
type InvalidInputResult = VerificationResultBase & {
readonly verified: false;
readonly status: "INVALID_INPUT";
readonly code: InputErrorCode | "PROVIDER_MISMATCH";
readonly stage: "input_parsing" | "input_validation";
readonly retryable: false;
readonly receipt: null;
readonly source: null;
};
JsonValue@1hubengineering/verifier
type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
readonly [key: string]: JsonValue;
};
MismatchCode@1hubengineering/verifier
type MismatchCode = "RECEIPT_PROVIDER_MISMATCH" | "TRANSACTION_ID_MISMATCH" | "AMOUNT_UNDERPAID" | "AMOUNT_OVERPAID" | "CURRENCY_MISMATCH" | "RECIPIENT_NAME_MISMATCH" | "RECIPIENT_ACCOUNT_MISMATCH" | "INVOICE_REFERENCE_MISMATCH" | "PAYMENT_TIME_OUT_OF_RANGE" | "PAYMENT_TYPE_MISMATCH" | "PAYMENT_PENDING" | "PAYMENT_FAILED" | "PAYMENT_REVERSED" | "PAYMENT_CANCELLED";
OfficialReceiptSource@1hubengineering/verifier
interface OfficialReceiptSource {
readonly kind: "OFFICIAL_RECEIPT";
readonly retrievedAt: string;
readonly parserVersion: string;
readonly contentHash: string;
}
OperationErrorCode@1hubengineering/verifier
type OperationErrorCode = keyof typeof operationMessages;
OperationStage@1hubengineering/verifier
type OperationStage = "request" | "expectation" | "idempotency" | "provider_configuration" | "adapter" | "completion" | "storage" | "queue";
PaymentExpectation@1hubengineering/verifier
interface PaymentExpectation {
readonly tenantId: string;
readonly paymentId: string;
readonly provider: ProviderId;
readonly currency: "ETB";
readonly amountMinor: EtbMinorUnits;
readonly amountPolicy: AmountPolicy;
readonly recipientName: string;
readonly recipientAccountLast4: string;
readonly reference: string;
/** Set to false to allow an empty expected reference. The receipt must match it. */
readonly referenceRequired?: boolean;
readonly validFrom: number;
readonly validUntil: number;
}
PaymentScope@1hubengineering/verifier
interface PaymentScope {
readonly tenantId: string;
readonly paymentId: string;
}
PreparedVerification@1hubengineering/verifier
interface PreparedVerification {
readonly [preparedBrand]: true;
}
ProviderFailureCode@1hubengineering/verifier
type ProviderFailureCode = keyof typeof providerMessages;
ProviderFailureStage@1hubengineering/verifier
type ProviderFailureStage = "receipt_retrieval" | "receipt_rendering" | "receipt_parsing";
ProviderId@1hubengineering/verifier
type ProviderId = "telebirr" | "cbe";
ReceiptComparison@1hubengineering/verifier
type ReceiptComparison = {
readonly status: "MATCH";
readonly code: null;
readonly checks: readonly VerificationCheck[];
} | {
readonly status: "MISMATCH";
readonly code: MismatchCode | "MULTIPLE_MISMATCHES";
readonly checks: readonly VerificationCheck[];
} | {
readonly status: "INCOMPLETE";
readonly code: IncompleteEvidenceCode | "MULTIPLE_VERIFICATION_ISSUES";
readonly checks: readonly VerificationCheck[];
};
ReceiptEvidence@1hubengineering/verifier
interface ReceiptEvidence {
readonly provider: ProviderId | null;
readonly currency: string | null;
readonly transactionId: string | null;
readonly status: "SUCCESSFUL" | "PENDING" | "FAILED" | "REVERSED" | "CANCELLED" | null;
readonly amountMinor: EtbMinorUnits | null;
readonly recipientName: string | null;
readonly recipientAccountLast4: string | null;
readonly reference: string | null;
readonly transactionAt: number | null;
readonly paymentType: string | null;
readonly ambiguousFields: readonly EvidenceField[];
readonly invalidFields?: readonly EvidenceField[];
}
ReceiptPaymentStatus@1hubengineering/verifier
type ReceiptPaymentStatus = "SUCCESSFUL" | "PENDING" | "FAILED" | "REVERSED" | "CANCELLED";
ReceiptProvider@1hubengineering/verifier
interface ReceiptProvider {
retrieve(locator: string, options?: RetrievalOptions): Promise<ProviderResult>;
}
ReceiptSnapshot@1hubengineering/verifier
interface ReceiptSnapshot {
readonly provider: ProviderId | null;
readonly transactionId: string | null;
readonly paymentStatus: ReceiptPaymentStatus | null;
readonly amountMinor: number | null;
readonly currency: string | null;
readonly recipientName: string | null;
readonly recipientAccount: {
readonly representation: "LAST4";
readonly value: string;
} | null;
readonly invoiceReference: string | null;
readonly transactionAt: string | null;
readonly paymentType: string | null;
}
ReceiptVerifier@1hubengineering/verifier
interface ReceiptVerifier {
initialize(): Promise<void>;
registerExpectation(expectation: PaymentExpectation): Promise<void>;
cancelExpectation(scope: PaymentScope): Promise<void>;
prepare(input: VerificationSubmission, options?: RetrievalOptions): Promise<PreparedVerification>;
complete(prepared: PreparedVerification, storage?: VerificationStorage): Promise<VerificationResult>;
submit(input: VerificationSubmission, options?: RetrievalOptions): Promise<VerificationResult>;
events(limit?: number): Promise<readonly StoredRecord[]>;
acknowledgeEvent(key: string): Promise<void>;
}
RecordTransaction@1hubengineering/verifier
interface RecordTransaction {
get(key: string): Promise<unknown>;
insert(key: string, value: unknown): Promise<void>;
set(key: string, value: unknown): Promise<void>;
delete(key: string): Promise<void>;
scan(prefix: string, limit: number): Promise<readonly StoredRecord[]>;
}
SerializedVerificationOperationError@1hubengineering/verifier
interface SerializedVerificationOperationError {
readonly type: "VERIFICATION_OPERATION_ERROR";
readonly code: OperationErrorCode;
readonly stage: OperationStage;
readonly message: string;
readonly retryable: boolean;
readonly details: DiagnosticDetails;
}
StorageConflict@1hubengineering/verifier
declare class StorageConflict extends Error {
constructor();
}
StoredRecord@1hubengineering/verifier
interface StoredRecord {
readonly key: string;
readonly value: unknown;
}
VerificationCheck@1hubengineering/verifier
type VerificationCheck = AmountCheck | (CheckFinding & {
readonly field: Exclude<CheckField, "amountMinor">;
readonly rule: CheckRule;
readonly expected?: JsonValue;
readonly actual?: JsonValue;
});
VerificationOperationError@1hubengineering/verifier
declare class VerificationOperationError extends Error {
readonly code: OperationErrorCode;
readonly stage: OperationStage;
readonly retryable: boolean;
readonly details: DiagnosticDetails;
constructor(code: OperationErrorCode, stage: OperationStage, options?: {
readonly cause?: unknown;
readonly retryable?: boolean;
readonly details?: DiagnosticDetails;
});
toJSON(): SerializedVerificationOperationError;
}
VerificationResult@1hubengineering/verifier
type VerificationResult = (ObservedResult & {
readonly verified: true;
readonly status: "VERIFIED";
readonly code: "PAYMENT_VERIFIED";
readonly stage: "completion";
readonly retryable: false;
readonly receipt: ReceiptSnapshot & {
readonly provider: ProviderId;
readonly transactionId: string;
readonly paymentStatus: "SUCCESSFUL";
readonly amountMinor: number;
readonly currency: "ETB";
};
readonly source: OfficialReceiptSource;
}) | InvalidInputResult | (ObservedResult & {
readonly verified: false;
readonly status: "MISMATCH";
readonly code: MismatchCode | "MULTIPLE_MISMATCHES";
readonly stage: "comparison";
readonly retryable: boolean;
readonly receipt: ReceiptSnapshot;
readonly source: OfficialReceiptSource;
}) | (ObservedResult & {
readonly verified: false;
readonly status: "NOT_FOUND";
readonly code: "RECEIPT_NOT_FOUND";
readonly stage: "receipt_retrieval";
readonly retryable: boolean;
readonly receipt: null;
readonly source: null;
}) | (ObservedResult & {
readonly verified: false;
readonly status: "UNAVAILABLE";
readonly code: UnavailableCode;
readonly stage: ProviderFailureStage | "comparison";
readonly retryable: boolean;
});
VerificationStatus@1hubengineering/verifier
type VerificationStatus = "VERIFIED" | "MISMATCH" | "NOT_FOUND" | "UNAVAILABLE" | "INVALID_INPUT";
VerificationStorage@1hubengineering/verifier
interface VerificationStorage {
readonly callerTransaction?: boolean;
read(key: string): Promise<unknown>;
/** Serializable or equivalent key locking, with unique inserts and no lost checked state.
* Work may retry; external effects belong outside. Scoped adapters leave commit/rollback/retry to the caller.
*/
transaction<T>(work: (transaction: RecordTransaction) => Promise<T>): Promise<T>;
}
VerificationSubmission@1hubengineering/verifier
interface VerificationSubmission extends PaymentScope {
readonly idempotencyKey: string;
readonly receiptLocator: string;
}
comparePaymentAmount@1hubengineering/verifier
declare function comparePaymentAmount(expectedMinor: number, actualMinor: unknown, policy?: AmountPolicy): AmountCheck;
compareReceipt@1hubengineering/verifier
declare function compareReceipt(expectation: PaymentExpectation, evidence: unknown, expectedTransactionId?: string): ReceiptComparison;
createPaymentExpectation@1hubengineering/verifier
declare function createPaymentExpectation(input: unknown, options?: {
readonly defaultAmountPolicy?: AmountPolicy;
}): PaymentExpectation;
createReceiptVerifier@1hubengineering/verifier
declare function createReceiptVerifier(config: VerifierConfig): ReceiptVerifier;
parseEtbAmount@1hubengineering/verifier
declare function parseEtbAmount(value: string): EtbMinorUnits;
storageKey@1hubengineering/verifier
declare function storageKey(kind: string, ...parts: string[]): string;
ParsedReceipt@1hubengineering/verifier/providers
interface ParsedReceipt {
readonly evidence: ReceiptEvidence;
readonly recognized: boolean;
readonly provenance: {
readonly kind: "SAVED_HTML";
readonly provider: ProviderId;
readonly parserVersion: "1";
};
}
ProviderConnectionCheck@1hubengineering/verifier/providers
interface ProviderConnectionCheck {
readonly hostname: string;
readonly route: "direct" | "telebirr-tunnel";
readonly error?: {
readonly code: RetrievalErrorCode;
readonly details: DiagnosticDetails;
};
}
ProviderResult@1hubengineering/verifier/providers
type ProviderResult = {
readonly kind: "EVIDENCE";
readonly evidence: ReceiptEvidence;
readonly pendingRetryable?: boolean;
readonly provenance: {
readonly kind: "OFFICIAL_HTTPS";
readonly url: string;
readonly retrievedAt: number;
readonly sha256: string;
readonly parserVersion: string;
};
} | {
readonly kind: "NOT_FOUND";
readonly retryable?: boolean;
readonly details?: DiagnosticDetails;
} | {
readonly kind: "UNAVAILABLE";
readonly code: ProviderFailureCode;
readonly stage: ProviderFailureStage;
readonly retryable: boolean;
readonly details: DiagnosticDetails;
};
ReceiptLocator@1hubengineering/verifier/providers
interface ReceiptLocator {
readonly provider: ProviderId;
readonly url: string;
readonly transactionId: string | null;
}
RetrievalError@1hubengineering/verifier/providers
declare class RetrievalError extends Error {
readonly code: RetrievalErrorCode;
readonly details: DiagnosticDetails;
readonly retryable: boolean;
constructor(code: RetrievalErrorCode, details?: DiagnosticDetails, retryable?: boolean, options?: ErrorOptions);
}
RetrievalErrorCode@1hubengineering/verifier/providers
type RetrievalErrorCode = ProviderFailureCode | "INVALID_LOCATOR" | "CANCELLED";
RetrievalOptions@1hubengineering/verifier/providers
interface RetrievalOptions {
readonly timeoutMs?: number;
readonly maxBytes?: number;
readonly signal?: AbortSignal;
/** Host-configured Unix socket forwarding only to the official Telebirr endpoint. */
readonly telebirrTunnelSocket?: string;
}
RetrievedHtml@1hubengineering/verifier/providers
interface RetrievedHtml {
readonly html: string;
readonly bytes: number;
}
cbeReceiptDataHost@1hubengineering/verifier/providers
declare const cbeReceiptDataHost: string;
checkProviderConnectivity@1hubengineering/verifier/providers
declare function checkProviderConnectivity(provider: ProviderId, options?: Pick<RetrievalOptions, "timeoutMs" | "telebirrTunnelSocket">): Promise<readonly ProviderConnectionCheck[]>;
interpretOfficialHtml@1hubengineering/verifier/providers
declare function interpretOfficialHtml(locator: ReceiptLocator, retrievedHtml: string, parsedHtml: string, retrievedAt: number): ProviderResult;
isPublicDestination@1hubengineering/verifier/providers
declare function isPublicDestination(address: string): boolean;
normalizeReceiptLocator@1hubengineering/verifier/providers
declare function normalizeReceiptLocator(provider: ProviderId, input: string): ReceiptLocator;
parseProviderTime@1hubengineering/verifier/providers
declare function parseProviderTime(value: string): number | null;
parseReceiptHtml@1hubengineering/verifier/providers
declare function parseReceiptHtml(provider: ProviderId, html: string): ParsedReceipt;
providerFailure@1hubengineering/verifier/providers
declare function providerFailure(error: unknown, stage: ProviderFailureStage): ProviderResult;
retrieveHtml@1hubengineering/verifier/providers
declare function retrieveHtml(locator: ReceiptLocator, options?: RetrievalOptions): Promise<RetrievedHtml>;
retrieveTelebirr@1hubengineering/verifier/providers
declare function retrieveTelebirr(input: string, options?: RetrievalOptions): Promise<ProviderResult>;
RecordTransaction@1hubengineering/verifier/storage
interface RecordTransaction {
get(key: string): Promise<unknown>;
insert(key: string, value: unknown): Promise<void>;
set(key: string, value: unknown): Promise<void>;
delete(key: string): Promise<void>;
scan(prefix: string, limit: number): Promise<readonly StoredRecord[]>;
}
StorageConflict@1hubengineering/verifier/storage
declare class StorageConflict extends Error {
constructor();
}
StorageDataError@1hubengineering/verifier/storage
declare class StorageDataError extends Error {
constructor();
}
StoredRecord@1hubengineering/verifier/storage
interface StoredRecord {
readonly key: string;
readonly value: unknown;
}
VerificationStorage@1hubengineering/verifier/storage
interface VerificationStorage {
readonly callerTransaction?: boolean;
read(key: string): Promise<unknown>;
/** Serializable or equivalent key locking, with unique inserts and no lost checked state.
* Work may retry; external effects belong outside. Scoped adapters leave commit/rollback/retry to the caller.
*/
transaction<T>(work: (transaction: RecordTransaction) => Promise<T>): Promise<T>;
}
decodeStorageRecord@1hubengineering/verifier/storage
declare function decodeStorageRecord(payload: string | undefined): unknown;
encodeStorageRecord@1hubengineering/verifier/storage
declare function encodeStorageRecord(value: unknown): string;
validateStorageKey@1hubengineering/verifier/storage
declare function validateStorageKey(key: string): void;
validateStorageScan@1hubengineering/verifier/storage
declare function validateStorageScan(prefix: string, limit: number): void;
createDurableVerifier@1hubengineering/verifier/jobs
export declare function createDurableVerifier(config: {
readonly storage: VerificationStorage;
readonly providers: Readonly<Partial<Record<ProviderId, ReceiptProvider>>>;
readonly encryptionKey: Uint8Array;
readonly policy?: Partial<JobPolicy>;
readonly now?: () => number;
}): DurableVerifier;
JobPolicy@1hubengineering/verifier/jobs
export interface JobPolicy {
readonly maxPending: number;
readonly maxRetained: number;
readonly concurrency: number;
readonly maxAttempts: number;
readonly timeoutMs: number;
readonly leaseMs: number;
readonly backoffMs: number;
}
VerificationJob@1hubengineering/verifier/jobs
export type VerificationJob = JobSummary & ({
readonly state: "QUEUED" | "RUNNING" | "RETRY_WAIT";
readonly result?: never;
readonly error?: never;
} | {
readonly state: "COMPLETED";
readonly result: VerificationResult;
readonly error?: never;
} | {
readonly state: "FAILED";
readonly error: SerializedVerificationOperationError;
readonly result?: never;
});
DurableVerifier@1hubengineering/verifier/jobs
export interface DurableVerifier {
initialize(): Promise<void>;
enqueue(input: VerificationSubmission): Promise<VerificationJob>;
status(scope: PaymentScope, jobId: string): Promise<VerificationJob>;
runOnce(options?: {
readonly signal?: AbortSignal;
}): Promise<"IDLE" | "BUSY" | "STALE" | "RETRY_WAIT" | "COMPLETED" | "FAILED">;
pruneCompleted(before: number, limit?: number): Promise<number>;
}
AmountAllowance@1hubengineering/verifier/comparison
type AmountAllowance = {
readonly type: "fixed";
readonly maxMinor: number;
} | {
readonly type: "percentage";
readonly percent: string;
};
AmountCheckDetails@1hubengineering/verifier/comparison
interface AmountCheckDetails {
readonly policy: AmountPolicy;
readonly differenceMinor: number | null;
readonly minimumAcceptedMinor: number;
readonly maximumAcceptedMinor: number;
readonly exactMatch: boolean | null;
readonly toleranceApplied: boolean;
readonly direction: "UNDERPAID" | "OVERPAID" | null;
}
AmountPolicy@1hubengineering/verifier/comparison
type AmountPolicy = {
readonly mode: "exact";
} | {
readonly mode: "tolerance";
readonly underpayment?: AmountAllowance;
readonly overpayment?: AmountAllowance;
/** Maximum percentage of the expected principal allowed in either direction. Defaults to 10%. */
readonly maxPercent?: string;
};
EtbMinorUnits@1hubengineering/verifier/comparison
type EtbMinorUnits = number & {
readonly __etbMinorUnits: unique symbol;
};
PaymentExpectation@1hubengineering/verifier/comparison
interface PaymentExpectation {
readonly tenantId: string;
readonly paymentId: string;
readonly provider: ProviderId;
readonly currency: "ETB";
readonly amountMinor: EtbMinorUnits;
readonly amountPolicy: AmountPolicy;
readonly recipientName: string;
readonly recipientAccountLast4: string;
readonly reference: string;
/** Set to false to allow an empty expected reference. The receipt must match it. */
readonly referenceRequired?: boolean;
readonly validFrom: number;
readonly validUntil: number;
}
ProviderId@1hubengineering/verifier/comparison
type ProviderId = "telebirr" | "cbe";
ReceiptComparison@1hubengineering/verifier/comparison
type ReceiptComparison = {
readonly status: "MATCH";
readonly code: null;
readonly checks: readonly VerificationCheck[];
} | {
readonly status: "MISMATCH";
readonly code: MismatchCode | "MULTIPLE_MISMATCHES";
readonly checks: readonly VerificationCheck[];
} | {
readonly status: "INCOMPLETE";
readonly code: IncompleteEvidenceCode | "MULTIPLE_VERIFICATION_ISSUES";
readonly checks: readonly VerificationCheck[];
};
ReceiptEvidence@1hubengineering/verifier/comparison
interface ReceiptEvidence {
readonly provider: ProviderId | null;
readonly currency: string | null;
readonly transactionId: string | null;
readonly status: "SUCCESSFUL" | "PENDING" | "FAILED" | "REVERSED" | "CANCELLED" | null;
readonly amountMinor: EtbMinorUnits | null;
readonly recipientName: string | null;
readonly recipientAccountLast4: string | null;
readonly reference: string | null;
readonly transactionAt: number | null;
readonly paymentType: string | null;
readonly ambiguousFields: readonly EvidenceField[];
readonly invalidFields?: readonly EvidenceField[];
}
VerificationCheck@1hubengineering/verifier/comparison
type VerificationCheck = AmountCheck | (CheckFinding & {
readonly field: Exclude<CheckField, "amountMinor">;
readonly rule: CheckRule;
readonly expected?: JsonValue;
readonly actual?: JsonValue;
});
comparePaymentAmount@1hubengineering/verifier/comparison
declare function comparePaymentAmount(expectedMinor: number, actualMinor: unknown, policy?: AmountPolicy): AmountCheck;
compareReceipt@1hubengineering/verifier/comparison
declare function compareReceipt(expectation: PaymentExpectation, evidence: unknown, expectedTransactionId?: string): ReceiptComparison;
createPaymentExpectation@1hubengineering/verifier/comparison
declare function createPaymentExpectation(input: unknown, options?: {
readonly defaultAmountPolicy?: AmountPolicy;
}): PaymentExpectation;
parseEtbAmount@1hubengineering/verifier/comparison
declare function parseEtbAmount(value: string): EtbMinorUnits;
DetectedPaymentInput@1hubengineering/verifier/input
type DetectedPaymentInput = {
readonly provider: "telebirr";
readonly inputType: InputType;
readonly identifierKind: "transaction_id";
readonly identifier: string;
} | {
readonly provider: "cbe";
readonly inputType: InputType;
readonly identifierKind: "receipt_id";
readonly identifier: string;
};
InputDetectionResult@1hubengineering/verifier/input
type InputDetectionResult = {
readonly ok: true;
readonly value: DetectedPaymentInput;
} | {
readonly ok: false;
readonly error: {
readonly code: InputErrorCode;
readonly message: string;
readonly details: Readonly<Record<string, JsonValue>>;
};
};
InputErrorCode@1hubengineering/verifier/input
type InputErrorCode = keyof typeof messages;
InputType@1hubengineering/verifier/input
type InputType = "identifier" | "receipt_url" | "sms";
PAYMENT_INPUT_LIMIT@1hubengineering/verifier/input
declare const PAYMENT_INPUT_LIMIT = 4096;
detectPaymentInput@1hubengineering/verifier/input
declare function detectPaymentInput(input: string): InputDetectionResult;
SqlEngine@1hubengineering/storage-sql
type SqlEngine = "postgres" | "mysql" | "sqlite";
SqlStorage@1hubengineering/storage-sql
interface SqlStorage extends VerificationStorage {
/** Apply v1 schema explicitly; no import-time migration or connection ownership. */
migrate(): Promise<void>;
/** Use the caller's actual Kysely transaction; caller owns commit, rollback and retry. */
withTransaction(transaction: Kysely<StorageSchema>): VerificationStorage;
}
StorageDataError@1hubengineering/storage-sql
declare class StorageDataError extends Error {
constructor();
}
StorageSchema@1hubengineering/storage-sql
interface StorageSchema {
receipt_verifier_records: {
record_key: string;
payload: string;
};
receipt_verifier_schema: {
id: number;
version: number;
};
}
createSqlStorage@1hubengineering/storage-sql
declare function createSqlStorage(database: Kysely<StorageSchema>, engine: SqlEngine): SqlStorage;
isSqlConflict@1hubengineering/storage-sql
declare function isSqlConflict(error: unknown): boolean;
postgresStorage@1hubengineering/storage-sql/postgres
export declare function postgresStorage(pool: Pool): SqlStorage;
postgresTransaction@1hubengineering/storage-sql/postgres
export declare function postgresTransaction(client: PoolClient): VerificationStorage;
mysqlStorage@1hubengineering/storage-sql/mysql
export declare function mysqlStorage(pool: Pool): SqlStorage;
mysqlTransaction@1hubengineering/storage-sql/mysql
export declare function mysqlTransaction(connection: PoolConnection): VerificationStorage;
sqliteStorage@1hubengineering/storage-sql/sqlite
export declare function sqliteStorage(database: Database): SqlStorage;
sqliteTransaction@1hubengineering/storage-sql/sqlite
export declare function sqliteTransaction(database: Database): VerificationStorage;
drizzlePostgresStorage@1hubengineering/adapter-drizzle/postgres
export declare function drizzlePostgresStorage<T extends AnyRelations>(database: NodePgDatabase<T>): VerificationStorage;
drizzlePostgresTransaction@1hubengineering/adapter-drizzle/postgres
export declare function drizzlePostgresTransaction<T extends AnyRelations>(transaction: Tx<T>): VerificationStorage;
receiptVerifierRecords@1hubengineering/adapter-drizzle/postgres
export declare const receiptVerifierRecords: ReturnType<typeof pgTable<"receipt_verifier_records", {
recordKey: ReturnType<PgVarcharBuilder["primaryKey"]>;
payload: ReturnType<PgTextBuilder["notNull"]>;
}>>;
receiptVerifierSchema@1hubengineering/adapter-drizzle/postgres
export declare const receiptVerifierSchema: ReturnType<typeof pgTable<"receipt_verifier_schema", {
id: ReturnType<PgIntegerBuilder["primaryKey"]>;
version: ReturnType<PgIntegerBuilder["notNull"]>;
}>>;
drizzleMysqlStorage@1hubengineering/adapter-drizzle/mysql
export declare function drizzleMysqlStorage<T extends AnyRelations>(database: MySql2Database<T>): VerificationStorage;
drizzleMysqlTransaction@1hubengineering/adapter-drizzle/mysql
export declare function drizzleMysqlTransaction<T extends AnyRelations>(transaction: Tx<T>): VerificationStorage;
receiptVerifierRecords@1hubengineering/adapter-drizzle/mysql
export declare const receiptVerifierRecords: ReturnType<typeof mysqlTable<"receipt_verifier_records", {
recordKey: ReturnType<MySqlVarCharBuilder<[string, ...string[]]>["primaryKey"]>;
payload: ReturnType<MySqlTextBuilder<[string, ...string[]]>["notNull"]>;
}>>;
receiptVerifierSchema@1hubengineering/adapter-drizzle/mysql
export declare const receiptVerifierSchema: ReturnType<typeof mysqlTable<"receipt_verifier_schema", {
id: ReturnType<MySqlIntBuilder<boolean | undefined>["primaryKey"]>;
version: ReturnType<MySqlIntBuilder<boolean | undefined>["notNull"]>;
}>>;
drizzleSqliteStorage@1hubengineering/adapter-drizzle/sqlite
export declare function drizzleSqliteStorage<T extends AnyRelations>(database: LibSQLDatabase<T>): VerificationStorage;
drizzleSqliteTransaction@1hubengineering/adapter-drizzle/sqlite
export declare function drizzleSqliteTransaction<T extends AnyRelations>(transaction: Tx<T>): VerificationStorage;
receiptVerifierRecords@1hubengineering/adapter-drizzle/sqlite
export declare const receiptVerifierRecords: ReturnType<typeof sqliteTable<"receipt_verifier_records", {
recordKey: ReturnType<SQLiteTextBuilder<[string, ...string[]]>["primaryKey"]>;
payload: ReturnType<SQLiteTextBuilder<[string, ...string[]]>["notNull"]>;
}>>;
receiptVerifierSchema@1hubengineering/adapter-drizzle/sqlite
export declare const receiptVerifierSchema: ReturnType<typeof sqliteTable<"receipt_verifier_schema", {
id: ReturnType<SQLiteIntegerBuilder["primaryKey"]>;
version: ReturnType<SQLiteIntegerBuilder["notNull"]>;
}>>;
prismaStorage@1hubengineering/adapter-prisma
export declare function prismaStorage(client: PrismaReceiptClient): VerificationStorage;
prismaTransaction@1hubengineering/adapter-prisma
export declare function prismaTransaction(client: PrismaReceiptTransaction, policy: {
readonly isolationLevel: "Serializable";
}): VerificationStorage;
PrismaRecord@1hubengineering/adapter-prisma
export interface PrismaRecord {
readonly recordKey: string;
readonly payload: string;
}
PrismaReceiptTransaction@1hubengineering/adapter-prisma
export interface PrismaReceiptTransaction {
readonly receiptVerifierRecord: {
findUnique(args: {
where: {
recordKey: string;
};
}): Promise<PrismaRecord | null>;
create(args: {
data: PrismaRecord;
}): Promise<PrismaRecord>;
updateMany(args: {
where: {
recordKey: string;
};
data: {
payload: string;
};
}): Promise<{
count: number;
}>;
deleteMany(args: {
where: {
recordKey: string;
};
}): Promise<{
count: number;
}>;
findMany(args: {
where: {
recordKey: {
startsWith: string;
};
};
orderBy: {
recordKey: "asc";
};
take: number;
}): Promise<PrismaRecord[]>;
};
}
PrismaReceiptClient@1hubengineering/adapter-prisma
export interface PrismaReceiptClient extends PrismaReceiptTransaction {
$transaction<T>(work: (transaction: PrismaReceiptTransaction) => Promise<T>, options: {
isolationLevel: "Serializable";
maxWait: number;
timeout: number;
}): Promise<T>;
}
checkCbeBrowser@1hubengineering/provider-cbe
export declare function checkCbeBrowser(): Promise<void>;
createCbeProvider@1hubengineering/provider-cbe
export declare function createCbeProvider(options?: {
readonly maxConcurrency?: number;
}): CbeProvider;
CbeProvider@1hubengineering/provider-cbe
export interface CbeProvider {
retrieve(input: string, options?: RetrievalOptions): Promise<ProviderResult>;
}