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

PIN 5554 eservice isDelegable #1188

Open
wants to merge 13 commits into
base: feature/incaricato
Choose a base branch
from
3 changes: 2 additions & 1 deletion collections/bff/catalog/Create a new EService.bru
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ body:json {
"description": "This is a test from BFF",
"technology": "SOAP",
"mode": "DELIVER",
"isSignalHubEnabled": true
"isSignalHubEnabled": true,
"isDelegable": true
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ body:json {
"description": "test eservice updated from BFF",
"technology": "SOAP",
"mode": "RECEIVE",
"isSignalHubEnabled": false
"isSignalHubEnabled": false,
"isDelegable": false
}
}

Expand Down
2 changes: 2 additions & 0 deletions packages/api-clients/open-api/apiGatewayApi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2619,6 +2619,8 @@ components:
type: string
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
EServiceAttributes:
description: the attributes set associated to the EService
properties:
Expand Down
10 changes: 10 additions & 0 deletions packages/api-clients/open-api/bffApi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12973,6 +12973,8 @@ components:
$ref: "#/components/schemas/EServiceMode"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
EServiceSeed:
type: object
additionalProperties: false
Expand All @@ -12992,6 +12994,8 @@ components:
$ref: "#/components/schemas/EServiceMode"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
UpdateEServiceDescriptorQuotas:
required:
- voucherLifespan
Expand Down Expand Up @@ -13239,6 +13243,8 @@ components:
$ref: "#/components/schemas/Mail"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
ProducerEServiceDetails:
type: object
additionalProperties: false
Expand Down Expand Up @@ -13267,6 +13273,8 @@ components:
$ref: "#/components/schemas/EServiceRiskAnalysis"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
EServiceMode:
type: string
description: Risk Analysis Mode
Expand Down Expand Up @@ -13394,6 +13402,8 @@ components:
$ref: "#/components/schemas/Mail"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
EServiceDoc:
type: object
additionalProperties: false
Expand Down
6 changes: 6 additions & 0 deletions packages/api-clients/open-api/catalogApi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,8 @@ components:
$ref: "#/components/schemas/DescriptorSeedForEServiceCreation"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
UpdateEServiceSeed:
type: object
additionalProperties: false
Expand All @@ -1151,6 +1153,8 @@ components:
$ref: "#/components/schemas/EServiceMode"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
DescriptorSeedForEServiceCreation:
required:
- audience
Expand Down Expand Up @@ -1459,6 +1463,8 @@ components:
$ref: "#/components/schemas/EServiceMode"
isSignalHubEnabled:
type: boolean
isDelegable:
type: boolean
EServiceMode:
type: string
description: Risk Analysis Mode
Expand Down
1 change: 1 addition & 0 deletions packages/api-gateway/src/services/catalogService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,5 +255,6 @@ export async function enhanceEservice(
serverUrls: latestNonDraftDescriptor.serverUrls,
producer: producerOrganization,
isSignalHubEnabled: eservice.isSignalHubEnabled,
isDelegable: eservice.isDelegable,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export function toBffCatalogDescriptorEService(
toBffCatalogApiEserviceRiskAnalysis
),
isSignalHubEnabled: eservice.isSignalHubEnabled,
isDelegable: eservice.isDelegable,
};
}

Expand Down Expand Up @@ -265,6 +266,7 @@ export function toBffCatalogApiProducerDescriptorEService(
),
descriptors: notDraftDecriptors,
isSignalHubEnabled: eservice.isSignalHubEnabled,
isDelegable: eservice.isDelegable,
};
}

Expand Down
1 change: 1 addition & 0 deletions packages/backend-for-frontend/src/model/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,6 @@ export const ConfigurationEservice = z.object({
descriptor: ConfigurationDescriptor,
riskAnalysis: z.array(ConfigurationRiskAnalysis),
isSignalHubEnabled: z.boolean().optional(),
isDelegable: z.boolean().optional(),
});
export type ConfigurationEservice = z.infer<typeof ConfigurationEservice>;
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ export function catalogServiceBuilder(
toBffCatalogApiEserviceRiskAnalysis
),
isSignalHubEnabled: eservice.isSignalHubEnabled,
isDelegable: eservice.isDelegable,
};
},
updateEServiceDescription: async (
Expand Down Expand Up @@ -1131,6 +1132,7 @@ export function catalogServiceBuilder(
importedEservice.descriptor.agreementApprovalPolicy,
},
isSignalHubEnabled: importedEservice.isSignalHubEnabled,
isDelegable: importedEservice.isDelegable,
};

