@altostra/core
Version:
Core library for shared types and logic
92 lines (91 loc) • 3.71 kB
TypeScript
import type { Integer } from "../../common/CustomTypes/Integer";
import type { NonEmptyString } from "../../common/CustomTypes/NonEmptyString";
import type { ResourceBase } from "./Common";
/**
* @deprecated Only for Backward compatibility
*/
export declare type SimpleTableType = 'resource.table.simple';
/**
* @deprecated Only for Backward compatibility
*/
export interface SimpleTable extends ResourceBase {
type: SimpleTableType;
tableName: string;
key: string;
throughput?: TableThroughput;
}
export declare type TableType = 'resource.table';
export interface Table extends ResourceBase {
type: TableType;
deletionPolicy?: 'Delete' | 'Retain';
tableName: string;
key: TableKey;
primaryIndexes?: TableIndex[];
secondaryIndexes?: TableIndex[];
stream?: TableStream;
TTL?: TTLSpecification;
aws: AwsTableSpecific;
isPointInTimeRecoveryEnabled?: boolean;
}
export interface TTLSpecification {
attributeName: NonEmptyString;
disabled?: boolean;
}
export interface TableStream {
streamViewType: StreamViewType;
}
export declare type StreamViewType = 'KEYS_ONLY' | 'NEW_AND_OLD_IMAGES' | 'NEW_IMAGE' | 'OLD_IMAGE';
export interface AwsTablePayPerRequestSpecific {
billingModel: 'PAY_PER_REQUEST';
throughput?: undefined;
}
export interface AwsTableProvisionedSpecific {
billingModel: 'PROVISIONED';
throughput: TableThroughput;
}
export declare type AwsTableSpecific = AwsTablePayPerRequestSpecific | AwsTableProvisionedSpecific;
export declare type TableKeyType = 'BINARY' | 'NUMBER' | 'STRING';
export interface TableKey {
hash: TableKeyPart;
range?: TableKeyPart;
}
export interface TableKeyPart {
name: string;
type: TableKeyType;
}
export interface TableIndex {
name: string;
key: TableKey;
projection: TableIndexProjection;
throughput?: TableThroughput;
}
export declare type TableIndexProjection = TableIndexIncludeProjection | {
type: 'table.index.projection.all';
} | {
type: 'table.index.projection.keys';
};
export interface TableIndexIncludeProjection {
type: 'table.index.projection.include';
attributes: string[];
}
export interface TableThroughput {
readUnits: Integer;
writeUnits: Integer;
}
export declare type TableResourceType = SimpleTableType | TableType;
export declare type TableResource = SimpleTable | Table;
export declare type TableResourceByType = {
[K in SimpleTableType]: SimpleTable;
} & {
[K in TableType]: Table;
};
export declare const isTableThroughput: import("@altostra/type-validations").ObjectOfTypeValidation<TableThroughput>;
export declare const isSimpleTable: import("@altostra/type-validations").ObjectOfTypeValidation<SimpleTable>;
export declare const isTableKeyPart: import("@altostra/type-validations").ObjectOfTypeValidation<TableKeyPart>;
export declare const isTableKey: import("@altostra/type-validations").ObjectOfTypeValidation<TableKey>;
export declare const isTableIndexProjection: import("@altostra/type-validations").TypeValidation<TableIndexProjection>;
export declare const isTableIndex: import("@altostra/type-validations").ObjectOfTypeValidation<TableIndex>;
export declare const isAwsTablePayPerRequestSpecific: import("@altostra/type-validations").ObjectOfTypeValidation<AwsTablePayPerRequestSpecific>;
export declare const isAwsTableProvisionedSpecific: import("@altostra/type-validations").ObjectOfTypeValidation<AwsTableProvisionedSpecific>;
export declare const isAwsTableSpecific: import("@altostra/type-validations").TypeValidation<AwsTablePayPerRequestSpecific | AwsTableProvisionedSpecific>;
export declare const isTable: import("@altostra/type-validations").ObjectOfTypeValidation<Table>;