@webiny/app-aco 6.4.5 → 6.6.0-alpha.0

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 (170) 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/domain/Filter.d.ts +1 -1
  4. package/components/AdvancedSearch/domain/FilterRepositoryFactory.d.ts +2 -2
  5. package/components/AdvancedSearch/domain/FilterRepositoryFactory.js.map +1 -1
  6. package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.d.ts +2 -2
  7. package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.js +9 -10
  8. package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.js.map +1 -1
  9. package/components/AdvancedSearch/gateways/filters.gql.d.ts +5 -5
  10. package/components/AdvancedSearch/gateways/filters.gql.js +5 -6
  11. package/components/AdvancedSearch/gateways/filters.gql.js.map +1 -1
  12. package/components/AdvancedSearch/useFilterRepository.js +7 -2
  13. package/components/AdvancedSearch/useFilterRepository.js.map +1 -1
  14. package/components/Table/cells/CellAuthor.d.ts +2 -0
  15. package/components/Table/cells/CellAuthor.js +10 -0
  16. package/components/Table/cells/CellAuthor.js.map +1 -0
  17. package/components/Table/cells/CellCreated.d.ts +2 -0
  18. package/components/Table/cells/CellCreated.js +13 -0
  19. package/components/Table/cells/CellCreated.js.map +1 -0
  20. package/components/Table/cells/CellModified.d.ts +2 -0
  21. package/components/Table/cells/CellModified.js +13 -0
  22. package/components/Table/cells/CellModified.js.map +1 -0
  23. package/components/Table/cells/index.d.ts +3 -0
  24. package/components/Table/cells/index.js +3 -0
  25. package/components/Table/createTableData.d.ts +7 -5
  26. package/components/Table/createTableData.js +22 -7
  27. package/components/Table/createTableData.js.map +1 -1
  28. package/components/Table/index.d.ts +2 -2
  29. package/components/Table/index.js +2 -2
  30. package/components/index.d.ts +0 -1
  31. package/components/index.js +0 -1
  32. package/config/AcoConfig.d.ts +8 -12
  33. package/config/advanced-search/FieldRenderer.d.ts +3 -1
  34. package/config/folder/Action.d.ts +1 -1
  35. package/config/folder/index.d.ts +3 -2
  36. package/config/index.d.ts +0 -1
  37. package/config/index.js +0 -1
  38. package/config/record/Action.d.ts +1 -1
  39. package/config/record/index.d.ts +1 -1
  40. package/config/table/Column.d.ts +8 -39
  41. package/config/table/Column.js +4 -67
  42. package/config/table/Column.js.map +1 -1
  43. package/config/table/Sorting.d.ts +2 -11
  44. package/config/table/Sorting.js +1 -28
  45. package/config/table/index.d.ts +5 -9
  46. package/contexts/index.d.ts +0 -3
  47. package/contexts/index.js +0 -3
  48. package/dialogs/DialogSetPermissions/graphql.d.ts +1 -1
  49. package/dialogs/DialogSetPermissions/graphql.js +1 -2
  50. package/dialogs/DialogSetPermissions/graphql.js.map +1 -1
  51. package/dialogs/useCreateDialog.js +2 -2
  52. package/dialogs/useCreateDialog.js.map +1 -1
  53. package/dialogs/useEditDialog.js +2 -2
  54. package/dialogs/useEditDialog.js.map +1 -1
  55. package/dialogs/useSetPermissionsDialog.js +16 -4
  56. package/dialogs/useSetPermissionsDialog.js.map +1 -1
  57. package/domain/folder/Folder.d.ts +2 -1
  58. package/domain/folder/Folder.js.map +1 -1
  59. package/features/folders/createFolder/CreateFolderGqlGateway.d.ts +3 -3
  60. package/features/folders/createFolder/CreateFolderGqlGateway.js +15 -16
  61. package/features/folders/createFolder/CreateFolderGqlGateway.js.map +1 -1
  62. package/features/folders/deleteFolder/DeleteFolderGqlGateway.d.ts +3 -3
  63. package/features/folders/deleteFolder/DeleteFolderGqlGateway.js +5 -6
  64. package/features/folders/deleteFolder/DeleteFolderGqlGateway.js.map +1 -1
  65. package/features/folders/folderModelProvider/FolderModelProvider.js +29 -31
  66. package/features/folders/folderModelProvider/FolderModelProvider.js.map +1 -1
  67. package/features/folders/folderModelProvider/GetFolderModelGqlGateway.d.ts +3 -3
  68. package/features/folders/folderModelProvider/GetFolderModelGqlGateway.js +5 -7
  69. package/features/folders/folderModelProvider/GetFolderModelGqlGateway.js.map +1 -1
  70. package/features/folders/getFolder/GetFolderGqlGateway.d.ts +3 -3
  71. package/features/folders/getFolder/GetFolderGqlGateway.js +5 -7
  72. package/features/folders/getFolder/GetFolderGqlGateway.js.map +1 -1
  73. package/features/folders/getFolderExtensionsFields/GetFolderExtensionsFieldsUseCase.d.ts +3 -3
  74. package/features/folders/getFolderExtensionsFields/useFolderExtensionsFields.d.ts +3 -3
  75. package/features/folders/listFolders/ListFoldersGqlGateway.d.ts +1 -1
  76. package/features/folders/listFolders/ListFoldersGqlGateway.js +1 -2
  77. package/features/folders/listFolders/ListFoldersGqlGateway.js.map +1 -1
  78. package/features/folders/listFolders/useListFolders.d.ts +1 -1
  79. package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.d.ts +3 -3
  80. package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.js +5 -7
  81. package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.js.map +1 -1
  82. package/features/folders/listFoldersByParentIds/useListFoldersByParentIds.d.ts +2 -2
  83. package/features/folders/loadFolderHierarchy/useLoadFolderHierarchy.d.ts +2 -2
  84. package/features/folders/updateFolder/UpdateFolderGqlGateway.d.ts +3 -3
  85. package/features/folders/updateFolder/UpdateFolderGqlGateway.js +5 -6
  86. package/features/folders/updateFolder/UpdateFolderGqlGateway.js.map +1 -1
  87. package/hooks/index.d.ts +0 -6
  88. package/hooks/index.js +0 -6
  89. package/index.d.ts +3 -2
  90. package/index.js +2 -2
  91. package/package.json +16 -23
  92. package/presentation/folderTree/FolderTreePresenter.js +8 -8
  93. package/presentation/folderTree/FolderTreePresenter.js.map +1 -1
  94. package/presentation/folderTree/FolderTreePresenter.test.js +4 -2
  95. package/presentation/folderTree/FolderTreePresenter.test.js.map +1 -1
  96. package/table.types.d.ts +2 -9
  97. package/types.d.ts +5 -26
  98. package/types.js.map +1 -1
  99. package/components/Extensions/Extensions.d.ts +0 -2
  100. package/components/Extensions/Extensions.js +0 -30
  101. package/components/Extensions/Extensions.js.map +0 -1
  102. package/components/Extensions/index.d.ts +0 -1
  103. package/components/Extensions/index.js +0 -1
  104. package/config/folder/createFolderFieldDecoratorFactory.d.ts +0 -13
  105. package/config/folder/createFolderFieldDecoratorFactory.js +0 -17
  106. package/config/folder/createFolderFieldDecoratorFactory.js.map +0 -1
  107. package/config/table/Sorting.js.map +0 -1
  108. package/contexts/acoList.d.ts +0 -49
  109. package/contexts/acoList.js +0 -303
  110. package/contexts/acoList.js.map +0 -1
  111. package/contexts/app.d.ts +0 -33
  112. package/contexts/app.js +0 -47
  113. package/contexts/app.js.map +0 -1
  114. package/contexts/folders.d.ts +0 -12
  115. package/contexts/folders.js +0 -32
  116. package/contexts/folders.js.map +0 -1
  117. package/contexts/navigateFolder.d.ts +0 -17
  118. package/contexts/navigateFolder.js +0 -54
  119. package/contexts/navigateFolder.js.map +0 -1
  120. package/contexts/records.d.ts +0 -31
  121. package/contexts/records.js +0 -316
  122. package/contexts/records.js.map +0 -1
  123. package/exports/admin/aco.d.ts +0 -2
  124. package/exports/admin/aco.js +0 -2
  125. package/graphql/app.gql.d.ts +0 -17
  126. package/graphql/app.gql.js +0 -22
  127. package/graphql/app.gql.js.map +0 -1
  128. package/graphql/records/common.d.ts +0 -4
  129. package/graphql/records/common.js +0 -57
  130. package/graphql/records/common.js.map +0 -1
  131. package/graphql/records/getRecord.d.ts +0 -2
  132. package/graphql/records/getRecord.js +0 -5
  133. package/graphql/records/getRecord.js.map +0 -1
  134. package/graphql/records/listRecords.d.ts +0 -2
  135. package/graphql/records/listRecords.js +0 -26
  136. package/graphql/records/listRecords.js.map +0 -1
  137. package/graphql/records/moveRecord.d.ts +0 -2
  138. package/graphql/records/moveRecord.js +0 -16
  139. package/graphql/records/moveRecord.js.map +0 -1
  140. package/graphql/records/types.d.ts +0 -108
  141. package/graphql/records/types.js +0 -0
  142. package/graphql/records.gql.d.ts +0 -3
  143. package/graphql/records.gql.js +0 -3
  144. package/handlers.d.ts +0 -23
  145. package/handlers.js +0 -22
  146. package/handlers.js.map +0 -1
  147. package/hooks/useAcoApp.d.ts +0 -2
  148. package/hooks/useAcoApp.js +0 -16
  149. package/hooks/useAcoApp.js.map +0 -1
  150. package/hooks/useAcoList.d.ts +0 -3
  151. package/hooks/useAcoList.js +0 -10
  152. package/hooks/useAcoList.js.map +0 -1
  153. package/hooks/useFolderModel.d.ts +0 -2
  154. package/hooks/useFolderModel.js +0 -16
  155. package/hooks/useFolderModel.js.map +0 -1
  156. package/hooks/useFoldersType.d.ts +0 -1
  157. package/hooks/useFoldersType.js +0 -12
  158. package/hooks/useFoldersType.js.map +0 -1
  159. package/hooks/useNavigateFolder.d.ts +0 -2
  160. package/hooks/useNavigateFolder.js +0 -10
  161. package/hooks/useNavigateFolder.js.map +0 -1
  162. package/hooks/useRecords.d.ts +0 -62
  163. package/hooks/useRecords.js +0 -64
  164. package/hooks/useRecords.js.map +0 -1
  165. package/hooks/useTags.d.ts +0 -14
  166. package/hooks/useTags.js +0 -27
  167. package/hooks/useTags.js.map +0 -1
  168. package/sorting.d.ts +0 -9
  169. package/sorting.js +0 -31
  170. package/sorting.js.map +0 -1
