websocket.ts 891 B

123456789101112131415161718192021222324
  1. export const SocketEventName = {
  2. // Update descendantCount
  3. UpdateDescCount: 'UpdateDescCount',
  4. // Public migration
  5. PMStarted: 'PublicMigrationStarted',
  6. PMMigrating: 'PublicMigrationMigrating',
  7. PMErrorCount: 'PublicMigrationErrorCount',
  8. PMEnded: 'PublicMigrationEnded',
  9. } as const;
  10. export type SocketEventName = typeof SocketEventName[keyof typeof SocketEventName];
  11. type PageId = string;
  12. type DescendantCount = number;
  13. /**
  14. * Data of updateDescCount when used through socket.io. Convert to UpdateDescCountData type when use with swr cache.
  15. */
  16. export type UpdateDescCountRawData = Record<PageId, DescendantCount>;
  17. export type UpdateDescCountData = Map<PageId, DescendantCount>;
  18. export type PMStartedData = { total: number };
  19. export type PMMigratingData = { count: number };
  20. export type PMErrorCountData = { skip: number };
  21. export type PMEndedData = { isSucceeded: boolean };