@webiny/app-aco 6.4.11 → 6.6.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/components/Actions/DeleteFolder/DeleteFolder.js +1 -1
  2. package/components/Actions/DeleteFolder/DeleteFolder.js.map +1 -1
  3. package/components/AdvancedSearch/AdvancedSearch.d.ts +2 -2
  4. package/components/AdvancedSearch/QueryBuilderDrawer/QueryBuilderDrawer.d.ts +2 -2
  5. package/components/AdvancedSearch/domain/Filter.d.ts +1 -1
  6. package/components/AdvancedSearch/domain/FilterRepositoryFactory.d.ts +2 -2
  7. package/components/AdvancedSearch/domain/FilterRepositoryFactory.js.map +1 -1
  8. package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.d.ts +2 -2
  9. package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.js +9 -10
  10. package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.js.map +1 -1
  11. package/components/AdvancedSearch/gateways/filters.gql.d.ts +5 -5
  12. package/components/AdvancedSearch/gateways/filters.gql.js +5 -6
  13. package/components/AdvancedSearch/gateways/filters.gql.js.map +1 -1
  14. package/components/AdvancedSearch/useFilterRepository.js +7 -2
  15. package/components/AdvancedSearch/useFilterRepository.js.map +1 -1
  16. package/components/FolderTree/List/List.js +6 -14
  17. package/components/FolderTree/List/List.js.map +1 -1
  18. package/components/Table/cells/CellAuthor.d.ts +2 -0
  19. package/components/Table/cells/CellAuthor.js +10 -0
  20. package/components/Table/cells/CellAuthor.js.map +1 -0
  21. package/components/Table/cells/CellCreated.d.ts +2 -0
  22. package/components/Table/cells/CellCreated.js +13 -0
  23. package/components/Table/cells/CellCreated.js.map +1 -0
  24. package/components/Table/cells/CellModified.d.ts +2 -0
  25. package/components/Table/cells/CellModified.js +13 -0
  26. package/components/Table/cells/CellModified.js.map +1 -0
  27. package/components/Table/cells/index.d.ts +3 -0
  28. package/components/Table/cells/index.js +3 -0
  29. package/components/Table/components/Table/TableInner.d.ts +2 -2
  30. package/components/Table/createTableData.d.ts +7 -5
  31. package/components/Table/createTableData.js +22 -7
  32. package/components/Table/createTableData.js.map +1 -1
  33. package/components/Table/index.d.ts +2 -2
  34. package/components/Table/index.js +2 -2
  35. package/components/index.d.ts +0 -1
  36. package/components/index.js +0 -1
  37. package/config/AcoConfig.d.ts +8 -12
  38. package/config/advanced-search/FieldRenderer.d.ts +3 -1
  39. package/config/folder/Action.d.ts +1 -1
  40. package/config/folder/index.d.ts +3 -2
  41. package/config/index.d.ts +0 -1
  42. package/config/index.js +0 -1
  43. package/config/record/Action.d.ts +1 -1
  44. package/config/record/index.d.ts +1 -1
  45. package/config/table/Column.d.ts +8 -39
  46. package/config/table/Column.js +4 -67
  47. package/config/table/Column.js.map +1 -1
  48. package/config/table/Sorting.d.ts +2 -11
  49. package/config/table/Sorting.js +1 -28
  50. package/config/table/index.d.ts +5 -9
  51. package/contexts/index.d.ts +0 -3
  52. package/contexts/index.js +0 -3
  53. package/dialogs/DialogSetPermissions/graphql.d.ts +1 -1
  54. package/dialogs/DialogSetPermissions/graphql.js +1 -2
  55. package/dialogs/DialogSetPermissions/graphql.js.map +1 -1
  56. package/dialogs/useConfirmMoveFolderDialog.d.ts +0 -1
  57. package/dialogs/useConfirmMoveFolderDialog.js +2 -3
  58. package/dialogs/useConfirmMoveFolderDialog.js.map +1 -1
  59. package/dialogs/useCreateDialog.js +5 -9
  60. package/dialogs/useCreateDialog.js.map +1 -1
  61. package/dialogs/useEditDialog.js +2 -2
  62. package/dialogs/useEditDialog.js.map +1 -1
  63. package/dialogs/useSetPermissionsDialog.js +16 -4
  64. package/dialogs/useSetPermissionsDialog.js.map +1 -1
  65. package/domain/folder/Folder.d.ts +2 -1
  66. package/domain/folder/Folder.js.map +1 -1
  67. package/features/folders/createFolder/CreateFolderGqlGateway.d.ts +3 -3
  68. package/features/folders/createFolder/CreateFolderGqlGateway.js +15 -16
  69. package/features/folders/createFolder/CreateFolderGqlGateway.js.map +1 -1
  70. package/features/folders/deleteFolder/DeleteFolderGqlGateway.d.ts +3 -3
  71. package/features/folders/deleteFolder/DeleteFolderGqlGateway.js +5 -6
  72. package/features/folders/deleteFolder/DeleteFolderGqlGateway.js.map +1 -1
  73. package/features/folders/folderModelProvider/FolderModelProvider.js +29 -31
  74. package/features/folders/folderModelProvider/FolderModelProvider.js.map +1 -1
  75. package/features/folders/folderModelProvider/GetFolderModelGqlGateway.d.ts +3 -3
  76. package/features/folders/folderModelProvider/GetFolderModelGqlGateway.js +5 -7
  77. package/features/folders/folderModelProvider/GetFolderModelGqlGateway.js.map +1 -1
  78. package/features/folders/getFolder/GetFolderGqlGateway.d.ts +3 -3
  79. package/features/folders/getFolder/GetFolderGqlGateway.js +5 -7
  80. package/features/folders/getFolder/GetFolderGqlGateway.js.map +1 -1
  81. package/features/folders/getFolderExtensionsFields/GetFolderExtensionsFieldsUseCase.d.ts +3 -3
  82. package/features/folders/getFolderExtensionsFields/useFolderExtensionsFields.d.ts +3 -3
  83. package/features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.js +12 -16
  84. package/features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.js.map +1 -1
  85. package/features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.d.ts +3 -3
  86. package/features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.js +5 -5
  87. package/features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.js.map +1 -1
  88. package/features/folders/listFolders/ListFoldersGqlGateway.d.ts +1 -1
  89. package/features/folders/listFolders/ListFoldersGqlGateway.js +1 -2
  90. package/features/folders/listFolders/ListFoldersGqlGateway.js.map +1 -1
  91. package/features/folders/listFolders/useListFolders.d.ts +1 -1
  92. package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.d.ts +3 -3
  93. package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.js +5 -7
  94. package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.js.map +1 -1
  95. package/features/folders/listFoldersByParentIds/useListFoldersByParentIds.d.ts +2 -2
  96. package/features/folders/loadFolderHierarchy/useLoadFolderHierarchy.d.ts +2 -2
  97. package/features/folders/updateFolder/UpdateFolderGqlGateway.d.ts +3 -3
  98. package/features/folders/updateFolder/UpdateFolderGqlGateway.js +5 -6
  99. package/features/folders/updateFolder/UpdateFolderGqlGateway.js.map +1 -1
  100. package/hooks/index.d.ts +0 -6
  101. package/hooks/index.js +0 -6
  102. package/index.d.ts +3 -2
  103. package/index.js +2 -2
  104. package/package.json +21 -28
  105. package/presentation/folderTree/FolderTreePresenter.d.ts +3 -1
  106. package/presentation/folderTree/FolderTreePresenter.js +15 -23
  107. package/presentation/folderTree/FolderTreePresenter.js.map +1 -1
  108. package/presentation/folderTree/FolderTreePresenter.test.js +8 -2
  109. package/presentation/folderTree/FolderTreePresenter.test.js.map +1 -1
  110. package/table.types.d.ts +2 -9
  111. package/types.d.ts +5 -26
  112. package/types.js.map +1 -1
  113. package/components/Extensions/Extensions.d.ts +0 -2
  114. package/components/Extensions/Extensions.js +0 -30
  115. package/components/Extensions/Extensions.js.map +0 -1
  116. package/components/Extensions/index.d.ts +0 -1
  117. package/components/Extensions/index.js +0 -1
  118. package/config/folder/createFolderFieldDecoratorFactory.d.ts +0 -13
  119. package/config/folder/createFolderFieldDecoratorFactory.js +0 -17
  120. package/config/folder/createFolderFieldDecoratorFactory.js.map +0 -1
  121. package/config/table/Sorting.js.map +0 -1
  122. package/contexts/acoList.d.ts +0 -49
  123. package/contexts/acoList.js +0 -303
  124. package/contexts/acoList.js.map +0 -1
  125. package/contexts/app.d.ts +0 -33
  126. package/contexts/app.js +0 -47
  127. package/contexts/app.js.map +0 -1
  128. package/contexts/folders.d.ts +0 -12
  129. package/contexts/folders.js +0 -32
  130. package/contexts/folders.js.map +0 -1
  131. package/contexts/navigateFolder.d.ts +0 -17
  132. package/contexts/navigateFolder.js +0 -54
  133. package/contexts/navigateFolder.js.map +0 -1
  134. package/contexts/records.d.ts +0 -31
  135. package/contexts/records.js +0 -316
  136. package/contexts/records.js.map +0 -1
  137. package/exports/admin/aco.d.ts +0 -2
  138. package/exports/admin/aco.js +0 -2
  139. package/graphql/app.gql.d.ts +0 -17
  140. package/graphql/app.gql.js +0 -22
  141. package/graphql/app.gql.js.map +0 -1
  142. package/graphql/records/common.d.ts +0 -4
  143. package/graphql/records/common.js +0 -57
  144. package/graphql/records/common.js.map +0 -1
  145. package/graphql/records/getRecord.d.ts +0 -2
  146. package/graphql/records/getRecord.js +0 -5
  147. package/graphql/records/getRecord.js.map +0 -1
  148. package/graphql/records/listRecords.d.ts +0 -2
  149. package/graphql/records/listRecords.js +0 -26
  150. package/graphql/records/listRecords.js.map +0 -1
  151. package/graphql/records/moveRecord.d.ts +0 -2
  152. package/graphql/records/moveRecord.js +0 -16
  153. package/graphql/records/moveRecord.js.map +0 -1
  154. package/graphql/records/types.d.ts +0 -108
  155. package/graphql/records/types.js +0 -0
  156. package/graphql/records.gql.d.ts +0 -3
  157. package/graphql/records.gql.js +0 -3
  158. package/handlers.d.ts +0 -23
  159. package/handlers.js +0 -22
  160. package/handlers.js.map +0 -1
  161. package/hooks/useAcoApp.d.ts +0 -2
  162. package/hooks/useAcoApp.js +0 -16
  163. package/hooks/useAcoApp.js.map +0 -1
  164. package/hooks/useAcoList.d.ts +0 -3
  165. package/hooks/useAcoList.js +0 -10
  166. package/hooks/useAcoList.js.map +0 -1
  167. package/hooks/useFolderModel.d.ts +0 -2
  168. package/hooks/useFolderModel.js +0 -16
  169. package/hooks/useFolderModel.js.map +0 -1
  170. package/hooks/useFoldersType.d.ts +0 -1
  171. package/hooks/useFoldersType.js +0 -12
  172. package/hooks/useFoldersType.js.map +0 -1
  173. package/hooks/useNavigateFolder.d.ts +0 -2
  174. package/hooks/useNavigateFolder.js +0 -10
  175. package/hooks/useNavigateFolder.js.map +0 -1
  176. package/hooks/useRecords.d.ts +0 -62
  177. package/hooks/useRecords.js +0 -64
  178. package/hooks/useRecords.js.map +0 -1
  179. package/hooks/useTags.d.ts +0 -14
  180. package/hooks/useTags.js +0 -27
  181. package/hooks/useTags.js.map +0 -1
  182. package/sorting.d.ts +0 -9
  183. package/sorting.js +0 -31
  184. package/sorting.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"domain/folder/Folder.js","sources":["../../../src/domain/folder/Folder.ts"],"sourcesContent":["import type { CmsIdentity, FolderPermission } from \"~/types.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\n\nexport interface FolderData {\n id?: string;\n title: string;\n slug: string;\n type: string;\n parentId: string | null;\n path?: string;\n permissions: FolderPermission[];\n hasNonInheritedPermissions?: boolean;\n canManagePermissions?: boolean;\n canManageStructure?: boolean;\n canManageContent?: boolean;\n createdBy?: CmsIdentity;\n createdOn?: string;\n savedBy?: CmsIdentity;\n savedOn?: string;\n modifiedBy?: CmsIdentity | null;\n modifiedOn?: string | null;\n extensions?: Record<string, any>;\n}\n\nexport class Folder {\n public id: string;\n public title: string;\n public slug: string;\n public type: string;\n public parentId: string | null;\n public path: string;\n public permissions: FolderPermission[];\n public hasNonInheritedPermissions?: boolean;\n public canManagePermissions?: boolean;\n public canManageStructure?: boolean;\n public canManageContent?: boolean;\n public createdBy?: CmsIdentity;\n public createdOn?: string;\n public savedBy?: CmsIdentity;\n public savedOn?: string;\n public modifiedBy?: CmsIdentity | null;\n public modifiedOn?: string | null;\n public extensions: Record<string, any>;\n\n protected constructor(folder: FolderData) {\n this.id = folder.id ?? \"\";\n this.title = folder.title;\n this.slug = folder.slug;\n this.type = folder.type;\n this.parentId = folder.parentId;\n this.path = folder.path ?? `${ROOT_FOLDER}/${folder.slug}`;\n this.permissions = folder.permissions;\n this.hasNonInheritedPermissions = folder.hasNonInheritedPermissions;\n this.canManagePermissions = folder.canManagePermissions;\n this.canManageStructure = folder.canManageStructure;\n this.canManageContent = folder.canManageContent;\n this.createdBy = folder.createdBy;\n this.createdOn = folder.createdOn;\n this.savedBy = folder.savedBy;\n this.savedOn = folder.savedOn;\n this.modifiedBy = folder.modifiedBy;\n this.modifiedOn = folder.modifiedOn;\n this.extensions = folder.extensions ?? {};\n }\n\n static create(folder: FolderData) {\n return new Folder(folder);\n }\n}\n"],"names":["Folder","folder","ROOT_FOLDER"],"mappings":";AAwBO,MAAMA;IAoBT,YAAsBC,MAAkB,CAAE;QACtC,IAAI,CAAC,EAAE,GAAGA,OAAO,EAAE,IAAI;QACvB,IAAI,CAAC,KAAK,GAAGA,OAAO,KAAK;QACzB,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI;QACvB,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI;QACvB,IAAI,CAAC,QAAQ,GAAGA,OAAO,QAAQ;QAC/B,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI,IAAI,GAAGC,YAAY,CAAC,EAAED,OAAO,IAAI,EAAE;QAC1D,IAAI,CAAC,WAAW,GAAGA,OAAO,WAAW;QACrC,IAAI,CAAC,0BAA0B,GAAGA,OAAO,0BAA0B;QACnE,IAAI,CAAC,oBAAoB,GAAGA,OAAO,oBAAoB;QACvD,IAAI,CAAC,kBAAkB,GAAGA,OAAO,kBAAkB;QACnD,IAAI,CAAC,gBAAgB,GAAGA,OAAO,gBAAgB;QAC/C,IAAI,CAAC,SAAS,GAAGA,OAAO,SAAS;QACjC,IAAI,CAAC,SAAS,GAAGA,OAAO,SAAS;QACjC,IAAI,CAAC,OAAO,GAAGA,OAAO,OAAO;QAC7B,IAAI,CAAC,OAAO,GAAGA,OAAO,OAAO;QAC7B,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU;QACnC,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU;QACnC,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU,IAAI,CAAC;IAC5C;IAEA,OAAO,OAAOA,MAAkB,EAAE;QAC9B,OAAO,IAAID,OAAOC;IACtB;AACJ"}
