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.68 kB
{"version":3,"file":"SingleContextLruCacheRecord.mjs","names":[],"sources":["../../../../src/modules/cache/singleContextLruCache/SingleContextLruCacheRecord.ts"],"sourcesContent":["import { Type } from 'class-transformer'\nimport type { TagsBase } from '../../../storage/BaseRecord'\n\nimport { BaseRecord } from '../../../storage/BaseRecord'\nimport { uuid } from '../../../utils/uuid'\n\nexport interface SingleContextLruCacheItem {\n value: unknown\n expiresAt?: number\n}\n\nexport interface SingleContextLruCacheProps {\n id?: string\n createdAt?: Date\n tags?: TagsBase\n\n entries: Map<string, SingleContextLruCacheItem>\n}\n\nexport class SingleContextLruCacheRecord extends BaseRecord {\n @Type(() => Object)\n public entries!: Map<string, SingleContextLruCacheItem>\n\n public static readonly type = 'SingleContextLruCacheRecord'\n public readonly type = SingleContextLruCacheRecord.type\n\n public constructor(props: SingleContextLruCacheProps) {\n super()\n\n if (props) {\n this.id = props.id ?? uuid()\n this.createdAt = props.createdAt ?? new Date()\n this.entries = props.entries\n this._tags = props.tags ?? {}\n }\n }\n\n public getTags() {\n return {\n ...this._tags,\n }\n }\n}\n"],"mappings":";;;;;;AAmBA,IAAa,8BAAb,MAAa,oCAAoC,WAAW;CAO1D,YAAmB,OAAmC;EACpD,MAAM;EAHR,KAAgB,OAAO,4BAA4B;EAKjD,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,4BAAuB,OAAO;AAH7B,WAAA,CAAA,WAAW,MAAM,GAAA,mBAAA,eAAA,OAAA,QAAA,cAAA,SAAA,GAAA,CAAA,GAAA,4BAAA,WAAA,WAAA,KAAA,CAAA"}