@@ -1,4 +1,3 @@
1
- import { createFieldsList } from "@webiny/app-headless-cms-common";
2
1
  import { GetFolderModelRepository } from "./abstractions.js";
3
2
  import { FolderModelProvider } from "../abstractions.js";
4
3
  class FolderModelProviderImpl {
@@ -13,38 +12,37 @@ class FolderModelProviderImpl {
13
12
  }
14
13
  async getGraphQLSelection() {
15
14
  const model = await this.getModel();
16
- const fields = createFieldsList({
17
- model,
18
- fields: model.fields
19
- });
20
- return `{
21
- id
22
- createdOn
23
- createdBy {
15
+ const valuesBlock = model.valuesSelection && "_empty" !== model.valuesSelection ? model.valuesSelection : "";
16
+ return `
17
+ {
24
18
  id
25
- displayName
19
+ createdOn
20
+ createdBy {
21
+ id
22
+ displayName
23
+ }
24
+ savedOn
25
+ savedBy {
26
+ id
27
+ displayName
28
+ }
29
+ modifiedOn
30
+ modifiedBy {
31
+ id
32
+ displayName
33
+ }
34
+ permissions {
35
+ target
36
+ level
37
+ inheritedFrom
38
+ }
39
+ hasNonInheritedPermissions
40
+ canManagePermissions
41
+ canManageStructure
42
+ canManageContent
43
+ ${valuesBlock}
26
44
  }
27
- savedOn
28
- savedBy {
29
- id
30
- displayName
31
- }
32
- modifiedOn
33
- modifiedBy {
34
- id
35
- displayName
36
- }
37
- permissions {
38
- target
39
- level
40
- inheritedFrom
41
- }
42
- hasNonInheritedPermissions
43
- canManagePermissions
44
- canManageStructure
45
- canManageContent
46
- ${fields}
47
- }`;
45
+ `;
48
46
  }
