@webiny/app-aco 0.0.0-unstable.7be00a75a9 → 0.0.0-unstable.7c2def32a7

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 (243) hide show
  1. package/app.js +5 -1
  2. package/app.js.map +1 -1
  3. package/components/Actions/DeleteFolder/DeleteFolder.js +1 -1
  4. package/components/Actions/DeleteFolder/DeleteFolder.js.map +1 -1
  5. package/components/AdvancedSearch/AdvancedSearch.d.ts +2 -2
  6. package/components/AdvancedSearch/AdvancedSearch.js +1 -1
  7. package/components/AdvancedSearch/AdvancedSearch.js.map +1 -1
  8. package/components/AdvancedSearch/QueryBuilderDrawer/QueryBuilder/components/OperationSelector.js +2 -2
  9. package/components/AdvancedSearch/QueryBuilderDrawer/QueryBuilder/components/OperationSelector.js.map +1 -1
  10. package/components/AdvancedSearch/QueryBuilderDrawer/QueryBuilderDrawer.d.ts +2 -2
  11. package/components/AdvancedSearch/SelectedFilter/SelectedFilter.js +1 -1
  12. package/components/AdvancedSearch/SelectedFilter/SelectedFilter.js.map +1 -1
  13. package/components/AdvancedSearch/domain/Filter.d.ts +1 -1
  14. package/components/AdvancedSearch/domain/FilterRepositoryFactory.d.ts +2 -2
  15. package/components/AdvancedSearch/domain/FilterRepositoryFactory.js.map +1 -1
  16. package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.d.ts +2 -2
  17. package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.js +9 -10
  18. package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.js.map +1 -1
  19. package/components/AdvancedSearch/gateways/filters.gql.d.ts +5 -5
  20. package/components/AdvancedSearch/gateways/filters.gql.js +5 -6
  21. package/components/AdvancedSearch/gateways/filters.gql.js.map +1 -1
  22. package/components/AdvancedSearch/useFilterRepository.js +7 -2
  23. package/components/AdvancedSearch/useFilterRepository.js.map +1 -1
  24. package/components/FolderTree/List/List.js +14 -6
  25. package/components/FolderTree/List/List.js.map +1 -1
  26. package/components/Table/cells/CellAuthor.d.ts +2 -0
  27. package/components/Table/cells/CellAuthor.js +10 -0
  28. package/components/Table/cells/CellAuthor.js.map +1 -0
  29. package/components/Table/cells/CellCreated.d.ts +2 -0
  30. package/components/Table/cells/CellCreated.js +13 -0
  31. package/components/Table/cells/CellCreated.js.map +1 -0
  32. package/components/Table/cells/CellModified.d.ts +2 -0
  33. package/components/Table/cells/CellModified.js +13 -0
  34. package/components/Table/cells/CellModified.js.map +1 -0
  35. package/components/Table/cells/index.d.ts +3 -0
  36. package/components/Table/cells/index.js +3 -0
  37. package/components/Table/components/Table/TableInner.d.ts +2 -2
  38. package/components/Table/createTableData.d.ts +7 -5
  39. package/components/Table/createTableData.js +22 -7
  40. package/components/Table/createTableData.js.map +1 -1
  41. package/components/Table/index.d.ts +2 -2
  42. package/components/Table/index.js +2 -2
  43. package/components/index.d.ts +0 -1
  44. package/components/index.js +0 -1
  45. package/config/AcoConfig.d.ts +8 -12
  46. package/config/advanced-search/FieldRenderer.d.ts +3 -1
  47. package/config/folder/Action.d.ts +1 -1
  48. package/config/folder/index.d.ts +3 -2
  49. package/config/index.d.ts +0 -1
  50. package/config/index.js +0 -1
  51. package/config/record/Action.d.ts +1 -1
  52. package/config/record/index.d.ts +1 -1
  53. package/config/table/Column.d.ts +8 -39
  54. package/config/table/Column.js +4 -67
  55. package/config/table/Column.js.map +1 -1
  56. package/config/table/Sorting.d.ts +2 -11
  57. package/config/table/Sorting.js +1 -28
  58. package/config/table/index.d.ts +5 -9
  59. package/contexts/index.d.ts +0 -3
  60. package/contexts/index.js +0 -3
  61. package/dialogs/DialogSetPermissions/UsersTeamsSelection/ListItemMeta.js +5 -0
  62. package/dialogs/DialogSetPermissions/UsersTeamsSelection/ListItemMeta.js.map +1 -1
  63. package/dialogs/DialogSetPermissions/graphql.d.ts +1 -1
  64. package/dialogs/DialogSetPermissions/graphql.js +1 -2
  65. package/dialogs/DialogSetPermissions/graphql.js.map +1 -1
  66. package/dialogs/useConfirmMoveFolderDialog.d.ts +1 -0
  67. package/dialogs/useConfirmMoveFolderDialog.js +3 -2
  68. package/dialogs/useConfirmMoveFolderDialog.js.map +1 -1
  69. package/dialogs/useCreateDialog.js +5 -9
  70. package/dialogs/useCreateDialog.js.map +1 -1
  71. package/dialogs/useEditDialog.js +2 -2
  72. package/dialogs/useEditDialog.js.map +1 -1
  73. package/dialogs/useSetPermissionsDialog.js +16 -4
  74. package/dialogs/useSetPermissionsDialog.js.map +1 -1
  75. package/domain/folder/Folder.d.ts +2 -1
  76. package/domain/folder/Folder.js.map +1 -1
  77. package/features/folders/cache/FoldersCacheFactory.d.ts +3 -1
  78. package/features/folders/cache/FoldersCacheFactory.js +5 -0
  79. package/features/folders/cache/FoldersCacheFactory.js.map +1 -1
  80. package/features/folders/cache/updateDescendantPermissions.d.ts +12 -0
  81. package/features/folders/cache/updateDescendantPermissions.js +27 -0
  82. package/features/folders/cache/updateDescendantPermissions.js.map +1 -0
  83. package/features/folders/createFolder/CreateFolderGqlGateway.d.ts +3 -3
  84. package/features/folders/createFolder/CreateFolderGqlGateway.js +15 -16
  85. package/features/folders/createFolder/CreateFolderGqlGateway.js.map +1 -1
  86. package/features/folders/deleteFolder/DeleteFolderGqlGateway.d.ts +3 -3
  87. package/features/folders/deleteFolder/DeleteFolderGqlGateway.js +5 -6
  88. package/features/folders/deleteFolder/DeleteFolderGqlGateway.js.map +1 -1
  89. package/features/folders/folderEvents/AddCreatedFolderToCache.d.ts +22 -0
  90. package/features/folders/folderEvents/AddCreatedFolderToCache.js +24 -0
  91. package/features/folders/folderEvents/AddCreatedFolderToCache.js.map +1 -0
  92. package/features/folders/folderEvents/FolderCreatedEvent.d.ts +14 -0
  93. package/features/folders/folderEvents/FolderCreatedEvent.js +13 -0
  94. package/features/folders/folderEvents/FolderCreatedEvent.js.map +1 -0
  95. package/features/folders/folderEvents/FolderDeletedEvent.d.ts +9 -0
  96. package/features/folders/folderEvents/FolderDeletedEvent.js +13 -0
  97. package/features/folders/folderEvents/FolderDeletedEvent.js.map +1 -0
  98. package/features/folders/folderEvents/FolderEvents.test.d.ts +1 -0
  99. package/features/folders/folderEvents/FolderEvents.test.js +238 -0
  100. package/features/folders/folderEvents/FolderEvents.test.js.map +1 -0
  101. package/features/folders/folderEvents/FolderUpdatedEvent.d.ts +12 -0
  102. package/features/folders/folderEvents/FolderUpdatedEvent.js +13 -0
  103. package/features/folders/folderEvents/FolderUpdatedEvent.js.map +1 -0
  104. package/features/folders/folderEvents/FolderWebsocketMessages.d.ts +15 -0
  105. package/features/folders/folderEvents/FolderWebsocketMessages.js +48 -0
  106. package/features/folders/folderEvents/FolderWebsocketMessages.js.map +1 -0
  107. package/features/folders/folderEvents/RefreshUpdatedFolderInCache.d.ts +19 -0
  108. package/features/folders/folderEvents/RefreshUpdatedFolderInCache.js +27 -0
  109. package/features/folders/folderEvents/RefreshUpdatedFolderInCache.js.map +1 -0
  110. package/features/folders/folderEvents/RemoveDeletedFolderFromCache.d.ts +13 -0
  111. package/features/folders/folderEvents/RemoveDeletedFolderFromCache.js +15 -0
  112. package/features/folders/folderEvents/RemoveDeletedFolderFromCache.js.map +1 -0
  113. package/features/folders/folderEvents/abstractions.d.ts +28 -0
  114. package/features/folders/folderEvents/abstractions.js +7 -0
  115. package/features/folders/folderEvents/abstractions.js.map +1 -0
  116. package/features/folders/folderEvents/feature.d.ts +9 -0
  117. package/features/folders/folderEvents/feature.js +21 -0
  118. package/features/folders/folderEvents/feature.js.map +1 -0
  119. package/features/folders/folderEvents/index.d.ts +5 -0
  120. package/features/folders/folderEvents/index.js +5 -0
  121. package/features/folders/folderModelProvider/FolderModelProvider.js +30 -31
  122. package/features/folders/folderModelProvider/FolderModelProvider.js.map +1 -1
  123. package/features/folders/folderModelProvider/GetFolderModelGqlGateway.d.ts +3 -3
  124. package/features/folders/folderModelProvider/GetFolderModelGqlGateway.js +5 -7
  125. package/features/folders/folderModelProvider/GetFolderModelGqlGateway.js.map +1 -1
  126. package/features/folders/getFolder/GetFolderGqlGateway.d.ts +3 -3
  127. package/features/folders/getFolder/GetFolderGqlGateway.js +5 -7
  128. package/features/folders/getFolder/GetFolderGqlGateway.js.map +1 -1
  129. package/features/folders/getFolderExtensionsFields/GetFolderExtensionsFieldsUseCase.d.ts +4 -3
  130. package/features/folders/getFolderExtensionsFields/useFolderExtensionsFields.d.ts +4 -3
  131. package/features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.js +12 -16
  132. package/features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.js.map +1 -1
  133. package/features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.d.ts +3 -3
  134. package/features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.js +5 -5
  135. package/features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.js.map +1 -1
  136. package/features/folders/listFolders/ListFoldersGqlGateway.d.ts +1 -1
  137. package/features/folders/listFolders/ListFoldersGqlGateway.js +1 -2
  138. package/features/folders/listFolders/ListFoldersGqlGateway.js.map +1 -1
  139. package/features/folders/listFolders/useListFolders.d.ts +1 -1
  140. package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.d.ts +3 -3
  141. package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.js +5 -7
  142. package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.js.map +1 -1
  143. package/features/folders/listFoldersByParentIds/useListFoldersByParentIds.d.ts +2 -2
  144. package/features/folders/loadFolderHierarchy/useLoadFolderHierarchy.d.ts +2 -2
  145. package/features/folders/updateFolder/UpdateFolderGqlGateway.d.ts +3 -3
  146. package/features/folders/updateFolder/UpdateFolderGqlGateway.js +6 -7
  147. package/features/folders/updateFolder/UpdateFolderGqlGateway.js.map +1 -1
  148. package/features/folders/updateFolder/decorators/RepositoryWithPermissionsChange.d.ts +1 -4
  149. package/features/folders/updateFolder/decorators/RepositoryWithPermissionsChange.js +3 -30
  150. package/features/folders/updateFolder/decorators/RepositoryWithPermissionsChange.js.map +1 -1
  151. package/features/folders/updateFolder/decorators/{UseCaseWithoutInheritedPermissions.d.ts → UseCaseWithoutReadOnlyPermissions.d.ts} +2 -2
  152. package/features/folders/updateFolder/decorators/{UseCaseWithoutInheritedPermissions.js → UseCaseWithoutReadOnlyPermissions.js} +6 -6
  153. package/features/folders/updateFolder/decorators/UseCaseWithoutReadOnlyPermissions.js.map +1 -0
  154. package/features/folders/updateFolder/feature.js +2 -2
  155. package/features/folders/updateFolder/feature.js.map +1 -1
  156. package/hooks/index.d.ts +0 -6
  157. package/hooks/index.js +0 -6
  158. package/index.d.ts +3 -2
  159. package/index.js +2 -2
  160. package/package.json +23 -29
  161. package/presentation/folderTree/FolderTree.js +13 -5
  162. package/presentation/folderTree/FolderTree.js.map +1 -1
  163. package/presentation/folderTree/FolderTreePresenter.d.ts +5 -1
  164. package/presentation/folderTree/FolderTreePresenter.js +49 -31
  165. package/presentation/folderTree/FolderTreePresenter.js.map +1 -1
  166. package/presentation/folderTree/FolderTreePresenter.test.js +111 -7
  167. package/presentation/folderTree/FolderTreePresenter.test.js.map +1 -1
  168. package/table.types.d.ts +2 -9
  169. package/types.d.ts +5 -26
  170. package/types.js.map +1 -1
  171. package/components/Extensions/Extensions.d.ts +0 -2
  172. package/components/Extensions/Extensions.js +0 -30
  173. package/components/Extensions/Extensions.js.map +0 -1
  174. package/components/Extensions/index.d.ts +0 -1
  175. package/components/Extensions/index.js +0 -1
  176. package/config/folder/createFolderFieldDecoratorFactory.d.ts +0 -13
  177. package/config/folder/createFolderFieldDecoratorFactory.js +0 -17
  178. package/config/folder/createFolderFieldDecoratorFactory.js.map +0 -1
  179. package/config/table/Sorting.js.map +0 -1
  180. package/contexts/acoList.d.ts +0 -49
  181. package/contexts/acoList.js +0 -303
  182. package/contexts/acoList.js.map +0 -1
  183. package/contexts/app.d.ts +0 -33
  184. package/contexts/app.js +0 -47
  185. package/contexts/app.js.map +0 -1
  186. package/contexts/folders.d.ts +0 -12
  187. package/contexts/folders.js +0 -32
  188. package/contexts/folders.js.map +0 -1
  189. package/contexts/navigateFolder.d.ts +0 -17
  190. package/contexts/navigateFolder.js +0 -54
  191. package/contexts/navigateFolder.js.map +0 -1
  192. package/contexts/records.d.ts +0 -31
  193. package/contexts/records.js +0 -316
  194. package/contexts/records.js.map +0 -1
  195. package/exports/admin/aco.d.ts +0 -2
  196. package/exports/admin/aco.js +0 -2
  197. package/features/folders/updateFolder/decorators/UseCaseWithoutInheritedPermissions.js.map +0 -1
  198. package/graphql/app.gql.d.ts +0 -17
  199. package/graphql/app.gql.js +0 -22
  200. package/graphql/app.gql.js.map +0 -1
  201. package/graphql/records/common.d.ts +0 -4
  202. package/graphql/records/common.js +0 -57
  203. package/graphql/records/common.js.map +0 -1
  204. package/graphql/records/getRecord.d.ts +0 -2
  205. package/graphql/records/getRecord.js +0 -5
  206. package/graphql/records/getRecord.js.map +0 -1
  207. package/graphql/records/listRecords.d.ts +0 -2
  208. package/graphql/records/listRecords.js +0 -26
  209. package/graphql/records/listRecords.js.map +0 -1
  210. package/graphql/records/moveRecord.d.ts +0 -2
  211. package/graphql/records/moveRecord.js +0 -16
  212. package/graphql/records/moveRecord.js.map +0 -1
  213. package/graphql/records/types.d.ts +0 -108
  214. package/graphql/records/types.js +0 -0
  215. package/graphql/records.gql.d.ts +0 -3
  216. package/graphql/records.gql.js +0 -3
  217. package/handlers.d.ts +0 -23
  218. package/handlers.js +0 -22
  219. package/handlers.js.map +0 -1
  220. package/hooks/useAcoApp.d.ts +0 -2
  221. package/hooks/useAcoApp.js +0 -16
  222. package/hooks/useAcoApp.js.map +0 -1
  223. package/hooks/useAcoList.d.ts +0 -3
  224. package/hooks/useAcoList.js +0 -10
  225. package/hooks/useAcoList.js.map +0 -1
  226. package/hooks/useFolderModel.d.ts +0 -2
  227. package/hooks/useFolderModel.js +0 -16
  228. package/hooks/useFolderModel.js.map +0 -1
  229. package/hooks/useFoldersType.d.ts +0 -1
  230. package/hooks/useFoldersType.js +0 -12
  231. package/hooks/useFoldersType.js.map +0 -1
  232. package/hooks/useNavigateFolder.d.ts +0 -2
  233. package/hooks/useNavigateFolder.js +0 -10
  234. package/hooks/useNavigateFolder.js.map +0 -1
  235. package/hooks/useRecords.d.ts +0 -62
  236. package/hooks/useRecords.js +0 -64
  237. package/hooks/useRecords.js.map +0 -1
  238. package/hooks/useTags.d.ts +0 -14
  239. package/hooks/useTags.js +0 -27
  240. package/hooks/useTags.js.map +0 -1
  241. package/sorting.d.ts +0 -9
  242. package/sorting.js +0 -31
  243. package/sorting.js.map +0 -1
