@webiny/app-aco 6.4.12-beta.5 → 6.5.0-beta.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 (180) 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/QueryBuilder/components/OperationSelector.js +1 -1
  5. package/components/AdvancedSearch/QueryBuilderDrawer/QueryBuilder/components/OperationSelector.js.map +1 -1
  6. package/components/AdvancedSearch/QueryBuilderDrawer/QueryBuilderDrawer.d.ts +2 -2
  7. package/components/AdvancedSearch/domain/Filter.d.ts +1 -1
  8. package/components/AdvancedSearch/domain/FilterRepositoryFactory.d.ts +2 -2
  9. package/components/AdvancedSearch/domain/FilterRepositoryFactory.js.map +1 -1
  10. package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.d.ts +2 -2
  11. package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.js +9 -10
  12. package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.js.map +1 -1
  13. package/components/AdvancedSearch/gateways/filters.gql.d.ts +5 -5
  14. package/components/AdvancedSearch/gateways/filters.gql.js +5 -6
  15. package/components/AdvancedSearch/gateways/filters.gql.js.map +1 -1
  16. package/components/AdvancedSearch/useFilterRepository.js +7 -2
  17. package/components/AdvancedSearch/useFilterRepository.js.map +1 -1
  18. package/components/FolderTree/List/List.js +1 -1
  19. package/components/FolderTree/List/List.js.map +1 -1
  20. package/components/Table/cells/CellAuthor.d.ts +2 -0
  21. package/components/Table/cells/CellAuthor.js +10 -0
  22. package/components/Table/cells/CellAuthor.js.map +1 -0
  23. package/components/Table/cells/CellCreated.d.ts +2 -0
  24. package/components/Table/cells/CellCreated.js +13 -0
  25. package/components/Table/cells/CellCreated.js.map +1 -0
  26. package/components/Table/cells/CellModified.d.ts +2 -0
  27. package/components/Table/cells/CellModified.js +13 -0
  28. package/components/Table/cells/CellModified.js.map +1 -0
  29. package/components/Table/cells/index.d.ts +3 -0
  30. package/components/Table/cells/index.js +3 -0
  31. package/components/Table/components/Table/TableInner.d.ts +2 -2
  32. package/components/Table/createTableData.d.ts +7 -5
  33. package/components/Table/createTableData.js +22 -7
  34. package/components/Table/createTableData.js.map +1 -1
  35. package/components/Table/index.d.ts +2 -2
  36. package/components/Table/index.js +2 -2
  37. package/components/index.d.ts +0 -1
  38. package/components/index.js +0 -1
  39. package/config/AcoConfig.d.ts +8 -12
  40. package/config/advanced-search/FieldRenderer.d.ts +3 -1
  41. package/config/folder/Action.d.ts +1 -1
  42. package/config/folder/index.d.ts +3 -2
  43. package/config/index.d.ts +0 -1
  44. package/config/index.js +0 -1
  45. package/config/record/Action.d.ts +1 -1
  46. package/config/record/index.d.ts +1 -1
  47. package/config/table/Column.d.ts +8 -39
  48. package/config/table/Column.js +4 -67
  49. package/config/table/Column.js.map +1 -1
  50. package/config/table/Sorting.d.ts +2 -11
  51. package/config/table/Sorting.js +1 -28
  52. package/config/table/index.d.ts +5 -9
  53. package/contexts/index.d.ts +0 -3
  54. package/contexts/index.js +0 -3
  55. package/dialogs/DialogSetPermissions/graphql.d.ts +1 -1
  56. package/dialogs/DialogSetPermissions/graphql.js +1 -2
  57. package/dialogs/DialogSetPermissions/graphql.js.map +1 -1
  58. package/dialogs/useCreateDialog.js +2 -2
  59. package/dialogs/useCreateDialog.js.map +1 -1
  60. package/dialogs/useEditDialog.js +2 -2
  61. package/dialogs/useEditDialog.js.map +1 -1
  62. package/dialogs/useSetPermissionsDialog.js +16 -4
  63. package/dialogs/useSetPermissionsDialog.js.map +1 -1
  64. package/domain/folder/Folder.d.ts +2 -1
  65. package/domain/folder/Folder.js.map +1 -1
  66. package/features/folders/createFolder/CreateFolderGqlGateway.d.ts +3 -3
  67. package/features/folders/createFolder/CreateFolderGqlGateway.js +15 -16
  68. package/features/folders/createFolder/CreateFolderGqlGateway.js.map +1 -1
  69. package/features/folders/deleteFolder/DeleteFolderGqlGateway.d.ts +3 -3
  70. package/features/folders/deleteFolder/DeleteFolderGqlGateway.js +5 -6
  71. package/features/folders/deleteFolder/DeleteFolderGqlGateway.js.map +1 -1
  72. package/features/folders/folderModelProvider/FolderModelProvider.js +29 -31
  73. package/features/folders/folderModelProvider/FolderModelProvider.js.map +1 -1
  74. package/features/folders/folderModelProvider/GetFolderModelGqlGateway.d.ts +3 -3
  75. package/features/folders/folderModelProvider/GetFolderModelGqlGateway.js +5 -7
  76. package/features/folders/folderModelProvider/GetFolderModelGqlGateway.js.map +1 -1
  77. package/features/folders/getFolder/GetFolderGqlGateway.d.ts +3 -3
  78. package/features/folders/getFolder/GetFolderGqlGateway.js +5 -7
  79. package/features/folders/getFolder/GetFolderGqlGateway.js.map +1 -1
  80. package/features/folders/getFolderExtensionsFields/GetFolderExtensionsFieldsUseCase.d.ts +4 -3
  81. package/features/folders/getFolderExtensionsFields/useFolderExtensionsFields.d.ts +4 -3
  82. package/features/folders/listFolders/ListFoldersGqlGateway.d.ts +1 -1
  83. package/features/folders/listFolders/ListFoldersGqlGateway.js +1 -2
  84. package/features/folders/listFolders/ListFoldersGqlGateway.js.map +1 -1
  85. package/features/folders/listFolders/useListFolders.d.ts +1 -1
  86. package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.d.ts +3 -3
  87. package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.js +5 -7
  88. package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.js.map +1 -1
  89. package/features/folders/listFoldersByParentIds/useListFoldersByParentIds.d.ts +2 -2
  90. package/features/folders/loadFolderHierarchy/useLoadFolderHierarchy.d.ts +2 -2
  91. package/features/folders/updateFolder/UpdateFolderGqlGateway.d.ts +3 -3
  92. package/features/folders/updateFolder/UpdateFolderGqlGateway.js +5 -6
  93. package/features/folders/updateFolder/UpdateFolderGqlGateway.js.map +1 -1
  94. package/hooks/index.d.ts +0 -6
  95. package/hooks/index.js +0 -6
  96. package/index.d.ts +3 -2
  97. package/index.js +2 -2
  98. package/package.json +21 -28
  99. package/presentation/folderTree/FolderTree.js +12 -4
  100. package/presentation/folderTree/FolderTree.js.map +1 -1
  101. package/presentation/folderTree/FolderTreePresenter.d.ts +2 -0
  102. package/presentation/folderTree/FolderTreePresenter.js +40 -14
  103. package/presentation/folderTree/FolderTreePresenter.js.map +1 -1
  104. package/presentation/folderTree/FolderTreePresenter.test.js +106 -7
  105. package/presentation/folderTree/FolderTreePresenter.test.js.map +1 -1
  106. package/table.types.d.ts +2 -9
  107. package/types.d.ts +5 -26
  108. package/types.js.map +1 -1
  109. package/components/Extensions/Extensions.d.ts +0 -2
  110. package/components/Extensions/Extensions.js +0 -30
  111. package/components/Extensions/Extensions.js.map +0 -1
  112. package/components/Extensions/index.d.ts +0 -1
  113. package/components/Extensions/index.js +0 -1
  114. package/config/folder/createFolderFieldDecoratorFactory.d.ts +0 -13
  115. package/config/folder/createFolderFieldDecoratorFactory.js +0 -17
  116. package/config/folder/createFolderFieldDecoratorFactory.js.map +0 -1
  117. package/config/table/Sorting.js.map +0 -1
  118. package/contexts/acoList.d.ts +0 -49
  119. package/contexts/acoList.js +0 -303
  120. package/contexts/acoList.js.map +0 -1
  121. package/contexts/app.d.ts +0 -33
  122. package/contexts/app.js +0 -47
  123. package/contexts/app.js.map +0 -1
  124. package/contexts/folders.d.ts +0 -12
  125. package/contexts/folders.js +0 -32
  126. package/contexts/folders.js.map +0 -1
  127. package/contexts/navigateFolder.d.ts +0 -17
  128. package/contexts/navigateFolder.js +0 -54
  129. package/contexts/navigateFolder.js.map +0 -1
  130. package/contexts/records.d.ts +0 -31
  131. package/contexts/records.js +0 -316
  132. package/contexts/records.js.map +0 -1
  133. package/exports/admin/aco.d.ts +0 -2
  134. package/exports/admin/aco.js +0 -2
  135. package/graphql/app.gql.d.ts +0 -17
  136. package/graphql/app.gql.js +0 -22
  137. package/graphql/app.gql.js.map +0 -1
  138. package/graphql/records/common.d.ts +0 -4
  139. package/graphql/records/common.js +0 -57
  140. package/graphql/records/common.js.map +0 -1
  141. package/graphql/records/getRecord.d.ts +0 -2
  142. package/graphql/records/getRecord.js +0 -5
  143. package/graphql/records/getRecord.js.map +0 -1
  144. package/graphql/records/listRecords.d.ts +0 -2
  145. package/graphql/records/listRecords.js +0 -26
  146. package/graphql/records/listRecords.js.map +0 -1
  147. package/graphql/records/moveRecord.d.ts +0 -2
  148. package/graphql/records/moveRecord.js +0 -16
  149. package/graphql/records/moveRecord.js.map +0 -1
  150. package/graphql/records/types.d.ts +0 -108
  151. package/graphql/records/types.js +0 -0
  152. package/graphql/records.gql.d.ts +0 -3
  153. package/graphql/records.gql.js +0 -3
  154. package/handlers.d.ts +0 -23
  155. package/handlers.js +0 -22
  156. package/handlers.js.map +0 -1
  157. package/hooks/useAcoApp.d.ts +0 -2
  158. package/hooks/useAcoApp.js +0 -16
  159. package/hooks/useAcoApp.js.map +0 -1
  160. package/hooks/useAcoList.d.ts +0 -3
  161. package/hooks/useAcoList.js +0 -10
  162. package/hooks/useAcoList.js.map +0 -1
  163. package/hooks/useFolderModel.d.ts +0 -2
  164. package/hooks/useFolderModel.js +0 -16
  165. package/hooks/useFolderModel.js.map +0 -1
  166. package/hooks/useFoldersType.d.ts +0 -1
  167. package/hooks/useFoldersType.js +0 -12
  168. package/hooks/useFoldersType.js.map +0 -1
  169. package/hooks/useNavigateFolder.d.ts +0 -2
  170. package/hooks/useNavigateFolder.js +0 -10
  171. package/hooks/useNavigateFolder.js.map +0 -1
  172. package/hooks/useRecords.d.ts +0 -62
  173. package/hooks/useRecords.js +0 -64
  174. package/hooks/useRecords.js.map +0 -1
  175. package/hooks/useTags.d.ts +0 -14
  176. package/hooks/useTags.js +0 -27
  177. package/hooks/useTags.js.map +0 -1
  178. package/sorting.d.ts +0 -9
  179. package/sorting.js +0 -31
  180. package/sorting.js.map +0 -1
@@ -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,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
  }[];
@@ -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 & {