@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,71 +1,8 @@
1
- import react from "react";
2
- import { Property, useIdGenerator } from "@webiny/react-properties";
3
- import { createUseTableRow } from "../../components/Table/useTableRow.js";
4
- const BaseColumn = ({ after, before, cell, className, header, hideable = true, truncate = true, name, path = "", remove = false, resizable = true, size = 100, sortable = false, visible = true })=>{
5
- const getId = useIdGenerator("tableColumn");
6
- const placeAfter = void 0 !== after ? getId(after) : void 0;
7
- const placeBefore = void 0 !== before ? getId(before) : void 0;
8
- return /*#__PURE__*/ react.createElement(Property, {
9
- id: "table",
10
- name: "table"
11
- }, /*#__PURE__*/ react.createElement(Property, {
12
- id: getId(name),
13
- name: "columns",
14
- remove: remove,
15
- array: true,
16
- before: placeBefore,
17
- after: placeAfter
18
- }, /*#__PURE__*/ react.createElement(Property, {
19
- id: getId(name, "name"),
20
- name: "name",
21
- value: name
22
- }), /*#__PURE__*/ react.createElement(Property, {
23
- id: getId(name, "path"),
24
- name: "path",
25
- value: path
26
- }), /*#__PURE__*/ react.createElement(Property, {
27
- id: getId(name, "sortable"),
28
- name: "sortable",
29
- value: sortable
30
- }), /*#__PURE__*/ react.createElement(Property, {
31
- id: getId(name, "resizable"),
32
- name: "resizable",
33
- value: resizable
34
- }), /*#__PURE__*/ react.createElement(Property, {
35
- id: getId(name, "truncate"),
36
- name: "truncate",
37
- value: truncate
38
- }), /*#__PURE__*/ react.createElement(Property, {
39
- id: getId(name, "hideable"),
40
- name: "hideable",
41
- value: hideable
42
- }), /*#__PURE__*/ react.createElement(Property, {
43
- id: getId(name, "size"),
44
- name: "size",
45
- value: size
46
- }), /*#__PURE__*/ react.createElement(Property, {
47
- id: getId(name, "visible"),
48
- name: "visible",
49
- value: visible
50
- }), header ? /*#__PURE__*/ react.createElement(Property, {
51
- id: getId(name, "header"),
52
- name: "header",
53
- value: header
54
- }) : null, cell ? /*#__PURE__*/ react.createElement(Property, {
55
- id: getId(name, "cell"),
56
- name: "cell",
57
- value: cell
58
- }) : null, className ? /*#__PURE__*/ react.createElement(Property, {
59
- id: getId(name, "className"),
60
- name: "className",
61
- value: className
62
- }) : null));
63
- };
1
+ import { Column } from "@webiny/app-admin/config/table/Column.js";
64
2
  const isFolderRow = (row)=>"FOLDER" === row.$type;
65
- const Column = Object.assign(BaseColumn, {
66
- isFolderRow: isFolderRow,
67
- createUseTableRow: createUseTableRow
3
+ const Column_Column = Object.assign(Column, {
4
+ isFolderRow: isFolderRow
68
5
  });
69
- export { Column };
6
+ export { Column_Column as Column };
70
7
 
71
8
  //# sourceMappingURL=Column.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config/table/Column.js","sources":["../../../src/config/table/Column.tsx"],"sourcesContent":["import type { ReactElement } from \"react\";\nimport React from \"react\";\nimport { Property, useIdGenerator } from \"@webiny/react-properties\";\nimport { createUseTableRow } from \"~/components/Table/useTableRow.js\";\nimport type { FolderTableRow, TableRow } from \"~/table.types.js\";\n\nexport interface ColumnConfig {\n cell: string | ReactElement;\n className: string;\n header: string | ReactElement;\n hideable: boolean;\n name: string;\n resizable: boolean;\n size: number;\n sortable: boolean;\n truncate: boolean;\n visible: boolean;\n}\n\nexport interface ColumnProps {\n after?: string;\n before?: string;\n cell?: string | ReactElement;\n className?: string;\n truncate?: boolean;\n header?: string | ReactElement;\n hideable?: boolean;\n name: string;\n path?: string;\n remove?: boolean;\n resizable?: boolean;\n size?: number;\n sortable?: boolean;\n visible?: boolean;\n}\n\nconst BaseColumn: React.FC<ColumnProps> = ({\n after = undefined,\n before = undefined,\n cell,\n className = undefined,\n header = undefined,\n hideable = true,\n truncate = true,\n name,\n path = \"\",\n remove = false,\n resizable = true,\n size = 100,\n sortable = false,\n visible = true\n}) => {\n const getId = useIdGenerator(\"tableColumn\");\n\n const placeAfter = after !== undefined ? getId(after) : undefined;\n const placeBefore = before !== undefined ? getId(before) : undefined;\n\n return (\n <Property id=\"table\" name={\"table\"}>\n <Property\n id={getId(name)}\n name={\"columns\"}\n remove={remove}\n array={true}\n before={placeBefore}\n after={placeAfter}\n >\n <Property id={getId(name, \"name\")} name={\"name\"} value={name} />\n <Property id={getId(name, \"path\")} name={\"path\"} value={path} />\n <Property id={getId(name, \"sortable\")} name={\"sortable\"} value={sortable} />\n <Property id={getId(name, \"resizable\")} name={\"resizable\"} value={resizable} />\n <Property id={getId(name, \"truncate\")} name={\"truncate\"} value={truncate} />\n <Property id={getId(name, \"hideable\")} name={\"hideable\"} value={hideable} />\n <Property id={getId(name, \"size\")} name={\"size\"} value={size} />\n <Property id={getId(name, \"visible\")} name={\"visible\"} value={visible} />\n {header ? (\n <Property id={getId(name, \"header\")} name={\"header\"} value={header} />\n ) : null}\n {cell ? <Property id={getId(name, \"cell\")} name={\"cell\"} value={cell} /> : null}\n {className ? (\n <Property id={getId(name, \"className\")} name={\"className\"} value={className} />\n ) : null}\n </Property>\n </Property>\n );\n};\n\nconst isFolderRow = (row: TableRow): row is FolderTableRow => {\n return row.$type === \"FOLDER\";\n};\n\nexport const Column = Object.assign(BaseColumn, { isFolderRow, createUseTableRow });\n"],"names":["BaseColumn","after","before","cell","className","header","hideable","truncate","name","path","remove","resizable","size","sortable","visible","getId","useIdGenerator","placeAfter","undefined","placeBefore","Property","isFolderRow","row","Column","Object","createUseTableRow"],"mappings":";;;AAoCA,MAAMA,aAAoC,CAAC,EACvCC,KAAiB,EACjBC,MAAkB,EAClBC,IAAI,EACJC,SAAqB,EACrBC,MAAkB,EAClBC,WAAW,IAAI,EACfC,WAAW,IAAI,EACfC,IAAI,EACJC,OAAO,EAAE,EACTC,SAAS,KAAK,EACdC,YAAY,IAAI,EAChBC,OAAO,GAAG,EACVC,WAAW,KAAK,EAChBC,UAAU,IAAI,EACjB;IACG,MAAMC,QAAQC,eAAe;IAE7B,MAAMC,aAAahB,AAAUiB,WAAVjB,QAAsBc,MAAMd,SAASiB;IACxD,MAAMC,cAAcjB,AAAWgB,WAAXhB,SAAuBa,MAAMb,UAAUgB;IAE3D,OAAO,WAAP,GACI,oBAACE,UAAQA;QAAC,IAAG;QAAQ,MAAM;qBACvB,oBAACA,UAAQA;QACL,IAAIL,MAAMP;QACV,MAAM;QACN,QAAQE;QACR,OAAO;QACP,QAAQS;QACR,OAAOF;qBAEP,oBAACG,UAAQA;QAAC,IAAIL,MAAMP,MAAM;QAAS,MAAM;QAAQ,OAAOA;sBACxD,oBAACY,UAAQA;QAAC,IAAIL,MAAMP,MAAM;QAAS,MAAM;QAAQ,OAAOC;sBACxD,oBAACW,UAAQA;QAAC,IAAIL,MAAMP,MAAM;QAAa,MAAM;QAAY,OAAOK;sBAChE,oBAACO,UAAQA;QAAC,IAAIL,MAAMP,MAAM;QAAc,MAAM;QAAa,OAAOG;sBAClE,oBAACS,UAAQA;QAAC,IAAIL,MAAMP,MAAM;QAAa,MAAM;QAAY,OAAOD;sBAChE,oBAACa,UAAQA;QAAC,IAAIL,MAAMP,MAAM;QAAa,MAAM;QAAY,OAAOF;sBAChE,oBAACc,UAAQA;QAAC,IAAIL,MAAMP,MAAM;QAAS,MAAM;QAAQ,OAAOI;sBACxD,oBAACQ,UAAQA;QAAC,IAAIL,MAAMP,MAAM;QAAY,MAAM;QAAW,OAAOM;QAC7DT,SAAS,WAATA,GACG,oBAACe,UAAQA;QAAC,IAAIL,MAAMP,MAAM;QAAW,MAAM;QAAU,OAAOH;SAC5D,MACHF,OAAO,WAAPA,GAAO,oBAACiB,UAAQA;QAAC,IAAIL,MAAMP,MAAM;QAAS,MAAM;QAAQ,OAAOL;SAAW,MAC1EC,YAAY,WAAZA,GACG,oBAACgB,UAAQA;QAAC,IAAIL,MAAMP,MAAM;QAAc,MAAM;QAAa,OAAOJ;SAClE;AAIpB;AAEA,MAAMiB,cAAc,CAACC,MACVA,AAAc,aAAdA,IAAI,KAAK;AAGb,MAAMC,SAASC,OAAO,MAAM,CAACxB,YAAY;IAAEqB,aAAAA;IAAaI,mBAAiBA;AAAC"}
1
+ {"version":3,"file":"config/table/Column.js","sources":["../../../src/config/table/Column.tsx"],"sourcesContent":["import { Column as BaseColumn } from \"@webiny/app-admin/config/table/Column.js\";\nimport type { TableRow } from \"~/table.types.js\";\nimport type { FolderTableRow } from \"~/table.types.js\";\n\nexport type { ColumnConfig, ColumnProps } from \"@webiny/app-admin/config/table/Column.js\";\n\nconst isFolderRow = (row: TableRow): row is FolderTableRow => {\n return row.$type === \"FOLDER\";\n};\n\nexport const Column = Object.assign(BaseColumn, { isFolderRow });\n"],"names":["isFolderRow","row","Column","Object","BaseColumn"],"mappings":";AAMA,MAAMA,cAAc,CAACC,MACVA,AAAc,aAAdA,IAAI,KAAK;AAGb,MAAMC,gBAASC,OAAO,MAAM,CAACC,QAAY;IAAEJ,aAAAA;AAAY"}
@@ -1,11 +1,2 @@
1
- import React from "react";
2
- export interface SortingConfig {
3
- field: string;
4
- order: "asc" | "desc";
5
- }
6
- export interface SortingProps {
7
- name: string;
8
- field: string;
9
- order?: "asc" | "desc";
10
- }
11
- export declare const Sorting: ({ name, field, order }: SortingProps) => React.JSX.Element;
1
+ export { Sorting } from "@webiny/app-admin/config/table/Sorting.js";
2
+ export type { SortingConfig, SortingProps } from "@webiny/app-admin/config/table/Sorting.js";
@@ -1,28 +1 @@
1
- import react from "react";
2
- import { Property, useIdGenerator } from "@webiny/react-properties";
3
- const Sorting = ({ name, field, order = "desc" })=>{
4
- const getId = useIdGenerator("tableSorting");
5
- return /*#__PURE__*/ react.createElement(Property, {
6
- id: "table",
7
- name: "table"
8
- }, /*#__PURE__*/ react.createElement(Property, {
9
- id: getId(name),
10
- name: "sorting",
11
- array: true
12
- }, /*#__PURE__*/ react.createElement(Property, {
13
- id: getId(name, "name"),
14
- name: "name",
15
- value: name
16
- }), /*#__PURE__*/ react.createElement(Property, {
17
- id: getId(name, "field"),
18
- name: "field",
19
- value: field
20
- }), /*#__PURE__*/ react.createElement(Property, {
21
- id: getId(name, "order"),
22
- name: "order",
23
- value: order
24
- })));
25
- };
26
- export { Sorting };
27
-
28
- //# sourceMappingURL=Sorting.js.map
1
+ export { Sorting } from "@webiny/app-admin/config/table/Sorting.js";
@@ -5,14 +5,10 @@ export interface TableConfig {
5
5
  sorting: SortingConfig[];
6
6
  }
7
7
  export declare const Table: {
8
- Column: import("react").FC<import("./Column.js").ColumnProps> & {
9
- isFolderRow: (row: import("../../table.types.js").TableRow) => row is import("../../table.types.js").FolderTableRow;
10
- createUseTableRow: <TBaseRow = Record<string, any>>() => {
11
- (): import("../../index.js").TableRowContextData<TBaseRow>;
12
- <TUserRow>(): import("../../index.js").TableRowContextData<TBaseRow & {
13
- data: TUserRow;
14
- }>;
15
- };
8
+ Column: import("react").FC<import("@webiny/app-admin/config/table/Column.js").ColumnProps> & {
9
+ createUseTableRow: typeof import("@webiny/app-admin/index.js").createUseTableRow;
10
+ } & {
11
+ isFolderRow: (row: import("@webiny/app-admin/index.js").TableRow) => row is import("../../table.types.js").FolderTableRow;
16
12
  };
17
- Sorting: ({ name, field, order }: import("./Sorting.js").SortingProps) => import("react").JSX.Element;
13
+ Sorting: ({ name, field, order }: import("@webiny/app-admin/config/table/Sorting.js").SortingProps) => React.JSX.Element;
18
14
  };
@@ -1,4 +1 @@
1
- export { AcoAppProvider as AcoProvider, type AcoAppProviderProps } from "../contexts/app.js";
2
1
  export { FolderProvider, type FolderContext } from "./folder.js";
3
- export { NavigateFolderProvider, type NavigateFolderContext, type NavigateFolderProviderProps } from "./navigateFolder.js";
4
- export { SearchRecordsProvider, type SearchRecordsContext, type ListRecordsParams } from "./records.js";
package/contexts/index.js CHANGED
@@ -1,4 +1 @@
1
- export { AcoAppProvider as AcoProvider } from "./app.js";
2
1
  export { FolderProvider } from "./folder.js";
3
- export { NavigateFolderProvider } from "./navigateFolder.js";
4
- export { SearchRecordsProvider } from "./records.js";
@@ -1 +1 @@
1
- export declare const LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS: import("graphql").DocumentNode;
1
+ export declare const LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS = "\n query ListFolderLevelPermissionsTargets {\n aco {\n listFolderLevelPermissionsTargets {\n data {\n id\n type\n target\n name\n meta\n }\n error {\n code\n data\n message\n }\n }\n }\n }\n";
@@ -1,5 +1,4 @@
1
- import graphql_tag from "graphql-tag";
2
- const LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS = graphql_tag`
1
+ const LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS = `
3
2
  query ListFolderLevelPermissionsTargets {
4
3
  aco {
5
4
  listFolderLevelPermissionsTargets {
@@ -1 +1 @@
1
- {"version":3,"file":"dialogs/DialogSetPermissions/graphql.js","sources":["../../../src/dialogs/DialogSetPermissions/graphql.ts"],"sourcesContent":["import gql from \"graphql-tag\";\n\nexport const LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS = gql`\n query ListFolderLevelPermissionsTargets {\n aco {\n listFolderLevelPermissionsTargets {\n data {\n id\n type\n target\n name\n meta\n }\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n"],"names":["LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS","gql"],"mappings":";AAEO,MAAMA,wCAAwCC,WAAG,CAAC;;;;;;;;;;;;;;;;;;;AAmBzD,CAAC"}
1
+ {"version":3,"file":"dialogs/DialogSetPermissions/graphql.js","sources":["../../../src/dialogs/DialogSetPermissions/graphql.ts"],"sourcesContent":["export const LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS = /* GraphQL */ `\n query ListFolderLevelPermissionsTargets {\n aco {\n listFolderLevelPermissionsTargets {\n data {\n id\n type\n target\n name\n meta\n }\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n"],"names":["LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS"],"mappings":"AAAO,MAAMA,wCAAsD,CAAC;;;;;;;;;;;;;;;;;;;AAmBpE,CAAC"}
@@ -4,7 +4,7 @@ import { Grid, Input } from "@webiny/admin-ui";
4
4
  import { useDialogs, useSnackbar } from "@webiny/app-admin";
5
5
  import { Bind, useForm } from "@webiny/form";
6
6
  import { validation } from "@webiny/validation";
7
- import { Extensions, FolderTree } from "../components/index.js";
7
+ import { FolderTree } from "../components/index.js";
8
8
  import { ROOT_FOLDER } from "../constants.js";
9
9
  import { useCreateFolder } from "../features/folders/createFolder/index.js";
10
10
  import { ParentFolderField } from "./ParentFolderField.js";
@@ -52,7 +52,7 @@ const FormComponent = ({ currentParentId = null })=>{
52
52
  setParentId(folder.id);
53
53
  onChange(folder.id === ROOT_FOLDER ? null : folder.id);
54
54
  }
55
- }))))), /*#__PURE__*/ react.createElement(Extensions, null));
55
+ }))))));
56
56
  };
