Skip to content

Commit

Permalink
added Incaricato models
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterITA committed Nov 14, 2024
1 parent f77d8fb commit 03d75f9
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pagopa/interop-outbound-models",
"version": "1.0.10",
"version": "1.0.12a",
"description": "PagoPA Interoperability outbound models",
"main": "dist",
"type": "module",
Expand Down
2 changes: 2 additions & 0 deletions proto/v2/eservice/eservice.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ message EServiceV2 {
int64 createdAt = 7;
EServiceModeV2 mode = 8;
optional bool isSignalHubEnabled = 9;
optional bool isDelegable = 10;
optional bool isClientAccessDelegable = 11;
}

message EServiceAttributeValueV2 {
Expand Down
8 changes: 8 additions & 0 deletions proto/v2/tenant/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,11 @@ message TenantDelegatedProducerFeatureAddedV2 {
message TenantDelegatedProducerFeatureRemovedV2 {
TenantV2 tenant = 1;
}

message TenantDelegatedConsumerFeatureAddedV2 {
TenantV2 tenant = 1;
}

message TenantDelegatedConsumerFeatureRemovedV2 {
TenantV2 tenant = 1;
}
5 changes: 5 additions & 0 deletions proto/v2/tenant/tenant.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ message TenantFeatureV2 {
oneof sealed_value {
CertifierV2 certifier = 1;
DelegatedProducerV2 delegatedProducer = 2;
DelegatedConsumerV2 delegatedConsumer = 3;
}
}

Expand All @@ -43,6 +44,10 @@ message DelegatedProducerV2 {
int64 availabilityTimestamp = 1;
}

message DelegatedConsumerV2 {
int64 availabilityTimestamp = 1;
}

message TenantVerifierV2 {
string id = 1;
int64 verificationDate = 2;
Expand Down
24 changes: 24 additions & 0 deletions src/tenant/eventsV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
MaintenanceTenantUpdatedV2,
TenantDelegatedProducerFeatureAddedV2,
TenantDelegatedProducerFeatureRemovedV2,
TenantDelegatedConsumerFeatureAddedV2,
TenantDelegatedConsumerFeatureRemovedV2,
} from "../gen/v2/tenant/events.js";
import { protobufDecoder } from "../utils.js";

Expand Down Expand Up @@ -70,6 +72,12 @@ export function tenantEventToBinaryDataV2(event: TenantEventV2): Uint8Array {
.with({ type: "TenantDelegatedProducerFeatureRemoved" }, ({ data }) =>
TenantDelegatedProducerFeatureRemovedV2.toBinary(data)
)
.with({ type: "TenantDelegatedConsumerFeatureAdded" }, ({ data }) =>
TenantDelegatedConsumerFeatureAddedV2.toBinary(data)
)
.with({ type: "TenantDelegatedConsumerFeatureRemoved" }, ({ data }) =>
TenantDelegatedConsumerFeatureRemovedV2.toBinary(data)
)
.exhaustive();
}

Expand Down Expand Up @@ -202,6 +210,22 @@ export const TenantEventV2 = z.discriminatedUnion("type", [
version: z.number(),
timestamp: z.coerce.date(),
}),
z.object({
event_version: z.literal(2),
type: z.literal("TenantDelegatedConsumerFeatureAdded"),
data: protobufDecoder(TenantDelegatedConsumerFeatureAddedV2),
stream_id: z.string(),
version: z.number(),
timestamp: z.coerce.date(),
}),
z.object({
event_version: z.literal(2),
type: z.literal("TenantDelegatedConsumerFeatureRemoved"),
data: protobufDecoder(TenantDelegatedConsumerFeatureRemovedV2),
stream_id: z.string(),
version: z.number(),
timestamp: z.coerce.date(),
}),
]);

export type TenantEventV2 = z.infer<typeof TenantEventV2>;

0 comments on commit 03d75f9

Please sign in to comment.