@webiny/api-aco 6.4.5 → 6.6.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AcoFeature.d.ts +5 -0
- package/AcoFeature.js +122 -0
- package/AcoFeature.js.map +1 -0
- package/AcoInitializer.d.ts +25 -0
- package/AcoInitializer.js +79 -0
- package/AcoInitializer.js.map +1 -0
- package/createAcoGraphQL.d.ts +7 -4
- package/createAcoGraphQL.js +56 -96
- package/createAcoGraphQL.js.map +1 -1
- package/exports/api/aco/folder.d.ts +1 -1
- package/exports/api/aco/folder.js +1 -1
- 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/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/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/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/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 +11 -3
- package/features/flp/UpdateFlp/UpdateFlpUseCase.js +14 -13
- package/features/flp/UpdateFlp/UpdateFlpUseCase.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/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/GetFolder/decorators/GetFolderWithFolderLevelPermissions.d.ts +8 -8
- 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.so.d.ts +10 -2
- package/filter/filter.so.js +2 -2
- package/filter/filter.so.js.map +1 -1
- package/flp/index.d.ts +0 -1
- package/flp/index.js +0 -1
- package/flp/tasks/createFlp.task.d.ts +2 -2
- package/flp/tasks/deleteFlp.task.d.ts +2 -2
- 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 +2 -2
- package/flp/tasks/syncFlp.task.js +12 -0
- package/flp/tasks/syncFlp.task.js.map +1 -1
- package/flp/tasks/updateFlp.task.d.ts +2 -2
- package/folder/folder.gql.d.ts +1 -1
- package/folder/folder.gql.js +9 -3
- package/folder/folder.gql.js.map +1 -1
- package/index.d.ts +1 -6
- package/index.js +1 -11
- package/package.json +20 -22
- package/utils/createOperationsWrapper.d.ts +5 -2
- package/utils/createOperationsWrapper.js +2 -2
- 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
package/features/folder/EnsureHcmsFolderIsEmptyOnDelete/ModelFolderBeforeDeleteHandler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/folder/EnsureHcmsFolderIsEmptyOnDelete/ModelFolderBeforeDeleteHandler.js","sources":["../../../../src/features/folder/EnsureHcmsFolderIsEmptyOnDelete/ModelFolderBeforeDeleteHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { FolderBeforeDeleteEventHandler } from \"~/features/folder/DeleteFolder/abstractions.js\";\nimport type { FolderBeforeDeleteEvent } from \"~/features/folder/DeleteFolder/events.js\";\nimport { EnsureFolderIsEmpty } from \"~/features/folder/EnsureFolderIsEmpty/abstractions.js\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { ListEntriesUseCase } from \"@webiny/api-headless-cms/features/contentEntry/ListEntries/abstractions.js\";\n\nclass ModelFolderBeforeDeleteHandlerImpl implements FolderBeforeDeleteEventHandler.Interface {\n constructor(\n private ensureFolderIsEmpty: EnsureFolderIsEmpty.Interface,\n private getModel: GetModelUseCase.Interface,\n private listEntries: ListEntriesUseCase.Interface\n ) {}\n\n async handle(event: FolderBeforeDeleteEvent): Promise<void> {\n const { folder } = event.payload;\n\n const { id, type } = folder;\n\n const modelId = type.split(\":\")[1];\n if (!modelId) {\n return;\n }\n\n const modelResult = await this.getModel.execute(modelId);\n if (modelResult.isFail()) {\n return;\n }\n\n const result = await this.ensureFolderIsEmpty.execute(type, id, async () => {\n const result = await this.listEntries.execute(modelResult.value, {\n where: {\n latest: true,\n wbyAco_location: {\n folderId: id\n }\n },\n limit: 1\n });\n\n const { entries } = result.value;\n\n return entries.length > 0;\n });\n\n if (result.isFail()) {\n throw WebinyError.from(result.error, {\n message: \"Error while ensuring HCMS folder is empty before delete.\",\n code: \"ACO_BEFORE_FOLDER_DELETE_HCMS_HANDLER\"\n });\n }\n }\n}\n\nexport const ModelFolderBeforeDeleteHandler = FolderBeforeDeleteEventHandler.createImplementation({\n implementation: ModelFolderBeforeDeleteHandlerImpl,\n dependencies: [EnsureFolderIsEmpty, GetModelUseCase, ListEntriesUseCase]\n});\n"],"names":["ModelFolderBeforeDeleteHandlerImpl","ensureFolderIsEmpty","getModel","listEntries","event","folder","id","type","modelId","modelResult","result","entries","WebinyError","ModelFolderBeforeDeleteHandler","FolderBeforeDeleteEventHandler","EnsureFolderIsEmpty","GetModelUseCase","ListEntriesUseCase"],"mappings":";;;;;AAOA,MAAMA;IACF,YACYC,mBAAkD,EAClDC,QAAmC,EACnCC,WAAyC,CACnD;aAHUF,mBAAmB,GAAnBA;aACAC,QAAQ,GAARA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,OAAOC,KAA8B,EAAiB;QACxD,MAAM,EAAEC,MAAM,EAAE,GAAGD,MAAM,OAAO;QAEhC,MAAM,EAAEE,EAAE,EAAEC,IAAI,EAAE,GAAGF;QAErB,MAAMG,UAAUD,KAAK,KAAK,CAAC,IAAI,CAAC,EAAE;QAClC,IAAI,CAACC,SACD;QAGJ,MAAMC,cAAc,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAACD;QAChD,IAAIC,YAAY,MAAM,IAClB;QAGJ,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAACH,MAAMD,IAAI;YAC5D,MAAMI,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAACD,YAAY,KAAK,EAAE;gBAC7D,OAAO;oBACH,QAAQ;oBACR,iBAAiB;wBACb,UAAUH;oBACd;gBACJ;gBACA,OAAO;YACX;YAEA,MAAM,
|
|
1
|
+
{"version":3,"file":"features/folder/EnsureHcmsFolderIsEmptyOnDelete/ModelFolderBeforeDeleteHandler.js","sources":["../../../../src/features/folder/EnsureHcmsFolderIsEmptyOnDelete/ModelFolderBeforeDeleteHandler.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { FolderBeforeDeleteEventHandler } from \"~/features/folder/DeleteFolder/abstractions.js\";\nimport type { FolderBeforeDeleteEvent } from \"~/features/folder/DeleteFolder/events.js\";\nimport { EnsureFolderIsEmpty } from \"~/features/folder/EnsureFolderIsEmpty/abstractions.js\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { ListEntriesUseCase } from \"@webiny/api-headless-cms/features/contentEntry/ListEntries/abstractions.js\";\n\nclass ModelFolderBeforeDeleteHandlerImpl implements FolderBeforeDeleteEventHandler.Interface {\n constructor(\n private ensureFolderIsEmpty: EnsureFolderIsEmpty.Interface,\n private getModel: GetModelUseCase.Interface,\n private listEntries: ListEntriesUseCase.Interface\n ) {}\n\n async handle(event: FolderBeforeDeleteEvent): Promise<void> {\n const { folder } = event.payload;\n\n const { id, type } = folder;\n\n const modelId = type.split(\":\")[1];\n if (!modelId) {\n return;\n }\n\n const modelResult = await this.getModel.execute(modelId);\n if (modelResult.isFail()) {\n return;\n }\n\n const result = await this.ensureFolderIsEmpty.execute(type, id, async () => {\n const result = await this.listEntries.execute(modelResult.value, {\n where: {\n latest: true,\n wbyAco_location: {\n folderId: id\n }\n },\n limit: 1\n });\n if (result.isFail()) {\n console.error(result.error.message);\n return true;\n }\n\n const { entries } = result.value;\n\n return entries.length > 0;\n });\n\n if (result.isFail()) {\n throw WebinyError.from(result.error, {\n message: \"Error while ensuring HCMS folder is empty before delete.\",\n code: \"ACO_BEFORE_FOLDER_DELETE_HCMS_HANDLER\"\n });\n }\n }\n}\n\nexport const ModelFolderBeforeDeleteHandler = FolderBeforeDeleteEventHandler.createImplementation({\n implementation: ModelFolderBeforeDeleteHandlerImpl,\n dependencies: [EnsureFolderIsEmpty, GetModelUseCase, ListEntriesUseCase]\n});\n"],"names":["ModelFolderBeforeDeleteHandlerImpl","ensureFolderIsEmpty","getModel","listEntries","event","folder","id","type","modelId","modelResult","result","console","entries","WebinyError","ModelFolderBeforeDeleteHandler","FolderBeforeDeleteEventHandler","EnsureFolderIsEmpty","GetModelUseCase","ListEntriesUseCase"],"mappings":";;;;;AAOA,MAAMA;IACF,YACYC,mBAAkD,EAClDC,QAAmC,EACnCC,WAAyC,CACnD;aAHUF,mBAAmB,GAAnBA;aACAC,QAAQ,GAARA;aACAC,WAAW,GAAXA;IACT;IAEH,MAAM,OAAOC,KAA8B,EAAiB;QACxD,MAAM,EAAEC,MAAM,EAAE,GAAGD,MAAM,OAAO;QAEhC,MAAM,EAAEE,EAAE,EAAEC,IAAI,EAAE,GAAGF;QAErB,MAAMG,UAAUD,KAAK,KAAK,CAAC,IAAI,CAAC,EAAE;QAClC,IAAI,CAACC,SACD;QAGJ,MAAMC,cAAc,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAACD;QAChD,IAAIC,YAAY,MAAM,IAClB;QAGJ,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAACH,MAAMD,IAAI;YAC5D,MAAMI,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAACD,YAAY,KAAK,EAAE;gBAC7D,OAAO;oBACH,QAAQ;oBACR,iBAAiB;wBACb,UAAUH;oBACd;gBACJ;gBACA,OAAO;YACX;YACA,IAAII,OAAO,MAAM,IAAI;gBACjBC,QAAQ,KAAK,CAACD,OAAO,KAAK,CAAC,OAAO;gBAClC,OAAO;YACX;YAEA,MAAM,EAAEE,OAAO,EAAE,GAAGF,OAAO,KAAK;YAEhC,OAAOE,QAAQ,MAAM,GAAG;QAC5B;QAEA,IAAIF,OAAO,MAAM,IACb,MAAMG,YAAY,IAAI,CAACH,OAAO,KAAK,EAAE;YACjC,SAAS;YACT,MAAM;QACV;IAER;AACJ;AAEO,MAAMI,iCAAiCC,+BAA+B,oBAAoB,CAAC;IAC9F,gBAAgBf;IAChB,cAAc;QAACgB;QAAqBC;QAAiBC;KAAmB;AAC5E"}
|
|
@@ -6,8 +6,13 @@ declare class GetFolderWithFolderLevelPermissionsImpl implements GetFolderUseCas
|
|
|
6
6
|
private folderLevelPermissions;
|
|
7
7
|
private readonly decoretee;
|
|
8
8
|
constructor(folderLevelPermissions: FolderLevelPermissions.Interface, decoretee: GetFolderUseCase.Interface);
|
|
9
|
-
execute(id: string): Promise<Result<never, import("~/domain/folder/errors.js").FolderNotFoundError |
|
|
10
|
-
|
|
9
|
+
execute(id: string): Promise<Result<never, FolderNotAuthorizedError | import("~/domain/folder/errors.js").FolderNotFoundError | import("~/domain/folder/errors.js").FolderPersistenceError> | Result<{
|
|
10
|
+
title: string;
|
|
11
|
+
slug: string;
|
|
12
|
+
type: string;
|
|
13
|
+
parentId?: string | null;
|
|
14
|
+
path: string;
|
|
15
|
+
extensions?: Record<string, any>;
|
|
11
16
|
id: string;
|
|
12
17
|
createdOn: string;
|
|
13
18
|
modifiedOn: string | null;
|
|
@@ -15,12 +20,7 @@ declare class GetFolderWithFolderLevelPermissionsImpl implements GetFolderUseCas
|
|
|
15
20
|
createdBy: import("../../../../types.js").User;
|
|
16
21
|
modifiedBy: import("../../../../types.js").User | null;
|
|
17
22
|
savedBy: import("../../../../types.js").User;
|
|
18
|
-
|
|
19
|
-
slug: string;
|
|
20
|
-
type: string;
|
|
21
|
-
parentId?: string | null;
|
|
22
|
-
path: string;
|
|
23
|
-
extensions?: Record<string, any>;
|
|
23
|
+
permissions: import("@webiny/shared-aco/flp/flp.types.js").FolderPermission[];
|
|
24
24
|
}, never>>;
|
|
25
25
|
}
|
|
26
26
|
export declare const GetFolderWithFolderLevelPermissions: typeof GetFolderWithFolderLevelPermissionsImpl & {
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import type { AcoStorageOperations as IAcoStorageOperations } from "../../../types.js";
|
|
2
|
+
import type { AcoFilterCrud as IAcoFilterCrud } from "../../../filter/filter.types.js";
|
|
3
|
+
import type { AcoFolderLevelPermissionsCrud } from "../../../flp/flp.types.js";
|
|
2
4
|
/** Storage operations for folder filtering. */
|
|
3
5
|
export declare const FilterStorageOperations: import("@webiny/di").Abstraction<import("~/types.js").AcoFilterStorageOperations>;
|
|
4
6
|
export declare namespace FilterStorageOperations {
|
|
5
7
|
type Interface = IAcoStorageOperations["filter"];
|
|
6
8
|
}
|
|
9
|
+
export declare const FlpStorageOperations: import("@webiny/di").Abstraction<import("~/types.js").AcoFolderLevelPermissionsStorageOperations>;
|
|
10
|
+
export declare namespace FlpStorageOperations {
|
|
11
|
+
type Interface = IAcoStorageOperations["flp"];
|
|
12
|
+
}
|
|
13
|
+
export declare const AcoFlpCrud: import("@webiny/di").Abstraction<AcoFolderLevelPermissionsCrud>;
|
|
14
|
+
export declare namespace AcoFlpCrud {
|
|
15
|
+
type Interface = AcoFolderLevelPermissionsCrud;
|
|
16
|
+
}
|
|
17
|
+
export declare const AcoFilterCrud: import("@webiny/di").Abstraction<IAcoFilterCrud>;
|
|
18
|
+
export declare namespace AcoFilterCrud {
|
|
19
|
+
type Interface = IAcoFilterCrud;
|
|
20
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { createAbstraction } from "@webiny/feature/api";
|
|
2
2
|
const FilterStorageOperations = createAbstraction("FilterStorageOperations");
|
|
3
|
-
|
|
3
|
+
const FlpStorageOperations = createAbstraction("FlpStorageOperations");
|
|
4
|
+
const AcoFlpCrud = createAbstraction("AcoFlpCrud");
|
|
5
|
+
const AcoFilterCrud = createAbstraction("AcoFilterCrud");
|
|
6
|
+
export { AcoFilterCrud, AcoFlpCrud, FilterStorageOperations, FlpStorageOperations };
|
|
4
7
|
|
|
5
8
|
//# sourceMappingURL=abstractions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/folder/shared/abstractions.js","sources":["../../../../src/features/folder/shared/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { AcoStorageOperations as IAcoStorageOperations } from \"~/types.js\";\n\n/** Storage operations for folder filtering. */\nexport const FilterStorageOperations =\n createAbstraction<IAcoStorageOperations[\"filter\"]>(\"FilterStorageOperations\");\n\nexport namespace FilterStorageOperations {\n export type Interface = IAcoStorageOperations[\"filter\"];\n}\n"],"names":["FilterStorageOperations","createAbstraction"],"mappings":";
|
|
1
|
+
{"version":3,"file":"features/folder/shared/abstractions.js","sources":["../../../../src/features/folder/shared/abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { AcoStorageOperations as IAcoStorageOperations } from \"~/types.js\";\nimport type { AcoFilterCrud as IAcoFilterCrud } from \"~/filter/filter.types.js\";\nimport type { AcoFolderLevelPermissionsCrud } from \"~/flp/flp.types.js\";\n\n/** Storage operations for folder filtering. */\nexport const FilterStorageOperations =\n createAbstraction<IAcoStorageOperations[\"filter\"]>(\"FilterStorageOperations\");\n\nexport namespace FilterStorageOperations {\n export type Interface = IAcoStorageOperations[\"filter\"];\n}\n\nexport const FlpStorageOperations =\n createAbstraction<IAcoStorageOperations[\"flp\"]>(\"FlpStorageOperations\");\n\nexport namespace FlpStorageOperations {\n export type Interface = IAcoStorageOperations[\"flp\"];\n}\n\nexport const AcoFlpCrud = createAbstraction<AcoFolderLevelPermissionsCrud>(\"AcoFlpCrud\");\n\nexport namespace AcoFlpCrud {\n export type Interface = AcoFolderLevelPermissionsCrud;\n}\n\nexport const AcoFilterCrud = createAbstraction<IAcoFilterCrud>(\"AcoFilterCrud\");\n\nexport namespace AcoFilterCrud {\n export type Interface = IAcoFilterCrud;\n}\n"],"names":["FilterStorageOperations","createAbstraction","FlpStorageOperations","AcoFlpCrud","AcoFilterCrud"],"mappings":";AAMO,MAAMA,0BACTC,kBAAmD;AAMhD,MAAMC,uBACTD,kBAAgD;AAM7C,MAAME,aAAaF,kBAAiD;AAMpE,MAAMG,gBAAgBH,kBAAkC"}
|
package/filter/filter.gql.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const filterSchema: GraphQLSchemaPlugin<AcoContext>;
|
|
1
|
+
import type { IGraphQLSchemaBuilder } from "@webiny/api-graphql/features/GraphQLSchemaBuilder/abstractions.js";
|
|
2
|
+
export declare const addFilterSchema: (builder: IGraphQLSchemaBuilder) => void;
|
package/filter/filter.gql.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ErrorResponse, ListResponse } from "@webiny/
|
|
2
|
-
import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/plugins/GraphQLSchemaPlugin.js";
|
|
1
|
+
import { ErrorResponse, ListResponse } from "@webiny/api-graphql/responses.js";
|
|
3
2
|
import { ensureAuthentication } from "../utils/ensureAuthentication.js";
|
|
4
3
|
import { resolve } from "../utils/resolve.js";
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { AcoFilterCrud } from "../features/folder/shared/abstractions.js";
|
|
5
|
+
const addFilterSchema = (builder)=>{
|
|
6
|
+
builder.addTypeDefs(`
|
|
7
7
|
enum OperationEnum {
|
|
8
8
|
AND
|
|
9
9
|
OR
|
|
@@ -92,39 +92,73 @@ const filterSchema = new GraphQLSchemaPlugin({
|
|
|
92
92
|
updateFilter(id: ID!, data: FilterUpdateInput!): FilterResponse
|
|
93
93
|
deleteFilter(id: ID!): AcoBooleanResponse
|
|
94
94
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
`);
|
|
96
|
+
builder.addResolver({
|
|
97
|
+
path: "AcoQuery.getFilter",
|
|
98
|
+
dependencies: [
|
|
99
|
+
AcoFilterCrud
|
|
100
|
+
],
|
|
101
|
+
resolver (filterCrud) {
|
|
102
|
+
return ({ args, context })=>resolve(()=>{
|
|
99
103
|
ensureAuthentication(context);
|
|
100
|
-
return
|
|
101
|
-
})
|
|
102
|
-
|
|
104
|
+
return filterCrud.get(args.id);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
builder.addResolver({
|
|
109
|
+
path: "AcoQuery.listFilters",
|
|
110
|
+
dependencies: [
|
|
111
|
+
AcoFilterCrud
|
|
112
|
+
],
|
|
113
|
+
resolver (filterCrud) {
|
|
114
|
+
return async ({ args, context })=>{
|
|
103
115
|
try {
|
|
104
116
|
ensureAuthentication(context);
|
|
105
|
-
const [entries, meta] = await
|
|
117
|
+
const [entries, meta] = await filterCrud.list(args);
|
|
106
118
|
return new ListResponse(entries, meta);
|
|
107
119
|
} catch (e) {
|
|
108
120
|
return new ErrorResponse(e);
|
|
109
121
|
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
builder.addResolver({
|
|
126
|
+
path: "AcoMutation.createFilter",
|
|
127
|
+
dependencies: [
|
|
128
|
+
AcoFilterCrud
|
|
129
|
+
],
|
|
130
|
+
resolver (filterCrud) {
|
|
131
|
+
return ({ args, context })=>resolve(()=>{
|
|
114
132
|
ensureAuthentication(context);
|
|
115
|
-
return
|
|
116
|
-
})
|
|
117
|
-
|
|
133
|
+
return filterCrud.create(args.data);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
builder.addResolver({
|
|
138
|
+
path: "AcoMutation.updateFilter",
|
|
139
|
+
dependencies: [
|
|
140
|
+
AcoFilterCrud
|
|
141
|
+
],
|
|
142
|
+
resolver (filterCrud) {
|
|
143
|
+
return ({ args, context })=>resolve(()=>{
|
|
118
144
|
ensureAuthentication(context);
|
|
119
|
-
return
|
|
120
|
-
})
|
|
121
|
-
|
|
145
|
+
return filterCrud.update(args.id, args.data);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
builder.addResolver({
|
|
150
|
+
path: "AcoMutation.deleteFilter",
|
|
151
|
+
dependencies: [
|
|
152
|
+
AcoFilterCrud
|
|
153
|
+
],
|
|
154
|
+
resolver (filterCrud) {
|
|
155
|
+
return ({ args, context })=>resolve(()=>{
|
|
122
156
|
ensureAuthentication(context);
|
|
123
|
-
return
|
|
124
|
-
})
|
|
157
|
+
return filterCrud.delete(args.id);
|
|
158
|
+
});
|
|
125
159
|
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
export {
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
export { addFilterSchema };
|
|
129
163
|
|
|
130
164
|
//# sourceMappingURL=filter.gql.js.map
|
package/filter/filter.gql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter/filter.gql.js","sources":["../../src/filter/filter.gql.ts"],"sourcesContent":["import { ErrorResponse, ListResponse } from \"@webiny/
|
|
1
|
+
{"version":3,"file":"filter/filter.gql.js","sources":["../../src/filter/filter.gql.ts"],"sourcesContent":["import { ErrorResponse, ListResponse } from \"@webiny/api-graphql/responses.js\";\nimport type { IGraphQLSchemaBuilder } from \"@webiny/api-graphql/features/GraphQLSchemaBuilder/abstractions.js\";\nimport { ensureAuthentication } from \"~/utils/ensureAuthentication.js\";\nimport { resolve } from \"~/utils/resolve.js\";\nimport { AcoFilterCrud } from \"~/features/folder/shared/abstractions.js\";\n\nexport const addFilterSchema = (builder: IGraphQLSchemaBuilder): void => {\n builder.addTypeDefs(/* GraphQL */ `\n enum OperationEnum {\n AND\n OR\n }\n\n type GroupFilter {\n field: String!\n condition: String!\n value: String!\n }\n\n type Group {\n operation: OperationEnum!\n filters: [GroupFilter]!\n }\n\n type Filter {\n id: ID!\n name: String!\n description: String\n namespace: String!\n operation: OperationEnum!\n groups: [Group]!\n createdOn: DateTime\n modifiedOn: DateTime\n savedOn: DateTime\n createdBy: AcoUser\n modifiedBy: AcoUser\n savedBy: AcoUser\n }\n\n input GroupFilterInput {\n field: String!\n condition: String!\n value: String!\n }\n\n input GroupInput {\n operation: OperationEnum!\n filters: [GroupFilterInput]!\n }\n\n input FilterCreateInput {\n id: ID!\n name: String!\n description: String\n namespace: String!\n operation: OperationEnum!\n groups: [GroupInput]!\n }\n\n input FilterUpdateInput {\n name: String\n description: String\n namespace: String\n operation: OperationEnum\n groups: [GroupInput]\n }\n\n input FiltersListWhereInput {\n namespace: String\n }\n\n type FilterResponse {\n data: Filter\n error: AcoError\n }\n\n type FilterListResponse {\n data: [Filter]\n error: AcoError\n }\n\n extend type AcoQuery {\n getFilter(id: ID!): FilterResponse\n listFilters(\n where: FiltersListWhereInput!\n limit: Int\n after: String\n sort: AcoSort\n ): FilterListResponse\n }\n\n extend type AcoMutation {\n createFilter(data: FilterCreateInput!): FilterResponse\n updateFilter(id: ID!, data: FilterUpdateInput!): FilterResponse\n deleteFilter(id: ID!): AcoBooleanResponse\n }\n `);\n\n builder.addResolver({\n path: \"AcoQuery.getFilter\",\n dependencies: [AcoFilterCrud],\n resolver(filterCrud) {\n return ({ args, context }) =>\n resolve(() => {\n ensureAuthentication(context);\n return filterCrud.get(args.id);\n });\n }\n });\n\n builder.addResolver({\n path: \"AcoQuery.listFilters\",\n dependencies: [AcoFilterCrud],\n resolver(filterCrud) {\n return async ({ args, context }) => {\n try {\n ensureAuthentication(context);\n const [entries, meta] = await filterCrud.list(args);\n return new ListResponse(entries, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n };\n }\n });\n\n builder.addResolver({\n path: \"AcoMutation.createFilter\",\n dependencies: [AcoFilterCrud],\n resolver(filterCrud) {\n return ({ args, context }) =>\n resolve(() => {\n ensureAuthentication(context);\n return filterCrud.create(args.data);\n });\n }\n });\n\n builder.addResolver({\n path: \"AcoMutation.updateFilter\",\n dependencies: [AcoFilterCrud],\n resolver(filterCrud) {\n return ({ args, context }) =>\n resolve(() => {\n ensureAuthentication(context);\n return filterCrud.update(args.id, args.data);\n });\n }\n });\n\n builder.addResolver({\n path: \"AcoMutation.deleteFilter\",\n dependencies: [AcoFilterCrud],\n resolver(filterCrud) {\n return ({ args, context }) =>\n resolve(() => {\n ensureAuthentication(context);\n return filterCrud.delete(args.id);\n });\n }\n });\n};\n"],"names":["addFilterSchema","builder","AcoFilterCrud","filterCrud","args","context","resolve","ensureAuthentication","entries","meta","ListResponse","e","ErrorResponse"],"mappings":";;;;AAMO,MAAMA,kBAAkB,CAACC;IAC5BA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyFnC,CAAC;IAEDA,QAAQ,WAAW,CAAC;QAChB,MAAM;QACN,cAAc;YAACC;SAAc;QAC7B,UAASC,UAAU;YACf,OAAO,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAE,GACrBC,QAAQ;oBACJC,qBAAqBF;oBACrB,OAAOF,WAAW,GAAG,CAACC,KAAK,EAAE;gBACjC;QACR;IACJ;IAEAH,QAAQ,WAAW,CAAC;QAChB,MAAM;QACN,cAAc;YAACC;SAAc;QAC7B,UAASC,UAAU;YACf,OAAO,OAAO,EAAEC,IAAI,EAAEC,OAAO,EAAE;gBAC3B,IAAI;oBACAE,qBAAqBF;oBACrB,MAAM,CAACG,SAASC,KAAK,GAAG,MAAMN,WAAW,IAAI,CAACC;oBAC9C,OAAO,IAAIM,aAAaF,SAASC;gBACrC,EAAE,OAAOE,GAAG;oBACR,OAAO,IAAIC,cAAcD;gBAC7B;YACJ;QACJ;IACJ;IAEAV,QAAQ,WAAW,CAAC;QAChB,MAAM;QACN,cAAc;YAACC;SAAc;QAC7B,UAASC,UAAU;YACf,OAAO,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAE,GACrBC,QAAQ;oBACJC,qBAAqBF;oBACrB,OAAOF,WAAW,MAAM,CAACC,KAAK,IAAI;gBACtC;QACR;IACJ;IAEAH,QAAQ,WAAW,CAAC;QAChB,MAAM;QACN,cAAc;YAACC;SAAc;QAC7B,UAASC,UAAU;YACf,OAAO,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAE,GACrBC,QAAQ;oBACJC,qBAAqBF;oBACrB,OAAOF,WAAW,MAAM,CAACC,KAAK,EAAE,EAAEA,KAAK,IAAI;gBAC/C;QACR;IACJ;IAEAH,QAAQ,WAAW,CAAC;QAChB,MAAM;QACN,cAAc;YAACC;SAAc;QAC7B,UAASC,UAAU;YACf,OAAO,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAE,GACrBC,QAAQ;oBACJC,qBAAqBF;oBACrB,OAAOF,WAAW,MAAM,CAACC,KAAK,EAAE;gBACpC;QACR;IACJ;AACJ"}
|
package/filter/filter.so.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HeadlessCms } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import type { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/abstractions.js";
|
|
3
|
+
import type { Container } from "@webiny/di";
|
|
4
|
+
interface CreateFilterOperationsParams {
|
|
5
|
+
cms: HeadlessCms;
|
|
6
|
+
identityContext: IdentityContext.Interface;
|
|
7
|
+
container: Container;
|
|
8
|
+
}
|
|
2
9
|
import type { AcoFilterStorageOperations } from "./filter.types.js";
|
|
3
|
-
export declare const createFilterOperations: (params:
|
|
10
|
+
export declare const createFilterOperations: (params: CreateFilterOperationsParams) => AcoFilterStorageOperations;
|
|
11
|
+
export {};
|
package/filter/filter.so.js
CHANGED
|
@@ -7,7 +7,7 @@ import { pickEntryFieldValues } from "../utils/pickEntryFieldValues.js";
|
|
|
7
7
|
import { ENTRY_META_FIELDS } from "@webiny/api-headless-cms/constants.js";
|
|
8
8
|
import { CmsSortMapper, CmsWhereMapper } from "@webiny/api-headless-cms";
|
|
9
9
|
const createFilterOperations = (params)=>{
|
|
10
|
-
const { cms,
|
|
10
|
+
const { cms, identityContext, container } = params;
|
|
11
11
|
const { withModel } = createOperationsWrapper({
|
|
12
12
|
...params,
|
|
13
13
|
modelName: FILTER_MODEL_ID
|
|
@@ -27,7 +27,7 @@ const createFilterOperations = (params)=>{
|
|
|
27
27
|
listFilters (params) {
|
|
28
28
|
return withModel(async (model)=>{
|
|
29
29
|
const { sort, where } = params;
|
|
30
|
-
const createdBy =
|
|
30
|
+
const createdBy = identityContext.getIdentity().id;
|
|
31
31
|
const [entries, meta] = await cms.listLatestEntries(model, {
|
|
32
32
|
...params,
|
|
33
33
|
sort: cmsSortMapper.map({
|
package/filter/filter.so.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter/filter.so.js","sources":["../../src/filter/filter.so.ts"],"sourcesContent":["import omit from \"lodash/omit.js\";\nimport WebinyError from \"@webiny/error\";\nimport { FILTER_MODEL_ID } from \"./filter.model.js\";\nimport type {
|
|
1
|
+
{"version":3,"file":"filter/filter.so.js","sources":["../../src/filter/filter.so.ts"],"sourcesContent":["import omit from \"lodash/omit.js\";\nimport WebinyError from \"@webiny/error\";\nimport { FILTER_MODEL_ID } from \"./filter.model.js\";\nimport type { HeadlessCms } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/abstractions.js\";\nimport type { Container } from \"@webiny/di\";\n\ninterface CreateFilterOperationsParams {\n cms: HeadlessCms;\n identityContext: IdentityContext.Interface;\n container: Container;\n}\nimport { createListSort } from \"~/utils/createListSort.js\";\nimport { createOperationsWrapper } from \"~/utils/createOperationsWrapper.js\";\nimport { pickEntryFieldValues } from \"~/utils/pickEntryFieldValues.js\";\nimport type { AcoFilterStorageOperations, Filter } from \"./filter.types.js\";\nimport { ENTRY_META_FIELDS } from \"@webiny/api-headless-cms/constants.js\";\nimport { CmsSortMapper, CmsWhereMapper } from \"@webiny/api-headless-cms\";\n\nexport const createFilterOperations = (\n params: CreateFilterOperationsParams\n): AcoFilterStorageOperations => {\n const { cms, identityContext, container } = params;\n\n const { withModel } = createOperationsWrapper({\n ...params,\n modelName: FILTER_MODEL_ID\n });\n\n const cmsWhereMapper = container.resolve(CmsWhereMapper);\n const cmsSortMapper = container.resolve(CmsSortMapper);\n\n return {\n getFilter({ id }) {\n return withModel(async model => {\n const entry = await cms.getEntryById(model, id);\n\n if (!entry) {\n throw new WebinyError(\"Could not load filter.\", \"GET_FILTER_ERROR\", {\n id\n });\n }\n\n return pickEntryFieldValues(entry);\n });\n },\n listFilters(params) {\n return withModel(async model => {\n const { sort, where } = params;\n const createdBy = identityContext.getIdentity().id;\n\n const [entries, meta] = await cms.listLatestEntries(model, {\n ...params,\n sort: cmsSortMapper.map({\n input: createListSort(sort),\n fields: model.fields\n }),\n where: cmsWhereMapper.map({\n input: {\n ...where,\n createdBy\n },\n fields: model.fields\n })\n });\n\n return [entries.map(pickEntryFieldValues<Filter>), meta];\n });\n },\n createFilter({ data }) {\n return withModel(async model => {\n const entry = await cms.createEntry(model, {\n id: data.id,\n values: data\n });\n return pickEntryFieldValues(entry);\n });\n },\n updateFilter({ id, data }) {\n return withModel(async model => {\n const original = await cms.getEntryById(model, id);\n\n const input = {\n /**\n * We are omitting the standard entry meta fields:\n * we don't want to override them with the ones coming from the `original` entry.\n */\n ...omit(original, ENTRY_META_FIELDS),\n values: {\n ...original.values,\n ...data\n }\n };\n\n const entry = await cms.updateEntry(model, original.id, input);\n return pickEntryFieldValues(entry);\n });\n },\n deleteFilter({ id }) {\n return withModel(async model => {\n await cms.deleteEntry(model, id);\n return true;\n });\n }\n };\n};\n"],"names":["createFilterOperations","params","cms","identityContext","container","withModel","createOperationsWrapper","FILTER_MODEL_ID","cmsWhereMapper","CmsWhereMapper","cmsSortMapper","CmsSortMapper","id","model","entry","WebinyError","pickEntryFieldValues","sort","where","createdBy","entries","meta","createListSort","data","original","input","omit","ENTRY_META_FIELDS"],"mappings":";;;;;;;;AAmBO,MAAMA,yBAAyB,CAClCC;IAEA,MAAM,EAAEC,GAAG,EAAEC,eAAe,EAAEC,SAAS,EAAE,GAAGH;IAE5C,MAAM,EAAEI,SAAS,EAAE,GAAGC,wBAAwB;QAC1C,GAAGL,MAAM;QACT,WAAWM;IACf;IAEA,MAAMC,iBAAiBJ,UAAU,OAAO,CAACK;IACzC,MAAMC,gBAAgBN,UAAU,OAAO,CAACO;IAExC,OAAO;QACH,WAAU,EAAEC,EAAE,EAAE;YACZ,OAAOP,UAAU,OAAMQ;gBACnB,MAAMC,QAAQ,MAAMZ,IAAI,YAAY,CAACW,OAAOD;gBAE5C,IAAI,CAACE,OACD,MAAM,IAAIC,MAAY,0BAA0B,oBAAoB;oBAChEH;gBACJ;gBAGJ,OAAOI,qBAAqBF;YAChC;QACJ;QACA,aAAYb,MAAM;YACd,OAAOI,UAAU,OAAMQ;gBACnB,MAAM,EAAEI,IAAI,EAAEC,KAAK,EAAE,GAAGjB;gBACxB,MAAMkB,YAAYhB,gBAAgB,WAAW,GAAG,EAAE;gBAElD,MAAM,CAACiB,SAASC,KAAK,GAAG,MAAMnB,IAAI,iBAAiB,CAACW,OAAO;oBACvD,GAAGZ,MAAM;oBACT,MAAMS,cAAc,GAAG,CAAC;wBACpB,OAAOY,eAAeL;wBACtB,QAAQJ,MAAM,MAAM;oBACxB;oBACA,OAAOL,eAAe,GAAG,CAAC;wBACtB,OAAO;4BACH,GAAGU,KAAK;4BACRC;wBACJ;wBACA,QAAQN,MAAM,MAAM;oBACxB;gBACJ;gBAEA,OAAO;oBAACO,QAAQ,GAAG,CAACJ;oBAA+BK;iBAAK;YAC5D;QACJ;QACA,cAAa,EAAEE,IAAI,EAAE;YACjB,OAAOlB,UAAU,OAAMQ;gBACnB,MAAMC,QAAQ,MAAMZ,IAAI,WAAW,CAACW,OAAO;oBACvC,IAAIU,KAAK,EAAE;oBACX,QAAQA;gBACZ;gBACA,OAAOP,qBAAqBF;YAChC;QACJ;QACA,cAAa,EAAEF,EAAE,EAAEW,IAAI,EAAE;YACrB,OAAOlB,UAAU,OAAMQ;gBACnB,MAAMW,WAAW,MAAMtB,IAAI,YAAY,CAACW,OAAOD;gBAE/C,MAAMa,QAAQ;oBAKV,GAAGC,KAAKF,UAAUG,kBAAkB;oBACpC,QAAQ;wBACJ,GAAGH,SAAS,MAAM;wBAClB,GAAGD,IAAI;oBACX;gBACJ;gBAEA,MAAMT,QAAQ,MAAMZ,IAAI,WAAW,CAACW,OAAOW,SAAS,EAAE,EAAEC;gBACxD,OAAOT,qBAAqBF;YAChC;QACJ;QACA,cAAa,EAAEF,EAAE,EAAE;YACf,OAAOP,UAAU,OAAMQ;gBACnB,MAAMX,IAAI,WAAW,CAACW,OAAOD;gBAC7B,OAAO;YACX;QACJ;IACJ;AACJ"}
|
package/flp/index.d.ts
CHANGED
package/flp/index.js
CHANGED
|
@@ -8,9 +8,9 @@ declare class CreateFlpTaskImpl implements TaskDefinition.Interface<ICreateFlpTa
|
|
|
8
8
|
readonly description = "Synchronizes the FLP catalog by creating the FLP record based on the provided folder.";
|
|
9
9
|
readonly databaseLogs = false;
|
|
10
10
|
readonly isPrivate = true;
|
|
11
|
-
readonly selfCleanup: ("
|
|
11
|
+
readonly selfCleanup: ("onAbort" | "onSuccess")[];
|
|
12
12
|
constructor(createFlp: CreateFlpUseCase.Interface);
|
|
13
|
-
run({ input, controller }: TaskDefinition.RunParams<ICreateFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").
|
|
13
|
+
run({ input, controller }: TaskDefinition.RunParams<ICreateFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultAborted | import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultError | TaskDefinition.ResultContinue<ICreateFlpTaskInput> | TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
14
14
|
}
|
|
15
15
|
export declare const CreateFlpTask: typeof CreateFlpTaskImpl & {
|
|
16
16
|
__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>>;
|
|
@@ -8,9 +8,9 @@ declare class DeleteFlpTaskImpl implements TaskDefinition.Interface<IDeleteFlpTa
|
|
|
8
8
|
readonly description = "Synchronizes the FLP catalog by deleting the FLP record based on the provided folder.";
|
|
9
9
|
readonly databaseLogs = false;
|
|
10
10
|
readonly isPrivate = true;
|
|
11
|
-
readonly selfCleanup: ("
|
|
11
|
+
readonly selfCleanup: ("onAbort" | "onSuccess")[];
|
|
12
12
|
constructor(deleteFlp: DeleteFlpUseCase.Interface);
|
|
13
|
-
run({ input, controller }: TaskDefinition.RunParams<IDeleteFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").
|
|
13
|
+
run({ input, controller }: TaskDefinition.RunParams<IDeleteFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultAborted | import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskResultError | TaskDefinition.ResultContinue<IDeleteFlpTaskInput> | TaskDefinition.ResultDone<import("@webiny/api-core/features/task/TaskDefinition/abstractions").ITaskOutput>>;
|
|
14
14
|
}
|
|
15
15
|
export declare const DeleteFlpTask: typeof DeleteFlpTaskImpl & {
|
|
16
16
|
__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>>;
|
package/flp/tasks/index.d.ts
CHANGED
|
@@ -2,4 +2,3 @@ export declare const CREATE_FLP_TASK_ID = "acoCreateFlp";
|
|
|
2
2
|
export declare const DELETE_FLP_TASK_ID = "acoDeleteFlp";
|
|
3
3
|
export declare const UPDATE_FLP_TASK_ID = "acoUpdateFlp";
|
|
4
4
|
export declare const SYNC_FLP_TASK_ID = "acoSyncFlp";
|
|
5
|
-
export declare const flpTasks: () => import("@webiny/api").ContextPlugin<import("@webiny/api/types.js").Context>[];
|
package/flp/tasks/index.js
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
import { CreateFlpTask } from "./createFlp.task.js";
|
|
2
|
-
import { UpdateFlpTask } from "./updateFlp.task.js";
|
|
3
|
-
import { DeleteFlpTask } from "./deleteFlp.task.js";
|
|
4
|
-
import { SyncFlpTask } from "./syncFlp.task.js";
|
|
5
|
-
import { createContextPlugin } from "@webiny/api";
|
|
6
1
|
const CREATE_FLP_TASK_ID = "acoCreateFlp";
|
|
7
2
|
const DELETE_FLP_TASK_ID = "acoDeleteFlp";
|
|
8
3
|
const UPDATE_FLP_TASK_ID = "acoUpdateFlp";
|
|
9
4
|
const SYNC_FLP_TASK_ID = "acoSyncFlp";
|
|
10
|
-
|
|
11
|
-
createContextPlugin((context)=>{
|
|
12
|
-
context.container.register(CreateFlpTask);
|
|
13
|
-
context.container.register(UpdateFlpTask);
|
|
14
|
-
context.container.register(DeleteFlpTask);
|
|
15
|
-
context.container.register(SyncFlpTask);
|
|
16
|
-
})
|
|
17
|
-
];
|
|
18
|
-
export { CREATE_FLP_TASK_ID, DELETE_FLP_TASK_ID, SYNC_FLP_TASK_ID, UPDATE_FLP_TASK_ID, flpTasks };
|
|
5
|
+
export { CREATE_FLP_TASK_ID, DELETE_FLP_TASK_ID, SYNC_FLP_TASK_ID, UPDATE_FLP_TASK_ID };
|
|
19
6
|
|
|
20
7
|
//# sourceMappingURL=index.js.map
|
package/flp/tasks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flp/tasks/index.js","sources":["../../../src/flp/tasks/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"flp/tasks/index.js","sources":["../../../src/flp/tasks/index.ts"],"sourcesContent":["export const CREATE_FLP_TASK_ID = \"acoCreateFlp\";\nexport const DELETE_FLP_TASK_ID = \"acoDeleteFlp\";\nexport const UPDATE_FLP_TASK_ID = \"acoUpdateFlp\";\nexport const SYNC_FLP_TASK_ID = \"acoSyncFlp\";\n"],"names":["CREATE_FLP_TASK_ID","DELETE_FLP_TASK_ID","UPDATE_FLP_TASK_ID","SYNC_FLP_TASK_ID"],"mappings":"AAAO,MAAMA,qBAAqB;AAC3B,MAAMC,qBAAqB;AAC3B,MAAMC,qBAAqB;AAC3B,MAAMC,mBAAmB"}
|
|
@@ -12,9 +12,9 @@ declare class SyncFlpTaskImpl implements TaskDefinition.Interface<ISyncFlpTaskIn
|
|
|
12
12
|
readonly description = "Synchronizes the FLP catalog by updating the FLP record and its descendants.";
|
|
13
13
|
readonly databaseLogs = false;
|
|
14
14
|
readonly isPrivate = true;
|
|
15
|
-
readonly selfCleanup: ("
|
|
15
|
+
readonly selfCleanup: ("onAbort" | "onSuccess")[];
|
|
16
16
|
constructor(getFolder: GetFolderUseCase.Interface, listFolders: ListFoldersUseCase.Interface, listModels: ListModelsUseCase.Interface);
|
|
17
|
-
run({ input, controller }: TaskDefinition.RunParams<ISyncFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").
|
|
17
|
+
run({ input, controller }: TaskDefinition.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>>;
|
|
18
18
|
}
|
|
19
19
|
export declare const SyncFlpTask: typeof SyncFlpTaskImpl & {
|
|
20
20
|
__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>>;
|
|
@@ -24,6 +24,7 @@ class SyncFlpTaskImpl {
|
|
|
24
24
|
if (controller.runtime.isAborted()) return controller.response.aborted();
|
|
25
25
|
if (input.folderId) {
|
|
26
26
|
const result = await this.getFolder.execute(input.folderId);
|
|
27
|
+
if (result.isFail()) return controller.response.error(result.error);
|
|
27
28
|
const folder = result.value;
|
|
28
29
|
await controller.task.trigger({
|
|
29
30
|
definition: UPDATE_FLP_TASK_ID,
|
|
@@ -49,6 +50,16 @@ class SyncFlpTaskImpl {
|
|
|
49
50
|
parentId: null
|
|
50
51
|
}
|
|
51
52
|
});
|
|
53
|
+
if (result.isFail()) {
|
|
54
|
+
await controller.logger.error({
|
|
55
|
+
message: `Failed to list root folders for type ${folderType}`,
|
|
56
|
+
data: {
|
|
57
|
+
type: folderType,
|
|
58
|
+
error: result.error
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
52
63
|
const { folders } = result.value;
|
|
53
64
|
for (const folder of folders)await controller.task.trigger({
|
|
54
65
|
definition: UPDATE_FLP_TASK_ID,
|
|
@@ -72,6 +83,7 @@ class SyncFlpTaskImpl {
|
|
|
72
83
|
parentId: null
|
|
73
84
|
}
|
|
74
85
|
});
|
|
86
|
+
if (result.isFail()) return controller.response.error(result.error);
|
|
75
87
|
const { folders } = result.value;
|
|
76
88
|
for (const folder of folders)await controller.task.trigger({
|
|
77
89
|
definition: UPDATE_FLP_TASK_ID,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flp/tasks/syncFlp.task.js","sources":["../../../src/flp/tasks/syncFlp.task.ts"],"sourcesContent":["import { TaskDefinition } 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 SyncFlpTaskImpl implements TaskDefinition.Interface<ISyncFlpTaskInput> {\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 public constructor(\n private getFolder: GetFolderUseCase.Interface,\n private listFolders: ListFoldersUseCase.Interface,\n private listModels: ListModelsUseCase.Interface\n ) {}\n\n async run({ input, controller }: TaskDefinition.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
|
|
1
|
+
{"version":3,"file":"flp/tasks/syncFlp.task.js","sources":["../../../src/flp/tasks/syncFlp.task.ts"],"sourcesContent":["import { TaskDefinition } 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 SyncFlpTaskImpl implements TaskDefinition.Interface<ISyncFlpTaskInput> {\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 public constructor(\n private getFolder: GetFolderUseCase.Interface,\n private listFolders: ListFoldersUseCase.Interface,\n private listModels: ListModelsUseCase.Interface\n ) {}\n\n async run({ input, controller }: TaskDefinition.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\nexport const SyncFlpTask = TaskDefinition.createImplementation({\n implementation: SyncFlpTaskImpl,\n dependencies: [GetFolderUseCase, ListFoldersUseCase, ListModelsUseCase]\n});\n"],"names":["SyncFlpTaskImpl","getFolder","listFolders","listModels","SYNC_FLP_TASK_ID","input","controller","result","folder","UPDATE_FLP_TASK_ID","folderTypes","FM_FILE_TYPE","modelsResult","models","model","folderType","folders","error","SyncFlpTask","TaskDefinition","GetFolderUseCase","ListFoldersUseCase","ListModelsUseCase"],"mappings":"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"}
|
|
@@ -8,9 +8,9 @@ declare class UpdateFlpTaskImpl implements TaskDefinition.Interface<IUpdateFlpTa
|
|
|
8
8
|
readonly description = "Synchronizes the FLP catalog by updating the FLP record and its descendants based on the provided folder.";
|
|
9
9
|
readonly databaseLogs = false;
|
|
10
10
|
readonly isPrivate = true;
|
|
11
|
-
readonly selfCleanup: ("
|
|
11
|
+
readonly selfCleanup: ("onAbort" | "onSuccess")[];
|
|
12
12
|
constructor(updateFlp: UpdateFlpUseCase.Interface);
|
|
13
|
-
run({ input, controller }: TaskDefinition.RunParams<IUpdateFlpTaskInput>): Promise<import("@webiny/api-core/features/task/TaskDefinition/abstractions").
|
|
13
|
+
run({ input, controller }: TaskDefinition.RunParams<IUpdateFlpTaskInput>): 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>>;
|
|
14
14
|
}
|
|
15
15
|
export declare const UpdateFlpTask: typeof UpdateFlpTaskImpl & {
|
|
16
16
|
__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>>;
|
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";
|
|
@@ -12,6 +12,7 @@ import { DeleteFolderUseCase } from "../features/folder/DeleteFolder/abstraction
|
|
|
12
12
|
import { GetFolderHierarchyUseCase } from "../features/folder/GetFolderHierarchy/abstractions.js";
|
|
13
13
|
import { ListFolderLevelPermissionsTargetsUseCase } from "../features/folder/ListFolderLevelPermissionsTargets/abstractions.js";
|
|
14
14
|
import { FolderModel } 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 = context.container.resolve(FolderModel);
|
|
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 ()=>{
|