UNPKG

@credo-ts/core

Version:

<p align="center"> <br /> <img alt="Credo Logo" src="https://github.com/openwallet-foundation/credo-ts/blob/c7886cb8377ceb8ee4efe8d264211e561a75072d/images/credo-logo.png" height="250px" /> </p> <h1 align="center"><b>Credo - Core</b></h1

59 lines • 2.13 kB
import { Metadata } from "./Metadata.mjs"; //#region src/storage/BaseRecord.d.ts export type TagValue = string | boolean | undefined | Array<string> | null; export type TagsBase = { [key: string]: TagValue; [key: number]: never; }; export type Tags<DefaultTags extends TagsBase, CustomTags extends TagsBase> = CustomTags & DefaultTags; export type RecordTags<Record extends BaseRecord> = ReturnType<Record['getTags']>; export type BaseRecordAny = BaseRecord<any, any, any>; export declare abstract class BaseRecord<DefaultTags extends TagsBase = TagsBase, CustomTags extends TagsBase = TagsBase, MetadataValues = {}> { protected _tags: CustomTags & TagsBase; id: string; createdAt: Date; updatedAt?: Date; readonly type: string; static readonly type: string; readonly allowCache: boolean; static readonly allowCache: boolean; /** @inheritdoc {Metadata#Metadata} */ metadata: Metadata<MetadataValues>; /** * Get all tags. This is includes custom and default tags * @returns tags object */ abstract getTags(): Tags<DefaultTags, CustomTags>; /** * Set the value for a tag * @param name name of the tag * @param value value of the tag */ setTag(name: keyof CustomTags | (string & {}), value: CustomTags[keyof CustomTags]): void; /** * Get the value for a tag * @param name name of the tag * @returns The tag value, or undefined if not found */ getTag(name: keyof CustomTags | keyof DefaultTags | (string & {})): Tags<DefaultTags, CustomTags>[(string & {}) | keyof CustomTags | keyof DefaultTags]; /** * Set custom tags. This will merge the tags object with passed in tag properties * * @param tags the tags to set */ setTags(tags: Partial<CustomTags | TagsBase>): void; /** * Replace tags. This will replace the whole tags object. * Default tags will still be overridden when retrieving tags * * @param tags the tags to set */ replaceTags(tags: CustomTags & Partial<TagsBase>): void; toJSON(): Record<string, unknown>; /** * Clones the record. */ clone(): this; } //#endregion //# sourceMappingURL=BaseRecord.d.mts.map