@veramo/data-store
Version:
Veramo data storage plugin based on TypeORM database drivers
66 lines (54 loc) • 1.6 kB
text/typescript
import { Entity, Column, BaseEntity, ManyToOne, PrimaryColumn, Relation } from 'typeorm'
import { Identifier } from './identifier.js'
import { Credential } from './credential.js'
/**
* Represents the properties of a claim extracted from a Verifiable Credential `credentialSubject`, and stored in a
* TypeORM database for querying.
*
* @see {@link @veramo/core-types#IDataStoreORM} for the interface defining how this can be queried.
* @see {@link @veramo/data-store#DataStoreORM} for the implementation of the query interface.
*
* @beta This API may change without a BREAKING CHANGE notice.
*/
('claim')
export class Claim extends BaseEntity {
()
// @ts-ignore
hash: string
((type) => Identifier, (identifier) => identifier.issuedClaims, {
eager: true,
onDelete: 'CASCADE',
})
// @ts-ignore
issuer: Relation<Identifier>
((type) => Identifier, (identifier) => identifier.receivedClaims, {
eager: true,
nullable: true,
})
subject?: Relation<Identifier>
((type) => Credential, (credential) => credential.claims, {
onDelete: 'CASCADE',
})
// @ts-ignore
credential: Relation<Credential>
()
// @ts-ignore
issuanceDate: Date
({ nullable: true })
expirationDate?: Date
('simple-array')
// @ts-ignore
context: string[]
('simple-array')
// @ts-ignore
credentialType: string[]
()
// @ts-ignore
type: string
('text', { nullable: true })
// @ts-ignore
value: string | null
()
// @ts-ignore
isObj: boolean
}