57
57
  const useCreateDialog = ()=>{
58
58
  const dialogs = useDialogs();
@@ -1 +1 @@
1
- {"version":3,"file":"dialogs/useCreateDialog.js","sources":["../../src/dialogs/useCreateDialog.tsx"],"sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport slugify from \"slugify\";\nimport { Grid, Input } from \"@webiny/admin-ui\";\nimport { useDialogs, useSnackbar } from \"@webiny/app-admin\";\nimport type { GenericFormData } from \"@webiny/form\";\nimport { Bind, useForm } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { Extensions, FolderTree } from \"~/components/index.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { useCreateFolder } from \"~/features/folders/createFolder/index.js\";\nimport { ParentFolderField } from \"./ParentFolderField.js\";\n\ninterface ShowDialogParams {\n currentParentId?: string | null;\n}\n\ninterface UseCreateDialogResponse {\n showDialog: (params?: ShowDialogParams) => void;\n}\n\ninterface FormComponentProps {\n currentParentId?: string | null;\n}\n\nconst FormComponent = ({ currentParentId = null }: FormComponentProps) => {\n const [parentId, setParentId] = useState<string | null>(currentParentId);\n const form = useForm();\n\n const generateSlug = () => {\n if (form.data.slug || !form.data.title) {\n return;\n }\n\n // We want to update slug only when the folder is first being created.\n form.setValue(\n \"slug\",\n slugify(form.data.title, {\n replacement: \"-\",\n lower: true,\n remove: /[*#?<>_{}[\\]+~.()'\"!:;@]/g,\n trim: false\n })\n );\n };\n\n return (\n <>\n <Grid>\n <Grid.Column span={12}>\n <Bind name={\"title\"} validators={validation.create(\"required\")}>\n {bind => (\n <Input\n {...bind}\n label={\"Title\"}\n onBlur={generateSlug}\n size={\"lg\"}\n required\n autoFocus={true}\n />\n )}\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind name={\"slug\"} validators={validation.create(\"required,slug\")}>\n <Input label={\"Slug\"} size={\"lg\"} required />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <ParentFolderField>\n <Bind name={\"parentId\"} defaultValue={parentId}>\n {({ onChange }) => (\n <FolderTree\n focusedFolderId={parentId || ROOT_FOLDER}\n onFolderClick={folder => {\n setParentId(folder.id);\n onChange(folder.id === ROOT_FOLDER ? null : folder.id);\n }}\n />\n )}\n </Bind>\n </ParentFolderField>\n </Grid.Column>\n </Grid>\n <Extensions />\n </>\n );\n};\n\nexport const useCreateDialog = (): UseCreateDialogResponse => {\n const dialogs = useDialogs();\n const { createFolder } = useCreateFolder();\n const { showSnackbar } = useSnackbar();\n\n const onAccept = useCallback(async (data: FolderDto) => {\n try {\n await createFolder({\n ...data,\n parentId: data.parentId === ROOT_FOLDER ? null : data.parentId\n });\n showSnackbar(\"Folder created successfully!\");\n } catch (error) {\n showSnackbar(error.message);\n }\n }, []);\n\n const showDialog = (params?: ShowDialogParams) => {\n const { currentParentId = null } = params ?? {};\n\n dialogs.showDialog({\n title: \"Create a new folder\",\n content: <FormComponent currentParentId={currentParentId} />,\n acceptLabel: \"Create folder\",\n cancelLabel: \"Cancel\",\n loadingLabel: \"Creating folder...\",\n /**\n * We need to cast as there are no generics to pass for the onAccept function.\n */\n onAccept: onAccept as (data: GenericFormData) => Promise<void>\n });\n };\n\n return {\n showDialog\n };\n};\n"],"names":["FormComponent","currentParentId","parentId","setParentId","useState","form","useForm","generateSlug","slugify","Grid","Bind","validation","bind","Input","ParentFolderField","onChange","FolderTree","ROOT_FOLDER","folder","Extensions","useCreateDialog","dialogs","useDialogs","createFolder","useCreateFolder","showSnackbar","useSnackbar","onAccept","useCallback","data","error","showDialog","params"],"mappings":";;;;;;;;;;AAyBA,MAAMA,gBAAgB,CAAC,EAAEC,kBAAkB,IAAI,EAAsB;IACjE,MAAM,CAACC,UAAUC,YAAY,GAAGC,SAAwBH;IACxD,MAAMI,OAAOC;IAEb,MAAMC,eAAe;QACjB,IAAIF,KAAK,IAAI,CAAC,IAAI,IAAI,CAACA,KAAK,IAAI,CAAC,KAAK,EAClC;QAIJA,KAAK,QAAQ,CACT,QACAG,QAAQH,KAAK,IAAI,CAAC,KAAK,EAAE;YACrB,aAAa;YACb,OAAO;YACP,QAAQ;YACR,MAAM;QACV;IAER;IAEA,OAAO,WAAP,GACI,wDACI,oBAACI,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QAAC,MAAM;QAAS,YAAYC,WAAW,MAAM,CAAC;OAC9CC,CAAAA,OAAAA,WAAAA,GACG,oBAACC,OAAKA;YACD,GAAGD,IAAI;YACR,OAAO;YACP,QAAQL;YACR,MAAM;YACN;YACA,WAAW;4BAK3B,oBAACE,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QAAC,MAAM;QAAQ,YAAYC,WAAW,MAAM,CAAC;qBAC9C,oBAACE,OAAKA;QAAC,OAAO;QAAQ,MAAM;QAAM;wBAG1C,oBAACJ,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACK,mBAAiBA,MAAAA,WAAAA,GACd,oBAACJ,MAAIA;QAAC,MAAM;QAAY,cAAcR;OACjC,CAAC,EAAEa,QAAQ,EAAE,iBACV,oBAACC,YAAUA;YACP,iBAAiBd,YAAYe;YAC7B,eAAeC,CAAAA;gBACXf,YAAYe,OAAO,EAAE;gBACrBH,SAASG,OAAO,EAAE,KAAKD,cAAc,OAAOC,OAAO,EAAE;YACzD;8BAOxB,oBAACC,YAAUA;AAGvB;AAEO,MAAMC,kBAAkB;IAC3B,MAAMC,UAAUC;IAChB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IACzB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IAEzB,MAAMC,WAAWC,YAAY,OAAOC;QAChC,IAAI;YACA,MAAMN,aAAa;gBACf,GAAGM,IAAI;gBACP,UAAUA,KAAK,QAAQ,KAAKZ,cAAc,OAAOY,KAAK,QAAQ;YAClE;YACAJ,aAAa;QACjB,EAAE,OAAOK,OAAO;YACZL,aAAaK,MAAM,OAAO;QAC9B;IACJ,GAAG,EAAE;IAEL,MAAMC,aAAa,CAACC;QAChB,MAAM,EAAE/B,kBAAkB,IAAI,EAAE,GAAG+B,UAAU,CAAC;QAE9CX,QAAQ,UAAU,CAAC;YACf,OAAO;YACP,SAAS,WAAT,GAAS,oBAACrB,eAAaA;gBAAC,iBAAiBC;;YACzC,aAAa;YACb,aAAa;YACb,cAAc;YAId,UAAU0B;QACd;IACJ;IAEA,OAAO;QACHI;IACJ;AACJ"}
1
+ {"version":3,"file":"dialogs/useCreateDialog.js","sources":["../../src/dialogs/useCreateDialog.tsx"],"sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport slugify from \"slugify\";\nimport { Grid, Input } from \"@webiny/admin-ui\";\nimport { useDialogs, useSnackbar } from \"@webiny/app-admin\";\nimport type { GenericFormData } from \"@webiny/form\";\nimport { Bind, useForm } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { FolderTree } from \"~/components/index.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { useCreateFolder } from \"~/features/folders/createFolder/index.js\";\nimport { ParentFolderField } from \"./ParentFolderField.js\";\n\ninterface ShowDialogParams {\n currentParentId?: string | null;\n}\n\ninterface UseCreateDialogResponse {\n showDialog: (params?: ShowDialogParams) => void;\n}\n\ninterface FormComponentProps {\n currentParentId?: string | null;\n}\n\nconst FormComponent = ({ currentParentId = null }: FormComponentProps) => {\n const [parentId, setParentId] = useState<string | null>(currentParentId);\n const form = useForm();\n\n const generateSlug = () => {\n if (form.data.slug || !form.data.title) {\n return;\n }\n\n // We want to update slug only when the folder is first being created.\n form.setValue(\n \"slug\",\n slugify(form.data.title, {\n replacement: \"-\",\n lower: true,\n remove: /[*#?<>_{}[\\]+~.()'\"!:;@]/g,\n trim: false\n })\n );\n };\n\n return (\n <>\n <Grid>\n <Grid.Column span={12}>\n <Bind name={\"title\"} validators={validation.create(\"required\")}>\n {bind => (\n <Input\n {...bind}\n label={\"Title\"}\n onBlur={generateSlug}\n size={\"lg\"}\n required\n autoFocus={true}\n />\n )}\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind name={\"slug\"} validators={validation.create(\"required,slug\")}>\n <Input label={\"Slug\"} size={\"lg\"} required />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <ParentFolderField>\n <Bind name={\"parentId\"} defaultValue={parentId}>\n {({ onChange }) => (\n <FolderTree\n focusedFolderId={parentId || ROOT_FOLDER}\n onFolderClick={folder => {\n setParentId(folder.id);\n onChange(folder.id === ROOT_FOLDER ? null : folder.id);\n }}\n />\n )}\n </Bind>\n </ParentFolderField>\n </Grid.Column>\n </Grid>\n </>\n );\n};\n\nexport const useCreateDialog = (): UseCreateDialogResponse => {\n const dialogs = useDialogs();\n const { createFolder } = useCreateFolder();\n const { showSnackbar } = useSnackbar();\n\n const onAccept = useCallback(async (data: FolderDto) => {\n try {\n await createFolder({\n ...data,\n parentId: data.parentId === ROOT_FOLDER ? null : data.parentId\n });\n showSnackbar(\"Folder created successfully!\");\n } catch (error) {\n showSnackbar(error.message);\n }\n }, []);\n\n const showDialog = (params?: ShowDialogParams) => {\n const { currentParentId = null } = params ?? {};\n\n dialogs.showDialog({\n title: \"Create a new folder\",\n content: <FormComponent currentParentId={currentParentId} />,\n acceptLabel: \"Create folder\",\n cancelLabel: \"Cancel\",\n loadingLabel: \"Creating folder...\",\n /**\n * We need to cast as there are no generics to pass for the onAccept function.\n */\n onAccept: onAccept as (data: GenericFormData) => Promise<void>\n });\n };\n\n return {\n showDialog\n };\n};\n"],"names":["FormComponent","currentParentId","parentId","setParentId","useState","form","useForm","generateSlug","slugify","Grid","Bind","validation","bind","Input","ParentFolderField","onChange","FolderTree","ROOT_FOLDER","folder","useCreateDialog","dialogs","useDialogs","createFolder","useCreateFolder","showSnackbar","useSnackbar","onAccept","useCallback","data","error","showDialog","params"],"mappings":";;;;;;;;;;AAyBA,MAAMA,gBAAgB,CAAC,EAAEC,kBAAkB,IAAI,EAAsB;IACjE,MAAM,CAACC,UAAUC,YAAY,GAAGC,SAAwBH;IACxD,MAAMI,OAAOC;IAEb,MAAMC,eAAe;QACjB,IAAIF,KAAK,IAAI,CAAC,IAAI,IAAI,CAACA,KAAK,IAAI,CAAC,KAAK,EAClC;QAIJA,KAAK,QAAQ,CACT,QACAG,QAAQH,KAAK,IAAI,CAAC,KAAK,EAAE;YACrB,aAAa;YACb,OAAO;YACP,QAAQ;YACR,MAAM;QACV;IAER;IAEA,OAAO,WAAP,GACI,wDACI,oBAACI,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QAAC,MAAM;QAAS,YAAYC,WAAW,MAAM,CAAC;OAC9CC,CAAAA,OAAAA,WAAAA,GACG,oBAACC,OAAKA;YACD,GAAGD,IAAI;YACR,OAAO;YACP,QAAQL;YACR,MAAM;YACN;YACA,WAAW;4BAK3B,oBAACE,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QAAC,MAAM;QAAQ,YAAYC,WAAW,MAAM,CAAC;qBAC9C,oBAACE,OAAKA;QAAC,OAAO;QAAQ,MAAM;QAAM;wBAG1C,oBAACJ,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACK,mBAAiBA,MAAAA,WAAAA,GACd,oBAACJ,MAAIA;QAAC,MAAM;QAAY,cAAcR;OACjC,CAAC,EAAEa,QAAQ,EAAE,iBACV,oBAACC,YAAUA;YACP,iBAAiBd,YAAYe;YAC7B,eAAeC,CAAAA;gBACXf,YAAYe,OAAO,EAAE;gBACrBH,SAASG,OAAO,EAAE,KAAKD,cAAc,OAAOC,OAAO,EAAE;YACzD;;AASpC;AAEO,MAAMC,kBAAkB;IAC3B,MAAMC,UAAUC;IAChB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IACzB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IAEzB,MAAMC,WAAWC,YAAY,OAAOC;QAChC,IAAI;YACA,MAAMN,aAAa;gBACf,GAAGM,IAAI;gBACP,UAAUA,KAAK,QAAQ,KAAKX,cAAc,OAAOW,KAAK,QAAQ;YAClE;YACAJ,aAAa;QACjB,EAAE,OAAOK,OAAO;YACZL,aAAaK,MAAM,OAAO;QAC9B;IACJ,GAAG,EAAE;IAEL,MAAMC,aAAa,CAACC;QAChB,MAAM,EAAE9B,kBAAkB,IAAI,EAAE,GAAG8B,UAAU,CAAC;QAE9CX,QAAQ,UAAU,CAAC;YACf,OAAO;YACP,SAAS,WAAT,GAAS,oBAACpB,eAAaA;gBAAC,iBAAiBC;;YACzC,aAAa;YACb,aAAa;YACb,cAAc;YAId,UAAUyB;QACd;IACJ;IAEA,OAAO;QACHI;IACJ;AACJ"}
@@ -3,7 +3,7 @@ import { Grid, Input } from "@webiny/admin-ui";
3
3
  import { useDialogs, useSnackbar } from "@webiny/app-admin";
