@webiny/api-aco 0.0.0-unstable.7be00a75a9 → 0.0.0-unstable.7c2def32a7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AcoFeature.d.ts +5 -0
- package/AcoFeature.js +134 -0
- package/AcoFeature.js.map +1 -0
- package/AcoFolderSchemaFactory.d.ts +32 -0
- package/AcoFolderSchemaFactory.js +82 -0
- package/AcoFolderSchemaFactory.js.map +1 -0
- package/createAcoGraphQL.d.ts +8 -4
- package/createAcoGraphQL.js +56 -96
- package/createAcoGraphQL.js.map +1 -1
- package/domain/folder/abstractions.d.ts +12 -5
- package/domain/folder/abstractions.js +2 -2
- package/domain/folder/abstractions.js.map +1 -1
- package/domain/folder/folder.model.js +2 -1
- package/domain/folder/folder.model.js.map +1 -1
- package/exports/api/aco/flp.d.ts +1 -0
- package/exports/api/aco/flp.js +1 -0
- package/exports/api/aco/folder.d.ts +2 -1
- package/exports/api/aco/folder.js +1 -1
- package/features/ai/CreateFolderTool.d.ts +49 -0
- package/features/ai/CreateFolderTool.js +58 -0
- package/features/ai/CreateFolderTool.js.map +1 -0
- package/features/ai/CreateTeamTool.d.ts +48 -0
- package/features/ai/CreateTeamTool.js +56 -0
- package/features/ai/CreateTeamTool.js.map +1 -0
- package/features/ai/DeleteFolderTool.d.ts +48 -0
- package/features/ai/DeleteFolderTool.js +55 -0
- package/features/ai/DeleteFolderTool.js.map +1 -0
- package/features/ai/GrantFolderAccessTool.d.ts +77 -0
- package/features/ai/GrantFolderAccessTool.js +80 -0
- package/features/ai/GrantFolderAccessTool.js.map +1 -0
- package/features/ai/ListFoldersTool.d.ts +47 -0
- package/features/ai/ListFoldersTool.js +57 -0
- package/features/ai/ListFoldersTool.js.map +1 -0
- package/features/ai/ListRolesTool.d.ts +39 -0
- package/features/ai/ListRolesTool.js +48 -0
- package/features/ai/ListRolesTool.js.map +1 -0
- package/features/ai/ListTeamsTool.d.ts +39 -0
- package/features/ai/ListTeamsTool.js +48 -0
- package/features/ai/ListTeamsTool.js.map +1 -0
- package/features/ai/RevokeFolderAccessTool.d.ts +63 -0
- package/features/ai/RevokeFolderAccessTool.js +69 -0
- package/features/ai/RevokeFolderAccessTool.js.map +1 -0
- package/features/ai/assertTargetIsUsable.d.ts +10 -0
- package/features/ai/assertTargetIsUsable.js +14 -0
- package/features/ai/assertTargetIsUsable.js.map +1 -0
- package/features/ai/feature.d.ts +12 -0
- package/features/ai/feature.js +25 -0
- package/features/ai/feature.js.map +1 -0
- package/features/ai/index.d.ts +9 -0
- package/features/ai/index.js +9 -0
- package/features/ai/loadFolderPermissions.d.ts +16 -0
- package/features/ai/loadFolderPermissions.js +14 -0
- package/features/ai/loadFolderPermissions.js.map +1 -0
- package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.js +1 -0
- package/features/cms/decorators/ListDeletedEntriesWithFlpDecorator.js.map +1 -1
- package/features/cms/decorators/ListEntriesWithFlpDecorator.js +1 -0
- package/features/cms/decorators/ListEntriesWithFlpDecorator.js.map +1 -1
- package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.js +1 -0
- package/features/cms/decorators/ListLatestEntriesWithFlpDecorator.js.map +1 -1
- package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.js +1 -0
- package/features/cms/decorators/ListPublishedEntriesWithFlpDecorator.js.map +1 -1
- package/features/cms/decorators/MoveEntryWithFlpDecorator.d.ts +1 -1
- package/features/flp/CreateFlp/CreateFlpUseCase.d.ts +3 -3
- package/features/flp/CreateFlp/CreateFlpUseCase.js +4 -4
- package/features/flp/CreateFlp/CreateFlpUseCase.js.map +1 -1
- package/features/flp/CreateFlp/feature.d.ts +1 -6
- package/features/flp/CreateFlp/feature.js +3 -2
- package/features/flp/CreateFlp/feature.js.map +1 -1
- package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.d.ts +8 -5
- package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.js +21 -14
- package/features/flp/CreateFlpOnFolderCreated/CreateFlpOnFolderCreatedHandler.js.map +1 -1
- package/features/flp/DeleteFlp/DeleteFlpUseCase.d.ts +3 -3
- package/features/flp/DeleteFlp/DeleteFlpUseCase.js +3 -3
- package/features/flp/DeleteFlp/DeleteFlpUseCase.js.map +1 -1
- package/features/flp/DeleteFlp/feature.d.ts +1 -6
- package/features/flp/DeleteFlp/feature.js +3 -2
- package/features/flp/DeleteFlp/feature.js.map +1 -1
- package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.d.ts +6 -5
- package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.js +16 -13
- package/features/flp/DeleteFlpOnFolderDeleted/DeleteFlpOnFolderDeletedHandler.js.map +1 -1
- package/features/flp/FolderLevelPermissions/FolderLevelPermissions.d.ts +3 -3
- package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js +6 -6
- package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js.map +1 -1
- package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.d.ts +25 -0
- package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.js +48 -0
- package/features/flp/FolderLevelPermissions/NoopFolderLevelPermissions.js.map +1 -0
- package/features/flp/FolderLevelPermissions/index.d.ts +1 -0
- package/features/flp/FolderLevelPermissions/index.js +1 -0
- package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.d.ts +13 -0
- package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.js +26 -0
- package/features/flp/GetFlp/decorators/GetFlpWithCodeFlps.js.map +1 -0
- package/features/flp/GetFlp/feature.d.ts +1 -1
- package/features/flp/GetFlp/feature.js +3 -2
- package/features/flp/GetFlp/feature.js.map +1 -1
- package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.d.ts +13 -0
- package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.js +27 -0
- package/features/flp/ListFlps/decorators/ListFlpsWithCodeFlps.js.map +1 -0
- package/features/flp/ListFlps/feature.d.ts +1 -1
- package/features/flp/ListFlps/feature.js +3 -2
- package/features/flp/ListFlps/feature.js.map +1 -1
- package/features/flp/UpdateFlp/UpdateFlpUseCase.d.ts +15 -8
- package/features/flp/UpdateFlp/UpdateFlpUseCase.js +37 -42
- package/features/flp/UpdateFlp/UpdateFlpUseCase.js.map +1 -1
- package/features/flp/UpdateFlp/abstractions.d.ts +6 -2
- package/features/flp/UpdateFlp/abstractions.js.map +1 -1
- package/features/flp/UpdateFlp/feature.d.ts +1 -6
- package/features/flp/UpdateFlp/feature.js +7 -2
- package/features/flp/UpdateFlp/feature.js.map +1 -1
- package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.d.ts +8 -5
- package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.js +21 -16
- package/features/flp/UpdateFlpOnFolderUpdated/UpdateFlpOnFolderUpdatedHandler.js.map +1 -1
- package/features/flp/shared/CodeFlpMerger.d.ts +26 -0
- package/features/flp/shared/CodeFlpMerger.js +20 -0
- package/features/flp/shared/CodeFlpMerger.js.map +1 -0
- package/features/flp/shared/CodeFlpPath.d.ts +15 -0
- package/features/flp/shared/CodeFlpPath.js +29 -0
- package/features/flp/shared/CodeFlpPath.js.map +1 -0
- package/features/flp/shared/CodeFlpTarget.d.ts +10 -0
- package/features/flp/shared/CodeFlpTarget.js +26 -0
- package/features/flp/shared/CodeFlpTarget.js.map +1 -0
- package/features/flp/shared/CodeFlpsProvider.d.ts +14 -0
- package/features/flp/shared/CodeFlpsProvider.js +33 -0
- package/features/flp/shared/CodeFlpsProvider.js.map +1 -0
- package/features/flp/shared/abstractions.d.ts +77 -0
- package/features/flp/shared/abstractions.js +19 -0
- package/features/flp/shared/abstractions.js.map +1 -0
- package/features/flp/shared/feature.d.ts +5 -0
- package/features/flp/shared/feature.js +17 -0
- package/features/flp/shared/feature.js.map +1 -0
- package/features/flp/shared/index.d.ts +4 -0
- package/features/flp/shared/index.js +4 -0
- package/features/folder/CreateFolder/CreateFolderRepository.d.ts +3 -3
- package/features/folder/CreateFolder/CreateFolderRepository.js +10 -7
- package/features/folder/CreateFolder/CreateFolderRepository.js.map +1 -1
- package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.d.ts +9 -1
- package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js +20 -3
- package/features/folder/CreateFolder/decorators/CreateFolderWithFolderLevelPermissions.js.map +1 -1
- package/features/folder/DeleteFolder/DeleteFolderRepository.d.ts +3 -3
- package/features/folder/DeleteFolder/DeleteFolderRepository.js +6 -5
- package/features/folder/DeleteFolder/DeleteFolderRepository.js.map +1 -1
- package/features/folder/DeleteFolder/decorators/DeleteFolderWithFolderLevelPermissions.d.ts +1 -1
- package/features/folder/EnsureFolderIsEmpty/EnsureFolderIsEmpty.js +4 -0
- package/features/folder/EnsureFolderIsEmpty/EnsureFolderIsEmpty.js.map +1 -1
- package/features/folder/EnsureHcmsFolderIsEmptyOnDelete/ModelFolderBeforeDeleteHandler.js +4 -0
- package/features/folder/EnsureHcmsFolderIsEmptyOnDelete/ModelFolderBeforeDeleteHandler.js.map +1 -1
- package/features/folder/FolderModelProvider.d.ts +26 -0
- package/features/folder/FolderModelProvider.js +22 -0
- package/features/folder/FolderModelProvider.js.map +1 -0
- package/features/folder/GetAncestors/GetAncestorsRepository.d.ts +3 -3
- package/features/folder/GetAncestors/GetAncestorsRepository.js +6 -5
- package/features/folder/GetAncestors/GetAncestorsRepository.js.map +1 -1
- package/features/folder/GetFolder/GetFolderRepository.d.ts +3 -3
- package/features/folder/GetFolder/GetFolderRepository.js +6 -5
- package/features/folder/GetFolder/GetFolderRepository.js.map +1 -1
- package/features/folder/GetFolder/decorators/GetFolderWithFolderLevelPermissions.d.ts +8 -8
- package/features/folder/GetFolderHierarchy/GetFolderHierarchyRepository.d.ts +3 -3
- package/features/folder/GetFolderHierarchy/GetFolderHierarchyRepository.js +10 -8
- package/features/folder/GetFolderHierarchy/GetFolderHierarchyRepository.js.map +1 -1
- package/features/folder/ListFolders/ListFoldersRepository.d.ts +3 -3
- package/features/folder/ListFolders/ListFoldersRepository.js +8 -7
- package/features/folder/ListFolders/ListFoldersRepository.js.map +1 -1
- package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.d.ts +11 -0
- package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.js +38 -0
- package/features/folder/NotifyFolderChange/NotifyFolderChangeUseCase.js.map +1 -0
- package/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.d.ts +12 -0
- package/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.js +24 -0
- package/features/folder/NotifyFolderChange/NotifyOnFolderDeletedHandler.js.map +1 -0
- package/features/folder/NotifyFolderChange/abstractions.d.ts +28 -0
- package/features/folder/NotifyFolderChange/abstractions.js +8 -0
- package/features/folder/NotifyFolderChange/abstractions.js.map +1 -0
- package/features/folder/NotifyFolderChange/feature.d.ts +9 -0
- package/features/folder/NotifyFolderChange/feature.js +13 -0
- package/features/folder/NotifyFolderChange/feature.js.map +1 -0
- package/features/folder/NotifyFolderChange/index.d.ts +2 -0
- package/features/folder/NotifyFolderChange/index.js +2 -0
- package/features/folder/UpdateFolder/UpdateFolderRepository.d.ts +3 -3
- package/features/folder/UpdateFolder/UpdateFolderRepository.js +11 -8
- package/features/folder/UpdateFolder/UpdateFolderRepository.js.map +1 -1
- package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.d.ts +14 -1
- package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.js +52 -4
- package/features/folder/UpdateFolder/decorators/UpdateFolderWithFolderLevelPermissions.js.map +1 -1
- package/features/folder/shared/abstractions.d.ts +14 -0
- package/features/folder/shared/abstractions.js +4 -1
- package/features/folder/shared/abstractions.js.map +1 -1
- package/filter/filter.gql.d.ts +2 -3
- package/filter/filter.gql.js +61 -27
- package/filter/filter.gql.js.map +1 -1
- package/filter/filter.model.js +2 -1
- package/filter/filter.model.js.map +1 -1
- package/filter/filter.so.d.ts +8 -2
- package/filter/filter.so.js +21 -9
- package/filter/filter.so.js.map +1 -1
- package/flp/flp.types.d.ts +6 -1
- package/flp/index.d.ts +0 -1
- package/flp/index.js +0 -1
- package/flp/tasks/createFlp.task.d.ts +12 -5
- package/flp/tasks/createFlp.task.js +32 -15
- package/flp/tasks/createFlp.task.js.map +1 -1
- package/flp/tasks/deleteFlp.task.d.ts +10 -5
- package/flp/tasks/deleteFlp.task.js +22 -13
- package/flp/tasks/deleteFlp.task.js.map +1 -1
- package/flp/tasks/index.d.ts +0 -1
- package/flp/tasks/index.js +1 -14
- package/flp/tasks/index.js.map +1 -1
- package/flp/tasks/syncFlp.task.d.ts +10 -5
- package/flp/tasks/syncFlp.task.js +34 -13
- package/flp/tasks/syncFlp.task.js.map +1 -1
- package/flp/tasks/updateFlp.task.d.ts +12 -5
- package/flp/tasks/updateFlp.task.js +40 -19
- package/flp/tasks/updateFlp.task.js.map +1 -1
- package/folder/createFolderTypeDefs.js +4 -1
- package/folder/createFolderTypeDefs.js.map +1 -1
- package/folder/folder.gql.d.ts +1 -1
- package/folder/folder.gql.js +10 -4
- package/folder/folder.gql.js.map +1 -1
- package/index.d.ts +1 -6
- package/index.js +1 -11
- package/package.json +25 -26
- package/types.d.ts +1 -2
- package/types.js.map +1 -1
- package/utils/createOperationsWrapper.d.ts +5 -2
- package/utils/createOperationsWrapper.js +5 -5
- package/utils/createOperationsWrapper.js.map +1 -1
- package/utils/decorators/CmsEntriesCrudDecorators.js +9 -5
- package/utils/decorators/CmsEntriesCrudDecorators.js.map +1 -1
- package/utils/resolve.d.ts +2 -2
- package/utils/resolve.js +1 -1
- package/utils/resolve.js.map +1 -1
- package/createAcoContext.d.ts +0 -9
- package/createAcoContext.js +0 -109
- package/createAcoContext.js.map +0 -1
- package/createAcoStorageOperations.d.ts +0 -12
- package/createAcoStorageOperations.js +0 -9
- package/createAcoStorageOperations.js.map +0 -1
- package/createAcoTasks.d.ts +0 -1
- package/createAcoTasks.js +0 -14
- package/createAcoTasks.js.map +0 -1
- package/flp/flp.so.d.ts +0 -20
- package/flp/flp.so.js +0 -183
- package/flp/flp.so.js.map +0 -1
- package/index.js.map +0 -1
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
1
|
+
import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
2
|
import { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels/index.js";
|
|
3
3
|
import { type ISyncFlpTaskInput } from "../../types.js";
|
|
4
4
|
import { GetFolderUseCase } from "../../features/folder/GetFolder/index.js";
|
|
5
5
|
import { ListFoldersUseCase } from "../../features/folder/ListFolders/index.js";
|
|
6
|
-
declare class
|
|
6
|
+
declare class SyncFlpTaskHandlerImpl implements TaskHandler.Interface<ISyncFlpTaskInput> {
|
|
7
7
|
private getFolder;
|
|
8
8
|
private listFolders;
|
|
9
9
|
private listModels;
|
|
10
|
+
constructor(getFolder: GetFolderUseCase.Interface, listFolders: ListFoldersUseCase.Interface, listModels: ListModelsUseCase.Interface);
|
|
11
|
+
run({ input, controller }: TaskHandler.RunParams<ISyncFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultAborted | import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultError | TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
12
|
+
}
|
|
13
|
+
declare class SyncFlpTaskImpl implements TaskDefinition.Interface {
|
|
10
14
|
readonly id = "acoSyncFlp";
|
|
11
15
|
readonly title = "ACO - Sync FLP record";
|
|
12
16
|
readonly description = "Synchronizes the FLP catalog by updating the FLP record and its descendants.";
|
|
13
17
|
readonly databaseLogs = false;
|
|
14
18
|
readonly isPrivate = true;
|
|
15
|
-
readonly selfCleanup: ("
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
readonly selfCleanup: ("onAbort" | "onSuccess")[];
|
|
20
|
+
handler: typeof SyncFlpTaskHandlerImpl & {
|
|
21
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskHandler<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
22
|
+
};
|
|
18
23
|
}
|
|
19
24
|
export declare const SyncFlpTask: typeof SyncFlpTaskImpl & {
|
|
20
25
|
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
@@ -1,29 +1,21 @@
|
|
|
1
|
-
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
1
|
+
import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
2
|
import { ListModelsUseCase } from "@webiny/api-headless-cms/features/contentModel/ListModels/index.js";
|
|
3
3
|
import { SYNC_FLP_TASK_ID, UPDATE_FLP_TASK_ID } from "./index.js";
|
|
4
4
|
import { FM_FILE_TYPE } from "../../constants.js";
|
|
5
5
|
import { GetFolderUseCase } from "../../features/folder/GetFolder/index.js";
|
|
6
6
|
import { ListFoldersUseCase } from "../../features/folder/ListFolders/index.js";
|
|
7
|
-
class
|
|
7
|
+
class SyncFlpTaskHandlerImpl {
|
|
8
8
|
constructor(getFolder, listFolders, listModels){
|
|
9
9
|
this.getFolder = getFolder;
|
|
10
10
|
this.listFolders = listFolders;
|
|
11
11
|
this.listModels = listModels;
|
|
12
|
-
this.id = SYNC_FLP_TASK_ID;
|
|
13
|
-
this.title = "ACO - Sync FLP record";
|
|
14
|
-
this.description = "Synchronizes the FLP catalog by updating the FLP record and its descendants.";
|
|
15
|
-
this.databaseLogs = false;
|
|
16
|
-
this.isPrivate = true;
|
|
17
|
-
this.selfCleanup = [
|
|
18
|
-
"onSuccess",
|
|
19
|
-
"onAbort"
|
|
20
|
-
];
|
|
21
12
|
}
|
|
22
13
|
async run({ input, controller }) {
|
|
23
14
|
try {
|
|
24
15
|
if (controller.runtime.isAborted()) return controller.response.aborted();
|
|
25
16
|
if (input.folderId) {
|
|
26
17
|
const result = await this.getFolder.execute(input.folderId);
|
|
18
|
+
if (result.isFail()) return controller.response.error(result.error);
|
|
27
19
|
const folder = result.value;
|
|
28
20
|
await controller.task.trigger({
|
|
29
21
|
definition: UPDATE_FLP_TASK_ID,
|
|
@@ -49,6 +41,16 @@ class SyncFlpTaskImpl {
|
|
|
49
41
|
parentId: null
|
|
50
42
|
}
|
|
51
43
|
});
|
|
44
|
+
if (result.isFail()) {
|
|
45
|
+
await controller.logger.error({
|
|
46
|
+
message: `Failed to list root folders for type ${folderType}`,
|
|
47
|
+
data: {
|
|
48
|
+
type: folderType,
|
|
49
|
+
error: result.error
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
52
54
|
const { folders } = result.value;
|
|
53
55
|
for (const folder of folders)await controller.task.trigger({
|
|
54
56
|
definition: UPDATE_FLP_TASK_ID,
|
|
@@ -72,6 +74,7 @@ class SyncFlpTaskImpl {
|
|
|
72
74
|
parentId: null
|
|
73
75
|
}
|
|
74
76
|
});
|
|
77
|
+
if (result.isFail()) return controller.response.error(result.error);
|
|
75
78
|
const { folders } = result.value;
|
|
76
79
|
for (const folder of folders)await controller.task.trigger({
|
|
77
80
|
definition: UPDATE_FLP_TASK_ID,
|
|
@@ -87,14 +90,32 @@ class SyncFlpTaskImpl {
|
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
|
-
const
|
|
91
|
-
implementation:
|
|
93
|
+
const SyncFlpTaskHandler = TaskHandler.createImplementation({
|
|
94
|
+
implementation: SyncFlpTaskHandlerImpl,
|
|
92
95
|
dependencies: [
|
|
93
96
|
GetFolderUseCase,
|
|
94
97
|
ListFoldersUseCase,
|
|
95
98
|
ListModelsUseCase
|
|
96
99
|
]
|
|
97
100
|
});
|
|
101
|
+
class SyncFlpTaskImpl {
|
|
102
|
+
constructor(){
|
|
103
|
+
this.id = SYNC_FLP_TASK_ID;
|
|
104
|
+
this.title = "ACO - Sync FLP record";
|
|
105
|
+
this.description = "Synchronizes the FLP catalog by updating the FLP record and its descendants.";
|
|
106
|
+
this.databaseLogs = false;
|
|
107
|
+
this.isPrivate = true;
|
|
108
|
+
this.selfCleanup = [
|
|
109
|
+
"onSuccess",
|
|
110
|
+
"onAbort"
|
|
111
|
+
];
|
|
112
|
+
this.handler = SyncFlpTaskHandler;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const SyncFlpTask = TaskDefinition.createImplementation({
|
|
116
|
+
implementation: SyncFlpTaskImpl,
|
|
117
|
+
dependencies: []
|
|
118
|
+
});
|
|
98
119
|
export { SyncFlpTask };
|
|
99
120
|
|
|
100
121
|
//# sourceMappingURL=syncFlp.task.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flp/tasks/syncFlp.task.js","sources":["../../../src/flp/tasks/syncFlp.task.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"flp/tasks/syncFlp.task.js","sources":["../../../src/flp/tasks/syncFlp.task.ts"],"sourcesContent":["import {\n TaskDefinition,\n TaskHandler\n} from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { ListModelsUseCase } from \"@webiny/api-headless-cms/features/contentModel/ListModels/index.js\";\nimport { SYNC_FLP_TASK_ID, UPDATE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\nimport { type ISyncFlpTaskInput, type IUpdateFlpTaskInput } from \"~/types.js\";\nimport { FM_FILE_TYPE } from \"~/constants.js\";\nimport { GetFolderUseCase } from \"~/features/folder/GetFolder/index.js\";\nimport { ListFoldersUseCase } from \"~/features/folder/ListFolders/index.js\";\n\nclass SyncFlpTaskHandlerImpl implements TaskHandler.Interface<ISyncFlpTaskInput> {\n public constructor(\n private getFolder: GetFolderUseCase.Interface,\n private listFolders: ListFoldersUseCase.Interface,\n private listModels: ListModelsUseCase.Interface\n ) {}\n\n async run({ input, controller }: TaskHandler.RunParams<ISyncFlpTaskInput>) {\n try {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n /**\n * `folderId` provided in the task input. We need to:\n *\n * - update the FLP records for the found folder and all its descendants.\n */\n if (input.folderId) {\n const result = await this.getFolder.execute(input.folderId);\n if (result.isFail()) {\n return controller.response.error(result.error);\n }\n const folder = result.value;\n\n await controller.task.trigger<IUpdateFlpTaskInput>({\n definition: UPDATE_FLP_TASK_ID,\n input: {\n folder\n }\n });\n\n return controller.response.done(\n `Task completed successfully: all FLP records for folderId \"${input.folderId}\" and its children have been queued to be synchronized.`\n );\n }\n\n /**\n * Full update required. We need to:\n *\n * - list cms models to collect their types, together with the default ones [FM_FILE_TYPE]\n * - list all root folders\n * - update the FLP records for the found folders and all its descendants.\n */\n if (input.type && input.type === \"*\") {\n // Some folder types are fixed: pages and files.\n const folderTypes = [FM_FILE_TYPE];\n\n // List all non-private models\n const modelsResult = await this.listModels.execute();\n if (modelsResult.isOk()) {\n const models = modelsResult.value;\n for (const model of models) {\n folderTypes.push(`cms:${model.modelId}`);\n }\n }\n\n for (const folderType of folderTypes) {\n const result = await this.listFolders.execute({\n where: {\n type: folderType,\n parentId: null\n }\n });\n if (result.isFail()) {\n await controller.logger.error({\n message: `Failed to list root folders for type ${folderType}`,\n data: {\n type: folderType,\n error: result.error\n }\n });\n continue;\n }\n\n const { folders } = result.value;\n\n for (const folder of folders) {\n await controller.task.trigger<IUpdateFlpTaskInput>({\n definition: UPDATE_FLP_TASK_ID,\n input: {\n folder\n }\n });\n }\n\n await controller.logger.info({\n message: `FLP Update task triggered for type ${folderType}`,\n data: {\n type: folderType\n }\n });\n }\n\n return controller.response.done(\n `Task completed successfully: all FLP records have been queued to be synchronized.`\n );\n }\n\n /**\n * `type` provided in the task input. We need to:\n *\n * - list all root folders for the provided type\n * - update the FLP records for the found folders and all its descendants.\n */\n if (input.type) {\n const result = await this.listFolders.execute({\n where: {\n type: input.type!,\n parentId: null\n }\n });\n if (result.isFail()) {\n return controller.response.error(result.error);\n }\n\n const { folders } = result.value;\n\n for (const folder of folders) {\n await controller.task.trigger<IUpdateFlpTaskInput>({\n definition: UPDATE_FLP_TASK_ID,\n input: {\n folder\n }\n });\n }\n\n return controller.response.done(\n `Task completed successfully: all FLP records for type \"${input.type}\" have been queued to be synchronized.`\n );\n }\n\n return controller.response.error(\n \"Invalid input: please provide either `type` or `folderId`.\"\n );\n } catch (error) {\n return controller.response.error(error);\n }\n }\n}\n\nconst SyncFlpTaskHandler = TaskHandler.createImplementation({\n implementation: SyncFlpTaskHandlerImpl,\n dependencies: [GetFolderUseCase, ListFoldersUseCase, ListModelsUseCase]\n});\n\nclass SyncFlpTaskImpl implements TaskDefinition.Interface {\n public readonly id = SYNC_FLP_TASK_ID;\n public readonly title = \"ACO - Sync FLP record\";\n public readonly description =\n \"Synchronizes the FLP catalog by updating the FLP record and its descendants.\";\n public readonly databaseLogs = false;\n public readonly isPrivate = true;\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n handler = SyncFlpTaskHandler;\n}\n\nexport const SyncFlpTask = TaskDefinition.createImplementation({\n implementation: SyncFlpTaskImpl,\n dependencies: []\n});\n"],"names":["SyncFlpTaskHandlerImpl","getFolder","listFolders","listModels","input","controller","result","folder","UPDATE_FLP_TASK_ID","folderTypes","FM_FILE_TYPE","modelsResult","models","model","folderType","folders","error","SyncFlpTaskHandler","TaskHandler","GetFolderUseCase","ListFoldersUseCase","ListModelsUseCase","SyncFlpTaskImpl","SYNC_FLP_TASK_ID","SyncFlpTask","TaskDefinition"],"mappings":";;;;;;AAWA,MAAMA;IACF,YACYC,S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AC3E;AAEA,MAAMC;;aACc,EAAE,GAAGC;aACL,KAAK,GAAG;aACR,WAAW,GACvB;aACY,YAAY,GAAG;aACf,SAAS,GAAG;aACZ,WAAW,GAAG;YAAC;YAAsB;SAAmB;aAExE,OAAO,GAAGN;;AACd;AAEO,MAAMO,cAAcC,eAAe,oBAAoB,CAAC;IAC3D,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
1
|
+
import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
2
|
import { type IUpdateFlpTaskInput } from "../../types.js";
|
|
3
3
|
import { UpdateFlpUseCase } from "../../features/flp/UpdateFlp/index.js";
|
|
4
|
-
|
|
4
|
+
import { NotifyFolderChangeUseCase } from "../../features/folder/NotifyFolderChange/index.js";
|
|
5
|
+
declare class UpdateFlpTaskHandlerImpl implements TaskHandler.Interface<IUpdateFlpTaskInput> {
|
|
5
6
|
private updateFlp;
|
|
7
|
+
private notifyFolderChange;
|
|
8
|
+
constructor(updateFlp: UpdateFlpUseCase.Interface, notifyFolderChange: NotifyFolderChangeUseCase.Interface);
|
|
9
|
+
run({ input, controller }: TaskHandler.RunParams<IUpdateFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultAborted | import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultError | TaskDefinition.ResultContinue<IUpdateFlpTaskInput> | TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
10
|
+
}
|
|
11
|
+
declare class UpdateFlpTaskImpl implements TaskDefinition.Interface {
|
|
6
12
|
readonly id = "acoUpdateFlp";
|
|
7
13
|
readonly title = "ACO - Update FLP record";
|
|
8
14
|
readonly description = "Synchronizes the FLP catalog by updating the FLP record and its descendants based on the provided folder.";
|
|
9
15
|
readonly databaseLogs = false;
|
|
10
16
|
readonly isPrivate = true;
|
|
11
|
-
readonly selfCleanup: ("
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
readonly selfCleanup: ("onAbort" | "onSuccess")[];
|
|
18
|
+
handler: typeof UpdateFlpTaskHandlerImpl & {
|
|
19
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskHandler<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
20
|
+
};
|
|
14
21
|
}
|
|
15
22
|
export declare const UpdateFlpTask: typeof UpdateFlpTaskImpl & {
|
|
16
23
|
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskDefinition<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskInput, import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
1
|
+
import { TaskDefinition, TaskHandler } from "@webiny/api-core/features/task/TaskDefinition/index.js";
|
|
2
2
|
import { UPDATE_FLP_TASK_ID } from "./index.js";
|
|
3
3
|
import { UpdateFlpUseCase } from "../../features/flp/UpdateFlp/index.js";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { NotifyFolderChangeUseCase } from "../../features/folder/NotifyFolderChange/index.js";
|
|
5
|
+
class UpdateFlpTaskHandlerImpl {
|
|
6
|
+
constructor(updateFlp, notifyFolderChange){
|
|
6
7
|
this.updateFlp = updateFlp;
|
|
7
|
-
this.
|
|
8
|
-
this.title = "ACO - Update FLP record";
|
|
9
|
-
this.description = "Synchronizes the FLP catalog by updating the FLP record and its descendants based on the provided folder.";
|
|
10
|
-
this.databaseLogs = false;
|
|
11
|
-
this.isPrivate = true;
|
|
12
|
-
this.selfCleanup = [
|
|
13
|
-
"onSuccess",
|
|
14
|
-
"onAbort"
|
|
15
|
-
];
|
|
8
|
+
this.notifyFolderChange = notifyFolderChange;
|
|
16
9
|
}
|
|
17
10
|
async run({ input, controller }) {
|
|
18
11
|
try {
|
|
19
12
|
if (controller.runtime.isAborted()) return controller.response.aborted();
|
|
13
|
+
let continuation;
|
|
20
14
|
await this.updateFlp.execute({
|
|
21
15
|
folder: input.folder,
|
|
22
|
-
|
|
16
|
+
completed: input.completed,
|
|
23
17
|
isCloseToTimeout: controller.runtime.isCloseToTimeout,
|
|
24
|
-
handleTimeout: (
|
|
18
|
+
handleTimeout: (completed)=>{
|
|
19
|
+
continuation = controller.response.continue({
|
|
25
20
|
...input,
|
|
26
|
-
|
|
27
|
-
})
|
|
21
|
+
completed
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
if (continuation) return continuation;
|
|
26
|
+
if (input.notifyIdentityId) await this.notifyFolderChange.execute({
|
|
27
|
+
id: input.folder.id,
|
|
28
|
+
change: "updated",
|
|
29
|
+
identityId: input.notifyIdentityId
|
|
28
30
|
});
|
|
29
31
|
return controller.response.done("Task done: FLP record updated.");
|
|
30
32
|
} catch (error) {
|
|
@@ -32,12 +34,31 @@ class UpdateFlpTaskImpl {
|
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
|
-
const
|
|
36
|
-
implementation:
|
|
37
|
+
const UpdateFlpTaskHandler = TaskHandler.createImplementation({
|
|
38
|
+
implementation: UpdateFlpTaskHandlerImpl,
|
|
37
39
|
dependencies: [
|
|
38
|
-
UpdateFlpUseCase
|
|
40
|
+
UpdateFlpUseCase,
|
|
41
|
+
NotifyFolderChangeUseCase
|
|
39
42
|
]
|
|
40
43
|
});
|
|
44
|
+
class UpdateFlpTaskImpl {
|
|
45
|
+
constructor(){
|
|
46
|
+
this.id = UPDATE_FLP_TASK_ID;
|
|
47
|
+
this.title = "ACO - Update FLP record";
|
|
48
|
+
this.description = "Synchronizes the FLP catalog by updating the FLP record and its descendants based on the provided folder.";
|
|
49
|
+
this.databaseLogs = false;
|
|
50
|
+
this.isPrivate = true;
|
|
51
|
+
this.selfCleanup = [
|
|
52
|
+
"onSuccess",
|
|
53
|
+
"onAbort"
|
|
54
|
+
];
|
|
55
|
+
this.handler = UpdateFlpTaskHandler;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const UpdateFlpTask = TaskDefinition.createImplementation({
|
|
59
|
+
implementation: UpdateFlpTaskImpl,
|
|
60
|
+
dependencies: []
|
|
61
|
+
});
|
|
41
62
|
export { UpdateFlpTask };
|
|
42
63
|
|
|
43
64
|
//# sourceMappingURL=updateFlp.task.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flp/tasks/updateFlp.task.js","sources":["../../../src/flp/tasks/updateFlp.task.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"flp/tasks/updateFlp.task.js","sources":["../../../src/flp/tasks/updateFlp.task.ts"],"sourcesContent":["import {\n TaskDefinition,\n TaskHandler\n} from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { UPDATE_FLP_TASK_ID } from \"~/flp/tasks/index.js\";\nimport { type IUpdateFlpTaskInput } from \"~/types.js\";\nimport { UpdateFlpUseCase } from \"~/features/flp/UpdateFlp/index.js\";\nimport { NotifyFolderChangeUseCase } from \"~/features/folder/NotifyFolderChange/index.js\";\n\nclass UpdateFlpTaskHandlerImpl implements TaskHandler.Interface<IUpdateFlpTaskInput> {\n public constructor(\n private updateFlp: UpdateFlpUseCase.Interface,\n private notifyFolderChange: NotifyFolderChangeUseCase.Interface\n ) {}\n\n async run({ input, controller }: TaskHandler.RunParams<IUpdateFlpTaskInput>) {\n try {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n /*\n * `response.continue()` only builds the result; it does nothing until the task returns\n * it. Returning `done` regardless used to drop the continuation, leaving the rest of a\n * large subtree with its old permissions.\n */\n let continuation: ReturnType<typeof controller.response.continue> | undefined;\n\n await this.updateFlp.execute({\n folder: input.folder,\n completed: input.completed,\n isCloseToTimeout: controller.runtime.isCloseToTimeout,\n handleTimeout: completed => {\n continuation = controller.response.continue({ ...input, completed });\n }\n });\n\n if (continuation) {\n return continuation;\n }\n\n // Only the last run tells the admin: before it, part of the subtree is still stale.\n if (input.notifyIdentityId) {\n await this.notifyFolderChange.execute({\n id: input.folder.id,\n change: \"updated\",\n identityId: input.notifyIdentityId\n });\n }\n\n return controller.response.done(\"Task done: FLP record updated.\");\n } catch (error) {\n return controller.response.error(error);\n }\n }\n}\n\nconst UpdateFlpTaskHandler = TaskHandler.createImplementation({\n implementation: UpdateFlpTaskHandlerImpl,\n dependencies: [UpdateFlpUseCase, NotifyFolderChangeUseCase]\n});\n\nclass UpdateFlpTaskImpl implements TaskDefinition.Interface {\n public readonly id = UPDATE_FLP_TASK_ID;\n public readonly title = \"ACO - Update FLP record\";\n public readonly description =\n \"Synchronizes the FLP catalog by updating the FLP record and its descendants based on the provided folder.\";\n public readonly databaseLogs = false;\n public readonly isPrivate = true;\n public readonly selfCleanup = [\"onSuccess\" as const, \"onAbort\" as const];\n\n handler = UpdateFlpTaskHandler;\n}\n\nexport const UpdateFlpTask = TaskDefinition.createImplementation({\n implementation: UpdateFlpTaskImpl,\n dependencies: []\n});\n"],"names":["UpdateFlpTaskHandlerImpl","updateFlp","notifyFolderChange","input","controller","continuation","completed","error","UpdateFlpTaskHandler","TaskHandler","UpdateFlpUseCase","NotifyFolderChangeUseCase","UpdateFlpTaskImpl","UPDATE_FLP_TASK_ID","UpdateFlpTask","TaskDefinition"],"mappings":";;;;AASA,MAAMA;IACF,YACYC,SAAqC,EACrCC,kBAAuD,CACjE;aAFUD,SAAS,GAATA;aACAC,kBAAkB,GAAlBA;IACT;IAEH,MAAM,IAAI,EAAEC,KAAK,EAAEC,UAAU,EAA8C,EAAE;QACzE,IAAI;YACA,IAAIA,WAAW,OAAO,CAAC,SAAS,IAC5B,OAAOA,WAAW,QAAQ,CAAC,OAAO;YAQtC,IAAIC;YAEJ,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;gBACzB,QAAQF,MAAM,MAAM;gBACpB,WAAWA,MAAM,SAAS;gBAC1B,kBAAkBC,WAAW,OAAO,CAAC,gBAAgB;gBACrD,eAAeE,CAAAA;oBACXD,eAAeD,WAAW,QAAQ,CAAC,QAAQ,CAAC;wBAAE,GAAGD,KAAK;wBAAEG;oBAAU;gBACtE;YACJ;YAEA,IAAID,cACA,OAAOA;YAIX,IAAIF,MAAM,gBAAgB,EACtB,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;gBAClC,IAAIA,MAAM,MAAM,CAAC,EAAE;gBACnB,QAAQ;gBACR,YAAYA,MAAM,gBAAgB;YACtC;YAGJ,OAAOC,WAAW,QAAQ,CAAC,IAAI,CAAC;QACpC,EAAE,OAAOG,OAAO;YACZ,OAAOH,WAAW,QAAQ,CAAC,KAAK,CAACG;QACrC;IACJ;AACJ;AAEA,MAAMC,uBAAuBC,YAAY,oBAAoB,CAAC;IAC1D,gBAAgBT;IAChB,cAAc;QAACU;QAAkBC;KAA0B;AAC/D;AAEA,MAAMC;;aACc,EAAE,GAAGC;aACL,KAAK,GAAG;aACR,WAAW,GACvB;aACY,YAAY,GAAG;aACf,SAAS,GAAG;aACZ,WAAW,GAAG;YAAC;YAAsB;SAAmB;aAExE,OAAO,GAAGL;;AACd;AAEO,MAAMM,gBAAgBC,eAAe,oBAAoB,CAAC;IAC7D,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -163,8 +163,11 @@ const createFolderTypeDefs = (params)=>{
|
|
|
163
163
|
|
|
164
164
|
extend type AcoFolder_Permissions {
|
|
165
165
|
inheritedFrom: ID
|
|
166
|
+
# Set on permissions contributed from code, via an "FlpFactory". Read-only by design:
|
|
167
|
+
# deliberately absent from the input type below, so it cannot be assigned via the API.
|
|
168
|
+
plugin: Boolean
|
|
166
169
|
}
|
|
167
|
-
|
|
170
|
+
|
|
168
171
|
extend input AcoFolder_PermissionsInput {
|
|
169
172
|
inheritedFrom: ID
|
|
170
173
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder/createFolderTypeDefs.js","sources":["../../src/folder/createFolderTypeDefs.ts"],"sourcesContent":["import type { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport { renderFields } from \"@webiny/api-headless-cms/utils/renderFields.js\";\nimport { renderInputFields } from \"@webiny/api-headless-cms/utils/renderInputFields.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\n\nexport interface CreateFolderTypeDefsParams {\n model: CmsModel;\n models: CmsModel[];\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n}\n\nconst removeFieldRequiredValidation = (field: CmsModelField) => {\n if (field.validation) {\n field.validation = field.validation.filter(validation => validation.name !== \"required\");\n }\n if (field.listValidation) {\n field.listValidation = field.listValidation.filter(v => v.name !== \"required\");\n }\n return field;\n};\n\nconst createUpdateFields = (fields: CmsModelField[]): CmsModelField[] => {\n return fields.reduce<CmsModelField[]>((collection, field) => {\n collection.push(removeFieldRequiredValidation({ ...field }));\n return collection;\n }, []);\n};\n\nexport const createFolderTypeDefs = (params: CreateFolderTypeDefsParams): string => {\n const { model, models, fieldRegistry } = params;\n const { fields } = model;\n\n const fieldTypes = renderFields({\n models,\n model,\n fields,\n type: \"manage\",\n fieldRegistry\n });\n const inputCreateFields = renderInputFields({\n models,\n model,\n fields,\n fieldRegistry\n });\n const inputUpdateFields = renderInputFields({\n models,\n model,\n fields: createUpdateFields(fields),\n fieldRegistry\n });\n\n return /* GraphQL */ `\n ${fieldTypes.map(f => f.typeDefs).join(\"\\n\")}\n \n type Folder {\n id: ID!\n # Tells us if the current user can manage folder structure.\n canManageStructure: Boolean\n\n # Tells us if the current user can manage folder permissions.\n canManagePermissions: Boolean\n\n # Tells us if the current user can manage folder content.\n canManageContent: Boolean\n\n # Tells us if the folder contains non-inherited permissions.\n hasNonInheritedPermissions: Boolean\n\n createdOn: DateTime\n modifiedOn: DateTime\n savedOn: DateTime\n createdBy: AcoUser\n modifiedBy: AcoUser\n savedBy: AcoUser\n \n ${fieldTypes.map(f => f.fields).join(\"\\n\")}\n }\n\n ${inputCreateFields.map(f => f.typeDefs).join(\"\\n\")}\n \n input FolderCreateInput {\n # Pass an ID if you want to create a folder with a specific ID.\n id: ID \n \n ${inputCreateFields.map(f => f.fields).join(\"\\n\")}\n }\n \n input FolderUpdateInput {\n ${inputUpdateFields.map(f => f.fields).join(\"\\n\")}\n }\n \n input FoldersListWhereInput {\n type: String!\n parentId: ID\n parentId_in: [ID]\n slug: String\n slug_not: String\n slug_contains: String\n slug_not_contains: String\n slug_in: [String]\n slug_not_in: [String]\n slug_startsWith: String\n slug_not_startsWith: String\n path: String\n path_not: String\n path_contains: String\n path_not_contains: String\n path_in: [String]\n path_not_in: [String]\n path_startsWith: String\n path_not_startsWith: String\n createdBy: ID\n }\n \n type FolderResponse {\n data: Folder\n error: AcoError\n }\n\n type FoldersListResponse {\n data: [Folder]\n error: AcoError\n meta: AcoMeta\n }\n\n type FoldersHierarchyData {\n parents: [Folder]\n siblings: [Folder]\n }\n\n type FoldersHierarchyResponse {\n data: FoldersHierarchyData\n error: AcoError\n }\n\n type FolderLevelPermissionsTarget {\n id: ID!\n type: String!\n target: ID!\n name: String!\n meta: JSON\n }\n\n type FolderLevelPermissionsTargetsListMeta {\n totalCount: Int!\n }\n\n type FolderLevelPermissionsTargetsListResponse {\n data: [FolderLevelPermissionsTarget]\n meta: FolderLevelPermissionsTargetsListMeta\n error: AcoError\n }\n \n type FolderModelResponse {\n data: JSON\n error: AcoError\n }\n\n extend type AcoQuery {\n getFolderModel: FolderModelResponse!\n getFolder(id: ID!): FolderResponse\n listFolders(\n where: FoldersListWhereInput!\n limit: Int\n after: String\n sort: AcoSort\n ): FoldersListResponse\n getFolderHierarchy(type: String!, id: ID!): FoldersHierarchyResponse\n listFolderLevelPermissionsTargets: FolderLevelPermissionsTargetsListResponse\n }\n\n extend type AcoMutation {\n createFolder(data: FolderCreateInput!): FolderResponse\n updateFolder(id: ID!, data: FolderUpdateInput!): FolderResponse\n deleteFolder(id: ID!): AcoBooleanResponse\n }\n \n # The base type is dynamically generated from a Folder model\n \n extend type AcoFolder_Permissions {\n inheritedFrom: ID\n }\n
|
|
1
|
+
{"version":3,"file":"folder/createFolderTypeDefs.js","sources":["../../src/folder/createFolderTypeDefs.ts"],"sourcesContent":["import type { CmsModel, CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport { renderFields } from \"@webiny/api-headless-cms/utils/renderFields.js\";\nimport { renderInputFields } from \"@webiny/api-headless-cms/utils/renderInputFields.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\n\nexport interface CreateFolderTypeDefsParams {\n model: CmsModel;\n models: CmsModel[];\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n}\n\nconst removeFieldRequiredValidation = (field: CmsModelField) => {\n if (field.validation) {\n field.validation = field.validation.filter(validation => validation.name !== \"required\");\n }\n if (field.listValidation) {\n field.listValidation = field.listValidation.filter(v => v.name !== \"required\");\n }\n return field;\n};\n\nconst createUpdateFields = (fields: CmsModelField[]): CmsModelField[] => {\n return fields.reduce<CmsModelField[]>((collection, field) => {\n collection.push(removeFieldRequiredValidation({ ...field }));\n return collection;\n }, []);\n};\n\nexport const createFolderTypeDefs = (params: CreateFolderTypeDefsParams): string => {\n const { model, models, fieldRegistry } = params;\n const { fields } = model;\n\n const fieldTypes = renderFields({\n models,\n model,\n fields,\n type: \"manage\",\n fieldRegistry\n });\n const inputCreateFields = renderInputFields({\n models,\n model,\n fields,\n fieldRegistry\n });\n const inputUpdateFields = renderInputFields({\n models,\n model,\n fields: createUpdateFields(fields),\n fieldRegistry\n });\n\n return /* GraphQL */ `\n ${fieldTypes.map(f => f.typeDefs).join(\"\\n\")}\n \n type Folder {\n id: ID!\n # Tells us if the current user can manage folder structure.\n canManageStructure: Boolean\n\n # Tells us if the current user can manage folder permissions.\n canManagePermissions: Boolean\n\n # Tells us if the current user can manage folder content.\n canManageContent: Boolean\n\n # Tells us if the folder contains non-inherited permissions.\n hasNonInheritedPermissions: Boolean\n\n createdOn: DateTime\n modifiedOn: DateTime\n savedOn: DateTime\n createdBy: AcoUser\n modifiedBy: AcoUser\n savedBy: AcoUser\n \n ${fieldTypes.map(f => f.fields).join(\"\\n\")}\n }\n\n ${inputCreateFields.map(f => f.typeDefs).join(\"\\n\")}\n \n input FolderCreateInput {\n # Pass an ID if you want to create a folder with a specific ID.\n id: ID \n \n ${inputCreateFields.map(f => f.fields).join(\"\\n\")}\n }\n \n input FolderUpdateInput {\n ${inputUpdateFields.map(f => f.fields).join(\"\\n\")}\n }\n \n input FoldersListWhereInput {\n type: String!\n parentId: ID\n parentId_in: [ID]\n slug: String\n slug_not: String\n slug_contains: String\n slug_not_contains: String\n slug_in: [String]\n slug_not_in: [String]\n slug_startsWith: String\n slug_not_startsWith: String\n path: String\n path_not: String\n path_contains: String\n path_not_contains: String\n path_in: [String]\n path_not_in: [String]\n path_startsWith: String\n path_not_startsWith: String\n createdBy: ID\n }\n \n type FolderResponse {\n data: Folder\n error: AcoError\n }\n\n type FoldersListResponse {\n data: [Folder]\n error: AcoError\n meta: AcoMeta\n }\n\n type FoldersHierarchyData {\n parents: [Folder]\n siblings: [Folder]\n }\n\n type FoldersHierarchyResponse {\n data: FoldersHierarchyData\n error: AcoError\n }\n\n type FolderLevelPermissionsTarget {\n id: ID!\n type: String!\n target: ID!\n name: String!\n meta: JSON\n }\n\n type FolderLevelPermissionsTargetsListMeta {\n totalCount: Int!\n }\n\n type FolderLevelPermissionsTargetsListResponse {\n data: [FolderLevelPermissionsTarget]\n meta: FolderLevelPermissionsTargetsListMeta\n error: AcoError\n }\n \n type FolderModelResponse {\n data: JSON\n error: AcoError\n }\n\n extend type AcoQuery {\n getFolderModel: FolderModelResponse!\n getFolder(id: ID!): FolderResponse\n listFolders(\n where: FoldersListWhereInput!\n limit: Int\n after: String\n sort: AcoSort\n ): FoldersListResponse\n getFolderHierarchy(type: String!, id: ID!): FoldersHierarchyResponse\n listFolderLevelPermissionsTargets: FolderLevelPermissionsTargetsListResponse\n }\n\n extend type AcoMutation {\n createFolder(data: FolderCreateInput!): FolderResponse\n updateFolder(id: ID!, data: FolderUpdateInput!): FolderResponse\n deleteFolder(id: ID!): AcoBooleanResponse\n }\n \n # The base type is dynamically generated from a Folder model\n \n extend type AcoFolder_Permissions {\n inheritedFrom: ID\n # Set on permissions contributed from code, via an \"FlpFactory\". Read-only by design:\n # deliberately absent from the input type below, so it cannot be assigned via the API.\n plugin: Boolean\n }\n\n extend input AcoFolder_PermissionsInput {\n inheritedFrom: ID\n }\n `;\n};\n"],"names":["removeFieldRequiredValidation","field","validation","v","createUpdateFields","fields","collection","createFolderTypeDefs","params","model","models","fieldRegistry","fieldTypes","renderFields","inputCreateFields","renderInputFields","inputUpdateFields","f"],"mappings":";;AAWA,MAAMA,gCAAgC,CAACC;IACnC,IAAIA,MAAM,UAAU,EAChBA,MAAM,UAAU,GAAGA,MAAM,UAAU,CAAC,MAAM,CAACC,CAAAA,aAAcA,AAAoB,eAApBA,WAAW,IAAI;IAE5E,IAAID,MAAM,cAAc,EACpBA,MAAM,cAAc,GAAGA,MAAM,cAAc,CAAC,MAAM,CAACE,CAAAA,IAAKA,AAAW,eAAXA,EAAE,IAAI;IAElE,OAAOF;AACX;AAEA,MAAMG,qBAAqB,CAACC,SACjBA,OAAO,MAAM,CAAkB,CAACC,YAAYL;QAC/CK,WAAW,IAAI,CAACN,8BAA8B;YAAE,GAAGC,KAAK;QAAC;QACzD,OAAOK;IACX,GAAG,EAAE;AAGF,MAAMC,uBAAuB,CAACC;IACjC,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,aAAa,EAAE,GAAGH;IACzC,MAAM,EAAEH,MAAM,EAAE,GAAGI;IAEnB,MAAMG,aAAaC,aAAa;QAC5BH;QACAD;QACAJ;QACA,MAAM;QACNM;IACJ;IACA,MAAMG,oBAAoBC,kBAAkB;QACxCL;QACAD;QACAJ;QACAM;IACJ;IACA,MAAMK,oBAAoBD,kBAAkB;QACxCL;QACAD;QACA,QAAQL,mBAAmBC;QAC3BM;IACJ;IAEA,OAAqB,CAAC;QAClB,EAAEC,WAAW,GAAG,CAACK,CAAAA,IAAKA,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;YAuBzC,EAAEL,WAAW,GAAG,CAACK,CAAAA,IAAKA,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM;;;QAG/C,EAAEH,kBAAkB,GAAG,CAACG,CAAAA,IAAKA,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM;;;;;;aAM/C,EAAEH,kBAAkB,GAAG,CAACG,CAAAA,IAAKA,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM;;;;YAInD,EAAED,kBAAkB,GAAG,CAACC,CAAAA,IAAKA,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqG1D,CAAC;AACL"}
|
package/folder/folder.gql.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GraphQLSchemaPlugin } from "@webiny/
|
|
1
|
+
import { GraphQLSchemaPlugin } from "@webiny/api-graphql/plugins/GraphQLSchemaPlugin.js";
|
|
2
2
|
import type { CreateFolderTypeDefsParams } from "./createFolderTypeDefs.js";
|
|
3
3
|
import type { AcoContext } from "../types.js";
|
|
4
4
|
export declare const createFoldersSchema: (params: CreateFolderTypeDefsParams) => GraphQLSchemaPlugin<AcoContext>;
|
package/folder/folder.gql.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ErrorResponse, ListResponse } from "@webiny/
|
|
2
|
-
import { GraphQLSchemaPlugin } from "@webiny/
|
|
1
|
+
import { ErrorResponse, ListResponse } from "@webiny/api-graphql/responses.js";
|
|
2
|
+
import { GraphQLSchemaPlugin } from "@webiny/api-graphql/plugins/GraphQLSchemaPlugin.js";
|
|
3
3
|
import { createFolderTypeDefs } from "./createFolderTypeDefs.js";
|
|
4
4
|
import { ensureAuthentication } from "../utils/ensureAuthentication.js";
|
|
5
5
|
import { resolve } from "../utils/resolve.js";
|
|
@@ -11,7 +11,8 @@ import { UpdateFolderUseCase } from "../features/folder/UpdateFolder/abstraction
|
|
|
11
11
|
import { DeleteFolderUseCase } from "../features/folder/DeleteFolder/abstractions.js";
|
|
12
12
|
import { GetFolderHierarchyUseCase } from "../features/folder/GetFolderHierarchy/abstractions.js";
|
|
13
13
|
import { ListFolderLevelPermissionsTargetsUseCase } from "../features/folder/ListFolderLevelPermissionsTargets/abstractions.js";
|
|
14
|
-
import {
|
|
14
|
+
import { FolderModelProvider } from "../domain/folder/abstractions.js";
|
|
15
|
+
import { ValuesSelectionGenerator } from "@webiny/api-headless-cms/features/contentModel/ValuesSelectionGenerator/abstractions.js";
|
|
15
16
|
const createFoldersSchema = (params)=>{
|
|
16
17
|
const folderGraphQL = new GraphQLSchemaPlugin({
|
|
17
18
|
typeDefs: createFolderTypeDefs(params),
|
|
@@ -38,7 +39,12 @@ const createFoldersSchema = (params)=>{
|
|
|
38
39
|
getFolderModel (_, __, context) {
|
|
39
40
|
return resolve(async ()=>{
|
|
40
41
|
ensureAuthentication(context);
|
|
41
|
-
|
|
42
|
+
const model = await context.container.resolve(FolderModelProvider).get();
|
|
43
|
+
const generator = context.container.resolve(ValuesSelectionGenerator);
|
|
44
|
+
return {
|
|
45
|
+
...model,
|
|
46
|
+
valuesSelection: generator.generate(model)
|
|
47
|
+
};
|
|
42
48
|
});
|
|
43
49
|
},
|
|
44
50
|
getFolder: async (_, { id }, context)=>resolve(async ()=>{
|
package/folder/folder.gql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"folder/folder.gql.js","sources":["../../src/folder/folder.gql.ts"],"sourcesContent":["import { ErrorResponse, ListResponse } from \"@webiny/handler-graphql/responses.js\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js\";\n\nimport type { CreateFolderTypeDefsParams } from \"./createFolderTypeDefs.js\";\nimport { createFolderTypeDefs } from \"./createFolderTypeDefs.js\";\nimport { ensureAuthentication } from \"~/utils/ensureAuthentication.js\";\nimport { resolve } from \"~/utils/resolve.js\";\nimport type { AcoContext, Folder } from \"~/types.js\";\nimport { FolderLevelPermissions } from \"~/features/flp/FolderLevelPermissions/index.js\";\nimport { GetFolderUseCase } from \"~/features/folder/GetFolder/abstractions.js\";\nimport { ListFoldersUseCase } from \"~/features/folder/ListFolders/abstractions.js\";\nimport { CreateFolderUseCase } from \"~/features/folder/CreateFolder/abstractions.js\";\nimport { UpdateFolderUseCase } from \"~/features/folder/UpdateFolder/abstractions.js\";\nimport { DeleteFolderUseCase } from \"~/features/folder/DeleteFolder/abstractions.js\";\nimport { GetFolderHierarchyUseCase } from \"~/features/folder/GetFolderHierarchy/abstractions.js\";\nimport { ListFolderLevelPermissionsTargetsUseCase } from \"~/features/folder/ListFolderLevelPermissionsTargets/abstractions.js\";\nimport { FolderModel } from \"~/domain/folder/abstractions.js\";\n\nexport const createFoldersSchema = (params: CreateFolderTypeDefsParams) => {\n const folderGraphQL = new GraphQLSchemaPlugin<AcoContext>({\n typeDefs: createFolderTypeDefs(params),\n resolvers: {\n Folder: {\n hasNonInheritedPermissions: (folder: Folder, _, context) => {\n const flp = context.container.resolve(FolderLevelPermissions);\n return flp.permissionsIncludeNonInheritedPermissions(folder.permissions ?? []);\n },\n canManageStructure: (folder, _, context) => {\n const flp = context.container.resolve(FolderLevelPermissions);\n return flp.canManageFolderStructure(folder);\n },\n canManagePermissions: (folder, _, context) => {\n const flp = context.container.resolve(FolderLevelPermissions);\n return flp.canManageFolderPermissions(folder);\n },\n canManageContent: (folder, _, context) => {\n const flp = context.container.resolve(FolderLevelPermissions);\n return flp.canManageFolderContent(folder);\n }\n },\n AcoQuery: {\n getFolderModel(_, __, context) {\n return resolve(async () => {\n ensureAuthentication(context);\n return context.container.resolve(FolderModel);\n });\n },\n getFolder: async (_, { id }, context) => {\n return resolve(async () => {\n ensureAuthentication(context);\n const getFolderUseCase = context.container.resolve(GetFolderUseCase);\n const result = await getFolderUseCase.execute(id);\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n },\n listFolders: async (_, args: any, context) => {\n try {\n ensureAuthentication(context);\n const listFoldersUseCase = context.container.resolve(ListFoldersUseCase);\n const result = await listFoldersUseCase.execute(args);\n if (result.isFail()) {\n throw result.error;\n }\n const { folders, meta } = result.value;\n return new ListResponse(folders, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n getFolderHierarchy: async (_, args: any, context) => {\n try {\n return resolve(async () => {\n ensureAuthentication(context);\n const getFolderHierarchyUseCase =\n context.container.resolve(GetFolderHierarchyUseCase);\n const result = await getFolderHierarchyUseCase.execute(args);\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n listFolderLevelPermissionsTargets: async (_, args: any, context) => {\n try {\n ensureAuthentication(context);\n const listTargetsUseCase = context.container.resolve(\n ListFolderLevelPermissionsTargetsUseCase\n );\n const result = await listTargetsUseCase.execute();\n if (result.isFail()) {\n throw result.error;\n }\n const [entries, meta] = result.value;\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n AcoMutation: {\n createFolder: async (_, { data }, context) => {\n return resolve(async () => {\n ensureAuthentication(context);\n const createFolderUseCase = context.container.resolve(CreateFolderUseCase);\n const result = await createFolderUseCase.execute(data);\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n },\n updateFolder: async (_, { id, data }, context) => {\n return resolve(async () => {\n ensureAuthentication(context);\n const updateFolderUseCase = context.container.resolve(UpdateFolderUseCase);\n const result = await updateFolderUseCase.execute(id, data);\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n },\n deleteFolder: async (_, { id }, context) => {\n return resolve(async () => {\n ensureAuthentication(context);\n const deleteFolderUseCase = context.container.resolve(DeleteFolderUseCase);\n const result = await deleteFolderUseCase.execute(id);\n if (result.isFail()) {\n throw result.error;\n }\n return true;\n });\n }\n }\n }\n });\n\n folderGraphQL.name = \"aco.graphql.folders\";\n\n return folderGraphQL;\n};\n"],"names":["createFoldersSchema","params","folderGraphQL","GraphQLSchemaPlugin","createFolderTypeDefs","folder","_","context","flp","FolderLevelPermissions","__","resolve","ensureAuthentication","FolderModel","id","getFolderUseCase","GetFolderUseCase","result","args","listFoldersUseCase","ListFoldersUseCase","folders","meta","ListResponse","e","ErrorResponse","getFolderHierarchyUseCase","GetFolderHierarchyUseCase","listTargetsUseCase","ListFolderLevelPermissionsTargetsUseCase","entries","data","createFolderUseCase","CreateFolderUseCase","updateFolderUseCase","UpdateFolderUseCase","deleteFolderUseCase","DeleteFolderUseCase"],"mappings":";;;;;;;;;;;;;;AAkBO,MAAMA,sBAAsB,CAACC;IAChC,MAAMC,gBAAgB,IAAIC,oBAAgC;QACtD,UAAUC,qBAAqBH;QAC/B,WAAW;YACP,QAAQ;gBACJ,4BAA4B,CAACI,QAAgBC,GAAGC;oBAC5C,MAAMC,MAAMD,QAAQ,SAAS,CAAC,OAAO,CAACE;oBACtC,OAAOD,IAAI,yCAAyC,CAACH,OAAO,WAAW,IAAI,EAAE;gBACjF;gBACA,oBAAoB,CAACA,QAAQC,GAAGC;oBAC5B,MAAMC,MAAMD,QAAQ,SAAS,CAAC,OAAO,CAACE;oBACtC,OAAOD,IAAI,wBAAwB,CAACH;gBACxC;gBACA,sBAAsB,CAACA,QAAQC,GAAGC;oBAC9B,MAAMC,MAAMD,QAAQ,SAAS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Q,SAAS,CAAC,OAAO,CAAC8B;wBACtD,MAAMpB,SAAS,MAAMmB,oBAAoB,OAAO,CAACtB;wBACjD,IAAIG,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;wBAEtB,OAAO;oBACX;YAER;QACJ;IACJ;IAEAf,cAAc,IAAI,GAAG;IAErB,OAAOA;AACX"}
|
|
1
|
+
{"version":3,"file":"folder/folder.gql.js","sources":["../../src/folder/folder.gql.ts"],"sourcesContent":["import { ErrorResponse, ListResponse } from \"@webiny/api-graphql/responses.js\";\nimport { GraphQLSchemaPlugin } from \"@webiny/api-graphql/plugins/GraphQLSchemaPlugin.js\";\n\nimport type { CreateFolderTypeDefsParams } from \"./createFolderTypeDefs.js\";\nimport { createFolderTypeDefs } from \"./createFolderTypeDefs.js\";\nimport { ensureAuthentication } from \"~/utils/ensureAuthentication.js\";\nimport { resolve } from \"~/utils/resolve.js\";\nimport type { AcoContext, Folder } from \"~/types.js\";\nimport { FolderLevelPermissions } from \"~/features/flp/FolderLevelPermissions/index.js\";\nimport { GetFolderUseCase } from \"~/features/folder/GetFolder/abstractions.js\";\nimport { ListFoldersUseCase } from \"~/features/folder/ListFolders/abstractions.js\";\nimport { CreateFolderUseCase } from \"~/features/folder/CreateFolder/abstractions.js\";\nimport { UpdateFolderUseCase } from \"~/features/folder/UpdateFolder/abstractions.js\";\nimport { DeleteFolderUseCase } from \"~/features/folder/DeleteFolder/abstractions.js\";\nimport { GetFolderHierarchyUseCase } from \"~/features/folder/GetFolderHierarchy/abstractions.js\";\nimport { ListFolderLevelPermissionsTargetsUseCase } from \"~/features/folder/ListFolderLevelPermissionsTargets/abstractions.js\";\nimport { FolderModelProvider } from \"~/domain/folder/abstractions.js\";\nimport { ValuesSelectionGenerator } from \"@webiny/api-headless-cms/features/contentModel/ValuesSelectionGenerator/abstractions.js\";\n\nexport const createFoldersSchema = (params: CreateFolderTypeDefsParams) => {\n const folderGraphQL = new GraphQLSchemaPlugin<AcoContext>({\n typeDefs: createFolderTypeDefs(params),\n resolvers: {\n Folder: {\n hasNonInheritedPermissions: (folder: Folder, _, context) => {\n const flp = context.container.resolve(FolderLevelPermissions);\n return flp.permissionsIncludeNonInheritedPermissions(folder.permissions ?? []);\n },\n canManageStructure: (folder, _, context) => {\n const flp = context.container.resolve(FolderLevelPermissions);\n return flp.canManageFolderStructure(folder);\n },\n canManagePermissions: (folder, _, context) => {\n const flp = context.container.resolve(FolderLevelPermissions);\n return flp.canManageFolderPermissions(folder);\n },\n canManageContent: (folder, _, context) => {\n const flp = context.container.resolve(FolderLevelPermissions);\n return flp.canManageFolderContent(folder);\n }\n },\n AcoQuery: {\n getFolderModel(_, __, context) {\n return resolve(async () => {\n ensureAuthentication(context);\n const model = await context.container.resolve(FolderModelProvider).get();\n const generator = context.container.resolve(ValuesSelectionGenerator);\n return {\n ...model,\n valuesSelection: generator.generate(model)\n };\n });\n },\n getFolder: async (_, { id }, context) => {\n return resolve(async () => {\n ensureAuthentication(context);\n const getFolderUseCase = context.container.resolve(GetFolderUseCase);\n const result = await getFolderUseCase.execute(id);\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n },\n listFolders: async (_, args: any, context) => {\n try {\n ensureAuthentication(context);\n const listFoldersUseCase = context.container.resolve(ListFoldersUseCase);\n const result = await listFoldersUseCase.execute(args);\n if (result.isFail()) {\n throw result.error;\n }\n const { folders, meta } = result.value;\n return new ListResponse(folders, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n getFolderHierarchy: async (_, args: any, context) => {\n try {\n return resolve(async () => {\n ensureAuthentication(context);\n const getFolderHierarchyUseCase =\n context.container.resolve(GetFolderHierarchyUseCase);\n const result = await getFolderHierarchyUseCase.execute(args);\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n listFolderLevelPermissionsTargets: async (_, args: any, context) => {\n try {\n ensureAuthentication(context);\n const listTargetsUseCase = context.container.resolve(\n ListFolderLevelPermissionsTargetsUseCase\n );\n const result = await listTargetsUseCase.execute();\n if (result.isFail()) {\n throw result.error;\n }\n const [entries, meta] = result.value;\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n }\n },\n AcoMutation: {\n createFolder: async (_, { data }, context) => {\n return resolve(async () => {\n ensureAuthentication(context);\n const createFolderUseCase = context.container.resolve(CreateFolderUseCase);\n const result = await createFolderUseCase.execute(data);\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n },\n updateFolder: async (_, { id, data }, context) => {\n return resolve(async () => {\n ensureAuthentication(context);\n const updateFolderUseCase = context.container.resolve(UpdateFolderUseCase);\n const result = await updateFolderUseCase.execute(id, data);\n if (result.isFail()) {\n throw result.error;\n }\n return result.value;\n });\n },\n deleteFolder: async (_, { id }, context) => {\n return resolve(async () => {\n ensureAuthentication(context);\n const deleteFolderUseCase = context.container.resolve(DeleteFolderUseCase);\n const result = await deleteFolderUseCase.execute(id);\n if (result.isFail()) {\n throw result.error;\n }\n return true;\n });\n }\n }\n }\n });\n\n folderGraphQL.name = \"aco.graphql.folders\";\n\n return folderGraphQL;\n};\n"],"names":["createFoldersSchema","params","folderGraphQL","GraphQLSchemaPlugin","createFolderTypeDefs","folder","_","context","flp","FolderLevelPermissions","__","resolve","ensureAuthentication","model","FolderModelProvider","generator","ValuesSelectionGenerator","id","getFolderUseCase","GetFolderUseCase","result","args","listFoldersUseCase","ListFoldersUseCase","folders","meta","ListResponse","e","ErrorResponse","getFolderHierarchyUseCase","GetFolderHierarchyUseCase","listTargetsUseCase","ListFolderLevelPermissionsTargetsUseCase","entries","data","createFolderUseCase","CreateFolderUseCase","updateFolderUseCase","UpdateFolderUseCase","deleteFolderUseCase","DeleteFolderUseCase"],"mappings":";;;;;;;;;;;;;;;AAmBO,MAAMA,sBAAsB,CAACC;IAChC,MAAMC,gBAAgB,IAAIC,oBAAgC;QACtD,UAAUC,qBAAqBH;QAC/B,WAAW;YACP,QAAQ;gBACJ,4BAA4B,CAAC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,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;wBAEtB,OAAOA,OAAO,KAAK;oBACvB;gBAEJ,cAAc,OAAOd,GAAG,EAAEW,EAAE,EAAEiB,IAAI,EAAE,EAAE3B,UAC3BI,QAAQ;wBACXC,qBAAqBL;wBACrB,MAAM8B,sBAAsB9B,QAAQ,SAAS,CAAC,OAAO,CAAC+B;wBACtD,MAAMlB,SAAS,MAAMiB,oBAAoB,OAAO,CAACpB,IAAIiB;wBACrD,IAAId,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;wBAEtB,OAAOA,OAAO,KAAK;oBACvB;gBAEJ,cAAc,OAAOd,GAAG,EAAEW,EAAE,EAAE,EAAEV,UACrBI,QAAQ;wBACXC,qBAAqBL;wBACrB,MAAMgC,sBAAsBhC,QAAQ,SAAS,CAAC,OAAO,CAACiC;wBACtD,MAAMpB,SAAS,MAAMmB,oBAAoB,OAAO,CAACtB;wBACjD,IAAIG,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;wBAEtB,OAAO;oBACX;YAER;QACJ;IACJ;IAEAlB,cAAc,IAAI,GAAG;IAErB,OAAOA;AACX"}
|
package/index.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb/index.js";
|
|
2
1
|
export { FILTER_MODEL_ID } from "./filter/filter.model.js";
|
|
3
|
-
export interface CreateAcoParams {
|
|
4
|
-
documentClient: DynamoDBDocument;
|
|
5
|
-
useFolderLevelPermissions?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare const createAco: (params: CreateAcoParams) => (import("@webiny/api/index.js").ContextPlugin<import("@webiny/api/types.js").Context> | (import("@webiny/api/index.js").ContextPlugin<import("./types.js").AcoContext> | import("@webiny/handler/index.js").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context>)[] | import("@webiny/handler-graphql/index.js").GraphQLSchemaPlugin<import("./types.js").AcoContext>)[];
|
|
8
2
|
export * from "./folder/createFolderModelModifier.js";
|
|
3
|
+
export { AcoFeature } from "./AcoFeature.js";
|
package/index.js
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import { createAcoContext } from "./createAcoContext.js";
|
|
2
|
-
import { createAcoGraphQL } from "./createAcoGraphQL.js";
|
|
3
|
-
import { createAcoTasks } from "./createAcoTasks.js";
|
|
4
1
|
export * from "./folder/createFolderModelModifier.js";
|
|
5
|
-
const createAco = (params)=>[
|
|
6
|
-
createAcoContext(params),
|
|
7
|
-
...createAcoGraphQL(),
|
|
8
|
-
createAcoTasks()
|
|
9
|
-
];
|
|
10
2
|
export { FILTER_MODEL_ID } from "./filter/filter.model.js";
|
|
11
|
-
export {
|
|
12
|
-
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
3
|
+
export { AcoFeature } from "./AcoFeature.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-aco",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.7c2def32a7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aco:base"
|
|
@@ -21,34 +21,33 @@
|
|
|
21
21
|
".": "./index.js"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@webiny/api": "0.0.0-unstable.
|
|
25
|
-
"@webiny/api-
|
|
26
|
-
"@webiny/api-headless-cms": "0.0.0-unstable.
|
|
27
|
-
"@webiny/
|
|
28
|
-
"@webiny/
|
|
29
|
-
"@webiny/
|
|
30
|
-
"@webiny/
|
|
31
|
-
"@webiny/feature": "0.0.0-unstable.
|
|
32
|
-
"@webiny/handler": "0.0.0-unstable.
|
|
33
|
-
"@webiny/
|
|
34
|
-
"@webiny/
|
|
35
|
-
"@webiny/
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"lodash": "4.18.1"
|
|
24
|
+
"@webiny/api-core": "0.0.0-unstable.7c2def32a7",
|
|
25
|
+
"@webiny/api-graphql": "0.0.0-unstable.7c2def32a7",
|
|
26
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.7c2def32a7",
|
|
27
|
+
"@webiny/api-websockets": "0.0.0-unstable.7c2def32a7",
|
|
28
|
+
"@webiny/di": "2.0.0",
|
|
29
|
+
"@webiny/error": "0.0.0-unstable.7c2def32a7",
|
|
30
|
+
"@webiny/event-handler-core": "0.0.0-unstable.7c2def32a7",
|
|
31
|
+
"@webiny/feature": "0.0.0-unstable.7c2def32a7",
|
|
32
|
+
"@webiny/handler": "0.0.0-unstable.7c2def32a7",
|
|
33
|
+
"@webiny/shared-aco": "0.0.0-unstable.7c2def32a7",
|
|
34
|
+
"@webiny/utils": "0.0.0-unstable.7c2def32a7",
|
|
35
|
+
"@webiny/validation": "0.0.0-unstable.7c2def32a7",
|
|
36
|
+
"lodash": "4.18.1",
|
|
37
|
+
"zod": "4.4.3"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
41
|
-
"@webiny/api
|
|
42
|
-
"@webiny/api-
|
|
43
|
-
"@webiny/
|
|
44
|
-
"@webiny/
|
|
45
|
-
"@webiny/
|
|
46
|
-
"@webiny/
|
|
47
|
-
"@webiny/wcp": "0.0.0-unstable.
|
|
48
|
-
"graphql": "16.14.
|
|
40
|
+
"@webiny/api": "0.0.0-unstable.7c2def32a7",
|
|
41
|
+
"@webiny/api-core-testing": "0.0.0-unstable.7c2def32a7",
|
|
42
|
+
"@webiny/api-file-manager": "0.0.0-unstable.7c2def32a7",
|
|
43
|
+
"@webiny/api-headless-cms-testing": "0.0.0-unstable.7c2def32a7",
|
|
44
|
+
"@webiny/build-tools": "0.0.0-unstable.7c2def32a7",
|
|
45
|
+
"@webiny/plugins": "0.0.0-unstable.7c2def32a7",
|
|
46
|
+
"@webiny/wcp": "0.0.0-unstable.7c2def32a7",
|
|
47
|
+
"graphql": "16.14.2",
|
|
49
48
|
"rimraf": "6.1.3",
|
|
50
|
-
"typescript": "
|
|
51
|
-
"vitest": "4.1.
|
|
49
|
+
"typescript": "7.0.2",
|
|
50
|
+
"vitest": "4.1.11"
|
|
52
51
|
},
|
|
53
52
|
"webiny": {
|
|
54
53
|
"publishFrom": "dist"
|
package/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Context as BaseContext } from "@webiny/handler/types.js";
|
|
2
|
-
import type { Context as TasksContext } from "@webiny/tasks/types.js";
|
|
3
2
|
import type { CmsContext } from "@webiny/api-headless-cms/types/index.js";
|
|
4
3
|
import type { AcoFilterCrud, AcoFilterStorageOperations } from "./filter/filter.types.js";
|
|
5
4
|
import type { AcoFolderLevelPermissionsCrud, AcoFolderLevelPermissionsStorageOperations } from "./flp/flp.types.js";
|
|
@@ -49,6 +48,6 @@ export interface AcoStorageOperations {
|
|
|
49
48
|
filter: AcoFilterStorageOperations;
|
|
50
49
|
flp: AcoFolderLevelPermissionsStorageOperations;
|
|
51
50
|
}
|
|
52
|
-
export interface AcoContext extends BaseContext, ApiCoreContext, CmsContext
|
|
51
|
+
export interface AcoContext extends BaseContext, ApiCoreContext, CmsContext {
|
|
53
52
|
aco: AdvancedContentOrganisation;
|
|
54
53
|
}
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type { Context as BaseContext } from \"@webiny/handler/types.js\";\nimport type {
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import type { Context as BaseContext } from \"@webiny/handler/types.js\";\nimport type { CmsContext } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { AcoFilterCrud, AcoFilterStorageOperations } from \"~/filter/filter.types.js\";\nimport type {\n AcoFolderLevelPermissionsCrud,\n AcoFolderLevelPermissionsStorageOperations\n} from \"~/flp/flp.types.js\";\nimport type { Container } from \"@webiny/di\";\nimport { FolderLevelPermissions } from \"./features/flp/FolderLevelPermissions/index.js\";\nimport type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport type { Tenant } from \"@webiny/api-core/types/tenancy.js\";\n\nexport * from \"./filter/filter.types.js\";\nexport type * from \"./folder/folder.types.js\";\nexport type * from \"./flp/flp.types.js\";\n\nexport interface User {\n id: string;\n type: string;\n displayName: string;\n}\n\nexport interface ListMeta {\n cursor: string | null;\n totalCount: number;\n hasMoreItems: boolean;\n}\n\nexport enum ListSortDirection {\n ASC,\n DESC\n}\n\nexport type ListSort = Record<string, ListSortDirection>;\n\nexport interface AcoBaseFields {\n id: string;\n entryId: string;\n createdOn: string;\n modifiedOn: string | null;\n savedOn: string;\n createdBy: User;\n modifiedBy: User | null;\n savedBy: User;\n}\n\nexport interface AdvancedContentOrganisation {\n filter: AcoFilterCrud;\n flp: AcoFolderLevelPermissionsCrud;\n}\n\nexport interface CreateAcoParams {\n getTenant: () => Tenant;\n storageOperations: AcoStorageOperations;\n folderLevelPermissions: FolderLevelPermissions.Interface;\n container: Container;\n}\n\nexport interface AcoStorageOperations {\n filter: AcoFilterStorageOperations;\n flp: AcoFolderLevelPermissionsStorageOperations;\n}\n\nexport interface AcoContext extends BaseContext, ApiCoreContext, CmsContext {\n aco: AdvancedContentOrganisation;\n}\n"],"names":["ListSortDirection"],"mappings":";AA4BO,IAAKA,0BAAiBA,WAAAA,GAAAA,SAAjBA,iBAAiB;;;WAAjBA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
2
|
+
import type { Container } from "@webiny/di";
|
|
2
3
|
import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
3
|
-
interface CreateOperationsWrapperParams
|
|
4
|
+
interface CreateOperationsWrapperParams {
|
|
5
|
+
container: Container;
|
|
6
|
+
identityContext: IdentityContext.Interface;
|
|
4
7
|
modelName: string;
|
|
5
8
|
}
|
|
6
9
|
export declare const createOperationsWrapper: (params: CreateOperationsWrapperParams) => {
|