Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync models with monorepo main branch #19

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion proto/v2/eservice/eservice.proto
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ message EServiceDescriptorV2 {
optional int64 deprecatedAt = 16;
optional int64 archivedAt = 17;
EServiceAttributesV2 attributes = 18;
repeated DescriptorRejectionReasonV2 rejectionReasons = 19;
}

message EServiceDocumentV2 {
Expand Down
15 changes: 0 additions & 15 deletions proto/v2/eservice/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,3 @@ 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;
}
3 changes: 3 additions & 0 deletions proto/v2/tenant/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ message TenantDelegatedProducerFeatureAddedV2 {
TenantV2 tenant = 1;
}

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

export function eServiceEventToBinaryDataV2(
Expand Down Expand Up @@ -87,15 +84,6 @@ 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 @@ -252,30 +240,6 @@ 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>;
12 changes: 12 additions & 0 deletions src/tenant/eventsV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
TenantKindUpdatedV2,
MaintenanceTenantPromotedToCertifierV2,
TenantDelegatedProducerFeatureAddedV2,
TenantDelegatedProducerFeatureRemovedV2,
} from "../gen/v2/tenant/events.js";
import { protobufDecoder } from "../utils.js";

Expand Down Expand Up @@ -62,6 +63,9 @@ export function tenantEventToBinaryDataV2(event: TenantEventV2): Uint8Array {
.with({ type: "TenantDelegatedProducerFeatureAdded" }, ({ data }) =>
TenantDelegatedProducerFeatureAddedV2.toBinary(data)
)
.with({ type: "TenantDelegatedProducerFeatureRemoved" }, ({ data }) =>
TenantDelegatedProducerFeatureRemovedV2.toBinary(data)
)
.exhaustive();
}

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

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