4
4
  import { Bind } from "@webiny/form";
5
5
  import { validation } from "@webiny/validation";
6
- import { Extensions, FolderTree } from "../components/index.js";
6
+ import { FolderTree } from "../components/index.js";
7
7
  import { ROOT_FOLDER } from "../constants.js";
8
8
  import { useUpdateFolder } from "../features/folders/updateFolder/index.js";
9
9
  import { ParentFolderField } from "./ParentFolderField.js";
@@ -49,7 +49,7 @@ const FormComponent = ({ folder })=>{
49
49
  onChange(folder.id === ROOT_FOLDER ? null : folder.id);
50
50
  },
51
51
  enableCreate: true
52
- }))))), /*#__PURE__*/ react.createElement(Extensions, null));
52
+ }))))));
53
53
  };
54
54
  const useEditDialog = ()=>{
55
55
  const dialog = useDialogs();
@@ -1 +1 @@
1
- {"version":3,"file":"dialogs/useEditDialog.js","sources":["../../src/dialogs/useEditDialog.tsx"],"sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport { Grid, Input } from \"@webiny/admin-ui\";\nimport { useSnackbar, useDialogs } from \"@webiny/app-admin\";\nimport type { GenericFormData } from \"@webiny/form\";\nimport { Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { Extensions, FolderTree } from \"~/components/index.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { useUpdateFolder } from \"~/features/folders/updateFolder/index.js\";\nimport { ParentFolderField } from \"./ParentFolderField.js\";\n\ninterface ShowDialogParams {\n folder: FolderDto;\n}\n\ninterface UseEditDialogResponse {\n showDialog: (params: ShowDialogParams) => void;\n}\n\ninterface FormComponentProps {\n folder: FolderDto;\n}\n\nconst FormComponent = ({ folder }: FormComponentProps) => {\n const [parentId, setParentId] = useState<string | null>(folder.parentId);\n\n return (\n <>\n <Grid>\n <Grid.Column span={12}>\n <Bind\n name={\"title\"}\n defaultValue={folder.title}\n validators={[validation.create(\"required\")]}\n >\n <Input label={\"Title\"} size={\"lg\"} required autoFocus />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name={\"slug\"}\n defaultValue={folder.slug}\n validators={[validation.create(\"required,slug\")]}\n >\n <Input label={\"Slug\"} size={\"lg\"} required />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <ParentFolderField>\n <Bind name={\"parentId\"} defaultValue={parentId}>\n {({ onChange }) => (\n <FolderTree\n focusedFolderId={parentId || ROOT_FOLDER}\n hiddenFolderIds={[folder.id]}\n onFolderClick={folder => {\n setParentId(folder.id);\n onChange(folder.id === ROOT_FOLDER ? null : folder.id);\n }}\n enableCreate={true}\n />\n )}\n </Bind>\n </ParentFolderField>\n </Grid.Column>\n </Grid>\n <Extensions />\n </>\n );\n};\n\nexport const useEditDialog = (): UseEditDialogResponse => {\n const dialog = useDialogs();\n const { updateFolder } = useUpdateFolder();\n const { showSnackbar } = useSnackbar();\n\n const onAccept = useCallback(async (folder: FolderDto, data: GenericFormData) => {\n try {\n await updateFolder({\n ...folder,\n ...data\n });\n showSnackbar(`The folder \"${data.title}\" was updated successfully!`);\n } catch (error) {\n showSnackbar(error.message);\n }\n }, []);\n\n const showDialog = ({ folder }: ShowDialogParams) => {\n dialog.showDialog({\n title: \"Edit folder\",\n content: <FormComponent folder={folder} />,\n formData: folder,\n acceptLabel: \"Edit folder\",\n cancelLabel: \"Cancel\",\n loadingLabel: \"Editing folder...\",\n onAccept: (data: GenericFormData) => onAccept(folder, data)\n });\n };\n\n return {\n showDialog\n };\n};\n"],"names":["FormComponent","folder","parentId","setParentId","useState","Grid","Bind","validation","Input","ParentFolderField","onChange","FolderTree","ROOT_FOLDER","Extensions","useEditDialog","dialog","useDialogs","updateFolder","useUpdateFolder","showSnackbar","useSnackbar","onAccept","useCallback","data","error","showDialog"],"mappings":";;;;;;;;;AAwBA,MAAMA,gBAAgB,CAAC,EAAEC,MAAM,EAAsB;IACjD,MAAM,CAACC,UAAUC,YAAY,GAAGC,SAAwBH,OAAO,QAAQ;IAEvE,OAAO,WAAP,GACI,wDACI,oBAACI,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QACD,MAAM;QACN,cAAcL,OAAO,KAAK;QAC1B,YAAY;YAACM,WAAW,MAAM,CAAC;SAAY;qBAE3C,oBAACC,OAAKA;QAAC,OAAO;QAAS,MAAM;QAAM;QAAS;wBAGpD,oBAACH,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QACD,MAAM;QACN,cAAcL,OAAO,IAAI;QACzB,YAAY;YAACM,WAAW,MAAM,CAAC;SAAiB;qBAEhD,oBAACC,OAAKA;QAAC,OAAO;QAAQ,MAAM;QAAM;wBAG1C,oBAACH,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACI,mBAAiBA,MAAAA,WAAAA,GACd,oBAACH,MAAIA;QAAC,MAAM;QAAY,cAAcJ;OACjC,CAAC,EAAEQ,QAAQ,EAAE,iBACV,oBAACC,YAAUA;YACP,iBAAiBT,YAAYU;YAC7B,iBAAiB;gBAACX,OAAO,EAAE;aAAC;YAC5B,eAAeA,CAAAA;gBACXE,YAAYF,OAAO,EAAE;gBACrBS,SAAST,OAAO,EAAE,KAAKW,cAAc,OAAOX,OAAO,EAAE;YACzD;YACA,cAAc;8BAOtC,oBAACY,YAAUA;AAGvB;AAEO,MAAMC,gBAAgB;IACzB,MAAMC,SAASC;IACf,MAAM,EAAEC,YAAY,EAAE,GAAGC;IACzB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IAEzB,MAAMC,WAAWC,YAAY,OAAOrB,QAAmBsB;QACnD,IAAI;YACA,MAAMN,aAAa;gBACf,GAAGhB,MAAM;gBACT,GAAGsB,IAAI;YACX;YACAJ,aAAa,CAAC,YAAY,EAAEI,KAAK,KAAK,CAAC,2BAA2B,CAAC;QACvE,EAAE,OAAOC,OAAO;YACZL,aAAaK,MAAM,OAAO;QAC9B;IACJ,GAAG,EAAE;IAEL,MAAMC,aAAa,CAAC,EAAExB,MAAM,EAAoB;QAC5Cc,OAAO,UAAU,CAAC;YACd,OAAO;YACP,SAAS,WAAT,GAAS,oBAACf,eAAaA;gBAAC,QAAQC;;YAChC,UAAUA;YACV,aAAa;YACb,aAAa;YACb,cAAc;YACd,UAAU,CAACsB,OAA0BF,SAASpB,QAAQsB;QAC1D;IACJ;IAEA,OAAO;QACHE;IACJ;AACJ"}
1
+ {"version":3,"file":"dialogs/useEditDialog.js","sources":["../../src/dialogs/useEditDialog.tsx"],"sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport { Grid, Input } from \"@webiny/admin-ui\";\nimport { useSnackbar, useDialogs } from \"@webiny/app-admin\";\nimport type { GenericFormData } from \"@webiny/form\";\nimport { Bind } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { FolderTree } from \"~/components/index.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { useUpdateFolder } from \"~/features/folders/updateFolder/index.js\";\nimport { ParentFolderField } from \"./ParentFolderField.js\";\n\ninterface ShowDialogParams {\n folder: FolderDto;\n}\n\ninterface UseEditDialogResponse {\n showDialog: (params: ShowDialogParams) => void;\n}\n\ninterface FormComponentProps {\n folder: FolderDto;\n}\n\nconst FormComponent = ({ folder }: FormComponentProps) => {\n const [parentId, setParentId] = useState<string | null>(folder.parentId);\n\n return (\n <>\n <Grid>\n <Grid.Column span={12}>\n <Bind\n name={\"title\"}\n defaultValue={folder.title}\n validators={[validation.create(\"required\")]}\n >\n <Input label={\"Title\"} size={\"lg\"} required autoFocus />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name={\"slug\"}\n defaultValue={folder.slug}\n validators={[validation.create(\"required,slug\")]}\n >\n <Input label={\"Slug\"} size={\"lg\"} required />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <ParentFolderField>\n <Bind name={\"parentId\"} defaultValue={parentId}>\n {({ onChange }) => (\n <FolderTree\n focusedFolderId={parentId || ROOT_FOLDER}\n hiddenFolderIds={[folder.id]}\n onFolderClick={folder => {\n setParentId(folder.id);\n onChange(folder.id === ROOT_FOLDER ? null : folder.id);\n }}\n enableCreate={true}\n />\n )}\n </Bind>\n </ParentFolderField>\n </Grid.Column>\n </Grid>\n </>\n );\n};\n\nexport const useEditDialog = (): UseEditDialogResponse => {\n const dialog = useDialogs();\n const { updateFolder } = useUpdateFolder();\n const { showSnackbar } = useSnackbar();\n\n const onAccept = useCallback(async (folder: FolderDto, data: GenericFormData) => {\n try {\n await updateFolder({\n ...folder,\n ...data\n });\n showSnackbar(`The folder \"${data.title}\" was updated successfully!`);\n } catch (error) {\n showSnackbar(error.message);\n }\n }, []);\n\n const showDialog = ({ folder }: ShowDialogParams) => {\n dialog.showDialog({\n title: \"Edit folder\",\n content: <FormComponent folder={folder} />,\n formData: folder,\n acceptLabel: \"Edit folder\",\n cancelLabel: \"Cancel\",\n loadingLabel: \"Editing folder...\",\n onAccept: (data: GenericFormData) => onAccept(folder, data)\n });\n };\n\n return {\n showDialog\n };\n};\n"],"names":["FormComponent","folder","parentId","setParentId","useState","Grid","Bind","validation","Input","ParentFolderField","onChange","FolderTree","ROOT_FOLDER","useEditDialog","dialog","useDialogs","updateFolder","useUpdateFolder","showSnackbar","useSnackbar","onAccept","useCallback","data","error","showDialog"],"mappings":";;;;;;;;;AAwBA,MAAMA,gBAAgB,CAAC,EAAEC,MAAM,EAAsB;IACjD,MAAM,CAACC,UAAUC,YAAY,GAAGC,SAAwBH,OAAO,QAAQ;IAEvE,OAAO,WAAP,GACI,wDACI,oBAACI,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QACD,MAAM;QACN,cAAcL,OAAO,KAAK;QAC1B,YAAY;YAACM,WAAW,MAAM,CAAC;SAAY;qBAE3C,oBAACC,OAAKA;QAAC,OAAO;QAAS,MAAM;QAAM;QAAS;wBAGpD,oBAACH,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QACD,MAAM;QACN,cAAcL,OAAO,IAAI;QACzB,YAAY;YAACM,WAAW,MAAM,CAAC;SAAiB;qBAEhD,oBAACC,OAAKA;QAAC,OAAO;QAAQ,MAAM;QAAM;wBAG1C,oBAACH,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACI,mBAAiBA,MAAAA,WAAAA,GACd,oBAACH,MAAIA;QAAC,MAAM;QAAY,cAAcJ;OACjC,CAAC,EAAEQ,QAAQ,EAAE,iBACV,oBAACC,YAAUA;YACP,iBAAiBT,YAAYU;YAC7B,iBAAiB;gBAACX,OAAO,EAAE;aAAC;YAC5B,eAAeA,CAAAA;gBACXE,YAAYF,OAAO,EAAE;gBACrBS,SAAST,OAAO,EAAE,KAAKW,cAAc,OAAOX,OAAO,EAAE;YACzD;YACA,cAAc;;AASlD;AAEO,MAAMY,gBAAgB;IACzB,MAAMC,SAASC;IACf,MAAM,EAAEC,YAAY,EAAE,GAAGC;IACzB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IAEzB,MAAMC,WAAWC,YAAY,OAAOpB,QAAmBqB;QACnD,IAAI;YACA,MAAMN,aAAa;gBACf,GAAGf,MAAM;gBACT,GAAGqB,IAAI;YACX;YACAJ,aAAa,CAAC,YAAY,EAAEI,KAAK,KAAK,CAAC,2BAA2B,CAAC;QACvE,EAAE,OAAOC,OAAO;YACZL,aAAaK,MAAM,OAAO;QAC9B;IACJ,GAAG,EAAE;IAEL,MAAMC,aAAa,CAAC,EAAEvB,MAAM,EAAoB;QAC5Ca,OAAO,UAAU,CAAC;YACd,OAAO;YACP,SAAS,WAAT,GAAS,oBAACd,eAAaA;gBAAC,QAAQC;;YAChC,UAAUA;YACV,aAAa;YACb,aAAa;YACb,cAAc;YACd,UAAU,CAACqB,OAA0BF,SAASnB,QAAQqB;QAC1D;IACJ;IAEA,OAAO;QACHE;IACJ;AACJ"}
@@ -1,5 +1,6 @@
1
- import react, { useCallback, useEffect, useState } from "react";
2
- import { useQuery } from "@apollo/react-hooks";
1
+ import react, { useCallback, useEffect, useMemo, useState } from "react";
2
+ import { useContainer } from "@webiny/app";
3
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
3
4
  import { Grid } from "@webiny/admin-ui";