1
+ {"version":3,"file":"domain/folder/Folder.js","sources":["../../../src/domain/folder/Folder.ts"],"sourcesContent":["import type { FolderPermission } from \"~/types.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport type { CmsIdentity } from \"~/types.js\";\n\nexport interface FolderData {\n id?: string;\n title: string;\n slug: string;\n type: string;\n parentId: string | null;\n path?: string;\n permissions: FolderPermission[];\n hasNonInheritedPermissions?: boolean;\n canManagePermissions?: boolean;\n canManageStructure?: boolean;\n canManageContent?: boolean;\n createdBy?: CmsIdentity;\n createdOn?: string;\n savedBy?: CmsIdentity;\n savedOn?: string;\n modifiedBy?: CmsIdentity | null;\n modifiedOn?: string | null;\n extensions?: Record<string, any>;\n}\n\nexport class Folder {\n public id: string;\n public title: string;\n public slug: string;\n public type: string;\n public parentId: string | null;\n public path: string;\n public permissions: FolderPermission[];\n public hasNonInheritedPermissions?: boolean;\n public canManagePermissions?: boolean;\n public canManageStructure?: boolean;\n public canManageContent?: boolean;\n public createdBy?: CmsIdentity;\n public createdOn?: string;\n public savedBy?: CmsIdentity;\n public savedOn?: string;\n public modifiedBy?: CmsIdentity | null;\n public modifiedOn?: string | null;\n public extensions: Record<string, any>;\n\n protected constructor(folder: FolderData) {\n this.id = folder.id ?? \"\";\n this.title = folder.title;\n this.slug = folder.slug;\n this.type = folder.type;\n this.parentId = folder.parentId;\n this.path = folder.path ?? `${ROOT_FOLDER}/${folder.slug}`;\n this.permissions = folder.permissions;\n this.hasNonInheritedPermissions = folder.hasNonInheritedPermissions;\n this.canManagePermissions = folder.canManagePermissions;\n this.canManageStructure = folder.canManageStructure;\n this.canManageContent = folder.canManageContent;\n this.createdBy = folder.createdBy;\n this.createdOn = folder.createdOn;\n this.savedBy = folder.savedBy;\n this.savedOn = folder.savedOn;\n this.modifiedBy = folder.modifiedBy;\n this.modifiedOn = folder.modifiedOn;\n this.extensions = folder.extensions ?? {};\n }\n\n static create(folder: FolderData) {\n return new Folder(folder);\n }\n}\n"],"names":["Folder","folder","ROOT_FOLDER"],"mappings":";AAyBO,MAAMA;IAoBT,YAAsBC,MAAkB,CAAE;QACtC,IAAI,CAAC,EAAE,GAAGA,OAAO,EAAE,IAAI;QACvB,IAAI,CAAC,KAAK,GAAGA,OAAO,KAAK;QACzB,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI;QACvB,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI;QACvB,IAAI,CAAC,QAAQ,GAAGA,OAAO,QAAQ;QAC/B,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI,IAAI,GAAGC,YAAY,CAAC,EAAED,OAAO,IAAI,EAAE;QAC1D,IAAI,CAAC,WAAW,GAAGA,OAAO,WAAW;QACrC,IAAI,CAAC,0BAA0B,GAAGA,OAAO,0BAA0B;QACnE,IAAI,CAAC,oBAAoB,GAAGA,OAAO,oBAAoB;QACvD,IAAI,CAAC,kBAAkB,GAAGA,OAAO,kBAAkB;QACnD,IAAI,CAAC,gBAAgB,GAAGA,OAAO,gBAAgB;QAC/C,IAAI,CAAC,SAAS,GAAGA,OAAO,SAAS;QACjC,IAAI,CAAC,SAAS,GAAGA,OAAO,SAAS;QACjC,IAAI,CAAC,OAAO,GAAGA,OAAO,OAAO;QAC7B,IAAI,CAAC,OAAO,GAAGA,OAAO,OAAO;QAC7B,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU;QACnC,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU;QACnC,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU,IAAI,CAAC;IAC5C;IAEA,OAAO,OAAOA,MAAkB,EAAE;QAC9B,OAAO,IAAID,OAAOC;IACtB;AACJ"}
@@ -1,4 +1,4 @@
1
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
2
2
  import type { FolderDto } from "../../../domain/folder/FolderDto.js";
