Skip to content

Commit

Permalink
Added MaintenanceTenantPromotedToCertifier event
Browse files Browse the repository at this point in the history
  • Loading branch information
Carminepo2 committed Aug 6, 2024
1 parent 1f21062 commit 70a43d1
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions proto/v2/tenant/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ message MaintenanceTenantDeletedV2 {
TenantV2 tenant = 2;
}

message MaintenanceTenantPromotedToCertifierV2 {
TenantV2 tenant = 1;
}

message TenantKindUpdatedV2 {
TenantKindV2 oldKind = 1;
TenantV2 tenant = 2;
Expand Down
1 change: 1 addition & 0 deletions src/agreement/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ export const AgreementEvent = VersionedEvent.transform((obj, ctx) => {
return res.data;
});

export type AgreementEventType = AgreementEvent["type"];
export type AgreementEvent = z.infer<typeof AgreementEvent>;
export { AgreementEventV1, AgreementEventV2 };
1 change: 1 addition & 0 deletions src/eservice/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ export const EServiceEvent = VersionedEvent.transform((obj, ctx) => {
return res.data;
});

export type EServiceEventType = EServiceEvent["type"];
export type EServiceEvent = z.infer<typeof EServiceEvent>;
export { EServiceEventV1, EServiceEventV2 };
2 changes: 2 additions & 0 deletions src/purpose/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@ export const PurposeEvent = VersionedEvent.transform((obj, ctx) => {
}
return res.data;
});

export type PurposeEventType = PurposeEvent["type"];
export type PurposeEvent = z.infer<typeof PurposeEvent>;
export { PurposeEventV1, PurposeEventV2 };
12 changes: 12 additions & 0 deletions src/tenant/eventsV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
MaintenanceTenantDeletedV2,
TenantVerifiedAttributeExtensionUpdatedV2,
TenantKindUpdatedV2,
MaintenanceTenantPromotedToCertifierV2,
} from "../gen/v2/tenant/events.js";
import { protobufDecoder } from "../utils.js";

Expand Down Expand Up @@ -54,6 +55,9 @@ export function tenantEventToBinaryDataV2(event: TenantEventV2): Uint8Array {
.with({ type: "TenantKindUpdated" }, ({ data }) =>
TenantKindUpdatedV2.toBinary(data)
)
.with({ type: "MaintenanceTenantPromotedToCertifier" }, ({ data }) =>
MaintenanceTenantPromotedToCertifierV2.toBinary(data)
)
.exhaustive();
}

Expand Down Expand Up @@ -154,6 +158,14 @@ export const TenantEventV2 = z.discriminatedUnion("type", [
version: z.number(),
timestamp: z.coerce.date(),
}),
z.object({
event_version: z.literal(2),
type: z.literal("MaintenanceTenantPromotedToCertifier"),
data: protobufDecoder(TenantKindUpdatedV2),
stream_id: z.string(),
version: z.number(),
timestamp: z.coerce.date(),
}),
]);

export type TenantEventV2 = z.infer<typeof TenantEventV2>;
2 changes: 2 additions & 0 deletions src/tenant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ export const TenantEvent = VersionedEvent.transform((obj, ctx) => {
});

export type TenantEvent = z.infer<typeof TenantEvent>;
export type TenantEventType = TenantEvent["type"];

export { TenantEventV1, TenantEventV2 };

0 comments on commit 70a43d1

Please sign in to comment.