page.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import type {
  2. GroupType,
  3. IGrantedGroup,
  4. IPageHasId,
  5. Nullable,
  6. Origin,
  7. PageGrant,
  8. } from '@growi/core';
  9. import type { ExternalGroupProviderType } from '~/features/external-user-group/interfaces/external-user-group';
  10. import type { IPageOperationProcessData } from './page-operation';
  11. export {
  12. isIPageInfoForEntity,
  13. isIPageInfoForListing,
  14. isIPageInfoForOperation,
  15. } from '@growi/core';
  16. export type IPageForItem = Partial<
  17. IPageHasId & { processData?: IPageOperationProcessData }
  18. >;
  19. export const UserGroupPageGrantStatus = {
  20. isGranted: 'isGranted',
  21. notGranted: 'notGranted',
  22. cannotGrant: 'cannotGrant',
  23. };
  24. type UserGroupPageGrantStatus =
  25. (typeof UserGroupPageGrantStatus)[keyof typeof UserGroupPageGrantStatus];
  26. export type UserRelatedGroupsData = {
  27. id: string;
  28. name: string;
  29. type: GroupType;
  30. provider?: ExternalGroupProviderType;
  31. status: UserGroupPageGrantStatus;
  32. };
  33. export type GroupGrantData = {
  34. userRelatedGroups: UserRelatedGroupsData[];
  35. nonUserRelatedGrantedGroups: {
  36. id: string;
  37. name: string;
  38. type: GroupType;
  39. provider?: ExternalGroupProviderType;
  40. }[];
  41. };
  42. // current grant data of page
  43. export type IPageGrantData = {
  44. grant: PageGrant;
  45. groupGrantData?: GroupGrantData;
  46. };
  47. // grant selected by user which is not yet applied
  48. export type IPageSelectedGrant = {
  49. grant: PageGrant;
  50. userRelatedGrantedGroups?: IGrantedGroup[];
  51. };
  52. export type IDeleteSinglePageApiv1Result = {
  53. ok: boolean;
  54. path: string;
  55. isRecursively: Nullable<true>;
  56. isCompletely: Nullable<true>;
  57. };
  58. export type IDeleteManyPageApiv3Result = {
  59. paths: string[];
  60. isRecursively: Nullable<true>;
  61. isCompletely: Nullable<true>;
  62. };
  63. export type IOptionsForUpdate = {
  64. origin?: Origin;
  65. wip?: boolean;
  66. grant?: PageGrant;
  67. userRelatedGrantUserGroupIds?: IGrantedGroup[];
  68. // isSyncRevisionToHackmd?: boolean,
  69. overwriteScopesOfDescendants?: boolean;
  70. };
  71. export type IOptionsForCreate = {
  72. grant?: PageGrant;
  73. grantUserGroupIds?: IGrantedGroup[];
  74. onlyInheritUserRelatedGrantedGroups?: boolean;
  75. overwriteScopesOfDescendants?: boolean;
  76. origin?: Origin;
  77. wip?: boolean;
  78. };
  79. export type IPagePathWithDescendantCount = {
  80. path: string;
  81. descendantCount: number;
  82. };