From 3a389dc01a1583f98f2e0abbdb91aa66ff9239f1 Mon Sep 17 00:00:00 2001 From: Konstantin Tsabolov <konstantin.tsabolov@spherity.com> Date: Mon, 18 Dec 2023 15:24:44 +0100 Subject: [PATCH] feat(shared): add credential offers events --- .../src/events/credentialOfferEvents.ts | 48 +++++++++++++++++++ apps/shared/src/index.ts | 1 + 2 files changed, 49 insertions(+) create mode 100644 apps/shared/src/events/credentialOfferEvents.ts diff --git a/apps/shared/src/events/credentialOfferEvents.ts b/apps/shared/src/events/credentialOfferEvents.ts new file mode 100644 index 0000000..d120f84 --- /dev/null +++ b/apps/shared/src/events/credentialOfferEvents.ts @@ -0,0 +1,48 @@ +import type { BaseEventInput } from './baseEvents.js'; +import type { AnonCredsCredentialOffer } from '@aries-framework/anoncreds'; + +import { BaseEvent } from './baseEvents.js'; + +export type EventAnonCredsCredentialOfferGetAllInput = BaseEventInput; + +export class EventAnonCredsCredentialOfferGetAll extends BaseEvent< + Array<AnonCredsCredentialOffer> +> { + public static token = 'anoncreds.credentialOffers.getAll'; + + public get instance() { + return this.data; + } + + public static fromEvent(e: EventAnonCredsCredentialOfferGetAll) { + return new EventAnonCredsCredentialOfferGetAll( + e.data, + e.tenantId, + e.id, + e.type, + e.timestamp, + ); + } +} + +export type EventAnonCredsCredentialOfferGetByIdInput = BaseEventInput & { + credentialOfferId: string; +}; + +export class EventAnonCredsCredentialOfferGetById extends BaseEvent<AnonCredsCredentialOffer | null> { + public static token = 'anoncreds.credentialOffers.getById'; + + public get instance() { + return this.data; + } + + public static fromEvent(e: EventAnonCredsCredentialOfferGetById) { + return new EventAnonCredsCredentialOfferGetById( + e.data, + e.tenantId, + e.id, + e.type, + e.timestamp, + ); + } +} diff --git a/apps/shared/src/index.ts b/apps/shared/src/index.ts index 9abcab2..7e5e282 100644 --- a/apps/shared/src/index.ts +++ b/apps/shared/src/index.ts @@ -10,6 +10,7 @@ export * from './events/tenantEvents.js'; export * from './events/schemaEvents.js'; export * from './events/credentialDefinitionEvents.js'; export * from './events/credentialEvents.js'; +export * from './events/credentialOfferEvents.js'; export * from './dto/pagination-params.dto.js'; export * from './dto/multitenancy-params.dto.js'; -- GitLab