@@ -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 plugin\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;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA4Bd,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,16 @@ 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
+ disabled?: boolean;
20
21
  predefinedValues?: import("@webiny/app-headless-cms-common/types/index.js").CmsEditorFieldPredefinedValues;
21
22
  settings?: import("@webiny/app-headless-cms-common/types/model.js").CmsModelFieldSettings<unknown> | undefined;
22
23
  renderer: {
23
24
  name: string;
24
25
  settings?: Record<string, any>;
25
- } | import("@webiny/app-headless-cms-common/types/index.js").CmsModelFieldRendererPlugin["renderer"]["render"];
26
+ };
26
27
  tags?: string[];
27
28
  rules?: import("@webiny/app-headless-cms-common/types/model.js").FieldRule[];
28
29
  }[]>;
@@ -9,15 +9,16 @@ 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
+ disabled?: boolean;
15
16
  predefinedValues?: import("@webiny/app-headless-cms-common/types/index.js").CmsEditorFieldPredefinedValues;
16
17
  settings?: import("@webiny/app-headless-cms-common/types/model.js").CmsModelFieldSettings<unknown> | undefined;
17
18
  renderer: {
18
19
  name: string;
19
20
  settings?: Record<string, any>;
20
- } | import("@webiny/app-headless-cms-common/types/index.js").CmsModelFieldRendererPlugin["renderer"]["render"];
21
+ };
21
22
  tags?: string[];
