Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/1.0.11-x' into release/1…
Browse files Browse the repository at this point in the history
….0.12b
  • Loading branch information
AsterITA committed Dec 2, 2024
2 parents 03d75f9 + a298109 commit a4c87e4
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions proto/v2/eservice/eservice.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ message EServiceDescriptorV2 {
optional int64 deprecatedAt = 16;
optional int64 archivedAt = 17;
EServiceAttributesV2 attributes = 18;
repeated DescriptorRejectionReasonV2 rejectionReasons = 19;
}

message EServiceDocumentV2 {
Expand Down
15 changes: 15 additions & 0 deletions proto/v2/eservice/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,18 @@ message EServiceDescriptorDocumentDeletedV2 {
message EServiceDescriptionUpdatedV2 {
EServiceV2 eservice = 1;
}

message EServiceDescriptorDelegateSubmittedV2 {
string descriptorId = 1;
EServiceV2 eservice = 2;
}

message EServiceDescriptorDelegatorApprovedV2 {
string descriptorId = 1;
EServiceV2 eservice = 2;
}

message EServiceDescriptorDelegatorRejectedV2 {
string descriptorId = 1;
EServiceV2 eservice = 2;
}
36 changes: 36 additions & 0 deletions src/eservice/eventsV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import {
EServiceDraftDescriptorUpdatedV2,
EServiceDescriptorQuotasUpdatedV2,
EServiceDescriptionUpdatedV2,
EServiceDescriptorDelegateSubmittedV2,
EServiceDescriptorDelegatorApprovedV2,
EServiceDescriptorDelegatorRejectedV2,
} from "../gen/v2/eservice/events.js";

export function eServiceEventToBinaryDataV2(
Expand Down Expand Up @@ -84,6 +87,15 @@ export function eServiceEventToBinaryDataV2(
.with({ type: "EServiceDescriptionUpdated" }, ({ data }) =>
EServiceDescriptionUpdatedV2.toBinary(data)
)
.with({ type: "EServiceDescriptorDelegateSubmitted" }, ({ data }) =>
EServiceDescriptorDelegateSubmittedV2.toBinary(data)
)
.with({ type: "EServiceDescriptorDelegatorApproved" }, ({ data }) =>
EServiceDescriptorDelegatorApprovedV2.toBinary(data)
)
.with({ type: "EServiceDescriptorDelegatorRejected" }, ({ data }) =>
EServiceDescriptorDelegatorRejectedV2.toBinary(data)
)
.exhaustive();
}

Expand Down Expand Up @@ -240,6 +252,30 @@ export const EServiceEventV2 = z.discriminatedUnion("type", [
version: z.number(),
timestamp: z.coerce.date(),
}),
z.object({
event_version: z.literal(2),
type: z.literal("EServiceDescriptorDelegateSubmitted"),
data: protobufDecoder(EServiceDescriptorDelegateSubmittedV2),
stream_id: z.string(),
version: z.number(),
timestamp: z.coerce.date(),
}),
z.object({
event_version: z.literal(2),
type: z.literal("EServiceDescriptorDelegatorApproved"),
data: protobufDecoder(EServiceDescriptorDelegatorApprovedV2),
stream_id: z.string(),
version: z.number(),
timestamp: z.coerce.date(),
}),
z.object({
event_version: z.literal(2),
type: z.literal("EServiceDescriptorDelegatorRejected"),
data: protobufDecoder(EServiceDescriptorDelegatorRejectedV2),
stream_id: z.string(),
version: z.number(),
timestamp: z.coerce.date(),
}),
]);

export type EServiceEventV2 = z.infer<typeof EServiceEventV2>;
1 change: 1 addition & 0 deletions tests/eservice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ describe("eservice", () => {
verified: [],
declared: [],
},
rejectionReasons: [],
},
],
},
Expand Down

0 comments on commit a4c87e4

Please sign in to comment.