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

1 lines • 1.51 kB
{"version":3,"file":"GenericRecord.mjs","names":[],"sources":["../../../../src/modules/generic-records/repository/GenericRecord.ts"],"sourcesContent":["import type { TagsBase } from '../../../storage/BaseRecord'\n\nimport { BaseRecord } from '../../../storage/BaseRecord'\nimport { uuid } from '../../../utils/uuid'\n\nexport type GenericRecordTags = TagsBase\n\nexport interface GenericRecordStorageProps {\n id?: string\n createdAt?: Date\n tags?: GenericRecordTags\n content: Record<string, unknown>\n}\n\nexport interface SaveGenericRecordOption {\n content: Record<string, unknown>\n id?: string\n tags?: GenericRecordTags\n}\n\nexport class GenericRecord extends BaseRecord<GenericRecordTags> {\n public content!: Record<string, unknown>\n\n public static readonly type = 'GenericRecord'\n public readonly type = GenericRecord.type\n\n public constructor(props: GenericRecordStorageProps) {\n super()\n\n if (props) {\n this.id = props.id ?? uuid()\n this.createdAt = props.createdAt ?? new Date()\n this.content = props.content\n this._tags = props.tags ?? {}\n }\n }\n\n public getTags() {\n return {\n ...this._tags,\n }\n }\n}\n"],"mappings":";;;AAoBA,IAAa,gBAAb,MAAa,sBAAsB,WAA8B;CAM/D,YAAmB,OAAkC;EACnD,MAAM;EAHR,KAAgB,OAAO,cAAc;EAKnC,IAAI,OAAO;GACT,KAAK,KAAK,MAAM,MAAM,KAAK;GAC3B,KAAK,YAAY,MAAM,6BAAa,IAAI,KAAK;GAC7C,KAAK,UAAU,MAAM;GACrB,KAAK,QAAQ,MAAM,QAAQ,CAAC;EAC9B;CACF;CAEA,UAAiB;EACf,OAAO,EACL,GAAG,KAAK,MACV;CACF;AACF;AAnBE,cAAuB,OAAO"}