page.ts 2.0 KB

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