{"version":3,"file":"StatusListRecord.mjs","names":[],"sources":["../../src/repository/StatusListRecord.ts"],"sourcesContent":["/**\n * StatusListRecord\n *\n * Stores issuer-side status list data including the bitstring and allocation state.\n */\n\nimport type { TagsBase } from '@credo-ts/core'\nimport { BaseRecord, utils } from '@credo-ts/core'\nimport type { StatusPurpose } from '../models/StatusListCredential'\n\nexport type DefaultStatusListTags = {\n  listId: string\n  issuerDid: string\n  purpose: StatusPurpose\n}\n\nexport type StatusListRecordProps = {\n  id?: string\n  createdAt?: Date\n  updatedAt?: Date\n  /** Unique identifier for this status list */\n  listId: string\n  /** DID of the issuer */\n  issuerDid: string\n  /** Purpose: revocation or suspension */\n  purpose: StatusPurpose\n  /** Base64url-encoded bitstring (uncompressed for manipulation) */\n  bitstringBase64: string\n  /** Total capacity in bits */\n  capacity: number\n  /** Next available index */\n  nextIndex: number\n  /** Map of credential IDs to their allocated indices */\n  credentialIndexMap: Record<string, number>\n  /** Base URL where the status list is hosted */\n  baseUrl: string\n  tags?: TagsBase\n}\n\nexport class StatusListRecord extends BaseRecord<DefaultStatusListTags, TagsBase> implements StatusListRecordProps {\n  public listId!: string\n  public issuerDid!: string\n  public purpose!: StatusPurpose\n  public bitstringBase64!: string\n  public capacity!: number\n  public nextIndex!: number\n  public credentialIndexMap!: Record<string, number>\n  public baseUrl!: string\n\n  public static readonly type = 'StatusListRecord'\n  public readonly type = StatusListRecord.type\n\n  public constructor(props?: StatusListRecordProps) {\n    super()\n    if (props) {\n      this.id = props.id ?? props.listId ?? utils.uuid()\n      this.createdAt = props.createdAt ?? new Date()\n      this.updatedAt = props.updatedAt ?? new Date()\n      this.listId = props.listId\n      this.issuerDid = props.issuerDid\n      this.purpose = props.purpose\n      this.bitstringBase64 = props.bitstringBase64\n      this.capacity = props.capacity\n      this.nextIndex = props.nextIndex\n      this.credentialIndexMap = props.credentialIndexMap\n      this.baseUrl = props.baseUrl\n      this._tags = props.tags ?? {}\n    } else {\n      this.id = utils.uuid()\n      this.createdAt = new Date()\n      this.updatedAt = new Date()\n      this.credentialIndexMap = {}\n      this._tags = {}\n    }\n  }\n\n  public getTags(): DefaultStatusListTags {\n    return {\n      ...this._tags,\n      listId: this.listId,\n      issuerDid: this.issuerDid,\n      purpose: this.purpose,\n    }\n  }\n}\n"],"mappings":";;;AAuCA,IAAa,mBAAb,MAAa,yBAAyB,WAA6E;CAajH,AAAO,YAAY,OAA+B;AAChD,SAAO;OAHO,OAAO,iBAAiB;AAItC,MAAI,OAAO;AACT,QAAK,KAAK,MAAM,MAAM,MAAM,UAAU,MAAM,MAAM;AAClD,QAAK,YAAY,MAAM,6BAAa,IAAI,MAAM;AAC9C,QAAK,YAAY,MAAM,6BAAa,IAAI,MAAM;AAC9C,QAAK,SAAS,MAAM;AACpB,QAAK,YAAY,MAAM;AACvB,QAAK,UAAU,MAAM;AACrB,QAAK,kBAAkB,MAAM;AAC7B,QAAK,WAAW,MAAM;AACtB,QAAK,YAAY,MAAM;AACvB,QAAK,qBAAqB,MAAM;AAChC,QAAK,UAAU,MAAM;AACrB,QAAK,QAAQ,MAAM,QAAQ,EAAE;SACxB;AACL,QAAK,KAAK,MAAM,MAAM;AACtB,QAAK,4BAAY,IAAI,MAAM;AAC3B,QAAK,4BAAY,IAAI,MAAM;AAC3B,QAAK,qBAAqB,EAAE;AAC5B,QAAK,QAAQ,EAAE;;;CAInB,AAAO,UAAiC;AACtC,SAAO;GACL,GAAG,KAAK;GACR,QAAQ,KAAK;GACb,WAAW,KAAK;GAChB,SAAS,KAAK;GACf;;;iBAjCoB,OAAO"}