const pollEServiceById = createPollingByCondition(() =>
Expand Down
1 change: 1 addition & 0 deletions packages/backend-for-frontend/src/utilities/fileUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export function buildJsonConfig(
technology: eservice.technology,
mode: eservice.mode,
isSignalHubEnabled: eservice.isSignalHubEnabled,
isDelegable: eservice.isDelegable,
descriptor: {
interface: descriptor.interface && {
prettyName: descriptor.interface.prettyName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,5 @@ export const eServiceToApiEService = (
})),
descriptors: eservice.descriptors.map(descriptorToApiDescriptor),
isSignalHubEnabled: eservice.isSignalHubEnabled,
isDelegable: eservice.isDelegable,
});
2 changes: 2 additions & 0 deletions packages/catalog-process/src/services/catalogService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ export function catalogServiceBuilder(
createdAt: creationDate,
riskAnalysis: [],
isSignalHubEnabled: seed.isSignalHubEnabled,
isDelegable: seed.isDelegable,
};

const eserviceCreationEvent = toCreateEventEServiceAdded(
Expand Down Expand Up @@ -558,6 +559,7 @@ export function catalogServiceBuilder(
}))
: eservice.data.descriptors,
isSignalHubEnabled: eserviceSeed.isSignalHubEnabled,
isDelegable: eserviceSeed.isDelegable,
};

const event = toCreateEventEServiceUpdated(
Expand Down
5 changes: 5 additions & 0 deletions packages/catalog-process/test/createEService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ describe("create eservice", () => {
});
it("should write on event-store for the creation of an eservice", async () => {
const isSignalHubEnabled = randomArrayItem([false, true, undefined]);
const isDelegable = randomArrayItem([false, true, undefined]);

const eservice = await catalogService.createEService(
{
name: mockEService.name,
Expand All @@ -49,6 +51,7 @@ describe("create eservice", () => {
mode: "DELIVER",
descriptor: buildDescriptorSeedForEserviceCreation(mockDescriptor),
isSignalHubEnabled,
isDelegable,
},
{
authData: getMockAuthData(mockEService.producerId),
Expand Down Expand Up @@ -96,12 +99,14 @@ describe("create eservice", () => {
id: eservice.id,
descriptors: [],
isSignalHubEnabled,
isDelegable,
};
const expectedEserviceWithDescriptor: EService = {
MalpenZibo marked this conversation as resolved.
Show resolved Hide resolved
...mockEService,
createdAt: new Date(),
id: eservice.id,
isSignalHubEnabled,
isDelegable,
descriptors: [
{
...mockDescriptor,
Expand Down
2 changes: 2 additions & 0 deletions packages/catalog-process/test/getEserviceById.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ describe("get eservice by id", () => {
id: generateId(),
name: "eservice 001",
descriptors: [descriptor1],
isSignalHubEnabled: true,
isDelegable: true,
ecamellini marked this conversation as resolved.
Show resolved Hide resolved
};
await addOneEService(eservice1);
const authData: AuthData = {
Expand Down
2 changes: 2 additions & 0 deletions packages/catalog-process/test/getEservices.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ describe("get eservices", () => {
name: "eservice 001 test",
descriptors: [descriptor1],
producerId: organizationId1,
isSignalHubEnabled: true,
isDelegable: true,
ecamellini marked this conversation as resolved.
Show resolved Hide resolved
};
await addOneEService(eservice1);

Expand Down
4 changes: 4 additions & 0 deletions packages/catalog-process/test/updateEservice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ describe("update eService", () => {
vi.spyOn(fileManager, "delete");

const isSignalHubEnabled = randomArrayItem([false, true, undefined]);
const isDelegable = randomArrayItem([false, true, undefined]);

const descriptor: Descriptor = {
...getMockDescriptor(),
state: descriptorState.draft,
Expand All @@ -59,6 +61,7 @@ describe("update eService", () => {
technology: "REST",
mode: "DELIVER",
isSignalHubEnabled,
isDelegable,
},
{
authData: getMockAuthData(mockEService.producerId),
Expand All @@ -72,6 +75,7 @@ describe("update eService", () => {
...eservice,
name: updatedName,
isSignalHubEnabled,
isDelegable,
};

const writtenEvent = await readLastEserviceEvent(mockEService.id);
Expand Down
1 change: 1 addition & 0 deletions packages/models/proto/v2/eservice/eservice.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ message EServiceV2 {
repeated EServiceRiskAnalysisV2 riskAnalysis = 8;
EServiceModeV2 mode = 9;
optional bool isSignalHubEnabled = 10;
optional bool isDelegable = 11;
}


Expand Down
1 change: 1 addition & 0 deletions packages/models/src/eservice/eservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,6 @@ export const EService = z.object({
riskAnalysis: z.array(RiskAnalysis),
mode: EServiceMode,
isSignalHubEnabled: z.boolean().optional(),
isDelegable: z.boolean().optional(),
});
export type EService = z.infer<typeof EService>;