49
47
  }
50
48
  const FolderModelProvider_FolderModelProvider = FolderModelProvider.createImplementation({
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/folderModelProvider/FolderModelProvider.js","sources":["../../../../src/features/folders/folderModelProvider/FolderModelProvider.ts"],"sourcesContent":["import { createFieldsList } from \"@webiny/app-headless-cms-common\";\nimport type { CmsModel } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport { GetFolderModelRepository } from \"./abstractions.js\";\nimport { FolderModelProvider as Provider } from \"~/features/folders/abstractions.js\";\n\nclass FolderModelProviderImpl implements Provider.Interface {\n constructor(private repository: GetFolderModelRepository.Interface) {}\n\n async getModel(): Promise<CmsModel> {\n await this.repository.load();\n\n const model = this.repository.getModel();\n if (!model) {\n // Something went seriously wrong!\n throw new Error(\"Unable to load File model!\");\n }\n\n return model;\n }\n\n async getGraphQLSelection(): Promise<string> {\n const model = await this.getModel();\n\n const fields = createFieldsList({ model, fields: model.fields });\n\n return /* GraphQL */ `{\n id\n createdOn\n createdBy {\n id\n displayName\n }\n savedOn\n savedBy {\n id\n displayName\n }\n modifiedOn\n modifiedBy {\n id\n displayName\n }\n permissions {\n target\n level\n inheritedFrom\n }\n hasNonInheritedPermissions\n canManagePermissions\n canManageStructure\n canManageContent\n ${fields}\n }`;\n }\n}\n\nexport const FolderModelProvider = Provider.createImplementation({\n implementation: FolderModelProviderImpl,\n dependencies: [GetFolderModelRepository]\n});\n"],"names":["FolderModelProviderImpl","repository","model","Error","fields","createFieldsList","FolderModelProvider","Provider","GetFolderModelRepository"],"mappings":";;;AAKA,MAAMA;IACF,YAAoBC,UAA8C,CAAE;aAAhDA,UAAU,GAAVA;IAAiD;IAErE,MAAM,WAA8B;QAChC,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI;QAE1B,MAAMC,QAAQ,IAAI,CAAC,UAAU,CAAC,QAAQ;QACtC,IAAI,CAACA,OAED,MAAM,IAAIC,MAAM;QAGpB,OAAOD;IACX;IAEA,MAAM,sBAAuC;QACzC,MAAMA,QAAQ,MAAM,IAAI,CAAC,QAAQ;QAEjC,MAAME,SAASC,iBAAiB;YAAEH;YAAO,QAAQA,MAAM,MAAM;QAAC;QAE9D,OAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;YA0BlB,EAAEE,OAAO;SACZ,CAAC;IACN;AACJ;AAEO,MAAME,0CAAsBC,oBAAAA,oBAA6B,CAAC;IAC7D,gBAAgBP;IAChB,cAAc;QAACQ;KAAyB;AAC5C"}
1
+ {"version":3,"file":"features/folders/folderModelProvider/FolderModelProvider.js","sources":["../../../../src/features/folders/folderModelProvider/FolderModelProvider.ts"],"sourcesContent":["import type { CmsModel } from \"@webiny/app-headless-cms-common/types/index.js\";\n\nimport { GetFolderModelRepository } from \"./abstractions.js\";\nimport { FolderModelProvider as Provider } from \"~/features/folders/abstractions.js\";\n\nclass FolderModelProviderImpl implements Provider.Interface {\n constructor(private repository: GetFolderModelRepository.Interface) {}\n\n async getModel(): Promise<CmsModel> {\n await this.repository.load();\n\n const model = this.repository.getModel();\n if (!model) {\n throw new Error(\"Unable to load File model!\");\n }\n\n return model;\n }\n\n async getGraphQLSelection(): Promise<string> {\n const model = await this.getModel();\n\n const valuesBlock =\n model.valuesSelection && model.valuesSelection !== \"_empty\"\n ? model.valuesSelection\n : \"\";\n\n return /* GraphQL */ `\n {\n id\n createdOn\n createdBy {\n id\n displayName\n }\n savedOn\n savedBy {\n id\n displayName\n }\n modifiedOn\n modifiedBy {\n id\n displayName\n }\n permissions {\n target\n level\n inheritedFrom\n }\n hasNonInheritedPermissions\n canManagePermissions\n canManageStructure\n canManageContent\n ${valuesBlock}\n }\n `;\n }\n}\n\nexport const FolderModelProvider = Provider.createImplementation({\n implementation: FolderModelProviderImpl,\n dependencies: [GetFolderModelRepository]\n});\n"],"names":["FolderModelProviderImpl","repository","model","Error","valuesBlock","FolderModelProvider","Provider","GetFolderModelRepository"],"mappings":";;AAKA,MAAMA;IACF,YAAoBC,UAA8C,CAAE;aAAhDA,UAAU,GAAVA;IAAiD;IAErE,MAAM,WAA8B;QAChC,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI;QAE1B,MAAMC,QAAQ,IAAI,CAAC,UAAU,CAAC,QAAQ;QACtC,IAAI,CAACA,OACD,MAAM,IAAIC,MAAM;QAGpB,OAAOD;IACX;IAEA,MAAM,sBAAuC;QACzC,MAAMA,QAAQ,MAAM,IAAI,CAAC,QAAQ;QAEjC,MAAME,cACFF,MAAM,eAAe,IAAIA,AAA0B,aAA1BA,MAAM,eAAe,GACxCA,MAAM,eAAe,GACrB;QAEV,OAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA2Bd,EAAEE,YAAY;;QAEtB,CAAC;IACL;AACJ;AAEO,MAAMC,0CAAsBC,oBAAAA,oBAA6B,CAAC;IAC7D,gBAAgBN;IAChB,cAAc;QAACO;KAAyB;AAC5C"}
@@ -1,4 +1,4 @@
1
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
2
2
  import { GetFolderModelGateway as GatewayAbstraction } from "./abstractions.js";
