Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// if the service is not visible anymore
// delete it from the visible services list
return remove(service.serviceId, visibleServicesObj);
} else if (
// if the service is visible and we don't have a related
// cached visible service yet...
service.isVisible &&
(isNone(maybeVisibleService) ||
// ... or if the updated service is visible and the version
// is greater than the stored version of the cached visible service
service.version > maybeVisibleService.value.version)
) {
// store the visible service into the object (map)
return insert(
service.serviceId,
pick(
[
"departmentName",
"id",
"organizationFiscalCode",
"organizationName",
"serviceId",
"serviceName",
"version"
],
service
),
visibleServicesObj
);
}
return visibleServicesObj;
}
function toBaseType(o: RetrievedMessageStatus): MessageStatus {
return pick(["messageId", "status", "updatedAt"], o);
}
function toBaseType(o: RetrievedNotification): Notification {
return pick(["fiscalCode", "messageId", "channels"], o);
}
function toBaseType(o: RetrievedService): Service {
return pick(
[
"authorizedCIDRs",
"authorizedRecipients",
"departmentName",
"isVisible",
"maxAllowedPaymentAmount",
"organizationFiscalCode",
"organizationName",
"serviceId",
"serviceName"
],
o
);
}
function toBaseType(o: RetrievedSenderService): SenderService {
return pick(
[
"lastNotificationAt",
SENDER_SERVICE_MODEL_PK_FIELD,
"serviceId",
"version"
],
o
);
}
function toBaseType(o: RetrievedMessage): Message {
const props: ReadonlyArray = [
"fiscalCode",
"senderServiceId",
"senderUserId",
"timeToLiveSeconds",
"createdAt"
];
return RetrievedMessageWithContent.is(o)
? pick(["content", ...props], o)
: pick(props, o);
}
function toBaseType(o: RetrievedMessage): Message {
const props: ReadonlyArray = [
"fiscalCode",
"senderServiceId",
"senderUserId",
"timeToLiveSeconds",
"createdAt"
];
return RetrievedMessageWithContent.is(o)
? pick(["content", ...props], o)
: pick(props, o);
}
function toBaseType(o: RetrievedNotificationStatus): NotificationStatus {
return pick(
[
"channel",
"messageId",
"notificationId",
"status",
"statusId",
"updatedAt"
],
o
);
}