@mbc-cqrs-serverless/core
Version:
CQRS and event base core
28 lines (27 loc) • 1.3 kB
TypeScript
export declare function addSortKeyVersion(sk: string, version: number): string;
export declare function getSortKeyVersion(sk: string): number;
export declare function removeSortKeyVersion(sk: string): string;
export declare function generateId(pk: string, sk: string): string;
/**
* Inverse of {@link generateId}: extracts the base sort key from a composite id (`pk#skBase`).
*/
export declare function sortKeyBaseFromId(pk: string, itemId: string): string | undefined;
/**
* Parses a composite {@link generateId} when partition key is always
* `{type}#{tenantCode}` (exactly two `#`-separated segments). The remainder of
* `itemId` after that prefix is `skBase` (may contain `#`).
*/
export declare function parseTwoSegmentPkSkFromId(itemId: string): {
pk: string;
skBase: string;
} | undefined;
export declare function getTenantCode(pk: string): string;
export declare function isS3AttributeKey(attributes: any): boolean;
export declare function toS3AttributeKey(bucket: string, key: string): string;
export declare function parseS3AttributeKey(s3Uri: string): {
bucket: string;
key: string;
};
export declare const masterPk: (tenantCode?: string) => string;
export declare const seqPk: (tenantCode?: string) => string;
export declare const ttlSk: (tableName: string) => string;