3
3
  import type { CmsModel } from "@webiny/app-headless-cms-common/types/index.js";
4
4
  import type { AcoError } from "../../../types.js";
@@ -10,10 +10,10 @@ export interface GetFolderModelResponse {
10
10
  };
11
11
  };
12
12
  }
13
- export declare const GET_FOLDER_MODEL: import("graphql").DocumentNode;
13
+ export declare const GET_FOLDER_MODEL = "\n query GetFolderModel {\n aco {\n getFolderModel {\n data\n error {\n code\n message\n data\n stack\n }\n }\n }\n }\n";
14
14
  declare class GetFolderModelGqlGatewayImpl implements GatewayAbstraction.Interface {
15
15
  private client;
16
- constructor(client: ApolloClient.Interface);
16
+ constructor(client: MainGraphQLClient.Interface);
17
17
  execute(): Promise<CmsModel>;
18
18
  }
19
19
  export declare const GetFolderModelGqlGateway: typeof GetFolderModelGqlGatewayImpl & {
@@ -1,7 +1,6 @@
1
- import graphql_tag from "graphql-tag";
2
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
3
2
  import { GetFolderModelGateway } from "./abstractions.js";
4
- const GET_FOLDER_MODEL = graphql_tag`
3
+ const GET_FOLDER_MODEL = `
5
4
  query GetFolderModel {
6
5
  aco {
7
6
  getFolderModel {
@@ -21,9 +20,8 @@ class GetFolderModelGqlGatewayImpl {
21
20
  this.client = client;
22
21
  }
23
22
  async execute() {
24
- const { data: response } = await this.client.query({
25
- query: GET_FOLDER_MODEL,
26
- fetchPolicy: "network-only"
23
+ const response = await this.client.execute({
24
+ query: GET_FOLDER_MODEL
27
25
  });
28
26
  if (!response) throw new Error("Network error while fetch folder.");
29
27
  const { data, error } = response.aco.getFolderModel;
@@ -34,7 +32,7 @@ class GetFolderModelGqlGatewayImpl {
34
32
  const GetFolderModelGqlGateway = GetFolderModelGateway.createImplementation({
35
33
  implementation: GetFolderModelGqlGatewayImpl,
36
34
  dependencies: [
37
- ApolloClient
35
+ MainGraphQLClient
38
36
  ]
39
37
  });
40
38
  export { GET_FOLDER_MODEL, GetFolderModelGqlGateway };
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/folderModelProvider/GetFolderModelGqlGateway.js","sources":["../../../../src/features/folders/folderModelProvider/GetFolderModelGqlGateway.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { ApolloClient } from \"@webiny/app-admin/features/apolloClient/abstraction.js\";\nimport { GetFolderModelGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { CmsModel } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface GetFolderModelResponse {\n aco: {\n getFolderModel: {\n data: CmsModel;\n error: AcoError | null;\n };\n };\n}\n\nexport const GET_FOLDER_MODEL = gql`\n query GetFolderModel {\n aco {\n getFolderModel {\n data\n error {\n code\n message\n data\n stack\n }\n }\n }\n }\n`;\n\nclass GetFolderModelGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: ApolloClient.Interface) {}\n\n async execute() {\n const { data: response } = await this.client.query<GetFolderModelResponse>({\n query: GET_FOLDER_MODEL,\n fetchPolicy: \"network-only\"\n });\n\n if (!response) {\n throw new Error(\"Network error while fetch folder.\");\n }\n\n const { data, error } = response.aco.getFolderModel;\n\n if (!data) {\n throw new Error(error?.message || `Could not fetch folder model`);\n }\n\n return data;\n }\n}\n\nexport const GetFolderModelGqlGateway = GatewayAbstraction.createImplementation({\n implementation: GetFolderModelGqlGatewayImpl,\n dependencies: [ApolloClient]\n});\n"],"names":["GET_FOLDER_MODEL","gql","GetFolderModelGqlGatewayImpl","client","response","Error","data","error","GetFolderModelGqlGateway","GatewayAbstraction","ApolloClient"],"mappings":";;;AAeO,MAAMA,mBAAmBC,WAAG,CAAC;;;;;;;;;;;;;;AAcpC,CAAC;AAED,MAAMC;IACF,YAAoBC,MAA8B,CAAE;aAAhCA,MAAM,GAANA;IAAiC;IAErD,MAAM,UAAU;QACZ,MAAM,EAAE,MAAMC,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAyB;YACvE,OAAOJ;YACP,aAAa;QACjB;QAEA,IAAI,CAACI,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,cAAc;QAEnD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAME,2BAA2BC,sBAAAA,oBAAuC,CAAC;IAC5E,gBAAgBP;IAChB,cAAc;QAACQ;KAAa;AAChC"}
1
+ {"version":3,"file":"features/folders/folderModelProvider/GetFolderModelGqlGateway.js","sources":["../../../../src/features/folders/folderModelProvider/GetFolderModelGqlGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport { GetFolderModelGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { CmsModel } from \"@webiny/app-headless-cms-common/types/index.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface GetFolderModelResponse {\n aco: {\n getFolderModel: {\n data: CmsModel;\n error: AcoError | null;\n };\n };\n}\n\nexport const GET_FOLDER_MODEL = /* GraphQL */ `\n query GetFolderModel {\n aco {\n getFolderModel {\n data\n error {\n code\n message\n data\n stack\n }\n }\n }\n }\n`;\n\nclass GetFolderModelGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: MainGraphQLClient.Interface) {}\n\n async execute() {\n const response = await this.client.execute<GetFolderModelResponse>({\n query: GET_FOLDER_MODEL\n });\n\n if (!response) {\n throw new Error(\"Network error while fetch folder.\");\n }\n\n const { data, error } = response.aco.getFolderModel;\n\n if (!data) {\n throw new Error(error?.message || `Could not fetch folder model`);\n }\n\n return data;\n }\n}\n\nexport const GetFolderModelGqlGateway = GatewayAbstraction.createImplementation({\n implementation: GetFolderModelGqlGatewayImpl,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["GET_FOLDER_MODEL","GetFolderModelGqlGatewayImpl","client","response","Error","data","error","GetFolderModelGqlGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAcO,MAAMA,mBAAiC,CAAC;;;;;;;;;;;;;;AAc/C,CAAC;AAED,MAAMC;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,UAAU;QACZ,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAyB;YAC/D,OAAOH;QACX;QAEA,IAAI,CAACG,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,cAAc;QAEnD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAME,2BAA2BC,sBAAAA,oBAAuC,CAAC;IAC5E,gBAAgBP;IAChB,cAAc;QAACQ;KAAkB;AACrC"}
@@ -1,4 +1,4 @@
1
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
2
2
  import type { FolderDto } from "../../../domain/folder/FolderDto.js";
3
3
  import { FolderModelProvider } from "../../../features/folders/abstractions.js";
4
4
  import { GetFolderGateway as GatewayAbstraction } from "./abstractions.js";
@@ -17,11 +17,11 @@ export interface GetFolderResponse {
17
17
  export interface GetFolderQueryVariables {
18
18
  id: string;
19
19
  }
20
- export declare const GET_FOLDER: (FOLDER_FIELDS: string) => import("graphql").DocumentNode;
20
+ export declare const GET_FOLDER: (FOLDER_FIELDS: string) => string;
21
21
  declare class GetFolderGqlGatewayImpl implements GatewayAbstraction.Interface {
22
22
  private client;
23
23
  private folderModelProvider;
24
- constructor(client: ApolloClient.Interface, folderModelProvider: FolderModelProvider.Interface);
24
+ constructor(client: MainGraphQLClient.Interface, folderModelProvider: FolderModelProvider.Interface);
25
25
  execute(id: string): Promise<FolderDto>;
26
26
  }
27
27
  export declare const GetFolderGqlGateway: typeof GetFolderGqlGatewayImpl & {
@@ -1,8 +1,7 @@
1
- import graphql_tag from "graphql-tag";
2
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
3
2
  import { FolderModelProvider } from "../abstractions.js";
4
3
  import { GetFolderGateway } from "./abstractions.js";
5
- const GET_FOLDER = (FOLDER_FIELDS)=>graphql_tag`
4
+ const GET_FOLDER = (FOLDER_FIELDS)=>`
6
5
  query GetFolder($id: ID!) {
7
6
  aco {
8
7
  getFolder(id: $id) {
@@ -23,12 +22,11 @@ class GetFolderGqlGatewayImpl {
23
22
  }
24
23
  async execute(id) {
25
24
  const fields = await this.folderModelProvider.getGraphQLSelection();
26
- const { data: response } = await this.client.query({
25
+ const response = await this.client.execute({
27
26
  query: GET_FOLDER(fields),
28
27
  variables: {
29
28
  id
30
- },
31
- fetchPolicy: "network-only"
29
+ }
32
30
  });
33
31
  if (!response) throw new Error("Network error while fetch folder.");
34
32
  const { data, error } = response.aco.getFolder;
@@ -39,7 +37,7 @@ class GetFolderGqlGatewayImpl {
39
37
  const GetFolderGqlGateway = GetFolderGateway.createImplementation({
40
38
  implementation: GetFolderGqlGatewayImpl,
41
39
  dependencies: [
42
- ApolloClient,
40
+ MainGraphQLClient,
43
41
  FolderModelProvider
44
42
  ]
45
43
  });
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/getFolder/GetFolderGqlGateway.js","sources":["../../../../src/features/folders/getFolder/GetFolderGqlGateway.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { ApolloClient } from \"@webiny/app-admin/features/apolloClient/abstraction.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { FolderModelProvider } from \"~/features/folders/abstractions.js\";\nimport { GetFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface GetFolderResponse {\n aco: {\n getFolder:\n | {\n data: FolderDto;\n error: null;\n }\n | {\n data: null;\n error: AcoError;\n };\n };\n}\n\nexport interface GetFolderQueryVariables {\n id: string;\n}\n\nexport const GET_FOLDER = (FOLDER_FIELDS: string) => gql`\n query GetFolder($id: ID!) {\n aco {\n getFolder(id: $id) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass GetFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: ApolloClient.Interface,\n private folderModelProvider: FolderModelProvider.Interface\n ) {}\n\n async execute(id: string) {\n const fields = await this.folderModelProvider.getGraphQLSelection();\n\n const { data: response } = await this.client.query<\n GetFolderResponse,\n GetFolderQueryVariables\n >({\n query: GET_FOLDER(fields),\n variables: { id },\n fetchPolicy: \"network-only\"\n });\n\n if (!response) {\n throw new Error(\"Network error while fetch folder.\");\n }\n\n const { data, error } = response.aco.getFolder;\n\n if (!data) {\n throw new Error(error?.message || `Could not fetch folder with id: ${id}`);\n }\n\n return data;\n }\n}\n\nexport const GetFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: GetFolderGqlGatewayImpl,\n dependencies: [ApolloClient, FolderModelProvider]\n});\n"],"names":["GET_FOLDER","FOLDER_FIELDS","gql","GetFolderGqlGatewayImpl","client","folderModelProvider","id","fields","response","Error","data","error","GetFolderGqlGateway","GatewayAbstraction","ApolloClient","FolderModelProvider"],"mappings":";;;;AAyBO,MAAMA,aAAa,CAACC,gBAA0BC,WAAG,CAAC;;;;qBAIpC,EAAED,cAAc;;;;;;;;;AASrC,CAAC;AAED,MAAME;IACF,YACYC,MAA8B,EAC9BC,mBAAkD,CAC5D;aAFUD,MAAM,GAANA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQC,EAAU,EAAE;QACtB,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,mBAAmB;QAEjE,MAAM,EAAE,MAAMC,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAGhD;YACE,OAAOR,WAAWO;YAClB,WAAW;gBAAED;YAAG;YAChB,aAAa;QACjB;QAEA,IAAI,CAACE,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,SAAS;QAE9C,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW,CAAC,gCAAgC,EAAEL,IAAI;QAG7E,OAAOI;IACX;AACJ;AAEO,MAAME,sBAAsBC,iBAAAA,oBAAuC,CAAC;IACvE,gBAAgBV;IAChB,cAAc;QAACW;QAAcC;KAAoB;AACrD"}
1
+ {"version":3,"file":"features/folders/getFolder/GetFolderGqlGateway.js","sources":["../../../../src/features/folders/getFolder/GetFolderGqlGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { FolderModelProvider } from \"~/features/folders/abstractions.js\";\nimport { GetFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface GetFolderResponse {\n aco: {\n getFolder:\n | {\n data: FolderDto;\n error: null;\n }\n | {\n data: null;\n error: AcoError;\n };\n };\n}\n\nexport interface GetFolderQueryVariables {\n id: string;\n}\n\nexport const GET_FOLDER = (FOLDER_FIELDS: string) => /* GraphQL */ `\n query GetFolder($id: ID!) {\n aco {\n getFolder(id: $id) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass GetFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: MainGraphQLClient.Interface,\n private folderModelProvider: FolderModelProvider.Interface\n ) {}\n\n async execute(id: string) {\n const fields = await this.folderModelProvider.getGraphQLSelection();\n\n const response = await this.client.execute<GetFolderResponse, GetFolderQueryVariables>({\n query: GET_FOLDER(fields),\n variables: { id }\n });\n\n if (!response) {\n throw new Error(\"Network error while fetch folder.\");\n }\n\n const { data, error } = response.aco.getFolder;\n\n if (!data) {\n throw new Error(error?.message || `Could not fetch folder with id: ${id}`);\n }\n\n return data;\n }\n}\n\nexport const GetFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: GetFolderGqlGatewayImpl,\n dependencies: [MainGraphQLClient, FolderModelProvider]\n});\n"],"names":["GET_FOLDER","FOLDER_FIELDS","GetFolderGqlGatewayImpl","client","folderModelProvider","id","fields","response","Error","data","error","GetFolderGqlGateway","GatewayAbstraction","MainGraphQLClient","FolderModelProvider"],"mappings":";;;AAwBO,MAAMA,aAAa,CAACC,gBAAwC,CAAC;;;;qBAI/C,EAAEA,cAAc;;;;;;;;;AASrC,CAAC;AAED,MAAMC;IACF,YACYC,MAAmC,EACnCC,mBAAkD,CAC5D;aAFUD,MAAM,GAANA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQC,EAAU,EAAE;QACtB,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,mBAAmB;QAEjE,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA6C;YACnF,OAAOP,WAAWM;YAClB,WAAW;gBAAED;YAAG;QACpB;QAEA,IAAI,CAACE,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,SAAS;QAE9C,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW,CAAC,gCAAgC,EAAEL,IAAI;QAG7E,OAAOI;IACX;AACJ;AAEO,MAAME,sBAAsBC,iBAAAA,oBAAuC,CAAC;IACvE,gBAAgBV;IAChB,cAAc;QAACW;QAAmBC;KAAoB;AAC1D"}
@@ -14,15 +14,15 @@ declare class GetFolderExtensionsFieldsUseCaseImpl implements UseCaseAbstraction
14
14
  description?: string | React.ReactNode;
15
15
  note?: string | React.ReactNode;
16
16
  placeholder?: string;
17
- validation?: (import("@webiny/app-headless-cms-common/types/validation.js").CmsModelFieldValidator | import("@webiny/validation/types.js").Validator)[];
18
- listValidation?: import("@webiny/app-headless-cms-common/types/validation.js").CmsModelFieldValidator[];
17
+ validation?: (import("@webiny/app-headless-cms-common/types/model.js").CmsModelFieldValidator | import("@webiny/validation/types.js").Validator)[];
18
+ listValidation?: import("@webiny/app-headless-cms-common/types/model.js").CmsModelFieldValidator[];
19
19
  list?: boolean;
20
20
  predefinedValues?: import("@webiny/app-headless-cms-common/types/index.js").CmsEditorFieldPredefinedValues;
21
21
  settings?: import("@webiny/app-headless-cms-common/types/model.js").CmsModelFieldSettings<unknown> | undefined;
22
22
  renderer: {
23
23
  name: string;
24
24
  settings?: Record<string, any>;
25
- } | import("@webiny/app-headless-cms-common/types/index.js").CmsModelFieldRendererPlugin["renderer"]["render"];
25
+ };
26
26
  tags?: string[];
27
27
  rules?: import("@webiny/app-headless-cms-common/types/model.js").FieldRule[];
28
28
  }[]>;
@@ -9,15 +9,15 @@ export declare const useFolderExtensionsFields: () => {
9
9
  description?: string | React.ReactNode;
10
10
  note?: string | React.ReactNode;
11
11
  placeholder?: string;
12
- validation?: (import("@webiny/app-headless-cms-common/types/validation.js").CmsModelFieldValidator | import("@webiny/validation/types.js").Validator)[];
13
- listValidation?: import("@webiny/app-headless-cms-common/types/validation.js").CmsModelFieldValidator[];
12
+ validation?: (import("@webiny/app-headless-cms-common/types/model.js").CmsModelFieldValidator | import("@webiny/validation/types.js").Validator)[];
13
+ listValidation?: import("@webiny/app-headless-cms-common/types/model.js").CmsModelFieldValidator[];
14
14
  list?: boolean;
15
15
  predefinedValues?: import("@webiny/app-headless-cms-common/types/index.js").CmsEditorFieldPredefinedValues;
16
16
  settings?: import("@webiny/app-headless-cms-common/types/model.js").CmsModelFieldSettings<unknown> | undefined;
17
17
  renderer: {
18
18
  name: string;
19
19
  settings?: Record<string, any>;
20
- } | import("@webiny/app-headless-cms-common/types/index.js").CmsModelFieldRendererPlugin["renderer"]["render"];
20
+ };
21
21
  tags?: string[];
22
22
  rules?: import("@webiny/app-headless-cms-common/types/model.js").FieldRule[];
23
23
  }[];
@@ -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: {
@@ -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
  });
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/updateFolder/UpdateFolderGqlGateway.js","sources":["../../../../src/features/folders/updateFolder/UpdateFolderGqlGateway.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 { UpdateFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\n\nexport interface UpdateFolderResponse {\n aco: {\n updateFolder: {\n data: FolderDto;\n error: AcoError | null;\n };\n };\n}\n\nexport interface UpdateFolderVariables {\n id: string;\n data: Partial<\n Omit<\n FolderDto,\n \"id\" | \"createdOn\" | \"createdBy\" | \"savedOn\" | \"savedBy\" | \"modifiedOn\" | \"modifiedBy\"\n >\n >;\n}\n\nexport const UPDATE_FOLDER = (FOLDER_FIELDS: string) => gql`\n mutation UpdateFolder($id: ID!, $data: FolderUpdateInput!) {\n aco {\n updateFolder(id: $id, data: $data) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass UpdateFolderGqlGatewayImpl 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 { id, title, slug, permissions, parentId, extensions } = folder;\n\n const { data: response } = await this.client.mutate<\n UpdateFolderResponse,\n UpdateFolderVariables\n >({\n mutation: UPDATE_FOLDER(fields),\n variables: {\n id,\n data: {\n title,\n slug,\n extensions,\n parentId: parentId === ROOT_FOLDER ? null : parentId,\n permissions: permissions.filter(p => !p.inheritedFrom)\n }\n }\n });\n\n if (!response) {\n throw new Error(\"Network error while updating folder.\");\n }\n\n const { data, error } = response.aco.updateFolder;\n\n if (!data) {\n throw new Error(error?.message || \"Could not update folder\");\n }\n\n return data;\n }\n}\n\nexport const UpdateFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: UpdateFolderGqlGatewayImpl,\n dependencies: [ApolloClient, FolderModelProvider]\n});\n"],"names":["UPDATE_FOLDER","FOLDER_FIELDS","gql","UpdateFolderGqlGatewayImpl","client","folderModelProvider","folder","fields","id","title","slug","permissions","parentId","extensions","response","ROOT_FOLDER","p","Error","data","error","UpdateFolderGqlGateway","GatewayAbstraction","ApolloClient","FolderModelProvider"],"mappings":";;;;;AA4BO,MAAMA,gBAAgB,CAACC,gBAA0BC,WAAG,CAAC;;;;qBAIvC,EAAED,cAAc;;;;;;;;;AASrC,CAAC;AAED,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,EAAEC,EAAE,EAAEC,KAAK,EAAEC,IAAI,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGP;QAE/D,MAAM,EAAE,MAAMQ,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAGjD;YACE,UAAUd,cAAcO;YACxB,WAAW;gBACPC;gBACA,MAAM;oBACFC;oBACAC;oBACAG;oBACA,UAAUD,aAAaG,cAAc,OAAOH;oBAC5C,aAAaD,YAAY,MAAM,CAACK,CAAAA,IAAK,CAACA,EAAE,aAAa;gBACzD;YACJ;QACJ;QAEA,IAAI,CAACF,UACD,MAAM,IAAIG,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGL,SAAS,GAAG,CAAC,YAAY;QAEjD,IAAI,CAACI,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAME,yBAAyBC,oBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBlB;IAChB,cAAc;QAACmB;QAAcC;KAAoB;AACrD"}
1
+ {"version":3,"file":"features/folders/updateFolder/UpdateFolderGqlGateway.js","sources":["../../../../src/features/folders/updateFolder/UpdateFolderGqlGateway.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 { UpdateFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\n\nexport interface UpdateFolderResponse {\n aco: {\n updateFolder: {\n data: FolderDto;\n error: AcoError | null;\n };\n };\n}\n\nexport interface UpdateFolderVariables {\n id: string;\n data: Partial<\n Omit<\n FolderDto,\n \"id\" | \"createdOn\" | \"createdBy\" | \"savedOn\" | \"savedBy\" | \"modifiedOn\" | \"modifiedBy\"\n >\n >;\n}\n\nexport const UPDATE_FOLDER = (FOLDER_FIELDS: string) => /* GraphQL */ `\n mutation UpdateFolder($id: ID!, $data: FolderUpdateInput!) {\n aco {\n updateFolder(id: $id, data: $data) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass UpdateFolderGqlGatewayImpl 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 { id, title, slug, permissions, parentId, extensions } = folder;\n\n const response = await this.client.execute<UpdateFolderResponse, UpdateFolderVariables>({\n query: UPDATE_FOLDER(fields),\n variables: {\n id,\n data: {\n title,\n slug,\n extensions,\n parentId: parentId === ROOT_FOLDER ? null : parentId,\n permissions: permissions.filter(p => !p.inheritedFrom)\n }\n }\n });\n\n if (!response) {\n throw new Error(\"Network error while updating folder.\");\n }\n\n const { data, error } = response.aco.updateFolder;\n\n if (!data) {\n throw new Error(error?.message || \"Could not update folder\");\n }\n\n return data;\n }\n}\n\nexport const UpdateFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: UpdateFolderGqlGatewayImpl,\n dependencies: [MainGraphQLClient, FolderModelProvider]\n});\n"],"names":["UPDATE_FOLDER","FOLDER_FIELDS","UpdateFolderGqlGatewayImpl","client","folderModelProvider","folder","fields","id","title","slug","permissions","parentId","extensions","response","ROOT_FOLDER","p","Error","data","error","UpdateFolderGqlGateway","GatewayAbstraction","MainGraphQLClient","FolderModelProvider"],"mappings":";;;;AA2BO,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,MAAM,EAAEC,EAAE,EAAEC,KAAK,EAAEC,IAAI,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,UAAU,EAAE,GAAGP;QAE/D,MAAMQ,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8C;YACpF,OAAOb,cAAcM;YACrB,WAAW;gBACPC;gBACA,MAAM;oBACFC;oBACAC;oBACAG;oBACA,UAAUD,aAAaG,cAAc,OAAOH;oBAC5C,aAAaD,YAAY,MAAM,CAACK,CAAAA,IAAK,CAACA,EAAE,aAAa;gBACzD;YACJ;QACJ;QAEA,IAAI,CAACF,UACD,MAAM,IAAIG,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGL,SAAS,GAAG,CAAC,YAAY;QAEjD,IAAI,CAACI,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAME,yBAAyBC,oBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBlB;IAChB,cAAc;QAACmB;QAAmBC;KAAoB;AAC1D"}
package/hooks/index.d.ts CHANGED
@@ -1,7 +1 @@
1
- export * from "./useAcoList.js";
2
- export * from "./useAcoApp.js";
3
1
  export * from "./useFolder.js";
4
- export * from "./useFoldersType.js";
5
- export * from "./useRecords.js";
6
- export * from "./useTags.js";
7
- export * from "./useNavigateFolder.js";
package/hooks/index.js CHANGED
@@ -1,7 +1 @@
1
- export * from "./useAcoList.js";
2
- export * from "./useAcoApp.js";
3
1
  export * from "./useFolder.js";
4
- export * from "./useFoldersType.js";
5
- export * from "./useRecords.js";
6
- export * from "./useTags.js";
7
- export * from "./useNavigateFolder.js";
package/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export * from "./app.js";
2
1
  export * from "./components/index.js";
3
2
  export * from "./config/index.js";
4
3
  export * from "./contexts/index.js";
5
4
  export * from "./hooks/index.js";
6
5
  export * from "./dialogs/index.js";
7
- export * from "./sorting.js";
8
6
  export type { TableRow, FolderTableRow, RecordTableRow } from "./table.types.js";
7
+ export { sortFolders } from "./components/Table/createTableData.js";
8
+ export type { FolderSortConfig } from "./components/Table/createTableData.js";
9
9
  export type { ListMeta, FolderLevelPermissionsTarget } from "./types.js";
10
10
  export { LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS } from "./dialogs/DialogSetPermissions/graphql.js";
11
11
  export { UsersTeamsMultiAutocomplete } from "./dialogs/DialogSetPermissions/UsersTeamsMultiAutocomplete.js";
@@ -23,3 +23,4 @@ export * from "./features/folders/loadFolderHierarchy/useLoadFolderHierarchy.js"
23
23
  export * from "./features/folders/listFolders/useListFolders.js";
24
24
  export * from "./features/folders/listFoldersByParentIds/useListFoldersByParentIds.js";
25
25
  export * from "./presentation/folderTree/index.js";
26
+ export * from "./app.js";
package/index.js CHANGED
@@ -1,10 +1,8 @@
1
- export * from "./app.js";
2
1
  export * from "./components/index.js";
3
2
  export * from "./config/index.js";
4
3
  export * from "./contexts/index.js";
5
4
  export * from "./hooks/index.js";
6
5
  export * from "./dialogs/index.js";
7
- export * from "./sorting.js";
8
6
  export * from "./domain/folder/FolderDto.js";
9
7
  export * from "./domain/folder/FolderDtoMapper.js";
10
8
  export * from "./features/folders/createFolder/useCreateFolder.js";
@@ -19,5 +17,7 @@ export * from "./features/folders/loadFolderHierarchy/useLoadFolderHierarchy.js"
19
17
  export * from "./features/folders/listFolders/useListFolders.js";
20
18
  export * from "./features/folders/listFoldersByParentIds/useListFoldersByParentIds.js";
21
19
  export * from "./presentation/folderTree/index.js";
20
+ export * from "./app.js";
21
+ export { sortFolders } from "./components/Table/createTableData.js";
22
22
  export { LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS } from "./dialogs/DialogSetPermissions/graphql.js";
23
23
  export { UsersTeamsMultiAutocomplete } from "./dialogs/DialogSetPermissions/UsersTeamsMultiAutocomplete.js";