chore: regenerate api-report.md

Signed-off-by: Marek Libra <marek.libra@gmail.com>
This commit is contained in:
Marek Libra
2024-02-28 10:55:20 +01:00
parent 6f13cda324
commit 8740058516
4 changed files with 26 additions and 9 deletions
@@ -228,7 +228,7 @@ describe.each(databases.eachSupportedId())(
await insertNotification({
id: id1,
...testNotification,
created: new Date(Date.now() - 1 * 60 * 60 * 1000 /* an hour ago */),
created: new Date(now - 1 * 60 * 60 * 1000 /* an hour ago */),
});
await insertNotification({
id: id2,
@@ -270,7 +270,7 @@ describe.each(databases.eachSupportedId())(
const notifications = await storage.getNotifications({
user,
createdAfter: new Date(Date.now() - 5 * 60 * 1000 /* 5mins */),
createdAfter: new Date(now - 5 * 60 * 1000 /* 5 mins */),
});
expect(notifications.length).toBe(6);
expect(notifications.at(0)?.id).toEqual(id7);
@@ -171,8 +171,7 @@ export class DatabaseNotificationsStore implements NotificationsStore {
countOptions.sort = null;
const notificationQuery = this.getNotificationsBaseQuery(countOptions);
const response = await notificationQuery.count('* as CNT');
const totalCount = Number.parseInt(response[0].CNT.toString(), 10);
return totalCount;
return Number(response[0].CNT);
}
async saveNotification(notification: Notification) {
@@ -212,8 +212,10 @@ export async function createRouter(
opts.createdAfter = new Date(sinceEpoch);
}
const notifications = await store.getNotifications(opts);
const totalCount = await store.getNotificationsCount(opts);
const [notifications, totalCount] = await Promise.all([
store.getNotifications(opts),
store.getNotificationsCount(opts),
]);
res.send({
totalCount,
notifications,
+19 -3
View File
@@ -14,6 +14,7 @@ import { Notification as Notification_2 } from '@backstage/plugin-notifications-
import { NotificationStatus } from '@backstage/plugin-notifications-common';
import { default as React_2 } from 'react';
import { RouteRef } from '@backstage/core-plugin-api';
import { TableProps } from '@backstage/core-components';
// @public (undocumented)
export type GetNotificationsOptions = {
@@ -24,6 +25,12 @@ export type GetNotificationsOptions = {
createdAfter?: Date;
};
// @public (undocumented)
export type GetNotificationsResponse = {
notifications: Notification_2[];
totalCount: number;
};
// @public (undocumented)
export interface NotificationsApi {
// (undocumented)
@@ -31,7 +38,7 @@ export interface NotificationsApi {
// (undocumented)
getNotifications(
options?: GetNotificationsOptions,
): Promise<Notification_2[]>;
): Promise<GetNotificationsResponse>;
// (undocumented)
getStatus(): Promise<NotificationStatus>;
// (undocumented)
@@ -51,7 +58,7 @@ export class NotificationsClient implements NotificationsApi {
// (undocumented)
getNotifications(
options?: GetNotificationsOptions,
): Promise<Notification_2[]>;
): Promise<GetNotificationsResponse>;
// (undocumented)
getStatus(): Promise<NotificationStatus>;
// (undocumented)
@@ -83,14 +90,23 @@ export const NotificationsTable: ({
notifications,
onUpdate,
setContainsText,
onPageChange,
onRowsPerPageChange,
page,
pageSize,
totalCount,
}: NotificationsTableProps) => React_2.JSX.Element;
// @public (undocumented)
export type NotificationsTableProps = {
export type NotificationsTableProps = Pick<
TableProps,
'onPageChange' | 'onRowsPerPageChange' | 'page' | 'totalCount'
> & {
isLoading?: boolean;
notifications?: Notification_2[];
onUpdate: () => void;
setContainsText: (search: string) => void;
pageSize: number;
};
// @public (undocumented)