Skip to content

Commit

Permalink
Aligned consumers events with oubound-model 1.2.0 (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
eduwardo authored Jan 20, 2025
1 parent 45827b3 commit ce74313
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 10 deletions.
11 changes: 8 additions & 3 deletions packages/commons/src/logging/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if (!parsedLoggerConfig.success) {

const logFormat = (
msg: string,
timestamp: string,
timestamp: unknown,
level: string,
{ serviceName, correlationId, messageId }: LoggerMetadata,
) => {
Expand All @@ -54,11 +54,16 @@ const logFormat = (

export const customFormat = () =>
winston.format.printf(({ level, message, timestamp, ...meta }) => {
const lines = message
const lines = `${message}`
.toString()
.split("\n")
.map((line: string) =>
logFormat(line, timestamp, level, meta.loggerMetadata),
logFormat(
line,
timestamp,
level,
meta.loggerMetadata as LoggerMetadata,
),
);
return lines.join("\n");
});
Expand Down
2 changes: 1 addition & 1 deletion packages/eservice-event-consumer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@pagopa/interop-outbound-models": "1.0.4",
"@pagopa/interop-outbound-models": "1.2.0",
"@tsconfig/node-lts": "20.1.1",
"@zodios/core": "10.9.6",
"axios": "1.7.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export async function handleMessageV2(
"EServiceAdded",
"EServiceCloned",
"EServiceDescriptionUpdated",
"EServiceNameUpdated",
),
},
async (evt) => {
Expand Down Expand Up @@ -95,6 +96,10 @@ export async function handleMessageV2(
"EServiceDescriptorPublished",
"EServiceDescriptorSuspended",
"EServiceDraftDescriptorUpdated",
"EServiceDescriptorAttributesUpdated",
"EServiceDescriptorSubmittedByDelegate",
"EServiceDescriptorApprovedByDelegator",
"EServiceDescriptorRejectedByDelegator",
),
},
async (evt) => {
Expand Down
1 change: 1 addition & 0 deletions packages/eservice-event-consumer/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export const getDescriptorV2 = (
createdAt: 1n,
dailyCallsPerConsumer: 100,
dailyCallsTotal: 100,
rejectionReasons: [],
docs: [],
serverUrls: ["http://test.com"],
state: EServiceDescriptorStateV2.DRAFT,
Expand Down
2 changes: 1 addition & 1 deletion packages/tenant-event-consumer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@pagopa/interop-outbound-models": "1.0.4",
"@pagopa/interop-outbound-models": "1.2.0",
"@tsconfig/node-lts": "20.1.1",
"@zodios/core": "10.9.6",
"axios": "1.7.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ export async function handleMessageV2(
await match(event)
.with(
{
type: P.union("TenantOnboarded", "TenantOnboardDetailsUpdated"),
type: P.union(
"TenantOnboarded",
"TenantOnboardDetailsUpdated",
"MaintenanceTenantUpdated",
),
},
async (evt) => {
const { tenant } = evt.data;
Expand Down Expand Up @@ -65,6 +69,9 @@ export async function handleMessageV2(
"TenantVerifiedAttributeExtensionUpdated",
"TenantKindUpdated",
"MaintenanceTenantPromotedToCertifier",
"TenantDelegatedProducerFeatureAdded",
"TenantDelegatedProducerFeatureRemoved",
"TenantCertifiedAttributeAssigned",
),
},
async (evt) => {
Expand Down
1 change: 1 addition & 0 deletions packages/tenant-event-consumer/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export const getDescriptorV2 = (
createdAt: 1n,
dailyCallsPerConsumer: 100,
dailyCallsTotal: 100,
rejectionReasons: [],
docs: [],
serverUrls: ["http://test.com"],
state: EServiceDescriptorStateV2.DRAFT,
Expand Down
18 changes: 14 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ce74313

Please sign in to comment.