From 03d75f9022b4147536a12d59e015f6b9efd6be20 Mon Sep 17 00:00:00 2001 From: AsterITA Date: Thu, 14 Nov 2024 11:26:02 +0100 Subject: [PATCH] added Incaricato models --- package.json | 2 +- proto/v2/eservice/eservice.proto | 2 ++ proto/v2/tenant/events.proto | 8 ++++++++ proto/v2/tenant/tenant.proto | 5 +++++ src/tenant/eventsV2.ts | 24 ++++++++++++++++++++++++ 5 files changed, 40 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index fbc62ee..2724b41 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/proto/v2/eservice/eservice.proto b/proto/v2/eservice/eservice.proto index 38d56ae..e87e514 100644 --- a/proto/v2/eservice/eservice.proto +++ b/proto/v2/eservice/eservice.proto @@ -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 { diff --git a/proto/v2/tenant/events.proto b/proto/v2/tenant/events.proto index f916abf..2b7d85e 100644 --- a/proto/v2/tenant/events.proto +++ b/proto/v2/tenant/events.proto @@ -77,3 +77,11 @@ message TenantDelegatedProducerFeatureAddedV2 { message TenantDelegatedProducerFeatureRemovedV2 { TenantV2 tenant = 1; } + +message TenantDelegatedConsumerFeatureAddedV2 { + TenantV2 tenant = 1; +} + +message TenantDelegatedConsumerFeatureRemovedV2 { + TenantV2 tenant = 1; +} \ No newline at end of file diff --git a/proto/v2/tenant/tenant.proto b/proto/v2/tenant/tenant.proto index 617ee2f..26346f4 100644 --- a/proto/v2/tenant/tenant.proto +++ b/proto/v2/tenant/tenant.proto @@ -32,6 +32,7 @@ message TenantFeatureV2 { oneof sealed_value { CertifierV2 certifier = 1; DelegatedProducerV2 delegatedProducer = 2; + DelegatedConsumerV2 delegatedConsumer = 3; } } @@ -43,6 +44,10 @@ message DelegatedProducerV2 { int64 availabilityTimestamp = 1; } +message DelegatedConsumerV2 { + int64 availabilityTimestamp = 1; +} + message TenantVerifierV2 { string id = 1; int64 verificationDate = 2; diff --git a/src/tenant/eventsV2.ts b/src/tenant/eventsV2.ts index 0953cdb..e8c3c0f 100644 --- a/src/tenant/eventsV2.ts +++ b/src/tenant/eventsV2.ts @@ -17,6 +17,8 @@ import { MaintenanceTenantUpdatedV2, TenantDelegatedProducerFeatureAddedV2, TenantDelegatedProducerFeatureRemovedV2, + TenantDelegatedConsumerFeatureAddedV2, + TenantDelegatedConsumerFeatureRemovedV2, } from "../gen/v2/tenant/events.js"; import { protobufDecoder } from "../utils.js"; @@ -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(); } @@ -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;