page-bulk-export.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import type {
  2. HasObjectId,
  3. IAttachment, IPage, IRevision, IUser, Ref,
  4. } from '@growi/core';
  5. export const PageBulkExportFormat = {
  6. md: 'md',
  7. pdf: 'pdf',
  8. } as const;
  9. export type PageBulkExportFormat = typeof PageBulkExportFormat[keyof typeof PageBulkExportFormat]
  10. export const PageBulkExportJobInProgressStatus = {
  11. initializing: 'initializing', // preparing for export
  12. exporting: 'exporting', // exporting to fs
  13. uploading: 'uploading', // uploading to cloud storage
  14. } as const;
  15. export const PageBulkExportJobStatus = {
  16. ...PageBulkExportJobInProgressStatus,
  17. completed: 'completed',
  18. failed: 'failed',
  19. } as const;
  20. export type PageBulkExportJobStatus = typeof PageBulkExportJobStatus[keyof typeof PageBulkExportJobStatus]
  21. export interface IPageBulkExportJob {
  22. user: Ref<IUser>, // user that started export job
  23. page: Ref<IPage>, // the root page of page tree to export
  24. lastExportedPagePath?: string, // the path of page that was exported to the fs last
  25. uploadId?: string, // upload ID of multipart upload of S3/GCS
  26. uploadKey?: string, // upload key of multipart upload of S3/GCS
  27. format: PageBulkExportFormat,
  28. completedAt?: Date, // the date at which job was completed
  29. attachment?: Ref<IAttachment>,
  30. status: PageBulkExportJobStatus,
  31. }
  32. export interface IPageBulkExportJobHasId extends IPageBulkExportJob, HasObjectId {}
  33. // snapshot of page info to upload
  34. export interface IPageBulkExportPageSnapshot {
  35. pageBulkExportJob: Ref<IPageBulkExportJob>,
  36. path: string, // page path when export was stared
  37. revision: Ref<IRevision>, // page revision when export was stared
  38. }