22
23
  rules?: import("@webiny/app-headless-cms-common/types/model.js").FieldRule[];
23
24
  }[];
@@ -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 };
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.js","sources":["../../../../../src/features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.ts"],"sourcesContent":["import type { FolderPermissionName } from \"~/features/folders/abstractions.js\";\nimport { FoldersCache } from \"~/features/folders/abstractions.js\";\nimport { GetFolderLevelPermissionUseCase as UseCaseAbstraction } from \"../abstractions.js\";\nimport { WcpService } from \"@webiny/app-admin/features/wcp/abstractions.js\";\n\nclass GetFolderLevelPermissionWithFlpDecoratorImpl implements UseCaseAbstraction.Interface {\n constructor(\n private cache: FoldersCache.Interface,\n private wcp: WcpService.Interface,\n private decoratee: UseCaseAbstraction.Interface\n ) {}\n\n execute(id: string, permissionName: FolderPermissionName) {\n // Check if WCP allows folder-level permissions feature\n if (!this.wcp.getProject().canUseFolderLevelPermissions()) {\n return this.decoratee.execute(id, permissionName);\n }\n\n // Check the permissions\n const folder = this.cache.getItem(folder => folder.id === id);\n\n if (!folder) {\n return false;\n }\n\n return folder[permissionName] ?? false;\n }\n}\n\nexport const GetFolderLevelPermissionWithFlpDecorator = UseCaseAbstraction.createDecorator({\n decorator: GetFolderLevelPermissionWithFlpDecoratorImpl,\n dependencies: [FoldersCache, WcpService]\n});\n"],"names":["GetFolderLevelPermissionWithFlpDecoratorImpl","cache","wcp","decoratee","id","permissionName","folder","GetFolderLevelPermissionWithFlpDecorator","UseCaseAbstraction","FoldersCache","WcpService"],"mappings":";;;AAKA,MAAMA;IACF,YACYC,KAA6B,EAC7BC,GAAyB,EACzBC,SAAuC,CACjD;aAHUF,KAAK,GAALA;aACAC,GAAG,GAAHA;aACAC,SAAS,GAATA;IACT;IAEH,QAAQC,EAAU,EAAEC,cAAoC,EAAE;QAEtD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,4BAA4B,IACnD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACD,IAAIC;QAItC,MAAMC,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAACA,CAAAA,SAAUA,OAAO,EAAE,KAAKF;QAE1D,IAAI,CAACE,QACD,OAAO;QAGX,OAAOA,MAAM,CAACD,eAAe,IAAI;IACrC;AACJ;AAEO,MAAME,2CAA2CC,gCAAAA,eAAkC,CAAC;IACvF,WAAWR;IACX,cAAc;QAACS;QAAcC;KAAW;AAC5C"}
1
+ {"version":3,"file":"features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.js","sources":["../../../../../src/features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.ts"],"sourcesContent":["import type { FolderPermissionName } from \"~/features/folders/abstractions.js\";\nimport { FoldersCache } from \"~/features/folders/abstractions.js\";\nimport { GetFolderLevelPermissionUseCase as UseCaseAbstraction } from \"../abstractions.js\";\nimport { FeatureFlagsService } from \"@webiny/app-admin/features/featureFlags/abstractions.js\";\n\nclass GetFolderLevelPermissionWithFlpDecoratorImpl implements UseCaseAbstraction.Interface {\n constructor(\n private cache: FoldersCache.Interface,\n private featureFlagsService: FeatureFlagsService.Interface,\n private decoratee: UseCaseAbstraction.Interface\n ) {}\n\n execute(id: string, permissionName: FolderPermissionName) {\n if (\n !this.featureFlagsService\n .getFlags()\n .isEnabled(\"advancedAccessControlLayer.folderLevelPermissions\")\n ) {\n return this.decoratee.execute(id, permissionName);\n }\n\n // Check the permissions\n const folder = this.cache.getItem(folder => folder.id === id);\n\n if (!folder) {\n return false;\n }\n\n return folder[permissionName] ?? false;\n }\n}\n\nexport const GetFolderLevelPermissionWithFlpDecorator = UseCaseAbstraction.createDecorator({\n decorator: GetFolderLevelPermissionWithFlpDecoratorImpl,\n dependencies: [FoldersCache, FeatureFlagsService]\n});\n"],"names":["GetFolderLevelPermissionWithFlpDecoratorImpl","cache","featureFlagsService","decoratee","id","permissionName","folder","GetFolderLevelPermissionWithFlpDecorator","UseCaseAbstraction","FoldersCache","FeatureFlagsService"],"mappings":";;;AAKA,MAAMA;IACF,YACYC,KAA6B,EAC7BC,mBAAkD,EAClDC,SAAuC,CACjD;aAHUF,KAAK,GAALA;aACAC,mBAAmB,GAAnBA;aACAC,SAAS,GAATA;IACT;IAEH,QAAQC,EAAU,EAAEC,cAAoC,EAAE;QACtD,IACI,CAAC,IAAI,CAAC,mBAAmB,CACpB,QAAQ,GACR,SAAS,CAAC,sDAEf,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACD,IAAIC;QAItC,MAAMC,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAACA,CAAAA,SAAUA,OAAO,EAAE,KAAKF;QAE1D,IAAI,CAACE,QACD,OAAO;QAGX,OAAOA,MAAM,CAACD,eAAe,IAAI;IACrC;AACJ;AAEO,MAAME,2CAA2CC,gCAAAA,eAAkC,CAAC;IACvF,WAAWR;IACX,cAAc;QAACS;QAAcC;KAAoB;AACrD"}
@@ -17,7 +17,7 @@ export interface ListFoldersQueryVariables {
17
17
  sort?: Record<string, any>;
18
18
  after?: string | null;
19
19
  }
