@webiny/api-aco 0.0.0-unstable.a4f3e4ea8b → 0.0.0-unstable.a85ef555b2
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/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/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 +4 -3
- package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js +14 -13
- package/features/flp/FolderLevelPermissions/FolderLevelPermissions.js.map +1 -1
- package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.d.ts +6 -0
- package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js +6 -2
- package/features/flp/FolderLevelPermissions/useCases/GetDefaultPermissions/GetDefaultPermissionsWithTeams.js.map +1 -1
- 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/EnsureFolderIsEmpty/EnsureFolderIsEmpty.d.ts +1 -3
- package/features/folder/EnsureFolderIsEmpty/EnsureFolderIsEmpty.js +3 -6
- package/features/folder/EnsureFolderIsEmpty/EnsureFolderIsEmpty.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/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 +10 -0
- package/features/folder/shared/abstractions.js +3 -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 +2 -4
- 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/tasks/createFlp.task.d.ts +11 -4
- package/flp/tasks/createFlp.task.js +32 -15
- package/flp/tasks/createFlp.task.js.map +1 -1
- package/flp/tasks/deleteFlp.task.d.ts +9 -4
- 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 +9 -4
- package/flp/tasks/syncFlp.task.js +22 -13
- package/flp/tasks/syncFlp.task.js.map +1 -1
- package/flp/tasks/updateFlp.task.d.ts +11 -4
- 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 +4 -4
- package/folder/folder.gql.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -11
- package/package.json +23 -21
- package/types.d.ts +1 -2
- package/types.js.map +1 -1
- package/utils/createOperationsWrapper.d.ts +4 -4
- 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 +1 -1
- package/utils/resolve.js +1 -1
- package/utils/resolve.js.map +1 -1
- package/createAcoContext.d.ts +0 -3
- package/createAcoContext.js +0 -112
- package/createAcoContext.js.map +0 -1
- package/createAcoTasks.d.ts +0 -1
- package/createAcoTasks.js +0 -14
- package/createAcoTasks.js.map +0 -1
- package/index.js.map +0 -1
|
@@ -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,7 @@ 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
15
|
import { ValuesSelectionGenerator } from "@webiny/api-headless-cms/features/contentModel/ValuesSelectionGenerator/abstractions.js";
|
|
16
16
|
const createFoldersSchema = (params)=>{
|
|
17
17
|
const folderGraphQL = new GraphQLSchemaPlugin({
|
|
@@ -39,7 +39,7 @@ const createFoldersSchema = (params)=>{
|
|
|
39
39
|
getFolderModel (_, __, context) {
|
|
40
40
|
return resolve(async ()=>{
|
|
41
41
|
ensureAuthentication(context);
|
|
42
|
-
const model = context.container.resolve(
|
|
42
|
+
const model = await context.container.resolve(FolderModelProvider).get();
|
|
43
43
|
const generator = context.container.resolve(ValuesSelectionGenerator);
|
|
44
44
|
return {
|
|
45
45
|
...model,
|
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\";\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 = context.container.resolve(FolderModel);\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","FolderModel","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,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,CAAC,OAAO,CAACE;oBACtC,OAAOD,IAAI,0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AAG,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"}
|
|
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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AQ,SAAS,CAAC,OAAO,CAAC6B;wBACtD,MAAMhB,SAAS,MAAMe,oBAAoB,OAAO,CAACD;wBACjD,IAAId,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,3 +1,3 @@
|
|
|
1
1
|
export { FILTER_MODEL_ID } from "./filter/filter.model.js";
|
|
2
|
-
export declare const createAco: () => ((import("@webiny/api/index.js").ContextPlugin<import("./types.js").AcoContext> | import("@webiny/handler/index.js").RegisterExtensionPlugin<import("@webiny/handler/types.js").Context>)[] | import("@webiny/api/index.js").ContextPlugin<import("./types.js").AcoContext> | import("@webiny/handler-graphql/index.js").GraphQLSchemaPlugin<import("./types.js").AcoContext>)[];
|
|
3
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 = ()=>[
|
|
6
|
-
createAcoContext(),
|
|
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.a85ef555b2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aco:base"
|
|
@@ -21,31 +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/di": "
|
|
29
|
-
"@webiny/error": "0.0.0-unstable.
|
|
30
|
-
"@webiny/
|
|
31
|
-
"@webiny/
|
|
32
|
-
"@webiny/handler
|
|
33
|
-
"@webiny/shared-aco": "0.0.0-unstable.
|
|
34
|
-
"@webiny/utils": "0.0.0-unstable.
|
|
35
|
-
"@webiny/validation": "0.0.0-unstable.
|
|
36
|
-
"lodash": "4.18.1"
|
|
24
|
+
"@webiny/api-core": "0.0.0-unstable.a85ef555b2",
|
|
25
|
+
"@webiny/api-graphql": "0.0.0-unstable.a85ef555b2",
|
|
26
|
+
"@webiny/api-headless-cms": "0.0.0-unstable.a85ef555b2",
|
|
27
|
+
"@webiny/api-websockets": "0.0.0-unstable.a85ef555b2",
|
|
28
|
+
"@webiny/di": "2.0.0",
|
|
29
|
+
"@webiny/error": "0.0.0-unstable.a85ef555b2",
|
|
30
|
+
"@webiny/event-handler-core": "0.0.0-unstable.a85ef555b2",
|
|
31
|
+
"@webiny/feature": "0.0.0-unstable.a85ef555b2",
|
|
32
|
+
"@webiny/handler": "0.0.0-unstable.a85ef555b2",
|
|
33
|
+
"@webiny/shared-aco": "0.0.0-unstable.a85ef555b2",
|
|
34
|
+
"@webiny/utils": "0.0.0-unstable.a85ef555b2",
|
|
35
|
+
"@webiny/validation": "0.0.0-unstable.a85ef555b2",
|
|
36
|
+
"lodash": "4.18.1",
|
|
37
|
+
"zod": "4.4.3"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
|
-
"@webiny/api
|
|
40
|
-
"@webiny/
|
|
41
|
-
"@webiny/
|
|
42
|
-
"@webiny/
|
|
43
|
-
"@webiny/
|
|
44
|
-
"@webiny/
|
|
40
|
+
"@webiny/api": "0.0.0-unstable.a85ef555b2",
|
|
41
|
+
"@webiny/api-core-testing": "0.0.0-unstable.a85ef555b2",
|
|
42
|
+
"@webiny/api-file-manager": "0.0.0-unstable.a85ef555b2",
|
|
43
|
+
"@webiny/api-headless-cms-testing": "0.0.0-unstable.a85ef555b2",
|
|
44
|
+
"@webiny/build-tools": "0.0.0-unstable.a85ef555b2",
|
|
45
|
+
"@webiny/plugins": "0.0.0-unstable.a85ef555b2",
|
|
46
|
+
"@webiny/wcp": "0.0.0-unstable.a85ef555b2",
|
|
45
47
|
"graphql": "16.14.2",
|
|
46
48
|
"rimraf": "6.1.3",
|
|
47
49
|
"typescript": "7.0.2",
|
|
48
|
-
"vitest": "4.1.
|
|
50
|
+
"vitest": "4.1.11"
|
|
49
51
|
},
|
|
50
52
|
"webiny": {
|
|
51
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/background-tasks/api/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,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
2
|
+
import type { Container } from "@webiny/di";
|
|
3
3
|
import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
4
4
|
interface CreateOperationsWrapperParams {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
container: Container;
|
|
6
|
+
identityContext: IdentityContext.Interface;
|
|
7
7
|
modelName: string;
|
|
8
8
|
}
|
|
9
9
|
export declare const createOperationsWrapper: (params: CreateOperationsWrapperParams) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
|
|
2
2
|
const createOperationsWrapper = (params)=>{
|
|
3
|
-
const {
|
|
3
|
+
const { identityContext, container, modelName } = params;
|
|
4
4
|
const withModel = async (cb)=>{
|
|
5
|
-
const
|
|
6
|
-
if (
|
|
7
|
-
return cb(
|
|
5
|
+
const result = await identityContext.withoutAuthorization(()=>container.resolve(GetModelUseCase).execute(modelName));
|
|
6
|
+
if (result.isFail()) throw result.error;
|
|
7
|
+
return cb(result.value);
|
|
8
8
|
};
|
|
9
9
|
return {
|
|
10
10
|
withModel
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/createOperationsWrapper.js","sources":["../../src/utils/createOperationsWrapper.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"utils/createOperationsWrapper.js","sources":["../../src/utils/createOperationsWrapper.ts"],"sourcesContent":["import type { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport type { Container } from \"@webiny/di\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\n\ninterface CreateOperationsWrapperParams {\n container: Container;\n identityContext: IdentityContext.Interface;\n modelName: string;\n}\n\nexport const createOperationsWrapper = (params: CreateOperationsWrapperParams) => {\n const { identityContext, container, modelName } = params;\n\n const withModel = async <TResult>(\n cb: (model: CmsModel) => Promise<TResult>\n ): Promise<TResult> => {\n const result = await identityContext.withoutAuthorization(() => {\n return container.resolve(GetModelUseCase).execute(modelName);\n });\n if (result.isFail()) {\n throw result.error;\n }\n\n return cb(result.value);\n };\n\n return { withModel };\n};\n"],"names":["createOperationsWrapper","params","identityContext","container","modelName","withModel","cb","result","GetModelUseCase"],"mappings":";AAWO,MAAMA,0BAA0B,CAACC;IACpC,MAAM,EAAEC,eAAe,EAAEC,SAAS,EAAEC,SAAS,EAAE,GAAGH;IAElD,MAAMI,YAAY,OACdC;QAEA,MAAMC,SAAS,MAAML,gBAAgB,oBAAoB,CAAC,IAC/CC,UAAU,OAAO,CAACK,iBAAiB,OAAO,CAACJ;QAEtD,IAAIG,OAAO,MAAM,IACb,MAAMA,OAAO,KAAK;QAGtB,OAAOD,GAAGC,OAAO,KAAK;IAC1B;IAEA,OAAO;QAAEF;IAAU;AACvB"}
|
|
@@ -3,6 +3,8 @@ import { ListEntriesFactory } from "./ListEntriesFactory.js";
|
|
|
3
3
|
import { FilterEntriesByFolderFactory } from "./FilterEntriesByFolderFactory.js";
|
|
4
4
|
import { decorateIfModelAuthorizationEnabled } from "./decorateIfModelAuthorizationEnabled.js";
|
|
5
5
|
import { FolderLevelPermissions } from "../../features/flp/FolderLevelPermissions/index.js";
|
|
6
|
+
import { GetRevisionByIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js";
|
|
7
|
+
import { GetLatestRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js";
|
|
6
8
|
class CmsEntriesCrudDecorators {
|
|
7
9
|
constructor({ context }){
|
|
8
10
|
this.context = context;
|
|
@@ -10,6 +12,8 @@ class CmsEntriesCrudDecorators {
|
|
|
10
12
|
decorate() {
|
|
11
13
|
const context = this.context;
|
|
12
14
|
const folderLevelPermissions = context.container.resolve(FolderLevelPermissions);
|
|
15
|
+
const getRevisionById = context.container.resolve(GetRevisionByIdStorageOperation);
|
|
16
|
+
const getLatestRevisionByEntryId = context.container.resolve(GetLatestRevisionByEntryIdStorageOperation);
|
|
13
17
|
const filterEntriesByFolder = new FilterEntriesByFolderFactory(folderLevelPermissions);
|
|
14
18
|
const listEntriesHandler = new ListEntriesFactory(folderLevelPermissions);
|
|
15
19
|
decorateIfModelAuthorizationEnabled(context, "listEntries", async (...allParams)=>{
|
|
@@ -91,7 +95,7 @@ class CmsEntriesCrudDecorators {
|
|
|
91
95
|
});
|
|
92
96
|
decorateIfModelAuthorizationEnabled(context, "createEntryRevisionFrom", async (...allParams)=>{
|
|
93
97
|
const [decoratee, model, id, input, options] = allParams;
|
|
94
|
-
const entry = await
|
|
98
|
+
const entry = await getRevisionById.execute(model, {
|
|
95
99
|
id
|
|
96
100
|
});
|
|
97
101
|
const folderId = entry?.location?.folderId;
|
|
@@ -105,7 +109,7 @@ class CmsEntriesCrudDecorators {
|
|
|
105
109
|
});
|
|
106
110
|
decorateIfModelAuthorizationEnabled(context, "updateEntry", async (...allParams)=>{
|
|
107
111
|
const [decoratee, model, id, input, meta, options] = allParams;
|
|
108
|
-
const entry = await
|
|
112
|
+
const entry = await getRevisionById.execute(model, {
|
|
109
113
|
id
|
|
110
114
|
});
|
|
111
115
|
const folderId = entry?.location?.folderId;
|
|
@@ -119,7 +123,7 @@ class CmsEntriesCrudDecorators {
|
|
|
119
123
|
});
|
|
120
124
|
decorateIfModelAuthorizationEnabled(context, "deleteEntry", async (...allParams)=>{
|
|
121
125
|
const [decoratee, model, id, options] = allParams;
|
|
122
|
-
const entry = await
|
|
126
|
+
const entry = await getLatestRevisionByEntryId.execute(model, {
|
|
123
127
|
id
|
|
124
128
|
});
|
|
125
129
|
const folderId = entry?.location?.folderId;
|
|
@@ -133,7 +137,7 @@ class CmsEntriesCrudDecorators {
|
|
|
133
137
|
});
|
|
134
138
|
decorateIfModelAuthorizationEnabled(context, "deleteEntryRevision", async (...allParams)=>{
|
|
135
139
|
const [decoratee, model, id] = allParams;
|
|
136
|
-
const entry = await
|
|
140
|
+
const entry = await getRevisionById.execute(model, {
|
|
137
141
|
id
|
|
138
142
|
});
|
|
139
143
|
const folderId = entry?.location?.folderId;
|
|
@@ -147,7 +151,7 @@ class CmsEntriesCrudDecorators {
|
|
|
147
151
|
});
|
|
148
152
|
decorateIfModelAuthorizationEnabled(context, "moveEntry", async (...allParams)=>{
|
|
149
153
|
const [decoratee, model, id, targetFolderId] = allParams;
|
|
150
|
-
const entry = await
|
|
154
|
+
const entry = await getRevisionById.execute(model, {
|
|
151
155
|
id
|
|
152
156
|
});
|
|
153
157
|
const folderId = entry?.location?.folderId || ROOT_FOLDER;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/decorators/CmsEntriesCrudDecorators.js","sources":["../../../src/utils/decorators/CmsEntriesCrudDecorators.ts"],"sourcesContent":["// @ts-nocheck Being removed\nimport type { AcoContext } from \"~/types.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport { ListEntriesFactory } from \"./ListEntriesFactory.js\";\nimport { FilterEntriesByFolderFactory } from \"./FilterEntriesByFolderFactory.js\";\nimport { decorateIfModelAuthorizationEnabled } from \"./decorateIfModelAuthorizationEnabled.js\";\nimport { FolderLevelPermissions } from \"~/features/flp/FolderLevelPermissions/index.js\";\n\ntype Context = AcoContext;\n\ninterface EntryManagerCrudDecoratorsParams {\n context: Context;\n}\n\nexport class CmsEntriesCrudDecorators {\n private readonly context: Context;\n\n public constructor({ context }: EntryManagerCrudDecoratorsParams) {\n this.context = context;\n }\n\n public decorate() {\n const context = this.context;\n const folderLevelPermissions = context.container.resolve(FolderLevelPermissions);\n\n const filterEntriesByFolder = new FilterEntriesByFolderFactory(folderLevelPermissions);\n const listEntriesHandler = new ListEntriesFactory(folderLevelPermissions);\n\n decorateIfModelAuthorizationEnabled(context, \"listEntries\", async (...allParams) => {\n const [decoratee, model, initialParams] = allParams;\n return await listEntriesHandler.execute({ decoratee, model, initialParams });\n });\n\n decorateIfModelAuthorizationEnabled(context, \"listLatestEntries\", async (...allParams) => {\n const [decoratee, model, initialParams] = allParams;\n return await listEntriesHandler.execute({ decoratee, model, initialParams });\n });\n\n decorateIfModelAuthorizationEnabled(\n context,\n \"listPublishedEntries\",\n async (...allParams) => {\n const [decoratee, model, initialParams] = allParams;\n return await listEntriesHandler.execute({ decoratee, model, initialParams });\n }\n );\n\n decorateIfModelAuthorizationEnabled(context, \"listDeletedEntries\", async (...allParams) => {\n const [decoratee, model, initialParams] = allParams;\n return await listEntriesHandler.execute({ decoratee, model, initialParams });\n });\n\n decorateIfModelAuthorizationEnabled(context, \"getEntry\", async (...allParams) => {\n const [decoratee, model, params] = allParams;\n const entry = await decoratee(model, params);\n\n const folderId = entry?.location?.folderId;\n if (!folderId || folderId === ROOT_FOLDER) {\n return entry;\n }\n\n const permissions = await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"r\"\n });\n\n return entry;\n });\n\n decorateIfModelAuthorizationEnabled(context, \"getEntryById\", async (...allParams) => {\n const [decoratee, model, params] = allParams;\n const entry = await decoratee(model, params);\n\n const folderId = entry?.location?.folderId;\n if (!folderId || folderId === ROOT_FOLDER) {\n return entry;\n }\n const permissions = await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"r\"\n });\n return entry;\n });\n\n decorateIfModelAuthorizationEnabled(\n context,\n \"getLatestEntriesByIds\",\n async (...allParams) => {\n const [decoratee, model, ids] = allParams;\n\n const entries = await decoratee(model, ids);\n\n return filterEntriesByFolder.execute(entries);\n }\n );\n\n decorateIfModelAuthorizationEnabled(\n context,\n \"getPublishedEntriesByIds\",\n async (...allParams) => {\n const [decoratee, model, ids] = allParams;\n\n const entries = await decoratee(model, ids);\n return filterEntriesByFolder.execute(entries);\n }\n );\n\n decorateIfModelAuthorizationEnabled(context, \"createEntry\", async (...allParams) => {\n const [decoratee, model, params, options] = allParams;\n const folderId = params.wbyAco_location?.folderId || params.location?.folderId;\n\n if (!folderId || folderId === ROOT_FOLDER) {\n return decoratee(model, params, options);\n }\n\n const permissions = await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"w\"\n });\n\n return decoratee(model, params, options);\n });\n\n decorateIfModelAuthorizationEnabled(\n context,\n \"createEntryRevisionFrom\",\n async (...allParams) => {\n const [decoratee, model, id, input, options] = allParams;\n\n const entry = await context.cms.storageOperations.entries.getRevisionById(model, {\n id\n });\n\n const folderId = entry?.location?.folderId;\n if (!folderId || folderId === ROOT_FOLDER) {\n return decoratee(model, id, input, options);\n }\n\n const permissions =\n await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"w\"\n });\n\n return decoratee(model, id, input, options);\n }\n );\n\n decorateIfModelAuthorizationEnabled(context, \"updateEntry\", async (...allParams) => {\n const [decoratee, model, id, input, meta, options] = allParams;\n const entry = await context.cms.storageOperations.entries.getRevisionById(model, {\n id\n });\n\n const folderId = entry?.location?.folderId;\n if (!folderId || folderId === ROOT_FOLDER) {\n return decoratee(model, id, input, meta, options);\n }\n\n const permissions = await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"w\"\n });\n\n return decoratee(model, id, input, meta, options);\n });\n\n decorateIfModelAuthorizationEnabled(context, \"deleteEntry\", async (...allParams) => {\n const [decoratee, model, id, options] = allParams;\n\n const entry = await context.cms.storageOperations.entries.getLatestRevisionByEntryId(\n model,\n {\n id\n }\n );\n\n const folderId = entry?.location?.folderId;\n if (!folderId || folderId === ROOT_FOLDER) {\n return decoratee(model, id, options);\n }\n\n const permissions = await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"d\"\n });\n\n return decoratee(model, id, options);\n });\n\n decorateIfModelAuthorizationEnabled(\n context,\n \"deleteEntryRevision\",\n async (...allParams) => {\n const [decoratee, model, id] = allParams;\n\n const entry = await context.cms.storageOperations.entries.getRevisionById(model, {\n id\n });\n\n const folderId = entry?.location?.folderId;\n if (!folderId || folderId === ROOT_FOLDER) {\n return decoratee(model, id);\n }\n\n const permissions =\n await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"d\"\n });\n\n return decoratee(model, id);\n }\n );\n\n decorateIfModelAuthorizationEnabled(context, \"moveEntry\", async (...allParams) => {\n const [decoratee, model, id, targetFolderId] = allParams;\n\n /**\n * First we need to check if user has access to the entries existing folder.\n */\n const entry = await context.cms.storageOperations.entries.getRevisionById(model, {\n id\n });\n\n const folderId = entry?.location?.folderId || ROOT_FOLDER;\n /**\n * If the entry is in the same folder we are trying to move it to, just continue.\n */\n if (folderId === targetFolderId) {\n return decoratee(model, id, targetFolderId);\n } else if (folderId !== ROOT_FOLDER) {\n /**\n * If entry current folder is not a root, check for access\n */\n const permissions =\n await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"w\"\n });\n }\n /**\n * If target folder is not a ROOT_FOLDER, check for access.\n */\n if (targetFolderId !== ROOT_FOLDER) {\n const permissions =\n await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"w\"\n });\n }\n\n return decoratee(model, id, targetFolderId);\n });\n }\n}\n"],"names":["CmsEntriesCrudDecorators","context","folderLevelPermissions","FolderLevelPermissions","filterEntriesByFolder","FilterEntriesByFolderFactory","listEntriesHandler","ListEntriesFactory","decorateIfModelAuthorizationEnabled","allParams","decoratee","model","initialParams","params","entry","folderId","ROOT_FOLDER","permissions","ids","entries","options","id","input","meta","targetFolderId"],"mappings":";;;;;AAcO,MAAMA;IAGT,YAAmB,EAAEC,OAAO,EAAoC,CAAE;QAC9D,IAAI,CAAC,OAAO,GAAGA;IACnB;IAEO,WAAW;QACd,MAAMA,UAAU,IAAI,CAAC,OAAO;QAC5B,MAAMC,yBAAyBD,QAAQ,SAAS,CAAC,OAAO,CAACE;QAEzD,MAAMC,wBAAwB,IAAIC,6BAA6BH;QAC/D,MAAMI,qBAAqB,IAAIC,mBAAmBL;QAElDM,oCAAoCP,SAAS,eAAe,OAAO,GAAGQ;YAClE,MAAM,CAACC,WAAWC,OAAOC,cAAc,GAAGH;YAC1C,OAAO,MAAMH,mBAAmB,OAAO,CAAC;gB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,MAAMf,uBAAuB,yBAAyB,CAACa;YAC3D,MAAMb,uBAAuB,4BAA4B,CAAC;gBACtDe;gBACA,KAAK;YACT;YAEA,OAAOP,UAAUC,OAAOU;QAC5B;QAGJb,oCAAoCP,SAAS,aAAa,OAAO,GAAGQ;YAChE,MAAM,CAACC,WAAWC,OAAOU,IAAIG,eAAe,GAAGf;YAK/C,MAAMK,QAAQ,MAAMb,QAAQ,GAAG,CAAC,iBAAiB,CAAC,OAAO,CAAC,eAAe,CAACU,OAAO;gBAC7EU;YACJ;YAEA,MAAMN,WAAWD,OAAO,UAAU,YAAYE;YAI9C,IAAID,aAAaS,gBACb,OAAOd,UAAUC,OAAOU,IAAIG;YACzB,IAAIT,aAAaC,aAAa;gBAIjC,MAAMC,cACF,MAAMf,uBAAuB,yBAAyB,CAACa;gBAC3D,MAAMb,uBAAuB,4BAA4B,CAAC;oBACtDe;oBACA,KAAK;gBACT;YACJ;YAIA,IAAIO,mBAAmBR,aAAa;gBAChC,MAAMC,cACF,MAAMf,uBAAuB,yBAAyB,CAACa;gBAC3D,MAAMb,uBAAuB,4BAA4B,CAAC;oBACtDe;oBACA,KAAK;gBACT;YACJ;YAEA,OAAOP,UAAUC,OAAOU,IAAIG;QAChC;IACJ;AACJ"}
|
|
1
|
+
{"version":3,"file":"utils/decorators/CmsEntriesCrudDecorators.js","sources":["../../../src/utils/decorators/CmsEntriesCrudDecorators.ts"],"sourcesContent":["// @ts-nocheck Being removed\nimport type { AcoContext } from \"~/types.js\";\nimport { ROOT_FOLDER } from \"~/constants.js\";\nimport { ListEntriesFactory } from \"./ListEntriesFactory.js\";\nimport { FilterEntriesByFolderFactory } from \"./FilterEntriesByFolderFactory.js\";\nimport { decorateIfModelAuthorizationEnabled } from \"./decorateIfModelAuthorizationEnabled.js\";\nimport { FolderLevelPermissions } from \"~/features/flp/FolderLevelPermissions/index.js\";\nimport { GetRevisionByIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js\";\nimport { GetLatestRevisionByEntryIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js\";\n\ntype Context = AcoContext;\n\ninterface EntryManagerCrudDecoratorsParams {\n context: Context;\n}\n\nexport class CmsEntriesCrudDecorators {\n private readonly context: Context;\n\n public constructor({ context }: EntryManagerCrudDecoratorsParams) {\n this.context = context;\n }\n\n public decorate() {\n const context = this.context;\n const folderLevelPermissions = context.container.resolve(FolderLevelPermissions);\n const getRevisionById = context.container.resolve(GetRevisionByIdStorageOperation);\n const getLatestRevisionByEntryId = context.container.resolve(\n GetLatestRevisionByEntryIdStorageOperation\n );\n\n const filterEntriesByFolder = new FilterEntriesByFolderFactory(folderLevelPermissions);\n const listEntriesHandler = new ListEntriesFactory(folderLevelPermissions);\n\n decorateIfModelAuthorizationEnabled(context, \"listEntries\", async (...allParams) => {\n const [decoratee, model, initialParams] = allParams;\n return await listEntriesHandler.execute({ decoratee, model, initialParams });\n });\n\n decorateIfModelAuthorizationEnabled(context, \"listLatestEntries\", async (...allParams) => {\n const [decoratee, model, initialParams] = allParams;\n return await listEntriesHandler.execute({ decoratee, model, initialParams });\n });\n\n decorateIfModelAuthorizationEnabled(\n context,\n \"listPublishedEntries\",\n async (...allParams) => {\n const [decoratee, model, initialParams] = allParams;\n return await listEntriesHandler.execute({ decoratee, model, initialParams });\n }\n );\n\n decorateIfModelAuthorizationEnabled(context, \"listDeletedEntries\", async (...allParams) => {\n const [decoratee, model, initialParams] = allParams;\n return await listEntriesHandler.execute({ decoratee, model, initialParams });\n });\n\n decorateIfModelAuthorizationEnabled(context, \"getEntry\", async (...allParams) => {\n const [decoratee, model, params] = allParams;\n const entry = await decoratee(model, params);\n\n const folderId = entry?.location?.folderId;\n if (!folderId || folderId === ROOT_FOLDER) {\n return entry;\n }\n\n const permissions = await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"r\"\n });\n\n return entry;\n });\n\n decorateIfModelAuthorizationEnabled(context, \"getEntryById\", async (...allParams) => {\n const [decoratee, model, params] = allParams;\n const entry = await decoratee(model, params);\n\n const folderId = entry?.location?.folderId;\n if (!folderId || folderId === ROOT_FOLDER) {\n return entry;\n }\n const permissions = await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"r\"\n });\n return entry;\n });\n\n decorateIfModelAuthorizationEnabled(\n context,\n \"getLatestEntriesByIds\",\n async (...allParams) => {\n const [decoratee, model, ids] = allParams;\n\n const entries = await decoratee(model, ids);\n\n return filterEntriesByFolder.execute(entries);\n }\n );\n\n decorateIfModelAuthorizationEnabled(\n context,\n \"getPublishedEntriesByIds\",\n async (...allParams) => {\n const [decoratee, model, ids] = allParams;\n\n const entries = await decoratee(model, ids);\n return filterEntriesByFolder.execute(entries);\n }\n );\n\n decorateIfModelAuthorizationEnabled(context, \"createEntry\", async (...allParams) => {\n const [decoratee, model, params, options] = allParams;\n const folderId = params.wbyAco_location?.folderId || params.location?.folderId;\n\n if (!folderId || folderId === ROOT_FOLDER) {\n return decoratee(model, params, options);\n }\n\n const permissions = await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"w\"\n });\n\n return decoratee(model, params, options);\n });\n\n decorateIfModelAuthorizationEnabled(\n context,\n \"createEntryRevisionFrom\",\n async (...allParams) => {\n const [decoratee, model, id, input, options] = allParams;\n\n const entry = await getRevisionById.execute(model, {\n id\n });\n\n const folderId = entry?.location?.folderId;\n if (!folderId || folderId === ROOT_FOLDER) {\n return decoratee(model, id, input, options);\n }\n\n const permissions =\n await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"w\"\n });\n\n return decoratee(model, id, input, options);\n }\n );\n\n decorateIfModelAuthorizationEnabled(context, \"updateEntry\", async (...allParams) => {\n const [decoratee, model, id, input, meta, options] = allParams;\n const entry = await getRevisionById.execute(model, {\n id\n });\n\n const folderId = entry?.location?.folderId;\n if (!folderId || folderId === ROOT_FOLDER) {\n return decoratee(model, id, input, meta, options);\n }\n\n const permissions = await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"w\"\n });\n\n return decoratee(model, id, input, meta, options);\n });\n\n decorateIfModelAuthorizationEnabled(context, \"deleteEntry\", async (...allParams) => {\n const [decoratee, model, id, options] = allParams;\n\n const entry = await getLatestRevisionByEntryId.execute(model, {\n id\n });\n\n const folderId = entry?.location?.folderId;\n if (!folderId || folderId === ROOT_FOLDER) {\n return decoratee(model, id, options);\n }\n\n const permissions = await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"d\"\n });\n\n return decoratee(model, id, options);\n });\n\n decorateIfModelAuthorizationEnabled(\n context,\n \"deleteEntryRevision\",\n async (...allParams) => {\n const [decoratee, model, id] = allParams;\n\n const entry = await getRevisionById.execute(model, {\n id\n });\n\n const folderId = entry?.location?.folderId;\n if (!folderId || folderId === ROOT_FOLDER) {\n return decoratee(model, id);\n }\n\n const permissions =\n await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"d\"\n });\n\n return decoratee(model, id);\n }\n );\n\n decorateIfModelAuthorizationEnabled(context, \"moveEntry\", async (...allParams) => {\n const [decoratee, model, id, targetFolderId] = allParams;\n\n /**\n * First we need to check if user has access to the entries existing folder.\n */\n const entry = await getRevisionById.execute(model, {\n id\n });\n\n const folderId = entry?.location?.folderId || ROOT_FOLDER;\n /**\n * If the entry is in the same folder we are trying to move it to, just continue.\n */\n if (folderId === targetFolderId) {\n return decoratee(model, id, targetFolderId);\n } else if (folderId !== ROOT_FOLDER) {\n /**\n * If entry current folder is not a root, check for access\n */\n const permissions =\n await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"w\"\n });\n }\n /**\n * If target folder is not a ROOT_FOLDER, check for access.\n */\n if (targetFolderId !== ROOT_FOLDER) {\n const permissions =\n await folderLevelPermissions.getFolderLevelPermissions(folderId);\n await folderLevelPermissions.ensureCanAccessFolderContent({\n permissions,\n rwd: \"w\"\n });\n }\n\n return decoratee(model, id, targetFolderId);\n });\n }\n}\n"],"names":["CmsEntriesCrudDecorators","context","folderLevelPermissions","FolderLevelPermissions","getRevisionById","GetRevisionByIdStorageOperation","getLatestRevisionByEntryId","GetLatestRevisionByEntryIdStorageOperation","filterEntriesByFolder","FilterEntriesByFolderFactory","listEntriesHandler","ListEntriesFactory","decorateIfModelAuthorizationEnabled","allParams","decoratee","model","initialParams","params","entry","folderId","ROOT_FOLDER","permissions","ids","entries","options","id","input","meta","targetFolderId"],"mappings":";;;;;;;AAgBO,MAAMA;IAGT,YAAmB,EAAEC,OAAO,EAAoC,CAAE;QAC9D,IAAI,CAAC,OAAO,GAAGA;IACnB;IAEO,WAAW;QACd,MAAMA,UAAU,IAAI,CAAC,OAAO;QAC5B,MAAMC,yBAAyBD,QAAQ,SAAS,CAAC,OAAO,CAACE;QACzD,MAAMC,kBAAkBH,QAAQ,SAAS,CAAC,OAAO,CAACI;QAClD,MAAMC,6BAA6BL,QAAQ,SAAS,CAAC,OAAO,CACxDM;QAGJ,MAAMC,wBAAwB,IAAIC,6BAA6BP;QAC/D,MAAMQ,qBAAqB,IAAIC,mBAAmBT;QAElDU,oCAAoCX,SAAS,eAAe,OAAO,GAAGY;YAClE,MAAM,CAACC,WAAWC,OAAOC,cAAc,GAAGH;YAC1C,OAAO,MAAMH,mBAAmB,OAAO,CAAC;gBAAEI;gBAAWC;gBAAOC;YAAc;QAC9E;QAEAJ,oCAAoCX,SAAS,qBAAqB,OAAO,GAAGY;YACxE,MAAM,CAACC,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,MAAMK,QAAQ,MAAMd,gBAAgB,OAAO,CAACW,OAAO;gBAC/CU;YACJ;YAEA,MAAMN,WAAWD,OAAO,UAAU,YAAYE;YAI9C,IAAID,aAAaS,gBACb,OAAOd,UAAUC,OAAOU,IAAIG;YACzB,IAAIT,aAAaC,aAAa;gBAIjC,MAAMC,cACF,MAAMnB,uBAAuB,yBAAyB,CAACiB;gBAC3D,MAAMjB,uBAAuB,4BAA4B,CAAC;oBACtDmB;oBACA,KAAK;gBACT;YACJ;YAIA,IAAIO,mBAAmBR,aAAa;gBAChC,MAAMC,cACF,MAAMnB,uBAAuB,yBAAyB,CAACiB;gBAC3D,MAAMjB,uBAAuB,4BAA4B,CAAC;oBACtDmB;oBACA,KAAK;gBACT;YACJ;YAEA,OAAOP,UAAUC,OAAOU,IAAIG;QAChC;IACJ;AACJ"}
|
package/utils/resolve.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ErrorResponse, Response } from "@webiny/
|
|
1
|
+
import { ErrorResponse, Response } from "@webiny/api-graphql";
|
|
2
2
|
export declare const resolve: (fn: () => Promise<any>) => Promise<ErrorResponse | Response<any>>;
|
package/utils/resolve.js
CHANGED
package/utils/resolve.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils/resolve.js","sources":["../../src/utils/resolve.ts"],"sourcesContent":["import { ErrorResponse, Response } from \"@webiny/
|
|
1
|
+
{"version":3,"file":"utils/resolve.js","sources":["../../src/utils/resolve.ts"],"sourcesContent":["import { ErrorResponse, Response } from \"@webiny/api-graphql\";\n\nexport const resolve = async (fn: () => Promise<any>) => {\n try {\n return new Response(await fn());\n } catch (e) {\n return new ErrorResponse(e);\n }\n};\n"],"names":["resolve","fn","Response","e","ErrorResponse"],"mappings":";AAEO,MAAMA,UAAU,OAAOC;IAC1B,IAAI;QACA,OAAO,IAAIC,SAAS,MAAMD;IAC9B,EAAE,OAAOE,GAAG;QACR,OAAO,IAAIC,cAAcD;IAC7B;AACJ"}
|
package/createAcoContext.d.ts
DELETED