Skip to content

Latest commit

 

History

History
78 lines (64 loc) · 2.38 KB

File metadata and controls

78 lines (64 loc) · 2.38 KB

API Report File for "@aws-blocks/bb-distributed-data"

Do not edit this file. It is a report generated by API Extractor.

import type { ChildLogger } from '@aws-blocks/bb-logger';
import { createKyselyAdapter } from '@aws-blocks/data-common';
import type { DatabaseBase } from '@aws-blocks/data-common';
import { DatabaseEngine } from '@aws-blocks/data-common';
import { Scope } from '@aws-blocks/core';
import type { ScopeParent } from '@aws-blocks/core';
import { sql } from '@aws-blocks/data-common';
import { SqlQuery } from '@aws-blocks/data-common';
import { Transaction } from '@aws-blocks/data-common';

// @public
export class Counter {
    // @internal
    constructor(resolveBase: () => Promise<DatabaseBase>, name: string);
    current(): Promise<number>;
    next(delta?: number): Promise<number>;
    reset(value?: number): Promise<void>;
}

export { createKyselyAdapter }

// @public (undocumented)
export class DistributedDatabase extends Scope {
    constructor(scope: ScopeParent, id: string, _options?: DistributedDatabaseOptions);
    counter(name: string): Counter;
    // (undocumented)
    execute(query: SqlQuery): Promise<{
        rowCount: number;
    }>;
    // @internal (undocumented)
    getEngine(): DatabaseEngine;
    // @internal
    protected log: ChildLogger;
    // (undocumented)
    query<T>(query: SqlQuery): Promise<T[]>;
    // (undocumented)
    queryOne<T>(query: SqlQuery): Promise<T | null>;
    transaction<T>(fn: (tx: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
}

// @public
export const DistributedDatabaseErrors: {
    readonly QueryFailed: "QueryFailedException";
    readonly ConnectionFailed: "ConnectionFailedException";
    readonly TransactionFailed: "TransactionFailedException";
    readonly UniqueConstraintViolation: "UniqueConstraintViolationException";
    readonly SerializationFailure: "SerializationFailureException";
    readonly TransactionRowLimitExceeded: "TransactionRowLimitExceededException";
};

// @public (undocumented)
export interface DistributedDatabaseOptions {
    logger?: ChildLogger;
    migrationsPath?: string;
    removalPolicy?: 'destroy' | 'retain';
}

export { sql }

export { SqlQuery }

export { Transaction }

// @public
export interface TransactionOptions {
    maxRetries?: number;
    retryOnConflict?: boolean;
}

// (No @packageDocumentation comment for this package)