page.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. };
  69. export type IPagePathWithDescendantCount = {
  70. path: string,
  71. descendantCount: number,
  72. };