websocket.ts 1.0 KB

123456789101112131415161718192021222324252627282930
  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. // Page migration
  10. PageMigrationSuccess: 'PageMigrationSuccess',
  11. PageMigrationError: 'PageMigrationError',
  12. } as const;
  13. export type SocketEventName = typeof SocketEventName[keyof typeof SocketEventName];
  14. type PageId = string;
  15. type DescendantCount = number;
  16. /**
  17. * Data of updateDescCount when used through socket.io. Convert to UpdateDescCountData type when use with swr cache.
  18. */
  19. export type UpdateDescCountRawData = Record<PageId, DescendantCount>;
  20. export type UpdateDescCountData = Map<PageId, DescendantCount>;
  21. export type PMStartedData = { total: number };
  22. export type PMMigratingData = { count: number };
  23. export type PMErrorCountData = { skip: number };
  24. export type PMEndedData = { isSucceeded: boolean };
  25. export type PageMigrationErrorData = { paths: string[] }