4
5
  import { useDialogs, useSnackbar } from "@webiny/app-admin";
5
6
  import { useBind } from "@webiny/form";
@@ -9,8 +10,19 @@ import { UsersTeamsSelection } from "./DialogSetPermissions/UsersTeamsSelection.
9
10
  import { LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS } from "./DialogSetPermissions/graphql.js";
10
11
  const FormComponent = ({ folder })=>{
11
12
  const [permissions, setPermissions] = useState(folder.permissions || []);
12
- const listTargetsQuery = useQuery(LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS);
13
- const targetsList = listTargetsQuery.data?.aco.listFolderLevelPermissionsTargets.data || [];
13
+ const container = useContainer();
14
+ const client = useMemo(()=>container.resolve(MainGraphQLClient), [
15
+ container
16
+ ]);
17
+ const [targetsList, setTargetsList] = useState([]);
18
+ useEffect(()=>{
19
+ client.execute({
20
+ query: LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS
21
+ }).then((response)=>{
22
+ const data = response.aco.listFolderLevelPermissionsTargets.data;
23
+ setTargetsList(data || []);
24
+ }).catch(console.error);
25
+ }, []);
14
26
  const bind = useBind({
15
27
  name: "permissions"
16
28
  });
@@ -1 +1 @@
1
- {"version":3,"file":"dialogs/useSetPermissionsDialog.js","sources":["../../src/dialogs/useSetPermissionsDialog.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from \"react\";\nimport { useQuery } from \"@apollo/react-hooks\";\nimport { Grid } from \"@webiny/admin-ui\";\nimport { useDialogs, useSnackbar } from \"@webiny/app-admin\";\nimport type { GenericFormData } from \"@webiny/form\";\nimport { useBind } from \"@webiny/form\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { useUpdateFolder } from \"~/features/folders/updateFolder/index.js\";\nimport { UsersTeamsMultiAutocomplete } from \"./DialogSetPermissions/UsersTeamsMultiAutocomplete.js\";\nimport { UsersTeamsSelection } from \"./DialogSetPermissions/UsersTeamsSelection.js\";\nimport { LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS } from \"./DialogSetPermissions/graphql.js\";\nimport type { FolderLevelPermissionsTarget, FolderPermission } from \"~/types.js\";\n\ninterface ShowDialogParams {\n folder: FolderDto;\n}\n\ninterface UseSetPermissionsDialogResponse {\n showDialog: (params: ShowDialogParams) => void;\n}\n\ninterface FormComponentProps {\n folder: FolderDto;\n}\n\ninterface UpdatePermissionCallableParams {\n permission: FolderPermission;\n}\n\ninterface UpdatePermissionCallable {\n (params: UpdatePermissionCallableParams): void;\n}\n\ninterface RemoveUserTeamCallableParams {\n permission: FolderPermission;\n}\n\ninterface RemoveUserTeamCallable {\n (params: RemoveUserTeamCallableParams): void;\n}\n\nconst FormComponent = ({ folder }: FormComponentProps) => {\n const [permissions, setPermissions] = useState<FolderPermission[]>(folder.permissions || []); // Moved useState outside showDialog\n const listTargetsQuery = useQuery(LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS);\n const targetsList: FolderLevelPermissionsTarget[] =\n listTargetsQuery.data?.aco.listFolderLevelPermissionsTargets.data || [];\n\n const bind = useBind({\n name: \"permissions\"\n });\n\n useEffect(() => {\n bind.onChange(permissions);\n }, [permissions]);\n\n const addPermission = useCallback(\n (value: FolderPermission[\"target\"][]) => {\n const selectedUserOrTeam = value[value.length - 1];\n const newPermission: FolderPermission = {\n target: selectedUserOrTeam,\n level: \"viewer\"\n };\n\n // We want to add the new permission to the 2nd position in the array.\n // The 1st position is reserved for the \"current user\" permission.\n setPermissions([permissions[0], newPermission, ...permissions.slice(1)]);\n },\n [permissions]\n );\n\n const updatePermission = useCallback<UpdatePermissionCallable>(\n ({ permission: updatedPermission }) => {\n setPermissions(\n permissions.map(permission => {\n if (permission.target === updatedPermission.target) {\n return updatedPermission;\n }\n return permission;\n })\n );\n },\n [permissions]\n );\n\n const removeUserTeam = useCallback<RemoveUserTeamCallable>(\n item => {\n setPermissions(\n permissions.filter(permission => permission.target !== item.permission.target)\n );\n },\n [permissions]\n );\n\n return (\n <Grid>\n <Grid.Column span={12}>\n <UsersTeamsMultiAutocomplete\n options={targetsList}\n value={permissions.map(permission => permission.target)}\n onChange={addPermission}\n />\n </Grid.Column>\n <Grid.Column span={12}>\n <UsersTeamsSelection\n permissions={permissions}\n targetsList={targetsList}\n onRemoveAccess={removeUserTeam}\n onUpdatePermission={updatePermission}\n />\n </Grid.Column>\n </Grid>\n );\n};\n\nexport const useSetPermissionsDialog = (): UseSetPermissionsDialogResponse => {\n const dialogs = useDialogs();\n const { updateFolder } = useUpdateFolder();\n const { showSnackbar } = useSnackbar();\n\n const onAccept = useCallback(async (folder: FolderDto, data: Partial<FolderDto>) => {\n const updateData = { ...folder, ...data };\n\n try {\n await updateFolder(updateData);\n showSnackbar(\"Folder permissions updated successfully!\");\n } catch (error) {\n showSnackbar(error.message);\n }\n }, []);\n\n const showDialog = ({ folder }: ShowDialogParams) => {\n dialogs.showDialog({\n title: `Manage permissions - ${folder.title}`,\n content: <FormComponent folder={folder} />,\n acceptLabel: \"Save\",\n cancelLabel: \"Cancel\",\n loadingLabel: \"Updating permissions...\",\n onAccept: (data: GenericFormData) => onAccept(folder, data)\n });\n };\n\n return {\n showDialog\n };\n};\n"],"names":["FormComponent","folder","permissions","setPermissions","useState","listTargetsQuery","useQuery","LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS","targetsList","bind","useBind","useEffect","addPermission","useCallback","value","selectedUserOrTeam","newPermission","updatePermission","updatedPermission","permission","removeUserTeam","item","Grid","UsersTeamsMultiAutocomplete","UsersTeamsSelection","useSetPermissionsDialog","dialogs","useDialogs","updateFolder","useUpdateFolder","showSnackbar","useSnackbar","onAccept","data","updateData","error","showDialog"],"mappings":";;;;;;;;;AAyCA,MAAMA,gBAAgB,CAAC,EAAEC,MAAM,EAAsB;IACjD,MAAM,CAACC,aAAaC,eAAe,GAAGC,SAA6BH,OAAO,WAAW,IAAI,EAAE;IAC3F,MAAMI,mBAAmBC,SAASC;IAClC,MAAMC,cACFH,iBAAiB,IAAI,EAAE,IAAI,kCAAkC,QAAQ,EAAE;IAE3E,MAAMI,OAAOC,QAAQ;QACjB,MAAM;IACV;IAEAC,UAAU;QACNF,KAAK,QAAQ,CAACP;IAClB,GAAG;QAACA;KAAY;IAEhB,MAAMU,gBAAgBC,YAClB,CAACC;QACG,MAAMC,qBAAqBD,KAAK,CAACA,MAAM,MAAM,GAAG,EAAE;QAClD,MAAME,gBAAkC;YACpC,QAAQD;YACR,OAAO;QACX;QAIAZ,eAAe;YAACD,WAAW,CAAC,EAAE;YAAEc;eAAkBd,YAAY,KAAK,CAAC;SAAG;IAC3E,GACA;QAACA;KAAY;IAGjB,MAAMe,mBAAmBJ,YACrB,CAAC,EAAE,YAAYK,iBAAiB,EAAE;QAC9Bf,eACID,YAAY,GAAG,CAACiB,CAAAA;YACZ,IAAIA,WAAW,MAAM,KAAKD,kBAAkB,MAAM,EAC9C,OAAOA;YAEX,OAAOC;QACX;IAER,GACA;QAACjB;KAAY;IAGjB,MAAMkB,iBAAiBP,YACnBQ,CAAAA;QACIlB,eACID,YAAY,MAAM,CAACiB,CAAAA,aAAcA,WAAW,MAAM,KAAKE,KAAK,UAAU,CAAC,MAAM;IAErF,GACA;QAACnB;KAAY;IAGjB,OAAO,WAAP,GACI,oBAACoB,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,6BAA2BA;QACxB,SAASf;QACT,OAAON,YAAY,GAAG,CAACiB,CAAAA,aAAcA,WAAW,MAAM;QACtD,UAAUP;uBAGlB,oBAACU,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACE,qBAAmBA;QAChB,aAAatB;QACb,aAAaM;QACb,gBAAgBY;QAChB,oBAAoBH;;AAKxC;AAEO,MAAMQ,0BAA0B;IACnC,MAAMC,UAAUC;IAChB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IACzB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IAEzB,MAAMC,WAAWnB,YAAY,OAAOZ,QAAmBgC;QACnD,MAAMC,aAAa;YAAE,GAAGjC,MAAM;YAAE,GAAGgC,IAAI;QAAC;QAExC,IAAI;YACA,MAAML,aAAaM;YACnBJ,aAAa;QACjB,EAAE,OAAOK,OAAO;YACZL,aAAaK,MAAM,OAAO;QAC9B;IACJ,GAAG,EAAE;IAEL,MAAMC,aAAa,CAAC,EAAEnC,MAAM,EAAoB;QAC5CyB,QAAQ,UAAU,CAAC;YACf,OAAO,CAAC,qBAAqB,EAAEzB,OAAO,KAAK,EAAE;YAC7C,SAAS,WAAT,GAAS,oBAACD,eAAaA;gBAAC,QAAQC;;YAChC,aAAa;YACb,aAAa;YACb,cAAc;YACd,UAAU,CAACgC,OAA0BD,SAAS/B,QAAQgC;QAC1D;IACJ;IAEA,OAAO;QACHG;IACJ;AACJ"}
1
+ {"version":3,"file":"dialogs/useSetPermissionsDialog.js","sources":["../../src/dialogs/useSetPermissionsDialog.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useContainer } from \"@webiny/app\";\nimport { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport { Grid } from \"@webiny/admin-ui\";\nimport { useDialogs, useSnackbar } from \"@webiny/app-admin\";\nimport type { GenericFormData } from \"@webiny/form\";\nimport { useBind } from \"@webiny/form\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { useUpdateFolder } from \"~/features/folders/updateFolder/index.js\";\nimport { UsersTeamsMultiAutocomplete } from \"./DialogSetPermissions/UsersTeamsMultiAutocomplete.js\";\nimport { UsersTeamsSelection } from \"./DialogSetPermissions/UsersTeamsSelection.js\";\nimport { LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS } from \"./DialogSetPermissions/graphql.js\";\nimport type { FolderLevelPermissionsTarget, FolderPermission } from \"~/types.js\";\n\ninterface ShowDialogParams {\n folder: FolderDto;\n}\n\ninterface UseSetPermissionsDialogResponse {\n showDialog: (params: ShowDialogParams) => void;\n}\n\ninterface FormComponentProps {\n folder: FolderDto;\n}\n\ninterface UpdatePermissionCallableParams {\n permission: FolderPermission;\n}\n\ninterface UpdatePermissionCallable {\n (params: UpdatePermissionCallableParams): void;\n}\n\ninterface RemoveUserTeamCallableParams {\n permission: FolderPermission;\n}\n\ninterface RemoveUserTeamCallable {\n (params: RemoveUserTeamCallableParams): void;\n}\n\ninterface ListFolderPermissionsTargetsResponse {\n aco: {\n listFolderLevelPermissionsTargets: {\n data: FolderLevelPermissionsTarget[] | null;\n error: { code: string; data: unknown; message: string } | null;\n };\n };\n}\n\nconst FormComponent = ({ folder }: FormComponentProps) => {\n const [permissions, setPermissions] = useState<FolderPermission[]>(folder.permissions || []);\n const container = useContainer();\n const client = useMemo(() => container.resolve(MainGraphQLClient), [container]);\n const [targetsList, setTargetsList] = useState<FolderLevelPermissionsTarget[]>([]);\n\n useEffect(() => {\n client\n .execute<ListFolderPermissionsTargetsResponse>({\n query: LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS\n })\n .then(response => {\n const data = response.aco.listFolderLevelPermissionsTargets.data;\n setTargetsList(data || []);\n })\n .catch(console.error);\n }, []);\n\n const bind = useBind({\n name: \"permissions\"\n });\n\n useEffect(() => {\n bind.onChange(permissions);\n }, [permissions]);\n\n const addPermission = useCallback(\n (value: FolderPermission[\"target\"][]) => {\n const selectedUserOrTeam = value[value.length - 1];\n const newPermission: FolderPermission = {\n target: selectedUserOrTeam,\n level: \"viewer\"\n };\n\n setPermissions([permissions[0], newPermission, ...permissions.slice(1)]);\n },\n [permissions]\n );\n\n const updatePermission = useCallback<UpdatePermissionCallable>(\n ({ permission: updatedPermission }) => {\n setPermissions(\n permissions.map(permission => {\n if (permission.target === updatedPermission.target) {\n return updatedPermission;\n }\n return permission;\n })\n );\n },\n [permissions]\n );\n\n const removeUserTeam = useCallback<RemoveUserTeamCallable>(\n item => {\n setPermissions(\n permissions.filter(permission => permission.target !== item.permission.target)\n );\n },\n [permissions]\n );\n\n return (\n <Grid>\n <Grid.Column span={12}>\n <UsersTeamsMultiAutocomplete\n options={targetsList}\n value={permissions.map(permission => permission.target)}\n onChange={addPermission}\n />\n </Grid.Column>\n <Grid.Column span={12}>\n <UsersTeamsSelection\n permissions={permissions}\n targetsList={targetsList}\n onRemoveAccess={removeUserTeam}\n onUpdatePermission={updatePermission}\n />\n </Grid.Column>\n </Grid>\n );\n};\n\nexport const useSetPermissionsDialog = (): UseSetPermissionsDialogResponse => {\n const dialogs = useDialogs();\n const { updateFolder } = useUpdateFolder();\n const { showSnackbar } = useSnackbar();\n\n const onAccept = useCallback(async (folder: FolderDto, data: Partial<FolderDto>) => {\n const updateData = { ...folder, ...data };\n\n try {\n await updateFolder(updateData);\n showSnackbar(\"Folder permissions updated successfully!\");\n } catch (error) {\n showSnackbar(error.message);\n }\n }, []);\n\n const showDialog = ({ folder }: ShowDialogParams) => {\n dialogs.showDialog({\n title: `Manage permissions - ${folder.title}`,\n content: <FormComponent folder={folder} />,\n acceptLabel: \"Save\",\n cancelLabel: \"Cancel\",\n loadingLabel: \"Updating permissions...\",\n onAccept: (data: GenericFormData) => onAccept(folder, data)\n });\n };\n\n return {\n showDialog\n };\n};\n"],"names":["FormComponent","folder","permissions","setPermissions","useState","container","useContainer","client","useMemo","MainGraphQLClient","targetsList","setTargetsList","useEffect","LIST_FOLDER_LEVEL_PERMISSIONS_TARGETS","response","data","console","bind","useBind","addPermission","useCallback","value","selectedUserOrTeam","newPermission","updatePermission","updatedPermission","permission","removeUserTeam","item","Grid","UsersTeamsMultiAutocomplete","UsersTeamsSelection","useSetPermissionsDialog","dialogs","useDialogs","updateFolder","useUpdateFolder","showSnackbar","useSnackbar","onAccept","updateData","error","showDialog"],"mappings":";;;;;;;;;;AAmDA,MAAMA,gBAAgB,CAAC,EAAEC,MAAM,EAAsB;IACjD,MAAM,CAACC,aAAaC,eAAe,GAAGC,SAA6BH,OAAO,WAAW,IAAI,EAAE;IAC3F,MAAMI,YAAYC;IAClB,MAAMC,SAASC,QAAQ,IAAMH,UAAU,OAAO,CAACI,oBAAoB;QAACJ;KAAU;IAC9E,MAAM,CAACK,aAAaC,eAAe,GAAGP,SAAyC,EAAE;IAEjFQ,UAAU;QACNL,OACK,OAAO,CAAuC;YAC3C,OAAOM;QACX,GACC,IAAI,CAACC,CAAAA;YACF,MAAMC,OAAOD,SAAS,GAAG,CAAC,iCAAiC,CAAC,IAAI;YAChEH,eAAeI,QAAQ,EAAE;QAC7B,GACC,KAAK,CAACC,QAAQ,KAAK;IAC5B,GAAG,EAAE;IAEL,MAAMC,OAAOC,QAAQ;QACjB,MAAM;IACV;IAEAN,UAAU;QACNK,KAAK,QAAQ,CAACf;IAClB,GAAG;QAACA;KAAY;IAEhB,MAAMiB,gBAAgBC,YAClB,CAACC;QACG,MAAMC,qBAAqBD,KAAK,CAACA,MAAM,MAAM,GAAG,EAAE;QAClD,MAAME,gBAAkC;YACpC,QAAQD;YACR,OAAO;QACX;QAEAnB,eAAe;YAACD,WAAW,CAAC,EAAE;YAAEqB;eAAkBrB,YAAY,KAAK,CAAC;SAAG;IAC3E,GACA;QAACA;KAAY;IAGjB,MAAMsB,mBAAmBJ,YACrB,CAAC,EAAE,YAAYK,iBAAiB,EAAE;QAC9BtB,eACID,YAAY,GAAG,CAACwB,CAAAA;YACZ,IAAIA,WAAW,MAAM,KAAKD,kBAAkB,MAAM,EAC9C,OAAOA;YAEX,OAAOC;QACX;IAER,GACA;QAACxB;KAAY;IAGjB,MAAMyB,iBAAiBP,YACnBQ,CAAAA;QACIzB,eACID,YAAY,MAAM,CAACwB,CAAAA,aAAcA,WAAW,MAAM,KAAKE,KAAK,UAAU,CAAC,MAAM;IAErF,GACA;QAAC1B;KAAY;IAGjB,OAAO,WAAP,GACI,oBAAC2B,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,6BAA2BA;QACxB,SAASpB;QACT,OAAOR,YAAY,GAAG,CAACwB,CAAAA,aAAcA,WAAW,MAAM;QACtD,UAAUP;uBAGlB,oBAACU,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACE,qBAAmBA;QAChB,aAAa7B;QACb,aAAaQ;QACb,gBAAgBiB;QAChB,oBAAoBH;;AAKxC;AAEO,MAAMQ,0BAA0B;IACnC,MAAMC,UAAUC;IAChB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IACzB,MAAM,EAAEC,YAAY,EAAE,GAAGC;IAEzB,MAAMC,WAAWnB,YAAY,OAAOnB,QAAmBc;QACnD,MAAMyB,aAAa;YAAE,GAAGvC,MAAM;YAAE,GAAGc,IAAI;QAAC;QAExC,IAAI;YACA,MAAMoB,aAAaK;YACnBH,aAAa;QACjB,EAAE,OAAOI,OAAO;YACZJ,aAAaI,MAAM,OAAO;QAC9B;IACJ,GAAG,EAAE;IAEL,MAAMC,aAAa,CAAC,EAAEzC,MAAM,EAAoB;QAC5CgC,QAAQ,UAAU,CAAC;YACf,OAAO,CAAC,qBAAqB,EAAEhC,OAAO,KAAK,EAAE;YAC7C,SAAS,WAAT,GAAS,oBAACD,eAAaA;gBAAC,QAAQC;;YAChC,aAAa;YACb,aAAa;YACb,cAAc;YACd,UAAU,CAACc,OAA0BwB,SAAStC,QAAQc;QAC1D;IACJ;IAEA,OAAO;QACH2B;IACJ;AACJ"}
@@ -1,4 +1,5 @@
1
- import type { CmsIdentity, FolderPermission } from "../../types.js";
1
+ import type { FolderPermission } from "../../types.js";
2
+ import type { CmsIdentity } from "../../types.js";
2
3
  export interface FolderData {
3
4
  id?: string;
4
5
  title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"domain/folder/Folder.js","sources":["../../../src/domain/folder/Folder.ts"],"sourcesContent":["import type { CmsIdentity, FolderPermission } from \"~/types.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\n\nexport interface FolderData {\n id?: string;\n title: string;\n slug: string;\n type: string;\n parentId: string | null;\n path?: string;\n permissions: FolderPermission[];\n hasNonInheritedPermissions?: boolean;\n canManagePermissions?: boolean;\n canManageStructure?: boolean;\n canManageContent?: boolean;\n createdBy?: CmsIdentity;\n createdOn?: string;\n savedBy?: CmsIdentity;\n savedOn?: string;\n modifiedBy?: CmsIdentity | null;\n modifiedOn?: string | null;\n extensions?: Record<string, any>;\n}\n\nexport class Folder {\n public id: string;\n public title: string;\n public slug: string;\n public type: string;\n public parentId: string | null;\n public path: string;\n public permissions: FolderPermission[];\n public hasNonInheritedPermissions?: boolean;\n public canManagePermissions?: boolean;\n public canManageStructure?: boolean;\n public canManageContent?: boolean;\n public createdBy?: CmsIdentity;\n public createdOn?: string;\n public savedBy?: CmsIdentity;\n public savedOn?: string;\n public modifiedBy?: CmsIdentity | null;\n public modifiedOn?: string | null;\n public extensions: Record<string, any>;\n\n protected constructor(folder: FolderData) {\n this.id = folder.id ?? \"\";\n this.title = folder.title;\n this.slug = folder.slug;\n this.type = folder.type;\n this.parentId = folder.parentId;\n this.path = folder.path ?? `${ROOT_FOLDER}/${folder.slug}`;\n this.permissions = folder.permissions;\n this.hasNonInheritedPermissions = folder.hasNonInheritedPermissions;\n this.canManagePermissions = folder.canManagePermissions;\n this.canManageStructure = folder.canManageStructure;\n this.canManageContent = folder.canManageContent;\n this.createdBy = folder.createdBy;\n this.createdOn = folder.createdOn;\n this.savedBy = folder.savedBy;\n this.savedOn = folder.savedOn;\n this.modifiedBy = folder.modifiedBy;\n this.modifiedOn = folder.modifiedOn;\n this.extensions = folder.extensions ?? {};\n }\n\n static create(folder: FolderData) {\n return new Folder(folder);\n }\n}\n"],"names":["Folder","folder","ROOT_FOLDER"],"mappings":";AAwBO,MAAMA;IAoBT,YAAsBC,MAAkB,CAAE;QACtC,IAAI,CAAC,EAAE,GAAGA,OAAO,EAAE,IAAI;QACvB,IAAI,CAAC,KAAK,GAAGA,OAAO,KAAK;QACzB,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI;QACvB,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI;QACvB,IAAI,CAAC,QAAQ,GAAGA,OAAO,QAAQ;QAC/B,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI,IAAI,GAAGC,YAAY,CAAC,EAAED,OAAO,IAAI,EAAE;QAC1D,IAAI,CAAC,WAAW,GAAGA,OAAO,WAAW;QACrC,IAAI,CAAC,0BAA0B,GAAGA,OAAO,0BAA0B;QACnE,IAAI,CAAC,oBAAoB,GAAGA,OAAO,oBAAoB;QACvD,IAAI,CAAC,kBAAkB,GAAGA,OAAO,kBAAkB;QACnD,IAAI,CAAC,gBAAgB,GAAGA,OAAO,gBAAgB;QAC/C,IAAI,CAAC,SAAS,GAAGA,OAAO,SAAS;QACjC,IAAI,CAAC,SAAS,GAAGA,OAAO,SAAS;QACjC,IAAI,CAAC,OAAO,GAAGA,OAAO,OAAO;QAC7B,IAAI,CAAC,OAAO,GAAGA,OAAO,OAAO;QAC7B,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU;QACnC,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU;QACnC,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU,IAAI,CAAC;IAC5C;IAEA,OAAO,OAAOA,MAAkB,EAAE;QAC9B,OAAO,IAAID,OAAOC;IACtB;AACJ"}
1
+ {"version":3,"file":"domain/folder/Folder.js","sources":["../../../src/domain/folder/Folder.ts"],"sourcesContent":["import type { FolderPermission } from \"~/types.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport type { CmsIdentity } from \"~/types.js\";\n\nexport interface FolderData {\n id?: string;\n title: string;\n slug: string;\n type: string;\n parentId: string | null;\n path?: string;\n permissions: FolderPermission[];\n hasNonInheritedPermissions?: boolean;\n canManagePermissions?: boolean;\n canManageStructure?: boolean;\n canManageContent?: boolean;\n createdBy?: CmsIdentity;\n createdOn?: string;\n savedBy?: CmsIdentity;\n savedOn?: string;\n modifiedBy?: CmsIdentity | null;\n modifiedOn?: string | null;\n extensions?: Record<string, any>;\n}\n\nexport class Folder {\n public id: string;\n public title: string;\n public slug: string;\n public type: string;\n public parentId: string | null;\n public path: string;\n public permissions: FolderPermission[];\n public hasNonInheritedPermissions?: boolean;\n public canManagePermissions?: boolean;\n public canManageStructure?: boolean;\n public canManageContent?: boolean;\n public createdBy?: CmsIdentity;\n public createdOn?: string;\n public savedBy?: CmsIdentity;\n public savedOn?: string;\n public modifiedBy?: CmsIdentity | null;\n public modifiedOn?: string | null;\n public extensions: Record<string, any>;\n\n protected constructor(folder: FolderData) {\n this.id = folder.id ?? \"\";\n this.title = folder.title;\n this.slug = folder.slug;\n this.type = folder.type;\n this.parentId = folder.parentId;\n this.path = folder.path ?? `${ROOT_FOLDER}/${folder.slug}`;\n this.permissions = folder.permissions;\n this.hasNonInheritedPermissions = folder.hasNonInheritedPermissions;\n this.canManagePermissions = folder.canManagePermissions;\n this.canManageStructure = folder.canManageStructure;\n this.canManageContent = folder.canManageContent;\n this.createdBy = folder.createdBy;\n this.createdOn = folder.createdOn;\n this.savedBy = folder.savedBy;\n this.savedOn = folder.savedOn;\n this.modifiedBy = folder.modifiedBy;\n this.modifiedOn = folder.modifiedOn;\n this.extensions = folder.extensions ?? {};\n }\n\n static create(folder: FolderData) {\n return new Folder(folder);\n }\n}\n"],"names":["Folder","folder","ROOT_FOLDER"],"mappings":";AAyBO,MAAMA;IAoBT,YAAsBC,MAAkB,CAAE;QACtC,IAAI,CAAC,EAAE,GAAGA,OAAO,EAAE,IAAI;QACvB,IAAI,CAAC,KAAK,GAAGA,OAAO,KAAK;QACzB,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI;QACvB,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI;QACvB,IAAI,CAAC,QAAQ,GAAGA,OAAO,QAAQ;QAC/B,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI,IAAI,GAAGC,YAAY,CAAC,EAAED,OAAO,IAAI,EAAE;QAC1D,IAAI,CAAC,WAAW,GAAGA,OAAO,WAAW;QACrC,IAAI,CAAC,0BAA0B,GAAGA,OAAO,0BAA0B;QACnE,IAAI,CAAC,oBAAoB,GAAGA,OAAO,oBAAoB;QACvD,IAAI,CAAC,kBAAkB,GAAGA,OAAO,kBAAkB;QACnD,IAAI,CAAC,gBAAgB,GAAGA,OAAO,gBAAgB;QAC/C,IAAI,CAAC,SAAS,GAAGA,OAAO,SAAS;QACjC,IAAI,CAAC,SAAS,GAAGA,OAAO,SAAS;QACjC,IAAI,CAAC,OAAO,GAAGA,OAAO,OAAO;QAC7B,IAAI,CAAC,OAAO,GAAGA,OAAO,OAAO;QAC7B,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU;QACnC,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU;QACnC,IAAI,CAAC,UAAU,GAAGA,OAAO,UAAU,IAAI,CAAC;IAC5C;IAEA,OAAO,OAAOA,MAAkB,EAAE;QAC9B,OAAO,IAAID,OAAOC;IACtB;AACJ"}
@@ -1,4 +1,4 @@
1
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
2
2
  import type { FolderDto } from "../../../domain/folder/FolderDto.js";
3
3
  import { FolderModelProvider } from "../../../features/folders/abstractions.js";
4
4
  import type { FolderGatewayDto } from "./abstractions.js";
@@ -15,11 +15,11 @@ export interface CreateFolderResponse {
15
15
  export interface CreateFolderVariables {
16
16
  data: Omit<FolderDto, "id" | "path" | "createdOn" | "createdBy" | "savedOn" | "savedBy" | "modifiedOn" | "modifiedBy" | "hasNonInheritedPermissions" | "canManageContent" | "canManagePermissions" | "canManageStructure">;
17
17
  }
18
- export declare const CREATE_FOLDER: (FOLDER_FIELDS: string) => import("graphql").DocumentNode;
18
+ export declare const CREATE_FOLDER: (FOLDER_FIELDS: string) => string;
19
19
  declare class CreateFolderGqlGatewayImpl implements GatewayAbstraction.Interface {
20
20
  private client;
21
21
  private folderModelProvider;
22
- constructor(client: ApolloClient.Interface, folderModelProvider: FolderModelProvider.Interface);
22
+ constructor(client: MainGraphQLClient.Interface, folderModelProvider: FolderModelProvider.Interface);
23
23
  execute(folder: FolderGatewayDto): Promise<FolderDto>;
24
24
  }
25
25
  export declare const CreateFolderGqlGateway: typeof CreateFolderGqlGatewayImpl & {
@@ -1,21 +1,20 @@
1
- import graphql_tag from "graphql-tag";
2
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
3
2
  import { FolderModelProvider } from "../abstractions.js";
4
3
  import { CreateFolderGateway } from "./abstractions.js";
5
- const CREATE_FOLDER = (FOLDER_FIELDS)=>graphql_tag`
6
- mutation CreateFolder($data: FolderCreateInput!) {
7
- aco {
8
- createFolder(data: $data) {
9
- data ${FOLDER_FIELDS}
10
- error {
11
- code
12
- data
13
- message
14
- }
4
+ const CREATE_FOLDER = (FOLDER_FIELDS)=>`
5
+ mutation CreateFolder($data: FolderCreateInput!) {
6
+ aco {
7
+ createFolder(data: $data) {
8
+ data ${FOLDER_FIELDS}
9
+ error {
10
+ code
11
+ data
12
+ message
15
13
  }
16
14
  }
17
15
  }
18
- `;
16
+ }
17
+ `;
19
18
  class CreateFolderGqlGatewayImpl {
20
19
  constructor(client, folderModelProvider){
21
20
  this.client = client;
@@ -23,8 +22,8 @@ class CreateFolderGqlGatewayImpl {
23
22
  }
24
23
  async execute(folder) {
25
24
  const fields = await this.folderModelProvider.getGraphQLSelection();
26
- const { data: response } = await this.client.mutate({
27
- mutation: CREATE_FOLDER(fields),
25
+ const response = await this.client.execute({
26
+ query: CREATE_FOLDER(fields),
28
27
  variables: {
29
28
  data: {
30
29
  ...folder
@@ -40,7 +39,7 @@ class CreateFolderGqlGatewayImpl {
40
39
  const CreateFolderGqlGateway = CreateFolderGateway.createImplementation({
41
40
  implementation: CreateFolderGqlGatewayImpl,
42
41
  dependencies: [
43
- ApolloClient,
42
+ MainGraphQLClient,
44
43
  FolderModelProvider
45
44
  ]
46
45
  });
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/createFolder/CreateFolderGqlGateway.js","sources":["../../../../src/features/folders/createFolder/CreateFolderGqlGateway.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { ApolloClient } from \"@webiny/app-admin/features/apolloClient/abstraction.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { FolderModelProvider } from \"~/features/folders/abstractions.js\";\nimport type { FolderGatewayDto } from \"./abstractions.js\";\nimport { CreateFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface CreateFolderResponse {\n aco: {\n createFolder: {\n data: FolderDto;\n error: AcoError | null;\n };\n };\n}\n\nexport interface CreateFolderVariables {\n data: Omit<\n FolderDto,\n | \"id\"\n | \"path\"\n | \"createdOn\"\n | \"createdBy\"\n | \"savedOn\"\n | \"savedBy\"\n | \"modifiedOn\"\n | \"modifiedBy\"\n | \"hasNonInheritedPermissions\"\n | \"canManageContent\"\n | \"canManagePermissions\"\n | \"canManageStructure\"\n >;\n}\n\nexport const CREATE_FOLDER = (FOLDER_FIELDS: string) => gql`\n mutation CreateFolder($data: FolderCreateInput!) {\n aco {\n createFolder(data: $data) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n `;\n\nclass CreateFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: ApolloClient.Interface,\n private folderModelProvider: FolderModelProvider.Interface\n ) {}\n\n async execute(folder: FolderGatewayDto) {\n const fields = await this.folderModelProvider.getGraphQLSelection();\n\n const { data: response } = await this.client.mutate<\n CreateFolderResponse,\n CreateFolderVariables\n >({\n mutation: CREATE_FOLDER(fields),\n variables: {\n data: {\n ...folder\n }\n }\n });\n\n if (!response) {\n throw new Error(\"Network error while creating folder.\");\n }\n\n const { data, error } = response.aco.createFolder;\n\n if (!data) {\n throw new Error(error?.message || \"Could not create folder\");\n }\n\n return data;\n }\n}\n\nexport const CreateFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: CreateFolderGqlGatewayImpl,\n dependencies: [ApolloClient, FolderModelProvider]\n});\n"],"names":["CREATE_FOLDER","FOLDER_FIELDS","gql","CreateFolderGqlGatewayImpl","client","folderModelProvider","folder","fields","response","Error","data","error","CreateFolderGqlGateway","GatewayAbstraction","ApolloClient","FolderModelProvider"],"mappings":";;;;AAmCO,MAAMA,gBAAgB,CAACC,gBAA0BC,WAAG,CAAC;;;;yBAInC,EAAED,cAAc;;;;;;;;;IASrC,CAAC;AAEL,MAAME;IACF,YACYC,MAA8B,EAC9BC,mBAAkD,CAC5D;aAFUD,MAAM,GAANA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQC,MAAwB,EAAE;QACpC,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,mBAAmB;QAEjE,MAAM,EAAE,MAAMC,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAGjD;YACE,UAAUR,cAAcO;YACxB,WAAW;gBACP,MAAM;oBACF,GAAGD,MAAM;gBACb;YACJ;QACJ;QAEA,IAAI,CAACE,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,YAAY;QAEjD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAME,yBAAyBC,oBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBV;IAChB,cAAc;QAACW;QAAcC;KAAoB;AACrD"}
1
+ {"version":3,"file":"features/folders/createFolder/CreateFolderGqlGateway.js","sources":["../../../../src/features/folders/createFolder/CreateFolderGqlGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport type { FolderDto } from \"~/domain/folder/FolderDto.js\";\nimport { FolderModelProvider } from \"~/features/folders/abstractions.js\";\nimport type { FolderGatewayDto } from \"./abstractions.js\";\nimport { CreateFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface CreateFolderResponse {\n aco: {\n createFolder: {\n data: FolderDto;\n error: AcoError | null;\n };\n };\n}\n\nexport interface CreateFolderVariables {\n data: Omit<\n FolderDto,\n | \"id\"\n | \"path\"\n | \"createdOn\"\n | \"createdBy\"\n | \"savedOn\"\n | \"savedBy\"\n | \"modifiedOn\"\n | \"modifiedBy\"\n | \"hasNonInheritedPermissions\"\n | \"canManageContent\"\n | \"canManagePermissions\"\n | \"canManageStructure\"\n >;\n}\n\nexport const CREATE_FOLDER = (FOLDER_FIELDS: string) => /* GraphQL */ `\n mutation CreateFolder($data: FolderCreateInput!) {\n aco {\n createFolder(data: $data) {\n data ${FOLDER_FIELDS}\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass CreateFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(\n private client: MainGraphQLClient.Interface,\n private folderModelProvider: FolderModelProvider.Interface\n ) {}\n\n async execute(folder: FolderGatewayDto) {\n const fields = await this.folderModelProvider.getGraphQLSelection();\n\n const response = await this.client.execute<CreateFolderResponse, CreateFolderVariables>({\n query: CREATE_FOLDER(fields),\n variables: {\n data: {\n ...folder\n }\n }\n });\n\n if (!response) {\n throw new Error(\"Network error while creating folder.\");\n }\n\n const { data, error } = response.aco.createFolder;\n\n if (!data) {\n throw new Error(error?.message || \"Could not create folder\");\n }\n\n return data;\n }\n}\n\nexport const CreateFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: CreateFolderGqlGatewayImpl,\n dependencies: [MainGraphQLClient, FolderModelProvider]\n});\n"],"names":["CREATE_FOLDER","FOLDER_FIELDS","CreateFolderGqlGatewayImpl","client","folderModelProvider","folder","fields","response","Error","data","error","CreateFolderGqlGateway","GatewayAbstraction","MainGraphQLClient","FolderModelProvider"],"mappings":";;;AAkCO,MAAMA,gBAAgB,CAACC,gBAAwC,CAAC;;;;qBAIlD,EAAEA,cAAc;;;;;;;;;AASrC,CAAC;AAED,MAAMC;IACF,YACYC,MAAmC,EACnCC,mBAAkD,CAC5D;aAFUD,MAAM,GAANA;aACAC,mBAAmB,GAAnBA;IACT;IAEH,MAAM,QAAQC,MAAwB,EAAE;QACpC,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,mBAAmB;QAEjE,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8C;YACpF,OAAOP,cAAcM;YACrB,WAAW;gBACP,MAAM;oBACF,GAAGD,MAAM;gBACb;YACJ;QACJ;QAEA,IAAI,CAACE,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,YAAY;QAEjD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAME,yBAAyBC,oBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBV;IAChB,cAAc;QAACW;QAAmBC;KAAoB;AAC1D"}
@@ -1,4 +1,4 @@
1
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
2
2
  import { DeleteFolderGateway as GatewayAbstraction } from "./abstractions.js";
3
3
  import type { AcoError } from "../../../types.js";
4
4
  export interface DeleteFolderVariables {
@@ -12,10 +12,10 @@ export interface DeleteFolderResponse {
12
12
  };
13
13
  };
14
14
  }
15
- export declare const DELETE_FOLDER: import("graphql").DocumentNode;
15
+ export declare const DELETE_FOLDER = "\n mutation DeleteFolder($id: ID!) {\n aco {\n deleteFolder(id: $id) {\n data\n error {\n code\n data\n message\n }\n }\n }\n }\n";
16
16
  declare class DeleteFolderGqlGatewayImpl implements GatewayAbstraction.Interface {
17
17
  private client;
18
- constructor(client: ApolloClient.Interface);
18
+ constructor(client: MainGraphQLClient.Interface);
19
19
  execute(id: string): Promise<void>;
20
20
  }
21
21
  export declare const DeleteFolderGqlGateway: typeof DeleteFolderGqlGatewayImpl & {
@@ -1,7 +1,6 @@
1
- import graphql_tag from "graphql-tag";
2
- import { ApolloClient } from "@webiny/app-admin/features/apolloClient/abstraction.js";
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
3
2
  import { DeleteFolderGateway } from "./abstractions.js";
4
- const DELETE_FOLDER = graphql_tag`
3
+ const DELETE_FOLDER = `
5
4
  mutation DeleteFolder($id: ID!) {
6
5
  aco {
7
6
  deleteFolder(id: $id) {
@@ -20,8 +19,8 @@ class DeleteFolderGqlGatewayImpl {
20
19
  this.client = client;
21
20
  }
22
21
  async execute(id) {
23
- const { data: response } = await this.client.mutate({
24
- mutation: DELETE_FOLDER,
22
+ const response = await this.client.execute({
23
+ query: DELETE_FOLDER,
25
24
  variables: {
26
25
  id
27
26
  }
@@ -34,7 +33,7 @@ class DeleteFolderGqlGatewayImpl {
34
33
  const DeleteFolderGqlGateway = DeleteFolderGateway.createImplementation({
35
34
  implementation: DeleteFolderGqlGatewayImpl,
36
35
  dependencies: [
37
- ApolloClient
36
+ MainGraphQLClient
38
37
  ]
39
38
  });
40
39
  export { DELETE_FOLDER, DeleteFolderGqlGateway };
@@ -1 +1 @@
1
- {"version":3,"file":"features/folders/deleteFolder/DeleteFolderGqlGateway.js","sources":["../../../../src/features/folders/deleteFolder/DeleteFolderGqlGateway.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport { ApolloClient } from \"@webiny/app-admin/features/apolloClient/abstraction.js\";\nimport { DeleteFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface DeleteFolderVariables {\n id: string;\n}\n\nexport interface DeleteFolderResponse {\n aco: {\n deleteFolder: {\n data: boolean;\n error: AcoError | null;\n };\n };\n}\n\nexport const DELETE_FOLDER = gql`\n mutation DeleteFolder($id: ID!) {\n aco {\n deleteFolder(id: $id) {\n data\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass DeleteFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: ApolloClient.Interface) {}\n\n async execute(id: string) {\n const { data: response } = await this.client.mutate<\n DeleteFolderResponse,\n DeleteFolderVariables\n >({\n mutation: DELETE_FOLDER,\n variables: {\n id\n }\n });\n\n if (!response) {\n throw new Error(\"Network error while deleting folder\");\n }\n\n const { data, error } = response.aco.deleteFolder;\n\n if (!data) {\n throw new Error(error?.message || \"Could not delete folder\");\n }\n\n return;\n }\n}\n\nexport const DeleteFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: DeleteFolderGqlGatewayImpl,\n dependencies: [ApolloClient]\n});\n"],"names":["DELETE_FOLDER","gql","DeleteFolderGqlGatewayImpl","client","id","response","Error","data","error","DeleteFolderGqlGateway","GatewayAbstraction","ApolloClient"],"mappings":";;;AAkBO,MAAMA,gBAAgBC,WAAG,CAAC;;;;;;;;;;;;;AAajC,CAAC;AAED,MAAMC;IACF,YAAoBC,MAA8B,CAAE;aAAhCA,MAAM,GAANA;IAAiC;IAErD,MAAM,QAAQC,EAAU,EAAE;QACtB,MAAM,EAAE,MAAMC,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAGjD;YACE,UAAUL;YACV,WAAW;gBACPI;YACJ;QACJ;QAEA,IAAI,CAACC,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,YAAY;QAEjD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;IAI1C;AACJ;AAEO,MAAMC,yBAAyBC,oBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBR;IAChB,cAAc;QAACS;KAAa;AAChC"}
1
+ {"version":3,"file":"features/folders/deleteFolder/DeleteFolderGqlGateway.js","sources":["../../../../src/features/folders/deleteFolder/DeleteFolderGqlGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport { DeleteFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface DeleteFolderVariables {\n id: string;\n}\n\nexport interface DeleteFolderResponse {\n aco: {\n deleteFolder: {\n data: boolean;\n error: AcoError | null;\n };\n };\n}\n\nexport const DELETE_FOLDER = /* GraphQL */ `\n mutation DeleteFolder($id: ID!) {\n aco {\n deleteFolder(id: $id) {\n data\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass DeleteFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: MainGraphQLClient.Interface) {}\n\n async execute(id: string) {\n const response = await this.client.execute<DeleteFolderResponse, DeleteFolderVariables>({\n query: DELETE_FOLDER,\n variables: {\n id\n }\n });\n\n if (!response) {\n throw new Error(\"Network error while deleting folder\");\n }\n\n const { data, error } = response.aco.deleteFolder;\n\n if (!data) {\n throw new Error(error?.message || \"Could not delete folder\");\n }\n\n return;\n }\n}\n\nexport const DeleteFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: DeleteFolderGqlGatewayImpl,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["DELETE_FOLDER","DeleteFolderGqlGatewayImpl","client","id","response","Error","data","error","DeleteFolderGqlGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAiBO,MAAMA,gBAA8B,CAAC;;;;;;;;;;;;;AAa5C,CAAC;AAED,MAAMC;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,EAAU,EAAE;QACtB,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8C;YACpF,OAAOJ;YACP,WAAW;gBACPG;YACJ;QACJ;QAEA,IAAI,CAACC,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,YAAY;QAEjD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;IAI1C;AACJ;AAEO,MAAMC,yBAAyBC,oBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBR;IAChB,cAAc;QAACS;KAAkB;AACrC"}