3
3
  import { FolderModelProvider } from "../../../features/folders/abstractions.js";
4
4
  import type { FolderGatewayDto } from "./abstractions.js";
@@ -15,11 +15,11 @@ export interface CreateFolderResponse {
15
15
  export interface CreateFolderVariables {
16
16
  data: Omit<FolderDto, "id" | "path" | "createdOn" | "createdBy" | "savedOn" | "savedBy" | "modifiedOn" | "modifiedBy" | "hasNonInheritedPermissions" | "canManageContent" | "canManagePermissions" | "canManageStructure">;
17
17
  }
18
- export declare const CREATE_FOLDER: (FOLDER_FIELDS: string) => import("graphql").DocumentNode;
18
+ export declare const CREATE_FOLDER: (FOLDER_FIELDS: string) => string;
19
19
  declare class CreateFolderGqlGatewayImpl implements GatewayAbstraction.Interface {
20
20
  private client;
21
21
  private folderModelProvider;
22
- constructor(client: ApolloClient.Interface, folderModelProvider: FolderModelProvider.Interface);
22
+ constructor(client: MainGraphQLClient.Interface, folderModelProvider: FolderModelProvider.Interface);
23
23
  execute(folder: FolderGatewayDto): Promise<FolderDto>;
24
24
  }
25
25
  export declare const CreateFolderGqlGateway: typeof CreateFolderGqlGatewayImpl & {
@@ -1,21 +1,20 @@
1
- import graphql_tag from "graphql-tag";
2
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
3
2
  import { FolderModelProvider } from "../abstractions.js";
4
3
  import { CreateFolderGateway } from "./abstractions.js";
5
- const CREATE_FOLDER = (FOLDER_FIELDS)=>graphql_tag`
6
- mutation CreateFolder($data: FolderCreateInput!) {
7
- aco {
8
- createFolder(data: $data) {
9
- data ${FOLDER_FIELDS}
10
- error {
11
- code
12
- data
13
- message
14
- }
4
+ const CREATE_FOLDER = (FOLDER_FIELDS)=>`
5
+ mutation CreateFolder($data: FolderCreateInput!) {
6
+ aco {
7
+ createFolder(data: $data) {
8
+ data ${FOLDER_FIELDS}
9
+ error {
10
+ code
11
+ data
12
+ message
15
13
  }
16
14
  }
17
15
  }
18
- `;
16
+ }
17
+ `;
19
18
  class CreateFolderGqlGatewayImpl {
20
19
  constructor(client, folderModelProvider){
21
20
  this.client = client;
@@ -23,8 +22,8 @@ class CreateFolderGqlGatewayImpl {
23
22
  }
24
23
  async execute(folder) {
25
24
  const fields = await this.folderModelProvider.getGraphQLSelection();
26
- const { data: response } = await this.client.mutate({
27
- mutation: CREATE_FOLDER(fields),
25
+ const response = await this.client.execute({
26
+ query: CREATE_FOLDER(fields),
28
27
  variables: {
29
28
  data: {
30
29
  ...folder
@@ -40,7 +39,7 @@ class CreateFolderGqlGatewayImpl {
40
39
  const CreateFolderGqlGateway = CreateFolderGateway.createImplementation({
41
40
  implementation: CreateFolderGqlGatewayImpl,
42
41
  dependencies: [
43
- ApolloClient,
42
+ MainGraphQLClient,
44
43
  FolderModelProvider
45
44
  ]
46
45
  });
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/createFolder/CreateFolderGqlGateway.js","sources":["../../../../src/features/folders/createFolder/CreateFolderGqlGateway.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { ApolloClient } from \"@webiny/app-admin/features/apolloClient/abstraction.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { FolderModelProvider } from \"~/features/folders/abstractions.js\";\nimport type { FolderGatewayDto } from \"./abstractions.js\";\nimport { CreateFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface CreateFolderResponse {\n aco: {\n createFolder: {\n data: FolderDto;\n error: AcoError | null;\n };\n };\n}\n\nexport interface CreateFolderVariables {\n data: Omit<\n FolderDto,\n | \"id\"\n | \"path\"\n | \"createdOn\"\n | \"createdBy\"\n | \"savedOn\"\n | \"savedBy\"\n | \"modifiedOn\"\n | \"modifiedBy\"\n | \"hasNonInheritedPermissions\"\n | \"canManageContent\"\n | \"canManagePermissions\"\n | \"canManageStructure\"\n >;\n}\n\nexport const CREATE_FOLDER = (FOLDER_FIELDS: string) => gql`\n mutation CreateFolder($data: FolderCreateInput!) {\n aco {\n createFolder(data: $data) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n `;\n\nclass CreateFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: ApolloClient.Interface,\n private folderModelProvider: FolderModelProvider.Interface\n ) {}\n\n async execute(folder: FolderGatewayDto) {\n const fields = await this.folderModelProvider.getGraphQLSelection();\n\n const { data: response } = await this.client.mutate<\n CreateFolderResponse,\n CreateFolderVariables\n >({\n mutation: CREATE_FOLDER(fields),\n variables: {\n data: {\n ...folder\n }\n }\n });\n\n if (!response) {\n throw new Error(\"Network error while creating folder.\");\n }\n\n const { data, error } = response.aco.createFolder;\n\n if (!data) {\n throw new Error(error?.message || \"Could not create folder\");\n }\n\n return data;\n }\n}\n\nexport const CreateFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: CreateFolderGqlGatewayImpl,\n dependencies: [ApolloClient, FolderModelProvider]\n});\n"],"names":["CREATE_FOLDER","FOLDER_FIELDS","gql","CreateFolderGqlGatewayImpl","client","folderModelProvider","folder","fields","response","Error","data","error","CreateFolderGqlGateway","GatewayAbstraction","ApolloClient","FolderModelProvider"],"mappings":";;;;AAmCO,MAAMA,gBAAgB,CAACC,gBAA0BC,WAAG,CAAC;;;;yBAInC,EAAED,cAAc;;;;;;;;;IASrC,CAAC;AAEL,MAAME;IACF,YACYC,MAA8B,EAC9BC,mBAAkD,CAC5D;aAFUD,MAAM,GAANA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQC,MAAwB,EAAE;QACpC,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,mBAAmB;QAEjE,MAAM,EAAE,MAAMC,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAGjD;YACE,UAAUR,cAAcO;YACxB,WAAW;gBACP,MAAM;oBACF,GAAGD,MAAM;gBACb;YACJ;QACJ;QAEA,IAAI,CAACE,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,YAAY;QAEjD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAME,yBAAyBC,oBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBV;IAChB,cAAc;QAACW;QAAcC;KAAoB;AACrD"}
1
+ {"version":3,"file":"features/folders/createFolder/CreateFolderGqlGateway.js","sources":["../../../../src/features/folders/createFolder/CreateFolderGqlGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { FolderModelProvider } from \"~/features/folders/abstractions.js\";\nimport type { FolderGatewayDto } from \"./abstractions.js\";\nimport { CreateFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface CreateFolderResponse {\n aco: {\n createFolder: {\n data: FolderDto;\n error: AcoError | null;\n };\n };\n}\n\nexport interface CreateFolderVariables {\n data: Omit<\n FolderDto,\n | \"id\"\n | \"path\"\n | \"createdOn\"\n | \"createdBy\"\n | \"savedOn\"\n | \"savedBy\"\n | \"modifiedOn\"\n | \"modifiedBy\"\n | \"hasNonInheritedPermissions\"\n | \"canManageContent\"\n | \"canManagePermissions\"\n | \"canManageStructure\"\n >;\n}\n\nexport const CREATE_FOLDER = (FOLDER_FIELDS: string) => /* GraphQL */ `\n mutation CreateFolder($data: FolderCreateInput!) {\n aco {\n createFolder(data: $data) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass CreateFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: MainGraphQLClient.Interface,\n private folderModelProvider: FolderModelProvider.Interface\n ) {}\n\n async execute(folder: FolderGatewayDto) {\n const fields = await this.folderModelProvider.getGraphQLSelection();\n\n const response = await this.client.execute<CreateFolderResponse, CreateFolderVariables>({\n query: CREATE_FOLDER(fields),\n variables: {\n data: {\n ...folder\n }\n }\n });\n\n if (!response) {\n throw new Error(\"Network error while creating folder.\");\n }\n\n const { data, error } = response.aco.createFolder;\n\n if (!data) {\n throw new Error(error?.message || \"Could not create folder\");\n }\n\n return data;\n }\n}\n\nexport const CreateFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: CreateFolderGqlGatewayImpl,\n dependencies: [MainGraphQLClient, FolderModelProvider]\n});\n"],"names":["CREATE_FOLDER","FOLDER_FIELDS","CreateFolderGqlGatewayImpl","client","folderModelProvider","folder","fields","response","Error","data","error","CreateFolderGqlGateway","GatewayAbstraction","MainGraphQLClient","FolderModelProvider"],"mappings":";;;AAkCO,MAAMA,gBAAgB,CAACC,gBAAwC,CAAC;;;;qBAIlD,EAAEA,cAAc;;;;;;;;;AASrC,CAAC;AAED,MAAMC;IACF,YACYC,MAAmC,EACnCC,mBAAkD,CAC5D;aAFUD,MAAM,GAANA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQC,MAAwB,EAAE;QACpC,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,mBAAmB;QAEjE,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8C;YACpF,OAAOP,cAAcM;YACrB,WAAW;gBACP,MAAM;oBACF,GAAGD,MAAM;gBACb;YACJ;QACJ;QAEA,IAAI,CAACE,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,YAAY;QAEjD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAME,yBAAyBC,oBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBV;IAChB,cAAc;QAACW;QAAmBC;KAAoB;AAC1D"}
@@ -1,4 +1,4 @@
1
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
2
2
  import { DeleteFolderGateway as GatewayAbstraction } from "./abstractions.js";
3
3
  import type { AcoError } from "../../../types.js";
4
4
  export interface DeleteFolderVariables {
@@ -12,10 +12,10 @@ export interface DeleteFolderResponse {
12
12
  };
13
13
  };
14
14
  }
15
- export declare const DELETE_FOLDER: import("graphql").DocumentNode;
15
+ export declare const DELETE_FOLDER = "\n mutation DeleteFolder($id: ID!) {\n aco {\n deleteFolder(id: $id) {\n data\n error {\n code\n data\n message\n }\n }\n }\n }\n";
16
16
  declare class DeleteFolderGqlGatewayImpl implements GatewayAbstraction.Interface {
17
17
  private client;
18
- constructor(client: ApolloClient.Interface);
18
+ constructor(client: MainGraphQLClient.Interface);
19
19
  execute(id: string): Promise<void>;
20
20
  }
21
21
  export declare const DeleteFolderGqlGateway: typeof DeleteFolderGqlGatewayImpl & {
@@ -1,7 +1,6 @@
1
- import graphql_tag from "graphql-tag";
2
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
3
2
  import { DeleteFolderGateway } from "./abstractions.js";
4
- const DELETE_FOLDER = graphql_tag`
3
+ const DELETE_FOLDER = `
5
4
  mutation DeleteFolder($id: ID!) {
6
5
  aco {
7
6
  deleteFolder(id: $id) {
@@ -20,8 +19,8 @@ class DeleteFolderGqlGatewayImpl {
20
19
  this.client = client;
21
20
  }
22
21
  async execute(id) {
23
- const { data: response } = await this.client.mutate({
24
- mutation: DELETE_FOLDER,
22
+ const response = await this.client.execute({
23
+ query: DELETE_FOLDER,
25
24
  variables: {
26
25
  id
27
26
  }
@@ -34,7 +33,7 @@ class DeleteFolderGqlGatewayImpl {
34
33
  const DeleteFolderGqlGateway = DeleteFolderGateway.createImplementation({
35
34
  implementation: DeleteFolderGqlGatewayImpl,
36
35
  dependencies: [
37
- ApolloClient
36
+ MainGraphQLClient
38
37
  ]
39
38
  });
40
39
  export { DELETE_FOLDER, DeleteFolderGqlGateway };
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/deleteFolder/DeleteFolderGqlGateway.js","sources":["../../../../src/features/folders/deleteFolder/DeleteFolderGqlGateway.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { ApolloClient } from \"@webiny/app-admin/features/apolloClient/abstraction.js\";\nimport { DeleteFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface DeleteFolderVariables {\n id: string;\n}\n\nexport interface DeleteFolderResponse {\n aco: {\n deleteFolder: {\n data: boolean;\n error: AcoError | null;\n };\n };\n}\n\nexport const DELETE_FOLDER = gql`\n mutation DeleteFolder($id: ID!) {\n aco {\n deleteFolder(id: $id) {\n data\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass DeleteFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: ApolloClient.Interface) {}\n\n async execute(id: string) {\n const { data: response } = await this.client.mutate<\n DeleteFolderResponse,\n DeleteFolderVariables\n >({\n mutation: DELETE_FOLDER,\n variables: {\n id\n }\n });\n\n if (!response) {\n throw new Error(\"Network error while deleting folder\");\n }\n\n const { data, error } = response.aco.deleteFolder;\n\n if (!data) {\n throw new Error(error?.message || \"Could not delete folder\");\n }\n\n return;\n }\n}\n\nexport const DeleteFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: DeleteFolderGqlGatewayImpl,\n dependencies: [ApolloClient]\n});\n"],"names":["DELETE_FOLDER","gql","DeleteFolderGqlGatewayImpl","client","id","response","Error","data","error","DeleteFolderGqlGateway","GatewayAbstraction","ApolloClient"],"mappings":";;;AAkBO,MAAMA,gBAAgBC,WAAG,CAAC;;;;;;;;;;;;;AAajC,CAAC;AAED,MAAMC;IACF,YAAoBC,MAA8B,CAAE;aAAhCA,MAAM,GAANA;IAAiC;IAErD,MAAM,QAAQC,EAAU,EAAE;QACtB,MAAM,EAAE,MAAMC,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAGjD;YACE,UAAUL;YACV,WAAW;gBACPI;YACJ;QACJ;QAEA,IAAI,CAACC,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,YAAY;QAEjD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;IAI1C;AACJ;AAEO,MAAMC,yBAAyBC,oBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBR;IAChB,cAAc;QAACS;KAAa;AAChC"}
1
+ {"version":3,"file":"features/folders/deleteFolder/DeleteFolderGqlGateway.js","sources":["../../../../src/features/folders/deleteFolder/DeleteFolderGqlGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport { DeleteFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface DeleteFolderVariables {\n id: string;\n}\n\nexport interface DeleteFolderResponse {\n aco: {\n deleteFolder: {\n data: boolean;\n error: AcoError | null;\n };\n };\n}\n\nexport const DELETE_FOLDER = /* GraphQL */ `\n mutation DeleteFolder($id: ID!) {\n aco {\n deleteFolder(id: $id) {\n data\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass DeleteFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: MainGraphQLClient.Interface) {}\n\n async execute(id: string) {\n const response = await this.client.execute<DeleteFolderResponse, DeleteFolderVariables>({\n query: DELETE_FOLDER,\n variables: {\n id\n }\n });\n\n if (!response) {\n throw new Error(\"Network error while deleting folder\");\n }\n\n const { data, error } = response.aco.deleteFolder;\n\n if (!data) {\n throw new Error(error?.message || \"Could not delete folder\");\n }\n\n return;\n }\n}\n\nexport const DeleteFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: DeleteFolderGqlGatewayImpl,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["DELETE_FOLDER","DeleteFolderGqlGatewayImpl","client","id","response","Error","data","error","DeleteFolderGqlGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAiBO,MAAMA,gBAA8B,CAAC;;;;;;;;;;;;;AAa5C,CAAC;AAED,MAAMC;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,EAAU,EAAE;QACtB,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8C;YACpF,OAAOJ;YACP,WAAW;gBACPG;YACJ;QACJ;QAEA,IAAI,CAACC,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,YAAY;QAEjD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;IAI1C;AACJ;AAEO,MAAMC,yBAAyBC,oBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBR;IAChB,cAAc;QAACS;KAAkB;AACrC"}
@@ -1,4 +1,3 @@
1
- import { createFieldsList } from "@webiny/app-headless-cms-common";
2
1
  import { GetFolderModelRepository } from "./abstractions.js";
3
2
  import { FolderModelProvider } from "../abstractions.js";
4
3
  class FolderModelProviderImpl {
@@ -13,38 +12,37 @@ class FolderModelProviderImpl {
13
12
  }
14
13
  async getGraphQLSelection() {
15
14
  const model = await this.getModel();
16
- const fields = createFieldsList({
17
- model,
18
- fields: model.fields
19
- });
20
- return `{
21
- id
22
- createdOn
23
- createdBy {
15
+ const valuesBlock = model.valuesSelection && "_empty" !== model.valuesSelection ? model.valuesSelection : "";
16
+ return `
17
+ {
24
18
  id
25
- displayName
19
+ createdOn
20
+ createdBy {
21
+ id
22
+ displayName
23
+ }
24
+ savedOn
25
+ savedBy {
26
+ id
27
+ displayName
28
+ }
29
+ modifiedOn
30
+ modifiedBy {
31
+ id
32
+ displayName
33
+ }
34
+ permissions {
35
+ target
36
+ level
37
+ inheritedFrom
38
+ }
39
+ hasNonInheritedPermissions
40
+ canManagePermissions
41
+ canManageStructure
42
+ canManageContent
43
+ ${valuesBlock}
26
44
  }
27
- savedOn
28
- savedBy {
29
- id
30
- displayName
31
- }
32
- modifiedOn
33
- modifiedBy {
34
- id
35
- displayName
36
- }
37
- permissions {
38
- target
39
- level
40
- inheritedFrom
41
- }
42
- hasNonInheritedPermissions
43
- canManagePermissions
44
- canManageStructure
45
- canManageContent
46
- ${fields}
47
- }`;
45
+ `;
48
46
  }
49
47
  }
50
48
  const FolderModelProvider_FolderModelProvider = FolderModelProvider.createImplementation({
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/folderModelProvider/FolderModelProvider.js","sources":["../../../../src/features/folders/folderModelProvider/FolderModelProvider.ts"],"sourcesContent":["import { createFieldsList } from \"@webiny/app-headless-cms-common\";\nimport type { CmsModel } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport { GetFolderModelRepository } from \"./abstractions.js\";\nimport { FolderModelProvider as Provider } from \"~/features/folders/abstractions.js\";\n\nclass FolderModelProviderImpl implements Provider.Interface {\n constructor(private repository: GetFolderModelRepository.Interface) {}\n\n async getModel(): Promise<CmsModel> {\n await this.repository.load();\n\n const model = this.repository.getModel();\n if (!model) {\n // Something went seriously wrong!\n throw new Error(\"Unable to load File model!\");\n }\n\n return model;\n }\n\n async getGraphQLSelection(): Promise<string> {\n const model = await this.getModel();\n\n const fields = createFieldsList({ model, fields: model.fields });\n\n return /* GraphQL */ `{\n id\n createdOn\n createdBy {\n id\n displayName\n }\n savedOn\n savedBy {\n id\n displayName\n }\n modifiedOn\n modifiedBy {\n id\n displayName\n }\n permissions {\n target\n level\n inheritedFrom\n }\n hasNonInheritedPermissions\n canManagePermissions\n canManageStructure\n canManageContent\n ${fields}\n }`;\n }\n}\n\nexport const FolderModelProvider = Provider.createImplementation({\n implementation: FolderModelProviderImpl,\n dependencies: [GetFolderModelRepository]\n});\n"],"names":["FolderModelProviderImpl","repository","model","Error","fields","createFieldsList","FolderModelProvider","Provider","GetFolderModelRepository"],"mappings":";;;AAKA,MAAMA;IACF,YAAoBC,UAA8C,CAAE;aAAhDA,UAAU,GAAVA;IAAiD;IAErE,MAAM,WAA8B;QAChC,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI;QAE1B,MAAMC,QAAQ,IAAI,CAAC,UAAU,CAAC,QAAQ;QACtC,IAAI,CAACA,OAED,MAAM,IAAIC,MAAM;QAGpB,OAAOD;IACX;IAEA,MAAM,sBAAuC;QACzC,MAAMA,QAAQ,MAAM,IAAI,CAAC,QAAQ;QAEjC,MAAME,SAASC,iBAAiB;YAAEH;YAAO,QAAQA,MAAM,MAAM;QAAC;QAE9D,OAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;YA0BlB,EAAEE,OAAO;SACZ,CAAC;IACN;AACJ;AAEO,MAAME,0CAAsBC,oBAAAA,oBAA6B,CAAC;IAC7D,gBAAgBP;IAChB,cAAc;QAACQ;KAAyB;AAC5C"}
1
+ {"version":3,"file":"features/folders/folderModelProvider/FolderModelProvider.js","sources":["../../../../src/features/folders/folderModelProvider/FolderModelProvider.ts"],"sourcesContent":["import type { CmsModel } from \"@webiny/app-headless-cms-common/types/index.js\";\n\nimport { GetFolderModelRepository } from \"./abstractions.js\";\nimport { FolderModelProvider as Provider } from \"~/features/folders/abstractions.js\";\n\nclass FolderModelProviderImpl implements Provider.Interface {\n constructor(private repository: GetFolderModelRepository.Interface) {}\n\n async getModel(): Promise<CmsModel> {\n await this.repository.load();\n\n const model = this.repository.getModel();\n if (!model) {\n throw new Error(\"Unable to load File model!\");\n }\n\n return model;\n }\n\n async getGraphQLSelection(): Promise<string> {\n const model = await this.getModel();\n\n const valuesBlock =\n model.valuesSelection && model.valuesSelection !== \"_empty\"\n ? model.valuesSelection\n : \"\";\n\n return /* GraphQL */ `\n {\n id\n createdOn\n createdBy {\n id\n displayName\n }\n savedOn\n savedBy {\n id\n displayName\n }\n modifiedOn\n modifiedBy {\n id\n displayName\n }\n permissions {\n target\n level\n inheritedFrom\n }\n hasNonInheritedPermissions\n canManagePermissions\n canManageStructure\n canManageContent\n ${valuesBlock}\n }\n `;\n }\n}\n\nexport const FolderModelProvider = Provider.createImplementation({\n implementation: FolderModelProviderImpl,\n dependencies: [GetFolderModelRepository]\n});\n"],"names":["FolderModelProviderImpl","repository","model","Error","valuesBlock","FolderModelProvider","Provider","GetFolderModelRepository"],"mappings":";;AAKA,MAAMA;IACF,YAAoBC,UAA8C,CAAE;aAAhDA,UAAU,GAAVA;IAAiD;IAErE,MAAM,WAA8B;QAChC,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI;QAE1B,MAAMC,QAAQ,IAAI,CAAC,UAAU,CAAC,QAAQ;QACtC,IAAI,CAACA,OACD,MAAM,IAAIC,MAAM;QAGpB,OAAOD;IACX;IAEA,MAAM,sBAAuC;QACzC,MAAMA,QAAQ,MAAM,IAAI,CAAC,QAAQ;QAEjC,MAAME,cACFF,MAAM,eAAe,IAAIA,AAA0B,aAA1BA,MAAM,eAAe,GACxCA,MAAM,eAAe,GACrB;QAEV,OAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA2Bd,EAAEE,YAAY;;QAEtB,CAAC;IACL;AACJ;AAEO,MAAMC,0CAAsBC,oBAAAA,oBAA6B,CAAC;IAC7D,gBAAgBN;IAChB,cAAc;QAACO;KAAyB;AAC5C"}
@@ -1,4 +1,4 @@
1
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
2
2
  import { GetFolderModelGateway as GatewayAbstraction } from "./abstractions.js";
3
3
  import type { CmsModel } from "@webiny/app-headless-cms-common/types/index.js";
4
4
  import type { AcoError } from "../../../types.js";
@@ -10,10 +10,10 @@ export interface GetFolderModelResponse {
10
10
  };
11
11
  };
12
12
  }
13
- export declare const GET_FOLDER_MODEL: import("graphql").DocumentNode;
13
+ export declare const GET_FOLDER_MODEL = "\n query GetFolderModel {\n aco {\n getFolderModel {\n data\n error {\n code\n message\n data\n stack\n }\n }\n }\n }\n";
14
14
  declare class GetFolderModelGqlGatewayImpl implements GatewayAbstraction.Interface {
15
15
  private client;
16
- constructor(client: ApolloClient.Interface);
16
+ constructor(client: MainGraphQLClient.Interface);
17
17
  execute(): Promise<CmsModel>;
18
18
  }
19
19
  export declare const GetFolderModelGqlGateway: typeof GetFolderModelGqlGatewayImpl & {
@@ -1,7 +1,6 @@
1
- import graphql_tag from "graphql-tag";
2
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
3
2
  import { GetFolderModelGateway } from "./abstractions.js";
4
- const GET_FOLDER_MODEL = graphql_tag`
3
+ const GET_FOLDER_MODEL = `
5
4
  query GetFolderModel {
6
5
  aco {
7
6
  getFolderModel {
@@ -21,9 +20,8 @@ class GetFolderModelGqlGatewayImpl {
21
20
  this.client = client;
22
21
  }
23
22
  async execute() {
24
- const { data: response } = await this.client.query({
25
- query: GET_FOLDER_MODEL,
26
- fetchPolicy: "network-only"
23
+ const response = await this.client.execute({
24
+ query: GET_FOLDER_MODEL
27
25
  });
28
26
  if (!response) throw new Error("Network error while fetch folder.");
29
27
  const { data, error } = response.aco.getFolderModel;
@@ -34,7 +32,7 @@ class GetFolderModelGqlGatewayImpl {
34
32
  const GetFolderModelGqlGateway = GetFolderModelGateway.createImplementation({
35
33
  implementation: GetFolderModelGqlGatewayImpl,
36
34
  dependencies: [
37
- ApolloClient
35
+ MainGraphQLClient
38
36
  ]
39
37
  });
40
38
  export { GET_FOLDER_MODEL, GetFolderModelGqlGateway };
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/folderModelProvider/GetFolderModelGqlGateway.js","sources":["../../../../src/features/folders/folderModelProvider/GetFolderModelGqlGateway.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { ApolloClient } from \"@webiny/app-admin/features/apolloClient/abstraction.js\";\nimport { GetFolderModelGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { CmsModel } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface GetFolderModelResponse {\n aco: {\n getFolderModel: {\n data: CmsModel;\n error: AcoError | null;\n };\n };\n}\n\nexport const GET_FOLDER_MODEL = gql`\n query GetFolderModel {\n aco {\n getFolderModel {\n data\n error {\n code\n message\n data\n stack\n }\n }\n }\n }\n`;\n\nclass GetFolderModelGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: ApolloClient.Interface) {}\n\n async execute() {\n const { data: response } = await this.client.query<GetFolderModelResponse>({\n query: GET_FOLDER_MODEL,\n fetchPolicy: \"network-only\"\n });\n\n if (!response) {\n throw new Error(\"Network error while fetch folder.\");\n }\n\n const { data, error } = response.aco.getFolderModel;\n\n if (!data) {\n throw new Error(error?.message || `Could not fetch folder model`);\n }\n\n return data;\n }\n}\n\nexport const GetFolderModelGqlGateway = GatewayAbstraction.createImplementation({\n implementation: GetFolderModelGqlGatewayImpl,\n dependencies: [ApolloClient]\n});\n"],"names":["GET_FOLDER_MODEL","gql","GetFolderModelGqlGatewayImpl","client","response","Error","data","error","GetFolderModelGqlGateway","GatewayAbstraction","ApolloClient"],"mappings":";;;AAeO,MAAMA,mBAAmBC,WAAG,CAAC;;;;;;;;;;;;;;AAcpC,CAAC;AAED,MAAMC;IACF,YAAoBC,MAA8B,CAAE;aAAhCA,MAAM,GAANA;IAAiC;IAErD,MAAM,UAAU;QACZ,MAAM,EAAE,MAAMC,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAyB;YACvE,OAAOJ;YACP,aAAa;QACjB;QAEA,IAAI,CAACI,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,cAAc;QAEnD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAME,2BAA2BC,sBAAAA,oBAAuC,CAAC;IAC5E,gBAAgBP;IAChB,cAAc;QAACQ;KAAa;AAChC"}
1
+ {"version":3,"file":"features/folders/folderModelProvider/GetFolderModelGqlGateway.js","sources":["../../../../src/features/folders/folderModelProvider/GetFolderModelGqlGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport { GetFolderModelGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { CmsModel } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface GetFolderModelResponse {\n aco: {\n getFolderModel: {\n data: CmsModel;\n error: AcoError | null;\n };\n };\n}\n\nexport const GET_FOLDER_MODEL = /* GraphQL */ `\n query GetFolderModel {\n aco {\n getFolderModel {\n data\n error {\n code\n message\n data\n stack\n }\n }\n }\n }\n`;\n\nclass GetFolderModelGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: MainGraphQLClient.Interface) {}\n\n async execute() {\n const response = await this.client.execute<GetFolderModelResponse>({\n query: GET_FOLDER_MODEL\n });\n\n if (!response) {\n throw new Error(\"Network error while fetch folder.\");\n }\n\n const { data, error } = response.aco.getFolderModel;\n\n if (!data) {\n throw new Error(error?.message || `Could not fetch folder model`);\n }\n\n return data;\n }\n}\n\nexport const GetFolderModelGqlGateway = GatewayAbstraction.createImplementation({\n implementation: GetFolderModelGqlGatewayImpl,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["GET_FOLDER_MODEL","GetFolderModelGqlGatewayImpl","client","response","Error","data","error","GetFolderModelGqlGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAcO,MAAMA,mBAAiC,CAAC;;;;;;;;;;;;;;AAc/C,CAAC;AAED,MAAMC;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,UAAU;QACZ,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAyB;YAC/D,OAAOH;QACX;QAEA,IAAI,CAACG,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,cAAc;QAEnD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAME,2BAA2BC,sBAAAA,oBAAuC,CAAC;IAC5E,gBAAgBP;IAChB,cAAc;QAACQ;KAAkB;AACrC"}
@@ -1,4 +1,4 @@
1
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
2
2
  import type { FolderDto } from "../../../domain/folder/FolderDto.js";
3
3
  import { FolderModelProvider } from "../../../features/folders/abstractions.js";
4
4
  import { GetFolderGateway as GatewayAbstraction } from "./abstractions.js";
@@ -17,11 +17,11 @@ export interface GetFolderResponse {
17
17
  export interface GetFolderQueryVariables {
18
18
  id: string;
19
19
  }
20
- export declare const GET_FOLDER: (FOLDER_FIELDS: string) => import("graphql").DocumentNode;
20
+ export declare const GET_FOLDER: (FOLDER_FIELDS: string) => string;
21
21
  declare class GetFolderGqlGatewayImpl implements GatewayAbstraction.Interface {
22
22
  private client;
23
23
  private folderModelProvider;
24
- constructor(client: ApolloClient.Interface, folderModelProvider: FolderModelProvider.Interface);
24
+ constructor(client: MainGraphQLClient.Interface, folderModelProvider: FolderModelProvider.Interface);
25
25
  execute(id: string): Promise<FolderDto>;
26
26
  }
27
27
  export declare const GetFolderGqlGateway: typeof GetFolderGqlGatewayImpl & {
@@ -1,8 +1,7 @@
1
- import graphql_tag from "graphql-tag";
2
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
3
2
  import { FolderModelProvider } from "../abstractions.js";
4
3
  import { GetFolderGateway } from "./abstractions.js";
5
- const GET_FOLDER = (FOLDER_FIELDS)=>graphql_tag`
4
+ const GET_FOLDER = (FOLDER_FIELDS)=>`
6
5
  query GetFolder($id: ID!) {
7
6
  aco {
8
7
  getFolder(id: $id) {
@@ -23,12 +22,11 @@ class GetFolderGqlGatewayImpl {
23
22
  }
24
23
  async execute(id) {
25
24
  const fields = await this.folderModelProvider.getGraphQLSelection();
26
- const { data: response } = await this.client.query({
25
+ const response = await this.client.execute({
27
26
  query: GET_FOLDER(fields),
28
27
  variables: {
29
28
  id
30
- },
31
- fetchPolicy: "network-only"
29
+ }
32
30
  });
33
31
  if (!response) throw new Error("Network error while fetch folder.");
34
32
  const { data, error } = response.aco.getFolder;
@@ -39,7 +37,7 @@ class GetFolderGqlGatewayImpl {
39
37
  const GetFolderGqlGateway = GetFolderGateway.createImplementation({
40
38
  implementation: GetFolderGqlGatewayImpl,
41
39
  dependencies: [
42
- ApolloClient,
40
+ MainGraphQLClient,
43
41
  FolderModelProvider
44
42
  ]
45
43
  });
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/getFolder/GetFolderGqlGateway.js","sources":["../../../../src/features/folders/getFolder/GetFolderGqlGateway.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { ApolloClient } from \"@webiny/app-admin/features/apolloClient/abstraction.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { FolderModelProvider } from \"~/features/folders/abstractions.js\";\nimport { GetFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface GetFolderResponse {\n aco: {\n getFolder:\n | {\n data: FolderDto;\n error: null;\n }\n | {\n data: null;\n error: AcoError;\n };\n };\n}\n\nexport interface GetFolderQueryVariables {\n id: string;\n}\n\nexport const GET_FOLDER = (FOLDER_FIELDS: string) => gql`\n query GetFolder($id: ID!) {\n aco {\n getFolder(id: $id) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass GetFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: ApolloClient.Interface,\n private folderModelProvider: FolderModelProvider.Interface\n ) {}\n\n async execute(id: string) {\n const fields = await this.folderModelProvider.getGraphQLSelection();\n\n const { data: response } = await this.client.query<\n GetFolderResponse,\n GetFolderQueryVariables\n >({\n query: GET_FOLDER(fields),\n variables: { id },\n fetchPolicy: \"network-only\"\n });\n\n if (!response) {\n throw new Error(\"Network error while fetch folder.\");\n }\n\n const { data, error } = response.aco.getFolder;\n\n if (!data) {\n throw new Error(error?.message || `Could not fetch folder with id: ${id}`);\n }\n\n return data;\n }\n}\n\nexport const GetFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: GetFolderGqlGatewayImpl,\n dependencies: [ApolloClient, FolderModelProvider]\n});\n"],"names":["GET_FOLDER","FOLDER_FIELDS","gql","GetFolderGqlGatewayImpl","client","folderModelProvider","id","fields","response","Error","data","error","GetFolderGqlGateway","GatewayAbstraction","ApolloClient","FolderModelProvider"],"mappings":";;;;AAyBO,MAAMA,aAAa,CAACC,gBAA0BC,WAAG,CAAC;;;;qBAIpC,EAAED,cAAc;;;;;;;;;AASrC,CAAC;AAED,MAAME;IACF,YACYC,MAA8B,EAC9BC,mBAAkD,CAC5D;aAFUD,MAAM,GAANA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQC,EAAU,EAAE;QACtB,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,mBAAmB;QAEjE,MAAM,EAAE,MAAMC,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAGhD;YACE,OAAOR,WAAWO;YAClB,WAAW;gBAAED;YAAG;YAChB,aAAa;QACjB;QAEA,IAAI,CAACE,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,SAAS;QAE9C,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW,CAAC,gCAAgC,EAAEL,IAAI;QAG7E,OAAOI;IACX;AACJ;AAEO,MAAME,sBAAsBC,iBAAAA,oBAAuC,CAAC;IACvE,gBAAgBV;IAChB,cAAc;QAACW;QAAcC;KAAoB;AACrD"}
1
+ {"version":3,"file":"features/folders/getFolder/GetFolderGqlGateway.js","sources":["../../../../src/features/folders/getFolder/GetFolderGqlGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { FolderModelProvider } from \"~/features/folders/abstractions.js\";\nimport { GetFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface GetFolderResponse {\n aco: {\n getFolder:\n | {\n data: FolderDto;\n error: null;\n }\n | {\n data: null;\n error: AcoError;\n };\n };\n}\n\nexport interface GetFolderQueryVariables {\n id: string;\n}\n\nexport const GET_FOLDER = (FOLDER_FIELDS: string) => /* GraphQL */ `\n query GetFolder($id: ID!) {\n aco {\n getFolder(id: $id) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass GetFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: MainGraphQLClient.Interface,\n private folderModelProvider: FolderModelProvider.Interface\n ) {}\n\n async execute(id: string) {\n const fields = await this.folderModelProvider.getGraphQLSelection();\n\n const response = await this.client.execute<GetFolderResponse, GetFolderQueryVariables>({\n query: GET_FOLDER(fields),\n variables: { id }\n });\n\n if (!response) {\n throw new Error(\"Network error while fetch folder.\");\n }\n\n const { data, error } = response.aco.getFolder;\n\n if (!data) {\n throw new Error(error?.message || `Could not fetch folder with id: ${id}`);\n }\n\n return data;\n }\n}\n\nexport const GetFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: GetFolderGqlGatewayImpl,\n dependencies: [MainGraphQLClient, FolderModelProvider]\n});\n"],"names":["GET_FOLDER","FOLDER_FIELDS","GetFolderGqlGatewayImpl","client","folderModelProvider","id","fields","response","Error","data","error","GetFolderGqlGateway","GatewayAbstraction","MainGraphQLClient","FolderModelProvider"],"mappings":";;;AAwBO,MAAMA,aAAa,CAACC,gBAAwC,CAAC;;;;qBAI/C,EAAEA,cAAc;;;;;;;;;AASrC,CAAC;AAED,MAAMC;IACF,YACYC,MAAmC,EACnCC,mBAAkD,CAC5D;aAFUD,MAAM,GAANA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQC,EAAU,EAAE;QACtB,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,mBAAmB;QAEjE,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA6C;YACnF,OAAOP,WAAWM;YAClB,WAAW;gBAAED;YAAG;QACpB;QAEA,IAAI,CAACE,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,SAAS;QAE9C,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW,CAAC,gCAAgC,EAAEL,IAAI;QAG7E,OAAOI;IACX;AACJ;AAEO,MAAME,sBAAsBC,iBAAAA,oBAAuC,CAAC;IACvE,gBAAgBV;IAChB,cAAc;QAACW;QAAmBC;KAAoB;AAC1D"}
@@ -14,15 +14,15 @@ declare class GetFolderExtensionsFieldsUseCaseImpl implements UseCaseAbstraction
14
14
  description?: string | React.ReactNode;
15
15
  note?: string | React.ReactNode;
16
16
  placeholder?: string;
17
- validation?: (import("@webiny/app-headless-cms-common/types/validation.js").CmsModelFieldValidator | import("@webiny/validation/types.js").Validator)[];
18
- listValidation?: import("@webiny/app-headless-cms-common/types/validation.js").CmsModelFieldValidator[];
17
+ validation?: (import("@webiny/app-headless-cms-common/types/model.js").CmsModelFieldValidator | import("@webiny/validation/types.js").Validator)[];
18
+ listValidation?: import("@webiny/app-headless-cms-common/types/model.js").CmsModelFieldValidator[];
19
19
  list?: boolean;
20
20
  predefinedValues?: import("@webiny/app-headless-cms-common/types/index.js").CmsEditorFieldPredefinedValues;
21
21
  settings?: import("@webiny/app-headless-cms-common/types/model.js").CmsModelFieldSettings<unknown> | undefined;
22
22
  renderer: {
23
23
  name: string;
24
24
  settings?: Record<string, any>;
25
- } | import("@webiny/app-headless-cms-common/types/index.js").CmsModelFieldRendererPlugin["renderer"]["render"];
25
+ };
26
26
  tags?: string[];
27
27
  rules?: import("@webiny/app-headless-cms-common/types/model.js").FieldRule[];
28
28
  }[]>;
@@ -9,15 +9,15 @@ export declare const useFolderExtensionsFields: () => {
9
9
  description?: string | React.ReactNode;
10
10
  note?: string | React.ReactNode;
11
11
  placeholder?: string;
12
- validation?: (import("@webiny/app-headless-cms-common/types/validation.js").CmsModelFieldValidator | import("@webiny/validation/types.js").Validator)[];
13
- listValidation?: import("@webiny/app-headless-cms-common/types/validation.js").CmsModelFieldValidator[];
12
+ validation?: (import("@webiny/app-headless-cms-common/types/model.js").CmsModelFieldValidator | import("@webiny/validation/types.js").Validator)[];
13
+ listValidation?: import("@webiny/app-headless-cms-common/types/model.js").CmsModelFieldValidator[];
14
14
  list?: boolean;
15
15
  predefinedValues?: import("@webiny/app-headless-cms-common/types/index.js").CmsEditorFieldPredefinedValues;
16
16
  settings?: import("@webiny/app-headless-cms-common/types/model.js").CmsModelFieldSettings<unknown> | undefined;
17
17
  renderer: {
18
18
  name: string;
19
19
  settings?: Record<string, any>;
20
- } | import("@webiny/app-headless-cms-common/types/index.js").CmsModelFieldRendererPlugin["renderer"]["render"];
20
+ };
21
21
  tags?: string[];
22
22
  rules?: import("@webiny/app-headless-cms-common/types/model.js").FieldRule[];
23
23
  }[];
@@ -1,31 +1,27 @@
1
1
  import { describe, expect, it } from "vitest";
2
2
  import { Container } from "@webiny/di";
3
- import { createTestWcpLicense } from "@webiny/wcp/testing/createTestWcpLicense.js";
4
3
  import { ListCache } from "../cache/index.js";
5
4
  import { FoldersCache, FoldersContext } from "../abstractions.js";
6
5
  import { GetFolderLevelPermissionFeature } from "./feature.js";
7
6
  import { GetFolderLevelPermissionUseCase } from "./abstractions.js";
8
- import { WcpService } from "@webiny/app-admin/features/wcp/abstractions.js";
7
+ import { FeatureFlagsService } from "@webiny/app-admin/features/featureFlags/abstractions.js";
9
8
  import { Folder } from "../../../domain/folder/Folder.js";
10
- import { License } from "@webiny/wcp";
11
- class WcpServiceMock {
9
+ import { FeatureFlags } from "@webiny/feature-flags";
10
+ class FeatureFlagsServiceMock {
12
11
  constructor(flpEnabled){
13
- this.license = License.fromLicenseDto(createTestWcpLicense({
14
- folderLevelPermissions: flpEnabled
15
- }));
16
- }
17
- canUseFeature(featureName) {
18
- return this.license.canUseFeature(featureName);
12
+ this.flags = new FeatureFlags({
13
+ advancedAccessControlLayer: flpEnabled ? {
14
+ folderLevelPermissions: true
15
+ } : false
16
+ });
19
17
  }
20
- getProject() {
21
- return this.license;
18
+ getFlags() {
19
+ return this.flags;
22
20
  }
23
21
  isLoaded() {
24
22
  return true;
25
23
  }
26
- loadProject() {
27
- return Promise.resolve(void 0);
28
- }
24
+ async loadFlags() {}
29
25
  }
30
26
  describe("GetFolderLevelPermission", ()=>{
31
27
  const type = "abc";
@@ -70,7 +66,7 @@ describe("GetFolderLevelPermission", ()=>{
70
66
  type
71
67
  })
72
68
  ]);
73
- container.registerInstance(WcpService, new WcpServiceMock(flpEnabled));
69
+ container.registerInstance(FeatureFlagsService, new FeatureFlagsServiceMock(flpEnabled));
74
70
  container.registerInstance(FoldersContext, {
75
71
  type
76
72
  });
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.js","sources":["../../../../src/features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.ts"],"sourcesContent":["import { describe, it, expect } from \"vitest\";\nimport { Container } from \"@webiny/di\";\nimport { createTestWcpLicense } from \"@webiny/wcp/testing/createTestWcpLicense.js\";\nimport { ListCache } from \"~/features/folders/cache/index.js\";\nimport { FoldersContext } from \"~/features/folders/abstractions.js\";\nimport { FoldersCache } from \"~/features/folders/abstractions.js\";\nimport { GetFolderLevelPermissionFeature } from \"~/features/folders/getFolderLevelPermission/feature.js\";\nimport { GetFolderLevelPermissionUseCase } from \"~/features/folders/getFolderLevelPermission/abstractions.js\";\nimport { WcpService } from \"@webiny/app-admin/features/wcp/abstractions.js\";\nimport { Folder } from \"~/domain/folder/Folder.js\";\nimport type { ILicense } from \"@webiny/wcp/types\";\nimport { License, WCP_FEATURE_LABEL } from \"@webiny/wcp\";\n\nclass WcpServiceMock implements WcpService.Interface {\n private readonly license: ILicense;\n\n constructor(flpEnabled: boolean) {\n this.license = License.fromLicenseDto(\n createTestWcpLicense({ folderLevelPermissions: flpEnabled })\n );\n }\n\n canUseFeature(featureName: keyof typeof WCP_FEATURE_LABEL): boolean {\n return this.license.canUseFeature(featureName);\n }\n\n getProject(): ILicense {\n return this.license;\n }\n\n isLoaded(): boolean {\n return true;\n }\n\n loadProject(): Promise<void> {\n return Promise.resolve(undefined);\n }\n}\n\ndescribe(\"GetFolderLevelPermission\", () => {\n const type = \"abc\";\n\n function setupTest(params: { flpEnabled: boolean }) {\n const { flpEnabled } = params;\n const container = new Container();\n const foldersCache = new ListCache<Folder>();\n\n foldersCache.addItems([\n Folder.create({\n id: \"folder-canManageContent\",\n title: \"Folder canManageContent\",\n slug: \"folder-canManageContent\",\n parentId: null,\n permissions: [],\n canManageContent: true,\n type\n }),\n Folder.create({\n id: \"folder-canManageStructure\",\n title: \"Folder canManageStructure\",\n slug: \"folder-canManageStructure\",\n parentId: null,\n permissions: [],\n canManageStructure: true,\n type\n }),\n Folder.create({\n id: \"folder-canManagePermissions\",\n title: \"Folder canManagePermissions3\",\n slug: \"folder-canManagePermissions\",\n parentId: null,\n permissions: [],\n canManagePermissions: true,\n type\n }),\n Folder.create({\n id: \"folder-no-permissions\",\n title: \"Folder No Permissions\",\n slug: \"folder-no-permissions\",\n parentId: null,\n permissions: [],\n type\n })\n ]);\n\n container.registerInstance(WcpService, new WcpServiceMock(flpEnabled));\n container.registerInstance(FoldersContext, { type });\n container.registerInstance(FoldersCache, foldersCache);\n\n GetFolderLevelPermissionFeature.register(container);\n\n return {\n container,\n foldersCache,\n useCase: container.resolve(GetFolderLevelPermissionUseCase)\n };\n }\n\n it(\"should return true in case a specific permission is set at folder level and FLP is enabled\", async () => {\n const { useCase } = setupTest({ flpEnabled: true });\n\n // canManagePermissions\n {\n const result = useCase.execute(\"folder-canManagePermissions\", \"canManagePermissions\");\n expect(result).toBe(true);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"folder-canManageStructure\", \"canManageStructure\");\n expect(result).toBe(true);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"folder-canManageContent\", \"canManageContent\");\n\n expect(result).toBe(true);\n }\n });\n\n it(\"should return false in case a specific permission is not set at folder level and FLP is enabled\", async () => {\n const { useCase } = setupTest({ flpEnabled: true });\n // canManagePermissions\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManagePermissions\");\n expect(result).toBe(false);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManageStructure\");\n\n expect(result).toBe(false);\n }\n\n // canManageContent\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManageContent\");\n\n expect(result).toBe(false);\n }\n });\n\n it(\"should return always false in case the folder is not found\", async () => {\n const { useCase } = setupTest({ flpEnabled: true });\n\n // canManagePermissions\n {\n const result = useCase.execute(\"not-existing-folder\", \"canManagePermissions\");\n\n expect(result).toBe(false);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"not-existing-folder\", \"canManageStructure\");\n\n expect(result).toBe(false);\n }\n\n // canManageContent\n {\n const result = useCase.execute(\"not-existing-folder\", \"canManageContent\");\n\n expect(result).toBe(false);\n }\n });\n\n it(\"should return always true in case FLP is not enabled\", async () => {\n const { useCase } = setupTest({ flpEnabled: false });\n\n // canManagePermissions\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManagePermissions\");\n\n expect(result).toBe(true);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManageStructure\");\n\n expect(result).toBe(true);\n }\n\n // canManageContent\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManageContent\");\n\n expect(result).toBe(true);\n }\n });\n});\n"],"names":["WcpServiceMock","flpEnabled","License","createTestWcpLicense","featureName","Promise","undefined","describe","type","setupTest","params","container","Container","foldersCache","ListCache","Folder","WcpService","FoldersContext","FoldersCache","GetFolderLevelPermissionFeature","GetFolderLevelPermissionUseCase","it","useCase","result","expect"],"mappings":"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"}
1
+ {"version":3,"file":"features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.js","sources":["../../../../src/features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.ts"],"sourcesContent":["import { describe, it, expect } from \"vitest\";\nimport { Container } from \"@webiny/di\";\nimport { ListCache } from \"~/features/folders/cache/index.js\";\nimport { FoldersContext } from \"~/features/folders/abstractions.js\";\nimport { FoldersCache } from \"~/features/folders/abstractions.js\";\nimport { GetFolderLevelPermissionFeature } from \"~/features/folders/getFolderLevelPermission/feature.js\";\nimport { GetFolderLevelPermissionUseCase } from \"~/features/folders/getFolderLevelPermission/abstractions.js\";\nimport { FeatureFlagsService } from \"@webiny/app-admin/features/featureFlags/abstractions.js\";\nimport { Folder } from \"~/domain/folder/Folder.js\";\nimport { FeatureFlags } from \"@webiny/feature-flags\";\n\nclass FeatureFlagsServiceMock implements FeatureFlagsService.Interface {\n private readonly flags: FeatureFlags;\n\n constructor(flpEnabled: boolean) {\n this.flags = new FeatureFlags({\n advancedAccessControlLayer: flpEnabled ? { folderLevelPermissions: true } : false\n });\n }\n\n getFlags(): FeatureFlags {\n return this.flags;\n }\n\n isLoaded(): boolean {\n return true;\n }\n\n async loadFlags(): Promise<void> {}\n}\n\ndescribe(\"GetFolderLevelPermission\", () => {\n const type = \"abc\";\n\n function setupTest(params: { flpEnabled: boolean }) {\n const { flpEnabled } = params;\n const container = new Container();\n const foldersCache = new ListCache<Folder>();\n\n foldersCache.addItems([\n Folder.create({\n id: \"folder-canManageContent\",\n title: \"Folder canManageContent\",\n slug: \"folder-canManageContent\",\n parentId: null,\n permissions: [],\n canManageContent: true,\n type\n }),\n Folder.create({\n id: \"folder-canManageStructure\",\n title: \"Folder canManageStructure\",\n slug: \"folder-canManageStructure\",\n parentId: null,\n permissions: [],\n canManageStructure: true,\n type\n }),\n Folder.create({\n id: \"folder-canManagePermissions\",\n title: \"Folder canManagePermissions3\",\n slug: \"folder-canManagePermissions\",\n parentId: null,\n permissions: [],\n canManagePermissions: true,\n type\n }),\n Folder.create({\n id: \"folder-no-permissions\",\n title: \"Folder No Permissions\",\n slug: \"folder-no-permissions\",\n parentId: null,\n permissions: [],\n type\n })\n ]);\n\n container.registerInstance(FeatureFlagsService, new FeatureFlagsServiceMock(flpEnabled));\n container.registerInstance(FoldersContext, { type });\n container.registerInstance(FoldersCache, foldersCache);\n\n GetFolderLevelPermissionFeature.register(container);\n\n return {\n container,\n foldersCache,\n useCase: container.resolve(GetFolderLevelPermissionUseCase)\n };\n }\n\n it(\"should return true in case a specific permission is set at folder level and FLP is enabled\", async () => {\n const { useCase } = setupTest({ flpEnabled: true });\n\n // canManagePermissions\n {\n const result = useCase.execute(\"folder-canManagePermissions\", \"canManagePermissions\");\n expect(result).toBe(true);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"folder-canManageStructure\", \"canManageStructure\");\n expect(result).toBe(true);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"folder-canManageContent\", \"canManageContent\");\n\n expect(result).toBe(true);\n }\n });\n\n it(\"should return false in case a specific permission is not set at folder level and FLP is enabled\", async () => {\n const { useCase } = setupTest({ flpEnabled: true });\n // canManagePermissions\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManagePermissions\");\n expect(result).toBe(false);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManageStructure\");\n\n expect(result).toBe(false);\n }\n\n // canManageContent\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManageContent\");\n\n expect(result).toBe(false);\n }\n });\n\n it(\"should return always false in case the folder is not found\", async () => {\n const { useCase } = setupTest({ flpEnabled: true });\n\n // canManagePermissions\n {\n const result = useCase.execute(\"not-existing-folder\", \"canManagePermissions\");\n\n expect(result).toBe(false);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"not-existing-folder\", \"canManageStructure\");\n\n expect(result).toBe(false);\n }\n\n // canManageContent\n {\n const result = useCase.execute(\"not-existing-folder\", \"canManageContent\");\n\n expect(result).toBe(false);\n }\n });\n\n it(\"should return always true in case FLP is not enabled\", async () => {\n const { useCase } = setupTest({ flpEnabled: false });\n\n // canManagePermissions\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManagePermissions\");\n\n expect(result).toBe(true);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManageStructure\");\n\n expect(result).toBe(true);\n }\n\n // canManageContent\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManageContent\");\n\n expect(result).toBe(true);\n }\n });\n});\n"],"names":["FeatureFlagsServiceMock","flpEnabled","FeatureFlags","describe","type","setupTest","params","container","Container","foldersCache","ListCache","Folder","FeatureFlagsService","FoldersContext","FoldersCache","GetFolderLevelPermissionFeature","GetFolderLevelPermissionUseCase","it","useCase","result","expect"],"mappings":"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"}
@@ -1,12 +1,12 @@
1
1
  import type { FolderPermissionName } from "../../../../features/folders/abstractions.js";
2
2
  import { FoldersCache } from "../../../../features/folders/abstractions.js";
3
3
  import { GetFolderLevelPermissionUseCase as UseCaseAbstraction } from "../abstractions.js";
4
- import { WcpService } from "@webiny/app-admin/features/wcp/abstractions.js";
4
+ import { FeatureFlagsService } from "@webiny/app-admin/features/featureFlags/abstractions.js";
5
5
  declare class GetFolderLevelPermissionWithFlpDecoratorImpl implements UseCaseAbstraction.Interface {
6
6
  private cache;
7
- private wcp;
7
+ private featureFlagsService;
8
8
  private decoratee;
9
- constructor(cache: FoldersCache.Interface, wcp: WcpService.Interface, decoratee: UseCaseAbstraction.Interface);
9
+ constructor(cache: FoldersCache.Interface, featureFlagsService: FeatureFlagsService.Interface, decoratee: UseCaseAbstraction.Interface);
10
10
  execute(id: string, permissionName: FolderPermissionName): boolean;
11
11
  }
12
12
  export declare const GetFolderLevelPermissionWithFlpDecorator: typeof GetFolderLevelPermissionWithFlpDecoratorImpl & {
@@ -1,14 +1,14 @@
1
1
  import { FoldersCache } from "../../abstractions.js";
2
2
  import { GetFolderLevelPermissionUseCase } from "../abstractions.js";
3
- import { WcpService } from "@webiny/app-admin/features/wcp/abstractions.js";
3
+ import { FeatureFlagsService } from "@webiny/app-admin/features/featureFlags/abstractions.js";
4
4
  class GetFolderLevelPermissionWithFlpDecoratorImpl {
5
- constructor(cache, wcp, decoratee){
5
+ constructor(cache, featureFlagsService, decoratee){
6
6
  this.cache = cache;
7
- this.wcp = wcp;
7
+ this.featureFlagsService = featureFlagsService;
8
8
  this.decoratee = decoratee;
9
9
  }
10
10
  execute(id, permissionName) {
11
- if (!this.wcp.getProject().canUseFolderLevelPermissions()) return this.decoratee.execute(id, permissionName);
11
+ if (!this.featureFlagsService.getFlags().isEnabled("advancedAccessControlLayer.folderLevelPermissions")) return this.decoratee.execute(id, permissionName);
12
12
  const folder = this.cache.getItem((folder)=>folder.id === id);
13
13
  if (!folder) return false;
14
14
  return folder[permissionName] ?? false;
@@ -18,7 +18,7 @@ const GetFolderLevelPermissionWithFlpDecorator = GetFolderLevelPermissionUseCase
18
18
  decorator: GetFolderLevelPermissionWithFlpDecoratorImpl,
19
19
  dependencies: [
20
20
  FoldersCache,
21
- WcpService
21
+ FeatureFlagsService
22
22
  ]
23
23
  });
24
24
  export { GetFolderLevelPermissionWithFlpDecorator };