20
- export declare const LIST_FOLDERS: (FOLDER_FIELDS: string) => import("graphql").DocumentNode;
20
+ export declare const LIST_FOLDERS: (FOLDER_FIELDS: string) => string;
21
21
  declare class ListFoldersGqlGatewayImpl implements GatewayAbstraction.Interface {
22
22
  private client;
23
23
  private folderModelProvider;
@@ -1,9 +1,8 @@
1
- import graphql_tag from "graphql-tag";
2
1
  import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
3
2
  import { RootFolder } from "../../../domain/folder/RootFolder.js";
4
3
  import { FolderModelProvider } from "../abstractions.js";
5
4
  import { ListFoldersGateway } from "./abstractions.js";
6
- const LIST_FOLDERS = (FOLDER_FIELDS)=>graphql_tag`
5
+ const LIST_FOLDERS = (FOLDER_FIELDS)=>`
7
6
  query ListFolders($type: String!, $limit: Int!) {
8
7
  aco {
9
8
  listFolders(where: { type: $type }, limit: $limit) {
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/listFolders/ListFoldersGqlGateway.js","sources":["../../../../src/features/folders/listFolders/ListFoldersGqlGateway.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { RootFolder } from \"~/domain/folder/RootFolder.js\";\nimport { FolderModelProvider } from \"~/features/folders/abstractions.js\";\nimport { ListFoldersGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface ListFoldersResponse {\n aco: {\n listFolders: {\n data: FolderDto[] | null;\n error: AcoError | null;\n };\n };\n}\n\nexport interface ListFoldersQueryVariables {\n type: string;\n limit: number;\n sort?: Record<string, any>;\n after?: string | null;\n}\n\nexport const LIST_FOLDERS = (FOLDER_FIELDS: string) => gql`\n query ListFolders($type: String!, $limit: Int!) {\n aco {\n listFolders(where: { type: $type }, limit: $limit) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass ListFoldersGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: MainGraphQLClient.Interface,\n private folderModelProvider: FolderModelProvider.Interface\n ) {}\n\n async execute(type: string) {\n const fields = await this.folderModelProvider.getGraphQLSelection();\n\n const response = await this.client.execute<ListFoldersResponse, ListFoldersQueryVariables>({\n query: LIST_FOLDERS(fields),\n variables: {\n type,\n limit: 10000\n }\n });\n\n const { data, error } = response.aco.listFolders;\n\n if (!data) {\n throw new Error(error?.message || \"Could not fetch folders\");\n }\n\n return [RootFolder.create(), ...(data || [])];\n }\n}\n\nexport const ListFoldersGqlGateway = GatewayAbstraction.createImplementation({\n implementation: ListFoldersGqlGatewayImpl,\n dependencies: [MainGraphQLClient, FolderModelProvider]\n});\n"],"names":["LIST_FOLDERS","FOLDER_FIELDS","gql","ListFoldersGqlGatewayImpl","client","folderModelProvider","type","fields","response","data","error","Error","RootFolder","ListFoldersGqlGateway","GatewayAbstraction","MainGraphQLClient","FolderModelProvider"],"mappings":";;;;;AAwBO,MAAMA,eAAe,CAACC,gBAA0BC,WAAG,CAAC;;;;qBAItC,EAAED,cAAc;;;;;;;;;AASrC,CAAC;AAED,MAAME;IACF,YACYC,MAAmC,EACnCC,mBAAkD,CAC5D;aAFUD,MAAM,GAANA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQC,IAAY,EAAE;QACxB,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,mBAAmB;QAEjE,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAiD;YACvF,OAAOR,aAAaO;YACpB,WAAW;gBACPD;gBACA,OAAO;YACX;QACJ;QAEA,MAAM,EAAEG,IAAI,EAAEC,KAAK,EAAE,GAAGF,SAAS,GAAG,CAAC,WAAW;QAEhD,IAAI,CAACC,MACD,MAAM,IAAIE,MAAMD,OAAO,WAAW;QAGtC,OAAO;YAACE,WAAW,MAAM;eAAQH,QAAQ,EAAE;SAAE;IACjD;AACJ;AAEO,MAAMI,wBAAwBC,mBAAAA,oBAAuC,CAAC;IACzE,gBAAgBX;IAChB,cAAc;QAACY;QAAmBC;KAAoB;AAC1D"}
1
+ {"version":3,"file":"features/folders/listFolders/ListFoldersGqlGateway.js","sources":["../../../../src/features/folders/listFolders/ListFoldersGqlGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { RootFolder } from \"~/domain/folder/RootFolder.js\";\nimport { FolderModelProvider } from \"~/features/folders/abstractions.js\";\nimport { ListFoldersGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface ListFoldersResponse {\n aco: {\n listFolders: {\n data: FolderDto[] | null;\n error: AcoError | null;\n };\n };\n}\n\nexport interface ListFoldersQueryVariables {\n type: string;\n limit: number;\n sort?: Record<string, any>;\n after?: string | null;\n}\n\nexport const LIST_FOLDERS = (FOLDER_FIELDS: string) => /* GraphQL */ `\n query ListFolders($type: String!, $limit: Int!) {\n aco {\n listFolders(where: { type: $type }, limit: $limit) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass ListFoldersGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: MainGraphQLClient.Interface,\n private folderModelProvider: FolderModelProvider.Interface\n ) {}\n\n async execute(type: string) {\n const fields = await this.folderModelProvider.getGraphQLSelection();\n\n const response = await this.client.execute<ListFoldersResponse, ListFoldersQueryVariables>({\n query: LIST_FOLDERS(fields),\n variables: {\n type,\n limit: 10000\n }\n });\n\n const { data, error } = response.aco.listFolders;\n\n if (!data) {\n throw new Error(error?.message || \"Could not fetch folders\");\n }\n\n return [RootFolder.create(), ...(data || [])];\n }\n}\n\nexport const ListFoldersGqlGateway = GatewayAbstraction.createImplementation({\n implementation: ListFoldersGqlGatewayImpl,\n dependencies: [MainGraphQLClient, FolderModelProvider]\n});\n"],"names":["LIST_FOLDERS","FOLDER_FIELDS","ListFoldersGqlGatewayImpl","client","folderModelProvider","type","fields","response","data","error","Error","RootFolder","ListFoldersGqlGateway","GatewayAbstraction","MainGraphQLClient","FolderModelProvider"],"mappings":";;;;AAuBO,MAAMA,eAAe,CAACC,gBAAwC,CAAC;;;;qBAIjD,EAAEA,cAAc;;;;;;;;;AASrC,CAAC;AAED,MAAMC;IACF,YACYC,MAAmC,EACnCC,mBAAkD,CAC5D;aAFUD,MAAM,GAANA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQC,IAAY,EAAE;QACxB,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,mBAAmB;QAEjE,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAiD;YACvF,OAAOP,aAAaM;YACpB,WAAW;gBACPD;gBACA,OAAO;YACX;QACJ;QAEA,MAAM,EAAEG,IAAI,EAAEC,KAAK,EAAE,GAAGF,SAAS,GAAG,CAAC,WAAW;QAEhD,IAAI,CAACC,MACD,MAAM,IAAIE,MAAMD,OAAO,WAAW;QAGtC,OAAO;YAACE,WAAW,MAAM;eAAQH,QAAQ,EAAE;SAAE;IACjD;AACJ;AAEO,MAAMI,wBAAwBC,mBAAAA,oBAAuC,CAAC;IACzE,gBAAgBX;IAChB,cAAc;QAACY;QAAmBC;KAAoB;AAC1D"}
@@ -1,6 +1,6 @@
1
1
  import type { FolderDto } from "../../../domain/folder/FolderDto.js";
2
2
  export declare const useListFolders: () => {
3
- listFolders: () => Promise<void>;
4
3
  folders: FolderDto[];
5
4
  loading: Record<string, boolean>;
5
+ listFolders: () => Promise<void>;
6
6
  };
@@ -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 { ListFoldersByParentIdsGateway as GatewayAbstraction } from "./abstractions.js";
@@ -18,11 +18,11 @@ export interface ListFoldersByParentIdsQueryVariables {
18
18
  sort?: Record<string, any>;
19
19
  after?: string | null;
20
20
  }
21
- export declare const LIST_FOLDERS_BY_PARENT_IDS: (FOLDER_FIELDS: string) => import("graphql").DocumentNode;
21
+ export declare const LIST_FOLDERS_BY_PARENT_IDS: (FOLDER_FIELDS: string) => string;
22
22
  declare class ListFoldersByParentIdsGqlGatewayImpl implements GatewayAbstraction.Interface {
23
23
  private client;
24
24
  private folderModelProvider;
25
- constructor(client: ApolloClient.Interface, folderModelProvider: FolderModelProvider.Interface);
25
+ constructor(client: MainGraphQLClient.Interface, folderModelProvider: FolderModelProvider.Interface);
26
26
  execute(type: string, parentIds: string[]): Promise<FolderDto[]>;
27
27
  }
28
28
  export declare const ListFoldersByParentIdsGqlGateway: typeof ListFoldersByParentIdsGqlGatewayImpl & {
@@ -1,9 +1,8 @@
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 { RootFolder } from "../../../domain/folder/RootFolder.js";
4
3
  import { FolderModelProvider } from "../abstractions.js";
5
4
  import { ListFoldersByParentIdsGateway } from "./abstractions.js";
6
- const LIST_FOLDERS_BY_PARENT_IDS = (FOLDER_FIELDS)=>graphql_tag`
5
+ const LIST_FOLDERS_BY_PARENT_IDS = (FOLDER_FIELDS)=>`
7
6
  query ListFoldersByParentIds($type: String!, $parentIds_in: [ID!]!, $limit: Int!) {
8
7
  aco {
9
8
  listFolders(where: { type: $type, parentId_in: $parentIds_in }, limit: $limit) {
@@ -24,14 +23,13 @@ class ListFoldersByParentIdsGqlGatewayImpl {
24
23
  }
25
24
  async execute(type, parentIds) {
26
25
  const fields = await this.folderModelProvider.getGraphQLSelection();
27
- const { data: response } = await this.client.query({
26
+ const response = await this.client.execute({
28
27
  query: LIST_FOLDERS_BY_PARENT_IDS(fields),
29
28
  variables: {
30
29
  type,
31
30
  parentIds_in: parentIds,
32
31
  limit: 10000
33
- },
34
- fetchPolicy: "network-only"
32
+ }
35
33
  });
36
34
  if (!response) throw new Error("Network error while listing folders.");
37
35
  const { data, error } = response.aco.listFolders;
@@ -45,7 +43,7 @@ class ListFoldersByParentIdsGqlGatewayImpl {
45
43
  const ListFoldersByParentIdsGqlGateway = ListFoldersByParentIdsGateway.createImplementation({
46
44
  implementation: ListFoldersByParentIdsGqlGatewayImpl,
47
45
  dependencies: [
48
- ApolloClient,
46
+ MainGraphQLClient,
49
47
  FolderModelProvider
50
48
  ]
51
49
  });
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.js","sources":["../../../../src/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.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 { RootFolder } from \"~/domain/folder/RootFolder.js\";\nimport { FolderModelProvider } from \"~/features/folders/abstractions.js\";\nimport { ListFoldersByParentIdsGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface ListFoldersByParentIdsResponse {\n aco: {\n listFolders: {\n data: FolderDto[] | null;\n error: AcoError | null;\n };\n };\n}\n\nexport interface ListFoldersByParentIdsQueryVariables {\n type: string;\n parentIds_in: string[];\n limit: number;\n sort?: Record<string, any>;\n after?: string | null;\n}\n\nexport const LIST_FOLDERS_BY_PARENT_IDS = (FOLDER_FIELDS: string) => gql`\n query ListFoldersByParentIds($type: String!, $parentIds_in: [ID!]!, $limit: Int!) {\n aco {\n listFolders(where: { type: $type, parentId_in: $parentIds_in }, limit: $limit) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass ListFoldersByParentIdsGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: ApolloClient.Interface,\n private folderModelProvider: FolderModelProvider.Interface\n ) {}\n\n async execute(type: string, parentIds: string[]) {\n const fields = await this.folderModelProvider.getGraphQLSelection();\n\n const { data: response } = await this.client.query<\n ListFoldersByParentIdsResponse,\n ListFoldersByParentIdsQueryVariables\n >({\n query: LIST_FOLDERS_BY_PARENT_IDS(fields),\n variables: {\n type,\n parentIds_in: parentIds,\n limit: 10000\n },\n fetchPolicy: \"network-only\"\n });\n\n if (!response) {\n throw new Error(\"Network error while listing folders.\");\n }\n\n const { data, error } = response.aco.listFolders;\n\n if (!data) {\n throw new Error(error?.message || \"Could not fetch folders\");\n }\n\n return [RootFolder.create(), ...(data || [])];\n }\n}\n\nexport const ListFoldersByParentIdsGqlGateway = GatewayAbstraction.createImplementation({\n implementation: ListFoldersByParentIdsGqlGatewayImpl,\n dependencies: [ApolloClient, FolderModelProvider]\n});\n"],"names":["LIST_FOLDERS_BY_PARENT_IDS","FOLDER_FIELDS","gql","ListFoldersByParentIdsGqlGatewayImpl","client","folderModelProvider","type","parentIds","fields","response","Error","data","error","RootFolder","ListFoldersByParentIdsGqlGateway","GatewayAbstraction","ApolloClient","FolderModelProvider"],"mappings":";;;;;AAyBO,MAAMA,6BAA6B,CAACC,gBAA0BC,WAAG,CAAC;;;;qBAIpD,EAAED,cAAc;;;;;;;;;AASrC,CAAC;AAED,MAAME;IACF,YACYC,MAA8B,EAC9BC,mBAAkD,CAC5D;aAFUD,MAAM,GAANA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQC,IAAY,EAAEC,SAAmB,EAAE;QAC7C,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,mBAAmB;QAEjE,MAAM,EAAE,MAAMC,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAGhD;YACE,OAAOT,2BAA2BQ;YAClC,WAAW;gBACPF;gBACA,cAAcC;gBACd,OAAO;YACX;YACA,aAAa;QACjB;QAEA,IAAI,CAACE,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,WAAW;QAEhD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;QAGtC,OAAO;YAACC,WAAW,MAAM;eAAQF,QAAQ,EAAE;SAAE;IACjD;AACJ;AAEO,MAAMG,mCAAmCC,8BAAAA,oBAAuC,CAAC;IACpF,gBAAgBZ;IAChB,cAAc;QAACa;QAAcC;KAAoB;AACrD"}
1
+ {"version":3,"file":"features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.js","sources":["../../../../src/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { RootFolder } from \"~/domain/folder/RootFolder.js\";\nimport { FolderModelProvider } from \"~/features/folders/abstractions.js\";\nimport { ListFoldersByParentIdsGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface ListFoldersByParentIdsResponse {\n aco: {\n listFolders: {\n data: FolderDto[] | null;\n error: AcoError | null;\n };\n };\n}\n\nexport interface ListFoldersByParentIdsQueryVariables {\n type: string;\n parentIds_in: string[];\n limit: number;\n sort?: Record<string, any>;\n after?: string | null;\n}\n\nexport const LIST_FOLDERS_BY_PARENT_IDS = (FOLDER_FIELDS: string) => /* GraphQL */ `\n query ListFoldersByParentIds($type: String!, $parentIds_in: [ID!]!, $limit: Int!) {\n aco {\n listFolders(where: { type: $type, parentId_in: $parentIds_in }, limit: $limit) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass ListFoldersByParentIdsGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: MainGraphQLClient.Interface,\n private folderModelProvider: FolderModelProvider.Interface\n ) {}\n\n async execute(type: string, parentIds: string[]) {\n const fields = await this.folderModelProvider.getGraphQLSelection();\n\n const response = await this.client.execute<\n ListFoldersByParentIdsResponse,\n ListFoldersByParentIdsQueryVariables\n >({\n query: LIST_FOLDERS_BY_PARENT_IDS(fields),\n variables: {\n type,\n parentIds_in: parentIds,\n limit: 10000\n }\n });\n\n if (!response) {\n throw new Error(\"Network error while listing folders.\");\n }\n\n const { data, error } = response.aco.listFolders;\n\n if (!data) {\n throw new Error(error?.message || \"Could not fetch folders\");\n }\n\n return [RootFolder.create(), ...(data || [])];\n }\n}\n\nexport const ListFoldersByParentIdsGqlGateway = GatewayAbstraction.createImplementation({\n implementation: ListFoldersByParentIdsGqlGatewayImpl,\n dependencies: [MainGraphQLClient, FolderModelProvider]\n});\n"],"names":["LIST_FOLDERS_BY_PARENT_IDS","FOLDER_FIELDS","ListFoldersByParentIdsGqlGatewayImpl","client","folderModelProvider","type","parentIds","fields","response","Error","data","error","RootFolder","ListFoldersByParentIdsGqlGateway","GatewayAbstraction","MainGraphQLClient","FolderModelProvider"],"mappings":";;;;AAwBO,MAAMA,6BAA6B,CAACC,gBAAwC,CAAC;;;;qBAI/D,EAAEA,cAAc;;;;;;;;;AASrC,CAAC;AAED,MAAMC;IACF,YACYC,MAAmC,EACnCC,mBAAkD,CAC5D;aAFUD,MAAM,GAANA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQC,IAAY,EAAEC,SAAmB,EAAE;QAC7C,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,mBAAmB;QAEjE,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAGxC;YACE,OAAOR,2BAA2BO;YAClC,WAAW;gBACPF;gBACA,cAAcC;gBACd,OAAO;YACX;QACJ;QAEA,IAAI,CAACE,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,WAAW;QAEhD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;QAGtC,OAAO;YAACC,WAAW,MAAM;eAAQF,QAAQ,EAAE;SAAE;IACjD;AACJ;AAEO,MAAMG,mCAAmCC,8BAAAA,oBAAuC,CAAC;IACpF,gBAAgBZ;IAChB,cAAc;QAACa;QAAmBC;KAAoB;AAC1D"}
@@ -1,7 +1,7 @@
1
1
  import type { FolderDto } from "../../../domain/folder/FolderDto.js";
2
2
  export declare const useListFoldersByParentIds: () => {
3
- listFoldersByParentIds: (parentIds?: string[]) => Promise<void>;
4
- getIsFolderLoading: (action?: string) => boolean;
5
3
  folders: FolderDto[];
6
4
  loading: string[];
5
+ listFoldersByParentIds: (parentIds?: string[]) => Promise<void>;
6
+ getIsFolderLoading: (action?: string) => boolean;
7
7
  };
@@ -1,7 +1,7 @@
1
1
  import type { FolderDto } from "../../../domain/folder/FolderDto.js";
2
2
  export declare const useLoadFolderHierarchy: () => {
3
- getIsFolderLoading: (action?: string) => boolean;
4
- loadFolderHierarchy: (id: string) => Promise<void>;
5
3
  folders: FolderDto[];
6
4
  loading: Record<string, boolean>;
5
+ getIsFolderLoading: (action?: string) => boolean;
6
+ loadFolderHierarchy: (id: string) => Promise<void>;
7
7
  };
@@ -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";
@@ -16,11 +16,11 @@ export interface UpdateFolderVariables {
16
16
  id: string;
17
17
  data: Partial<Omit<FolderDto, "id" | "createdOn" | "createdBy" | "savedOn" | "savedBy" | "modifiedOn" | "modifiedBy">>;
18
18
  }
19
- export declare const UPDATE_FOLDER: (FOLDER_FIELDS: string) => import("graphql").DocumentNode;
19
+ export declare const UPDATE_FOLDER: (FOLDER_FIELDS: string) => string;
20
20
  declare class UpdateFolderGqlGatewayImpl implements GatewayAbstraction.Interface {
21
21
  private client;
22
22
  private folderModelProvider;
23
- constructor(client: ApolloClient.Interface, folderModelProvider: FolderModelProvider.Interface);
23
+ constructor(client: MainGraphQLClient.Interface, folderModelProvider: FolderModelProvider.Interface);
24
24
  execute(folder: FolderGatewayDto): Promise<FolderDto>;
25
25
  }
26
26
  export declare const UpdateFolderGqlGateway: typeof UpdateFolderGqlGatewayImpl & {
@@ -1,9 +1,8 @@
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 { UpdateFolderGateway } from "./abstractions.js";
5
4
  import { ROOT_FOLDER } from "../../../constants.js";
6
- const UPDATE_FOLDER = (FOLDER_FIELDS)=>graphql_tag`
5
+ const UPDATE_FOLDER = (FOLDER_FIELDS)=>`
7
6
  mutation UpdateFolder($id: ID!, $data: FolderUpdateInput!) {
8
7
  aco {
9
8
  updateFolder(id: $id, data: $data) {
@@ -25,8 +24,8 @@ class UpdateFolderGqlGatewayImpl {
25
24
  async execute(folder) {
26
25
  const fields = await this.folderModelProvider.getGraphQLSelection();
27
26
  const { id, title, slug, permissions, parentId, extensions } = folder;
28
- const { data: response } = await this.client.mutate({
29
- mutation: UPDATE_FOLDER(fields),
27
+ const response = await this.client.execute({
28
+ query: UPDATE_FOLDER(fields),
30
29
  variables: {
31
30
  id,
32
31
  data: {
@@ -34,7 +33,7 @@ class UpdateFolderGqlGatewayImpl {
34
33
  slug,
35
34
  extensions,
36
35
  parentId: parentId === ROOT_FOLDER ? null : parentId,
37
- permissions: permissions.filter((p)=>!p.inheritedFrom)
36
+ permissions: permissions.filter((p)=>!p.inheritedFrom && !p.plugin)
38
37
  }
39
38
  }
40
39
  });
@@ -47,7 +46,7 @@ class UpdateFolderGqlGatewayImpl {
47
46
  const UpdateFolderGqlGateway = UpdateFolderGateway.createImplementation({
48
47
  implementation: UpdateFolderGqlGatewayImpl,
49
48
  dependencies: [
50
- ApolloClient,
49
+ MainGraphQLClient,
51
50
  FolderModelProvider
52
51
  ]
53
52
  });