@webiny/app-aco 6.4.11 → 6.6.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Actions/DeleteFolder/DeleteFolder.js +1 -1
- package/components/Actions/DeleteFolder/DeleteFolder.js.map +1 -1
- package/components/AdvancedSearch/AdvancedSearch.d.ts +2 -2
- package/components/AdvancedSearch/QueryBuilderDrawer/QueryBuilderDrawer.d.ts +2 -2
- package/components/AdvancedSearch/domain/Filter.d.ts +1 -1
- package/components/AdvancedSearch/domain/FilterRepositoryFactory.d.ts +2 -2
- package/components/AdvancedSearch/domain/FilterRepositoryFactory.js.map +1 -1
- package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.d.ts +2 -2
- package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.js +9 -10
- package/components/AdvancedSearch/gateways/FiltersGraphQLGateway.js.map +1 -1
- package/components/AdvancedSearch/gateways/filters.gql.d.ts +5 -5
- package/components/AdvancedSearch/gateways/filters.gql.js +5 -6
- package/components/AdvancedSearch/gateways/filters.gql.js.map +1 -1
- package/components/AdvancedSearch/useFilterRepository.js +7 -2
- package/components/AdvancedSearch/useFilterRepository.js.map +1 -1
- package/components/FolderTree/List/List.js +6 -14
- package/components/FolderTree/List/List.js.map +1 -1
- package/components/Table/cells/CellAuthor.d.ts +2 -0
- package/components/Table/cells/CellAuthor.js +10 -0
- package/components/Table/cells/CellAuthor.js.map +1 -0
- package/components/Table/cells/CellCreated.d.ts +2 -0
- package/components/Table/cells/CellCreated.js +13 -0
- package/components/Table/cells/CellCreated.js.map +1 -0
- package/components/Table/cells/CellModified.d.ts +2 -0
- package/components/Table/cells/CellModified.js +13 -0
- package/components/Table/cells/CellModified.js.map +1 -0
- package/components/Table/cells/index.d.ts +3 -0
- package/components/Table/cells/index.js +3 -0
- package/components/Table/components/Table/TableInner.d.ts +2 -2
- package/components/Table/createTableData.d.ts +7 -5
- package/components/Table/createTableData.js +22 -7
- package/components/Table/createTableData.js.map +1 -1
- package/components/Table/index.d.ts +2 -2
- package/components/Table/index.js +2 -2
- package/components/index.d.ts +0 -1
- package/components/index.js +0 -1
- package/config/AcoConfig.d.ts +8 -12
- package/config/advanced-search/FieldRenderer.d.ts +3 -1
- package/config/folder/Action.d.ts +1 -1
- package/config/folder/index.d.ts +3 -2
- package/config/index.d.ts +0 -1
- package/config/index.js +0 -1
- package/config/record/Action.d.ts +1 -1
- package/config/record/index.d.ts +1 -1
- package/config/table/Column.d.ts +8 -39
- package/config/table/Column.js +4 -67
- package/config/table/Column.js.map +1 -1
- package/config/table/Sorting.d.ts +2 -11
- package/config/table/Sorting.js +1 -28
- package/config/table/index.d.ts +5 -9
- package/contexts/index.d.ts +0 -3
- package/contexts/index.js +0 -3
- package/dialogs/DialogSetPermissions/graphql.d.ts +1 -1
- package/dialogs/DialogSetPermissions/graphql.js +1 -2
- package/dialogs/DialogSetPermissions/graphql.js.map +1 -1
- package/dialogs/useConfirmMoveFolderDialog.d.ts +0 -1
- package/dialogs/useConfirmMoveFolderDialog.js +2 -3
- package/dialogs/useConfirmMoveFolderDialog.js.map +1 -1
- package/dialogs/useCreateDialog.js +5 -9
- package/dialogs/useCreateDialog.js.map +1 -1
- package/dialogs/useEditDialog.js +2 -2
- package/dialogs/useEditDialog.js.map +1 -1
- package/dialogs/useSetPermissionsDialog.js +16 -4
- package/dialogs/useSetPermissionsDialog.js.map +1 -1
- package/domain/folder/Folder.d.ts +2 -1
- package/domain/folder/Folder.js.map +1 -1
- package/features/folders/createFolder/CreateFolderGqlGateway.d.ts +3 -3
- package/features/folders/createFolder/CreateFolderGqlGateway.js +15 -16
- package/features/folders/createFolder/CreateFolderGqlGateway.js.map +1 -1
- package/features/folders/deleteFolder/DeleteFolderGqlGateway.d.ts +3 -3
- package/features/folders/deleteFolder/DeleteFolderGqlGateway.js +5 -6
- package/features/folders/deleteFolder/DeleteFolderGqlGateway.js.map +1 -1
- package/features/folders/folderModelProvider/FolderModelProvider.js +29 -31
- package/features/folders/folderModelProvider/FolderModelProvider.js.map +1 -1
- package/features/folders/folderModelProvider/GetFolderModelGqlGateway.d.ts +3 -3
- package/features/folders/folderModelProvider/GetFolderModelGqlGateway.js +5 -7
- package/features/folders/folderModelProvider/GetFolderModelGqlGateway.js.map +1 -1
- package/features/folders/getFolder/GetFolderGqlGateway.d.ts +3 -3
- package/features/folders/getFolder/GetFolderGqlGateway.js +5 -7
- package/features/folders/getFolder/GetFolderGqlGateway.js.map +1 -1
- package/features/folders/getFolderExtensionsFields/GetFolderExtensionsFieldsUseCase.d.ts +3 -3
- package/features/folders/getFolderExtensionsFields/useFolderExtensionsFields.d.ts +3 -3
- package/features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.js +12 -16
- package/features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.js.map +1 -1
- package/features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.d.ts +3 -3
- package/features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.js +5 -5
- package/features/folders/getFolderLevelPermission/decorators/GetFolderLevelPermissionWithFlpDecorator.js.map +1 -1
- package/features/folders/listFolders/ListFoldersGqlGateway.d.ts +1 -1
- package/features/folders/listFolders/ListFoldersGqlGateway.js +1 -2
- package/features/folders/listFolders/ListFoldersGqlGateway.js.map +1 -1
- package/features/folders/listFolders/useListFolders.d.ts +1 -1
- package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.d.ts +3 -3
- package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.js +5 -7
- package/features/folders/listFoldersByParentIds/ListFoldersByParentIdsGqlGateway.js.map +1 -1
- package/features/folders/listFoldersByParentIds/useListFoldersByParentIds.d.ts +2 -2
- package/features/folders/loadFolderHierarchy/useLoadFolderHierarchy.d.ts +2 -2
- package/features/folders/updateFolder/UpdateFolderGqlGateway.d.ts +3 -3
- package/features/folders/updateFolder/UpdateFolderGqlGateway.js +5 -6
- package/features/folders/updateFolder/UpdateFolderGqlGateway.js.map +1 -1
- package/hooks/index.d.ts +0 -6
- package/hooks/index.js +0 -6
- package/index.d.ts +3 -2
- package/index.js +2 -2
- package/package.json +21 -28
- package/presentation/folderTree/FolderTreePresenter.d.ts +3 -1
- package/presentation/folderTree/FolderTreePresenter.js +15 -23
- package/presentation/folderTree/FolderTreePresenter.js.map +1 -1
- package/presentation/folderTree/FolderTreePresenter.test.js +8 -2
- package/presentation/folderTree/FolderTreePresenter.test.js.map +1 -1
- package/table.types.d.ts +2 -9
- package/types.d.ts +5 -26
- package/types.js.map +1 -1
- package/components/Extensions/Extensions.d.ts +0 -2
- package/components/Extensions/Extensions.js +0 -30
- package/components/Extensions/Extensions.js.map +0 -1
- package/components/Extensions/index.d.ts +0 -1
- package/components/Extensions/index.js +0 -1
- package/config/folder/createFolderFieldDecoratorFactory.d.ts +0 -13
- package/config/folder/createFolderFieldDecoratorFactory.js +0 -17
- package/config/folder/createFolderFieldDecoratorFactory.js.map +0 -1
- package/config/table/Sorting.js.map +0 -1
- package/contexts/acoList.d.ts +0 -49
- package/contexts/acoList.js +0 -303
- package/contexts/acoList.js.map +0 -1
- package/contexts/app.d.ts +0 -33
- package/contexts/app.js +0 -47
- package/contexts/app.js.map +0 -1
- package/contexts/folders.d.ts +0 -12
- package/contexts/folders.js +0 -32
- package/contexts/folders.js.map +0 -1
- package/contexts/navigateFolder.d.ts +0 -17
- package/contexts/navigateFolder.js +0 -54
- package/contexts/navigateFolder.js.map +0 -1
- package/contexts/records.d.ts +0 -31
- package/contexts/records.js +0 -316
- package/contexts/records.js.map +0 -1
- package/exports/admin/aco.d.ts +0 -2
- package/exports/admin/aco.js +0 -2
- package/graphql/app.gql.d.ts +0 -17
- package/graphql/app.gql.js +0 -22
- package/graphql/app.gql.js.map +0 -1
- package/graphql/records/common.d.ts +0 -4
- package/graphql/records/common.js +0 -57
- package/graphql/records/common.js.map +0 -1
- package/graphql/records/getRecord.d.ts +0 -2
- package/graphql/records/getRecord.js +0 -5
- package/graphql/records/getRecord.js.map +0 -1
- package/graphql/records/listRecords.d.ts +0 -2
- package/graphql/records/listRecords.js +0 -26
- package/graphql/records/listRecords.js.map +0 -1
- package/graphql/records/moveRecord.d.ts +0 -2
- package/graphql/records/moveRecord.js +0 -16
- package/graphql/records/moveRecord.js.map +0 -1
- package/graphql/records/types.d.ts +0 -108
- package/graphql/records/types.js +0 -0
- package/graphql/records.gql.d.ts +0 -3
- package/graphql/records.gql.js +0 -3
- package/handlers.d.ts +0 -23
- package/handlers.js +0 -22
- package/handlers.js.map +0 -1
- package/hooks/useAcoApp.d.ts +0 -2
- package/hooks/useAcoApp.js +0 -16
- package/hooks/useAcoApp.js.map +0 -1
- package/hooks/useAcoList.d.ts +0 -3
- package/hooks/useAcoList.js +0 -10
- package/hooks/useAcoList.js.map +0 -1
- package/hooks/useFolderModel.d.ts +0 -2
- package/hooks/useFolderModel.js +0 -16
- package/hooks/useFolderModel.js.map +0 -1
- package/hooks/useFoldersType.d.ts +0 -1
- package/hooks/useFoldersType.js +0 -12
- package/hooks/useFoldersType.js.map +0 -1
- package/hooks/useNavigateFolder.d.ts +0 -2
- package/hooks/useNavigateFolder.js +0 -10
- package/hooks/useNavigateFolder.js.map +0 -1
- package/hooks/useRecords.d.ts +0 -62
- package/hooks/useRecords.js +0 -64
- package/hooks/useRecords.js.map +0 -1
- package/hooks/useTags.d.ts +0 -14
- package/hooks/useTags.js +0 -27
- package/hooks/useTags.js.map +0 -1
- package/sorting.d.ts +0 -9
- package/sorting.js +0 -31
- package/sorting.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain/folder/Folder.js","sources":["../../../src/domain/folder/Folder.ts"],"sourcesContent":["import type {
|
|
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 {
|
|
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) =>
|
|
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:
|
|
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
|
|
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)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
27
|
-
|
|
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
|
-
|
|
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
|
|
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 {
|
|
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:
|
|
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:
|
|
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
|
|
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 =
|
|
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
|
|
24
|
-
|
|
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
|
-
|
|
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
|
|
1
|
+
{"version":3,"file":"features/folders/deleteFolder/DeleteFolderGqlGateway.js","sources":["../../../../src/features/folders/deleteFolder/DeleteFolderGqlGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport { DeleteFolderGateway as GatewayAbstraction } from \"./abstractions.js\";\nimport type { AcoError } from \"~/types.js\";\n\nexport interface DeleteFolderVariables {\n id: string;\n}\n\nexport interface DeleteFolderResponse {\n aco: {\n deleteFolder: {\n data: boolean;\n error: AcoError | null;\n };\n };\n}\n\nexport const DELETE_FOLDER = /* GraphQL */ `\n mutation DeleteFolder($id: ID!) {\n aco {\n deleteFolder(id: $id) {\n data\n error {\n code\n data\n message\n }\n }\n }\n }\n`;\n\nclass DeleteFolderGqlGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private client: MainGraphQLClient.Interface) {}\n\n async execute(id: string) {\n const response = await this.client.execute<DeleteFolderResponse, DeleteFolderVariables>({\n query: DELETE_FOLDER,\n variables: {\n id\n }\n });\n\n if (!response) {\n throw new Error(\"Network error while deleting folder\");\n }\n\n const { data, error } = response.aco.deleteFolder;\n\n if (!data) {\n throw new Error(error?.message || \"Could not delete folder\");\n }\n\n return;\n }\n}\n\nexport const DeleteFolderGqlGateway = GatewayAbstraction.createImplementation({\n implementation: DeleteFolderGqlGatewayImpl,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["DELETE_FOLDER","DeleteFolderGqlGatewayImpl","client","id","response","Error","data","error","DeleteFolderGqlGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAiBO,MAAMA,gBAA8B,CAAC;;;;;;;;;;;;;AAa5C,CAAC;AAED,MAAMC;IACF,YAAoBC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAE1D,MAAM,QAAQC,EAAU,EAAE;QACtB,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8C;YACpF,OAAOJ;YACP,WAAW;gBACPG;YACJ;QACJ;QAEA,IAAI,CAACC,UACD,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGH,SAAS,GAAG,CAAC,YAAY;QAEjD,IAAI,CAACE,MACD,MAAM,IAAID,MAAME,OAAO,WAAW;IAI1C;AACJ;AAEO,MAAMC,yBAAyBC,oBAAAA,oBAAuC,CAAC;IAC1E,gBAAgBR;IAChB,cAAc;QAACS;KAAkB;AACrC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createFieldsList } from "@webiny/app-headless-cms-common";
|
|
2
1
|
import { GetFolderModelRepository } from "./abstractions.js";
|
|
3
2
|
import { FolderModelProvider } from "../abstractions.js";
|
|
4
3
|
class FolderModelProviderImpl {
|
|
@@ -13,38 +12,37 @@ class FolderModelProviderImpl {
|
|
|
13
12
|
}
|
|
14
13
|
async getGraphQLSelection() {
|
|
15
14
|
const model = await this.getModel();
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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 {
|
|
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
|
|
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:
|
|
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
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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
|
|
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 {
|
|
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) =>
|
|
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:
|
|
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
|
|
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)
|
|
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
|
|
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
|
-
|
|
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
|
|
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/
|
|
18
|
-
listValidation?: import("@webiny/app-headless-cms-common/types/
|
|
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
|
-
}
|
|
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/
|
|
13
|
-
listValidation?: import("@webiny/app-headless-cms-common/types/
|
|
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
|
-
}
|
|
20
|
+
};
|
|
21
21
|
tags?: string[];
|
|
22
22
|
rules?: import("@webiny/app-headless-cms-common/types/model.js").FieldRule[];
|
|
23
23
|
}[];
|
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { Container } from "@webiny/di";
|
|
3
|
-
import { createTestWcpLicense } from "@webiny/wcp/testing/createTestWcpLicense.js";
|
|
4
3
|
import { ListCache } from "../cache/index.js";
|
|
5
4
|
import { FoldersCache, FoldersContext } from "../abstractions.js";
|
|
6
5
|
import { GetFolderLevelPermissionFeature } from "./feature.js";
|
|
7
6
|
import { GetFolderLevelPermissionUseCase } from "./abstractions.js";
|
|
8
|
-
import {
|
|
7
|
+
import { FeatureFlagsService } from "@webiny/app-admin/features/featureFlags/abstractions.js";
|
|
9
8
|
import { Folder } from "../../../domain/folder/Folder.js";
|
|
10
|
-
import {
|
|
11
|
-
class
|
|
9
|
+
import { FeatureFlags } from "@webiny/feature-flags";
|
|
10
|
+
class FeatureFlagsServiceMock {
|
|
12
11
|
constructor(flpEnabled){
|
|
13
|
-
this.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return this.license.canUseFeature(featureName);
|
|
12
|
+
this.flags = new FeatureFlags({
|
|
13
|
+
advancedAccessControlLayer: flpEnabled ? {
|
|
14
|
+
folderLevelPermissions: true
|
|
15
|
+
} : false
|
|
16
|
+
});
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
return this.
|
|
18
|
+
getFlags() {
|
|
19
|
+
return this.flags;
|
|
22
20
|
}
|
|
23
21
|
isLoaded() {
|
|
24
22
|
return true;
|
|
25
23
|
}
|
|
26
|
-
|
|
27
|
-
return Promise.resolve(void 0);
|
|
28
|
-
}
|
|
24
|
+
async loadFlags() {}
|
|
29
25
|
}
|
|
30
26
|
describe("GetFolderLevelPermission", ()=>{
|
|
31
27
|
const type = "abc";
|
|
@@ -70,7 +66,7 @@ describe("GetFolderLevelPermission", ()=>{
|
|
|
70
66
|
type
|
|
71
67
|
})
|
|
72
68
|
]);
|
|
73
|
-
container.registerInstance(
|
|
69
|
+
container.registerInstance(FeatureFlagsService, new FeatureFlagsServiceMock(flpEnabled));
|
|
74
70
|
container.registerInstance(FoldersContext, {
|
|
75
71
|
type
|
|
76
72
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.js","sources":["../../../../src/features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.ts"],"sourcesContent":["import { describe, it, expect } from \"vitest\";\nimport { Container } from \"@webiny/di\";\nimport {
|
|
1
|
+
{"version":3,"file":"features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.js","sources":["../../../../src/features/folders/getFolderLevelPermission/GetFolderLevelPermission.test.ts"],"sourcesContent":["import { describe, it, expect } from \"vitest\";\nimport { Container } from \"@webiny/di\";\nimport { ListCache } from \"~/features/folders/cache/index.js\";\nimport { FoldersContext } from \"~/features/folders/abstractions.js\";\nimport { FoldersCache } from \"~/features/folders/abstractions.js\";\nimport { GetFolderLevelPermissionFeature } from \"~/features/folders/getFolderLevelPermission/feature.js\";\nimport { GetFolderLevelPermissionUseCase } from \"~/features/folders/getFolderLevelPermission/abstractions.js\";\nimport { FeatureFlagsService } from \"@webiny/app-admin/features/featureFlags/abstractions.js\";\nimport { Folder } from \"~/domain/folder/Folder.js\";\nimport { FeatureFlags } from \"@webiny/feature-flags\";\n\nclass FeatureFlagsServiceMock implements FeatureFlagsService.Interface {\n private readonly flags: FeatureFlags;\n\n constructor(flpEnabled: boolean) {\n this.flags = new FeatureFlags({\n advancedAccessControlLayer: flpEnabled ? { folderLevelPermissions: true } : false\n });\n }\n\n getFlags(): FeatureFlags {\n return this.flags;\n }\n\n isLoaded(): boolean {\n return true;\n }\n\n async loadFlags(): Promise<void> {}\n}\n\ndescribe(\"GetFolderLevelPermission\", () => {\n const type = \"abc\";\n\n function setupTest(params: { flpEnabled: boolean }) {\n const { flpEnabled } = params;\n const container = new Container();\n const foldersCache = new ListCache<Folder>();\n\n foldersCache.addItems([\n Folder.create({\n id: \"folder-canManageContent\",\n title: \"Folder canManageContent\",\n slug: \"folder-canManageContent\",\n parentId: null,\n permissions: [],\n canManageContent: true,\n type\n }),\n Folder.create({\n id: \"folder-canManageStructure\",\n title: \"Folder canManageStructure\",\n slug: \"folder-canManageStructure\",\n parentId: null,\n permissions: [],\n canManageStructure: true,\n type\n }),\n Folder.create({\n id: \"folder-canManagePermissions\",\n title: \"Folder canManagePermissions3\",\n slug: \"folder-canManagePermissions\",\n parentId: null,\n permissions: [],\n canManagePermissions: true,\n type\n }),\n Folder.create({\n id: \"folder-no-permissions\",\n title: \"Folder No Permissions\",\n slug: \"folder-no-permissions\",\n parentId: null,\n permissions: [],\n type\n })\n ]);\n\n container.registerInstance(FeatureFlagsService, new FeatureFlagsServiceMock(flpEnabled));\n container.registerInstance(FoldersContext, { type });\n container.registerInstance(FoldersCache, foldersCache);\n\n GetFolderLevelPermissionFeature.register(container);\n\n return {\n container,\n foldersCache,\n useCase: container.resolve(GetFolderLevelPermissionUseCase)\n };\n }\n\n it(\"should return true in case a specific permission is set at folder level and FLP is enabled\", async () => {\n const { useCase } = setupTest({ flpEnabled: true });\n\n // canManagePermissions\n {\n const result = useCase.execute(\"folder-canManagePermissions\", \"canManagePermissions\");\n expect(result).toBe(true);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"folder-canManageStructure\", \"canManageStructure\");\n expect(result).toBe(true);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"folder-canManageContent\", \"canManageContent\");\n\n expect(result).toBe(true);\n }\n });\n\n it(\"should return false in case a specific permission is not set at folder level and FLP is enabled\", async () => {\n const { useCase } = setupTest({ flpEnabled: true });\n // canManagePermissions\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManagePermissions\");\n expect(result).toBe(false);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManageStructure\");\n\n expect(result).toBe(false);\n }\n\n // canManageContent\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManageContent\");\n\n expect(result).toBe(false);\n }\n });\n\n it(\"should return always false in case the folder is not found\", async () => {\n const { useCase } = setupTest({ flpEnabled: true });\n\n // canManagePermissions\n {\n const result = useCase.execute(\"not-existing-folder\", \"canManagePermissions\");\n\n expect(result).toBe(false);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"not-existing-folder\", \"canManageStructure\");\n\n expect(result).toBe(false);\n }\n\n // canManageContent\n {\n const result = useCase.execute(\"not-existing-folder\", \"canManageContent\");\n\n expect(result).toBe(false);\n }\n });\n\n it(\"should return always true in case FLP is not enabled\", async () => {\n const { useCase } = setupTest({ flpEnabled: false });\n\n // canManagePermissions\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManagePermissions\");\n\n expect(result).toBe(true);\n }\n\n // canManageStructure\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManageStructure\");\n\n expect(result).toBe(true);\n }\n\n // canManageContent\n {\n const result = useCase.execute(\"folder-no-permissions\", \"canManageContent\");\n\n expect(result).toBe(true);\n }\n });\n});\n"],"names":["FeatureFlagsServiceMock","flpEnabled","FeatureFlags","describe","type","setupTest","params","container","Container","foldersCache","ListCache","Folder","FeatureFlagsService","FoldersContext","FoldersCache","GetFolderLevelPermissionFeature","GetFolderLevelPermissionUseCase","it","useCase","result","expect"],"mappings":"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"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { FolderPermissionName } from "../../../../features/folders/abstractions.js";
|
|
2
2
|
import { FoldersCache } from "../../../../features/folders/abstractions.js";
|
|
3
3
|
import { GetFolderLevelPermissionUseCase as UseCaseAbstraction } from "../abstractions.js";
|
|
4
|
-
import {
|
|
4
|
+
import { FeatureFlagsService } from "@webiny/app-admin/features/featureFlags/abstractions.js";
|
|
5
5
|
declare class GetFolderLevelPermissionWithFlpDecoratorImpl implements UseCaseAbstraction.Interface {
|
|
6
6
|
private cache;
|
|
7
|
-
private
|
|
7
|
+
private featureFlagsService;
|
|
8
8
|
private decoratee;
|
|
9
|
-
constructor(cache: FoldersCache.Interface,
|
|
9
|
+
constructor(cache: FoldersCache.Interface, featureFlagsService: FeatureFlagsService.Interface, decoratee: UseCaseAbstraction.Interface);
|
|
10
10
|
execute(id: string, permissionName: FolderPermissionName): boolean;
|
|
11
11
|
}
|
|
12
12
|
export declare const GetFolderLevelPermissionWithFlpDecorator: typeof GetFolderLevelPermissionWithFlpDecoratorImpl & {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { FoldersCache } from "../../abstractions.js";
|
|
2
2
|
import { GetFolderLevelPermissionUseCase } from "../abstractions.js";
|
|
3
|
-
import {
|
|
3
|
+
import { FeatureFlagsService } from "@webiny/app-admin/features/featureFlags/abstractions.js";
|
|
4
4
|
class GetFolderLevelPermissionWithFlpDecoratorImpl {
|
|
5
|
-
constructor(cache,
|
|
5
|
+
constructor(cache, featureFlagsService, decoratee){
|
|
6
6
|
this.cache = cache;
|
|
7
|
-
this.
|
|
7
|
+
this.featureFlagsService = featureFlagsService;
|
|
8
8
|
this.decoratee = decoratee;
|
|
9
9
|
}
|
|
10
10
|
execute(id, permissionName) {
|
|
11
|
-
if (!this.
|
|
11
|
+
if (!this.featureFlagsService.getFlags().isEnabled("advancedAccessControlLayer.folderLevelPermissions")) return this.decoratee.execute(id, permissionName);
|
|
12
12
|
const folder = this.cache.getItem((folder)=>folder.id === id);
|
|
13
13
|
if (!folder) return false;
|
|
14
14
|
return folder[permissionName] ?? false;
|
|
@@ -18,7 +18,7 @@ const GetFolderLevelPermissionWithFlpDecorator = GetFolderLevelPermissionUseCase
|
|
|
18
18
|
decorator: GetFolderLevelPermissionWithFlpDecoratorImpl,
|
|
19
19
|
dependencies: [
|
|
20
20
|
FoldersCache,
|
|
21
|
-
|
|
21
|
+
FeatureFlagsService
|
|
22
22
|
]
|
|
23
23
|
});
|
|
24
24
|
export { GetFolderLevelPermissionWithFlpDecorator };
|