@webiny/api-headless-cms-aco 6.0.0-alpha.5 β 6.0.0-rc.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/README.md +6 -13
- package/features/SetLocationOnEntryRestore/SetLocationOnEntryRestore.d.ts +10 -0
- package/features/SetLocationOnEntryRestore/SetLocationOnEntryRestore.js +38 -0
- package/features/SetLocationOnEntryRestore/SetLocationOnEntryRestore.js.map +1 -0
- package/features/SetLocationOnEntryRestore/feature.d.ts +1 -0
- package/features/SetLocationOnEntryRestore/feature.js +10 -0
- package/features/SetLocationOnEntryRestore/feature.js.map +1 -0
- package/features/SetLocationOnEntryRestore/index.d.ts +1 -0
- package/features/SetLocationOnEntryRestore/index.js +3 -0
- package/features/SetLocationOnEntryRestore/index.js.map +1 -0
- package/index.d.ts +2 -2
- package/index.js +6 -31
- package/index.js.map +1 -1
- package/package.json +18 -23
- package/plugins/createCmsFolderModelModifier.js +3 -10
- package/plugins/createCmsFolderModelModifier.js.map +1 -1
- package/plugins/index.d.ts +1 -1
- package/plugins/index.js +1 -16
- package/plugins/index.js.map +1 -1
- package/types.d.ts +3 -3
- package/types.js +1 -5
- package/types.js.map +1 -1
- package/hooks/entry/index.d.ts +0 -3
- package/hooks/entry/index.js +0 -19
- package/hooks/entry/index.js.map +0 -1
- package/hooks/entry/onEntryBeforeRestoreFromBin.hook.d.ts +0 -2
- package/hooks/entry/onEntryBeforeRestoreFromBin.hook.js +0 -47
- package/hooks/entry/onEntryBeforeRestoreFromBin.hook.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
# @webiny/api-headless-cms-aco
|
|
2
2
|
|
|
3
|
-
[!
|
|
4
|
-
[
|
|
5
|
-
|
|
6
|
-
[](http://makeapullrequest.com)
|
|
3
|
+
> [!NOTE]
|
|
4
|
+
> This package is part of the [Webiny](https://www.webiny.com) monorepo.
|
|
5
|
+
> Itβs **included in every Webiny project by default** and is not meant to be used as a standalone package.
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
π **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
npm install --save @webiny/api-headless-cms-aco
|
|
12
|
-
```
|
|
9
|
+
---
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
yarn add @webiny/api-headless-cms-aco
|
|
18
|
-
```
|
|
11
|
+
_This README file is automatically generated during the publish process._
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EntryBeforeRestoreFromBinEventHandler } from "@webiny/api-headless-cms/features/contentEntry/RestoreEntryFromBin/events.js";
|
|
2
|
+
import { GetFolderUseCase } from "@webiny/api-aco/features/folder/GetFolder/abstractions.js";
|
|
3
|
+
export declare class SetLocationOnEntryRestore implements EntryBeforeRestoreFromBinEventHandler.Interface {
|
|
4
|
+
private getFolderUseCase;
|
|
5
|
+
constructor(getFolderUseCase: GetFolderUseCase.Interface);
|
|
6
|
+
handle(event: EntryBeforeRestoreFromBinEventHandler.Event): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const SetLocationOnEntryRestoreImpl: typeof SetLocationOnEntryRestore & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/EventPublisher").IEventHandler<import("@webiny/api-headless-cms/features/contentEntry/RestoreEntryFromBin/events.js").EntryBeforeRestoreFromBinEvent>>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ROOT_FOLDER } from "@webiny/api-headless-cms/constants.js";
|
|
2
|
+
import { EntryBeforeRestoreFromBinEventHandler } from "@webiny/api-headless-cms/features/contentEntry/RestoreEntryFromBin/events.js";
|
|
3
|
+
import { GetFolderUseCase } from "@webiny/api-aco/features/folder/GetFolder/abstractions.js";
|
|
4
|
+
export class SetLocationOnEntryRestore {
|
|
5
|
+
constructor(getFolderUseCase) {
|
|
6
|
+
this.getFolderUseCase = getFolderUseCase;
|
|
7
|
+
}
|
|
8
|
+
async handle(event) {
|
|
9
|
+
const {
|
|
10
|
+
entry
|
|
11
|
+
} = event.payload;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Skip further execution if folderId is falsy or equals ROOT_FOLDER.
|
|
15
|
+
*/
|
|
16
|
+
if (!entry.location?.folderId || entry.location.folderId === ROOT_FOLDER) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Retrieve the folder: if it exists, no additional operations are necessary.
|
|
22
|
+
*/
|
|
23
|
+
const result = await this.getFolderUseCase.execute(entry.location.folderId);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* If the folder is not found, set ROOT_FOLDER as the location.
|
|
27
|
+
*/
|
|
28
|
+
if (result.isFail()) {
|
|
29
|
+
entry.location.folderId = ROOT_FOLDER;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export const SetLocationOnEntryRestoreImpl = EntryBeforeRestoreFromBinEventHandler.createImplementation({
|
|
34
|
+
implementation: SetLocationOnEntryRestore,
|
|
35
|
+
dependencies: [GetFolderUseCase]
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=SetLocationOnEntryRestore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ROOT_FOLDER","EntryBeforeRestoreFromBinEventHandler","GetFolderUseCase","SetLocationOnEntryRestore","constructor","getFolderUseCase","handle","event","entry","payload","location","folderId","result","execute","isFail","SetLocationOnEntryRestoreImpl","createImplementation","implementation","dependencies"],"sources":["SetLocationOnEntryRestore.ts"],"sourcesContent":["import { ROOT_FOLDER } from \"@webiny/api-headless-cms/constants.js\";\nimport { EntryBeforeRestoreFromBinEventHandler } from \"@webiny/api-headless-cms/features/contentEntry/RestoreEntryFromBin/events.js\";\nimport { GetFolderUseCase } from \"@webiny/api-aco/features/folder/GetFolder/abstractions.js\";\n\nexport class SetLocationOnEntryRestore implements EntryBeforeRestoreFromBinEventHandler.Interface {\n constructor(private getFolderUseCase: GetFolderUseCase.Interface) {}\n\n async handle(event: EntryBeforeRestoreFromBinEventHandler.Event): Promise<void> {\n const { entry } = event.payload;\n\n /**\n * Skip further execution if folderId is falsy or equals ROOT_FOLDER.\n */\n if (!entry.location?.folderId || entry.location.folderId === ROOT_FOLDER) {\n return;\n }\n\n /**\n * Retrieve the folder: if it exists, no additional operations are necessary.\n */\n const result = await this.getFolderUseCase.execute(entry.location.folderId);\n\n /**\n * If the folder is not found, set ROOT_FOLDER as the location.\n */\n if (result.isFail()) {\n entry.location.folderId = ROOT_FOLDER;\n }\n }\n}\n\nexport const SetLocationOnEntryRestoreImpl =\n EntryBeforeRestoreFromBinEventHandler.createImplementation({\n implementation: SetLocationOnEntryRestore,\n dependencies: [GetFolderUseCase]\n });\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,uCAAuC;AACnE,SAASC,qCAAqC,QAAQ,8EAA8E;AACpI,SAASC,gBAAgB,QAAQ,2DAA2D;AAE5F,OAAO,MAAMC,yBAAyB,CAA4D;EAC9FC,WAAWA,CAASC,gBAA4C,EAAE;IAAA,KAA9CA,gBAA4C,GAA5CA,gBAA4C;EAAG;EAEnE,MAAMC,MAAMA,CAACC,KAAkD,EAAiB;IAC5E,MAAM;MAAEC;IAAM,CAAC,GAAGD,KAAK,CAACE,OAAO;;IAE/B;AACR;AACA;IACQ,IAAI,CAACD,KAAK,CAACE,QAAQ,EAAEC,QAAQ,IAAIH,KAAK,CAACE,QAAQ,CAACC,QAAQ,KAAKX,WAAW,EAAE;MACtE;IACJ;;IAEA;AACR;AACA;IACQ,MAAMY,MAAM,GAAG,MAAM,IAAI,CAACP,gBAAgB,CAACQ,OAAO,CAACL,KAAK,CAACE,QAAQ,CAACC,QAAQ,CAAC;;IAE3E;AACR;AACA;IACQ,IAAIC,MAAM,CAACE,MAAM,CAAC,CAAC,EAAE;MACjBN,KAAK,CAACE,QAAQ,CAACC,QAAQ,GAAGX,WAAW;IACzC;EACJ;AACJ;AAEA,OAAO,MAAMe,6BAA6B,GACtCd,qCAAqC,CAACe,oBAAoB,CAAC;EACvDC,cAAc,EAAEd,yBAAyB;EACzCe,YAAY,EAAE,CAAChB,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SetLocationOnEntryRestoreFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/api";
|
|
2
|
+
import { SetLocationOnEntryRestoreImpl } from "./SetLocationOnEntryRestore.js";
|
|
3
|
+
export const SetLocationOnEntryRestoreFeature = createFeature({
|
|
4
|
+
name: "SetLocationOnEntryRestore",
|
|
5
|
+
register(container) {
|
|
6
|
+
container.register(SetLocationOnEntryRestoreImpl);
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createFeature","SetLocationOnEntryRestoreImpl","SetLocationOnEntryRestoreFeature","name","register","container"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { SetLocationOnEntryRestoreImpl } from \"./SetLocationOnEntryRestore.js\";\n\nexport const SetLocationOnEntryRestoreFeature = createFeature({\n name: \"SetLocationOnEntryRestore\",\n register(container) {\n container.register(SetLocationOnEntryRestoreImpl);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,6BAA6B;AAEtC,OAAO,MAAMC,gCAAgC,GAAGF,aAAa,CAAC;EAC1DG,IAAI,EAAE,2BAA2B;EACjCC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,6BAA6B,CAAC;EACrD;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SetLocationOnEntryRestoreFeature } from "./feature.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["SetLocationOnEntryRestoreFeature"],"sources":["index.ts"],"sourcesContent":["export { SetLocationOnEntryRestoreFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,gCAAgC","ignoreList":[]}
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ContextPlugin } from "@webiny/api";
|
|
2
|
-
import type { HcmsAcoContext } from "./types";
|
|
2
|
+
import type { HcmsAcoContext } from "./types.js";
|
|
3
3
|
export declare const createAcoHcmsContext: () => ContextPlugin<HcmsAcoContext>;
|
|
4
|
-
export * from "./plugins";
|
|
4
|
+
export * from "./plugins/index.js";
|
package/index.js
CHANGED
|
@@ -1,37 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
createAcoHcmsContext: true
|
|
8
|
-
};
|
|
9
|
-
exports.createAcoHcmsContext = void 0;
|
|
10
|
-
var _api = require("@webiny/api");
|
|
11
|
-
var _entry = require("./hooks/entry");
|
|
12
|
-
var _plugins = require("./plugins");
|
|
13
|
-
Object.keys(_plugins).forEach(function (key) {
|
|
14
|
-
if (key === "default" || key === "__esModule") return;
|
|
15
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
16
|
-
if (key in exports && exports[key] === _plugins[key]) return;
|
|
17
|
-
Object.defineProperty(exports, key, {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function () {
|
|
20
|
-
return _plugins[key];
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
const createAcoHcmsContext = () => {
|
|
25
|
-
const plugin = new _api.ContextPlugin(async context => {
|
|
26
|
-
if (!context.aco) {
|
|
27
|
-
console.log(`There is no ACO initialized so we will not initialize the HCMS ACO.`);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
(0, _entry.createEntryHooks)(context);
|
|
1
|
+
import { ContextPlugin } from "@webiny/api";
|
|
2
|
+
import { SetLocationOnEntryRestoreFeature } from "./features/SetLocationOnEntryRestore/index.js";
|
|
3
|
+
export const createAcoHcmsContext = () => {
|
|
4
|
+
const plugin = new ContextPlugin(context => {
|
|
5
|
+
SetLocationOnEntryRestoreFeature.register(context.container);
|
|
31
6
|
});
|
|
32
7
|
plugin.name = "hcms-aco.createContext";
|
|
33
8
|
return plugin;
|
|
34
9
|
};
|
|
35
|
-
|
|
10
|
+
export * from "./plugins/index.js";
|
|
36
11
|
|
|
37
12
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["ContextPlugin","SetLocationOnEntryRestoreFeature","createAcoHcmsContext","plugin","context","register","container","name"],"sources":["index.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport type { HcmsAcoContext } from \"~/types.js\";\nimport { SetLocationOnEntryRestoreFeature } from \"~/features/SetLocationOnEntryRestore/index.js\";\n\nexport const createAcoHcmsContext = () => {\n const plugin = new ContextPlugin<HcmsAcoContext>(context => {\n SetLocationOnEntryRestoreFeature.register(context.container);\n });\n\n plugin.name = \"hcms-aco.createContext\";\n\n return plugin;\n};\n\nexport * from \"./plugins/index.js\";\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;AAE3C,SAASC,gCAAgC;AAEzC,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACtC,MAAMC,MAAM,GAAG,IAAIH,aAAa,CAAiBI,OAAO,IAAI;IACxDH,gCAAgC,CAACI,QAAQ,CAACD,OAAO,CAACE,SAAS,CAAC;EAChE,CAAC,CAAC;EAEFH,MAAM,CAACI,IAAI,GAAG,wBAAwB;EAEtC,OAAOJ,MAAM;AACjB,CAAC;AAED","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-aco",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-rc.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"main": "index.js",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"api-headless-cms-aco-aco:base"
|
|
@@ -13,34 +14,28 @@
|
|
|
13
14
|
"description": "Connect Headless CMS to ACO",
|
|
14
15
|
"author": "Webiny Ltd.",
|
|
15
16
|
"license": "MIT",
|
|
16
|
-
"scripts": {
|
|
17
|
-
"build": "node ../cli/bin.js run build",
|
|
18
|
-
"watch": "node ../cli/bin.js run watch"
|
|
19
|
-
},
|
|
20
17
|
"publishConfig": {
|
|
21
18
|
"access": "public",
|
|
22
19
|
"directory": "dist"
|
|
23
20
|
},
|
|
24
21
|
"devDependencies": {
|
|
25
|
-
"@webiny/api-
|
|
26
|
-
"@webiny/
|
|
27
|
-
"@webiny/
|
|
28
|
-
"@webiny/
|
|
29
|
-
"@webiny/
|
|
30
|
-
"@webiny/
|
|
31
|
-
"@webiny/
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"@webiny/wcp": "6.0.0-alpha.5",
|
|
35
|
-
"graphql": "15.9.0",
|
|
36
|
-
"typescript": "5.3.3"
|
|
22
|
+
"@webiny/api-core": "6.0.0-rc.0",
|
|
23
|
+
"@webiny/build-tools": "6.0.0-rc.0",
|
|
24
|
+
"@webiny/handler-aws": "6.0.0-rc.0",
|
|
25
|
+
"@webiny/handler-graphql": "6.0.0-rc.0",
|
|
26
|
+
"@webiny/plugins": "6.0.0-rc.0",
|
|
27
|
+
"@webiny/project-utils": "6.0.0-rc.0",
|
|
28
|
+
"@webiny/wcp": "6.0.0-rc.0",
|
|
29
|
+
"graphql": "16.12.0",
|
|
30
|
+
"typescript": "5.9.3"
|
|
37
31
|
},
|
|
38
32
|
"dependencies": {
|
|
39
|
-
"@webiny/api": "6.0.0-
|
|
40
|
-
"@webiny/api-aco": "6.0.0-
|
|
41
|
-
"@webiny/api-headless-cms": "6.0.0-
|
|
42
|
-
"@webiny/
|
|
43
|
-
"@webiny/handler": "6.0.0-
|
|
33
|
+
"@webiny/api": "6.0.0-rc.0",
|
|
34
|
+
"@webiny/api-aco": "6.0.0-rc.0",
|
|
35
|
+
"@webiny/api-headless-cms": "6.0.0-rc.0",
|
|
36
|
+
"@webiny/feature": "6.0.0-rc.0",
|
|
37
|
+
"@webiny/handler": "6.0.0-rc.0",
|
|
38
|
+
"vitest": "4.0.18"
|
|
44
39
|
},
|
|
45
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "0f2aa699f4642e550ab62c96fcd050e8d02345c9"
|
|
46
41
|
}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createCmsFolderModelModifier = void 0;
|
|
7
|
-
var _apiAco = require("@webiny/api-aco");
|
|
1
|
+
import { FolderCmsModelModifierPlugin } from "@webiny/api-aco";
|
|
8
2
|
class FolderModelFieldsModifier {
|
|
9
3
|
fields = [];
|
|
10
4
|
namespace = "cms";
|
|
@@ -39,13 +33,12 @@ class FolderModelFieldsModifier {
|
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
35
|
}
|
|
42
|
-
const createCmsFolderModelModifier = callback => {
|
|
36
|
+
export const createCmsFolderModelModifier = callback => {
|
|
43
37
|
const modifier = new FolderModelFieldsModifier();
|
|
44
|
-
return new
|
|
38
|
+
return new FolderCmsModelModifierPlugin({
|
|
45
39
|
callback,
|
|
46
40
|
modifier
|
|
47
41
|
});
|
|
48
42
|
};
|
|
49
|
-
exports.createCmsFolderModelModifier = createCmsFolderModelModifier;
|
|
50
43
|
|
|
51
44
|
//# sourceMappingURL=createCmsFolderModelModifier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["FolderCmsModelModifierPlugin","FolderModelFieldsModifier","fields","namespace","setFields","addField","field","tags","modelIds","rest","baseTags","length","forEach","modelId","push","id","fieldId","storageId","type","concat","createCmsFolderModelModifier","callback","modifier"],"sources":["createCmsFolderModelModifier.ts"],"sourcesContent":["import type { CmsModelField as BaseModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport {\n type CmsModelField,\n FolderCmsModelModifierPlugin,\n type IFolderModelFieldsModifier\n} from \"@webiny/api-aco\";\n\nclass FolderModelFieldsModifier implements IFolderModelFieldsModifier {\n private fields: BaseModelField[] = [];\n private readonly namespace = \"cms\";\n\n setFields(fields: BaseModelField[]) {\n this.fields = fields;\n }\n\n addField(field: CmsModelField) {\n const { tags, modelIds = [], ...rest } = field;\n const baseTags = [`$namespace:${this.namespace}`];\n\n if (modelIds.length > 0) {\n modelIds.forEach(modelId => {\n this.fields.push({\n ...rest,\n id: `${this.namespace}_${modelId}_${field.id}`,\n fieldId: `${this.namespace}_${modelId}_${field.fieldId}`,\n storageId: `${field.type}@${this.namespace}_${modelId}_${field.id}`,\n tags: (tags ?? []).concat(baseTags, `$modelId:${modelId}`)\n });\n });\n } else {\n this.fields.push({\n ...rest,\n id: `${this.namespace}_${field.id}`,\n fieldId: `${this.namespace}_${field.fieldId}`,\n storageId: `${field.type}@${this.namespace}_${field.id}`,\n tags: (tags ?? []).concat(baseTags)\n });\n }\n }\n}\n\ninterface CmsModelModifierCallableParams {\n modifier: IFolderModelFieldsModifier;\n}\n\ninterface CmsModelModifierCallable {\n (params: CmsModelModifierCallableParams): Promise<void> | void;\n}\n\nexport const createCmsFolderModelModifier = (callback: CmsModelModifierCallable) => {\n const modifier = new FolderModelFieldsModifier();\n\n return new FolderCmsModelModifierPlugin({\n callback,\n modifier\n });\n};\n"],"mappings":"AACA,SAEIA,4BAA4B,QAEzB,iBAAiB;AAExB,MAAMC,yBAAyB,CAAuC;EAC1DC,MAAM,GAAqB,EAAE;EACpBC,SAAS,GAAG,KAAK;EAElCC,SAASA,CAACF,MAAwB,EAAE;IAChC,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEAG,QAAQA,CAACC,KAAoB,EAAE;IAC3B,MAAM;MAAEC,IAAI;MAAEC,QAAQ,GAAG,EAAE;MAAE,GAAGC;IAAK,CAAC,GAAGH,KAAK;IAC9C,MAAMI,QAAQ,GAAG,CAAC,cAAc,IAAI,CAACP,SAAS,EAAE,CAAC;IAEjD,IAAIK,QAAQ,CAACG,MAAM,GAAG,CAAC,EAAE;MACrBH,QAAQ,CAACI,OAAO,CAACC,OAAO,IAAI;QACxB,IAAI,CAACX,MAAM,CAACY,IAAI,CAAC;UACb,GAAGL,IAAI;UACPM,EAAE,EAAE,GAAG,IAAI,CAACZ,SAAS,IAAIU,OAAO,IAAIP,KAAK,CAACS,EAAE,EAAE;UAC9CC,OAAO,EAAE,GAAG,IAAI,CAACb,SAAS,IAAIU,OAAO,IAAIP,KAAK,CAACU,OAAO,EAAE;UACxDC,SAAS,EAAE,GAAGX,KAAK,CAACY,IAAI,IAAI,IAAI,CAACf,SAAS,IAAIU,OAAO,IAAIP,KAAK,CAACS,EAAE,EAAE;UACnER,IAAI,EAAE,CAACA,IAAI,IAAI,EAAE,EAAEY,MAAM,CAACT,QAAQ,EAAE,YAAYG,OAAO,EAAE;QAC7D,CAAC,CAAC;MACN,CAAC,CAAC;IACN,CAAC,MAAM;MACH,IAAI,CAACX,MAAM,CAACY,IAAI,CAAC;QACb,GAAGL,IAAI;QACPM,EAAE,EAAE,GAAG,IAAI,CAACZ,SAAS,IAAIG,KAAK,CAACS,EAAE,EAAE;QACnCC,OAAO,EAAE,GAAG,IAAI,CAACb,SAAS,IAAIG,KAAK,CAACU,OAAO,EAAE;QAC7CC,SAAS,EAAE,GAAGX,KAAK,CAACY,IAAI,IAAI,IAAI,CAACf,SAAS,IAAIG,KAAK,CAACS,EAAE,EAAE;QACxDR,IAAI,EAAE,CAACA,IAAI,IAAI,EAAE,EAAEY,MAAM,CAACT,QAAQ;MACtC,CAAC,CAAC;IACN;EACJ;AACJ;AAUA,OAAO,MAAMU,4BAA4B,GAAIC,QAAkC,IAAK;EAChF,MAAMC,QAAQ,GAAG,IAAIrB,yBAAyB,CAAC,CAAC;EAEhD,OAAO,IAAID,4BAA4B,CAAC;IACpCqB,QAAQ;IACRC;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
package/plugins/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./createCmsFolderModelModifier";
|
|
1
|
+
export * from "./createCmsFolderModelModifier.js";
|
package/plugins/index.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _createCmsFolderModelModifier = require("./createCmsFolderModelModifier");
|
|
7
|
-
Object.keys(_createCmsFolderModelModifier).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _createCmsFolderModelModifier[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _createCmsFolderModelModifier[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
1
|
+
export * from "./createCmsFolderModelModifier.js";
|
|
17
2
|
|
|
18
3
|
//# sourceMappingURL=index.js.map
|
package/plugins/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./createCmsFolderModelModifier.js\";\n"],"mappings":"AAAA","ignoreList":[]}
|
package/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AcoContext } from "@webiny/api-aco/types";
|
|
2
|
-
import type { CmsContext } from "@webiny/api-headless-cms/types";
|
|
3
|
-
import type { Context as BaseContext } from "@webiny/handler/types";
|
|
1
|
+
import type { AcoContext } from "@webiny/api-aco/types.js";
|
|
2
|
+
import type { CmsContext } from "@webiny/api-headless-cms/types/index.js";
|
|
3
|
+
import type { Context as BaseContext } from "@webiny/handler/types.js";
|
|
4
4
|
export interface HcmsAcoContext extends BaseContext, AcoContext, CmsContext {
|
|
5
5
|
}
|
package/types.js
CHANGED
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { AcoContext } from \"@webiny/api-aco/types\";\nimport type { CmsContext } from \"@webiny/api-headless-cms/types\";\nimport type { Context as BaseContext } from \"@webiny/handler/types\";\n\nexport interface HcmsAcoContext extends BaseContext, AcoContext, CmsContext {}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { AcoContext } from \"@webiny/api-aco/types.js\";\nimport type { CmsContext } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { Context as BaseContext } from \"@webiny/handler/types.js\";\n\nexport interface HcmsAcoContext extends BaseContext, AcoContext, CmsContext {}\n"],"mappings":"","ignoreList":[]}
|
package/hooks/entry/index.d.ts
DELETED
package/hooks/entry/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createEntryHooks = void 0;
|
|
7
|
-
Object.defineProperty(exports, "onEntryBeforeRestoreFromBinHook", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () {
|
|
10
|
-
return _onEntryBeforeRestoreFromBin.onEntryBeforeRestoreFromBinHook;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
var _onEntryBeforeRestoreFromBin = require("./onEntryBeforeRestoreFromBin.hook");
|
|
14
|
-
const createEntryHooks = context => {
|
|
15
|
-
(0, _onEntryBeforeRestoreFromBin.onEntryBeforeRestoreFromBinHook)(context);
|
|
16
|
-
};
|
|
17
|
-
exports.createEntryHooks = createEntryHooks;
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
package/hooks/entry/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_onEntryBeforeRestoreFromBin","require","createEntryHooks","context","onEntryBeforeRestoreFromBinHook","exports"],"sources":["index.ts"],"sourcesContent":["import { onEntryBeforeRestoreFromBinHook } from \"~/hooks/entry/onEntryBeforeRestoreFromBin.hook\";\n\nexport { onEntryBeforeRestoreFromBinHook } from \"./onEntryBeforeRestoreFromBin.hook\";\n\nimport type { HcmsAcoContext } from \"~/types\";\n\nexport const createEntryHooks = (context: HcmsAcoContext) => {\n onEntryBeforeRestoreFromBinHook(context);\n};\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,4BAAA,GAAAC,OAAA;AAMO,MAAMC,gBAAgB,GAAIC,OAAuB,IAAK;EACzD,IAAAC,4DAA+B,EAACD,OAAO,CAAC;AAC5C,CAAC;AAACE,OAAA,CAAAH,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.onEntryBeforeRestoreFromBinHook = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _constants = require("@webiny/api-headless-cms/constants");
|
|
10
|
-
const onEntryBeforeRestoreFromBinHook = context => {
|
|
11
|
-
const {
|
|
12
|
-
aco,
|
|
13
|
-
cms
|
|
14
|
-
} = context;
|
|
15
|
-
cms.onEntryBeforeRestoreFromBin.subscribe(async ({
|
|
16
|
-
entry
|
|
17
|
-
}) => {
|
|
18
|
-
/**
|
|
19
|
-
* Skip further execution if folderId is falsy or equals ROOT_FOLDER.
|
|
20
|
-
*/
|
|
21
|
-
if (!entry.location?.folderId || entry.location.folderId === _constants.ROOT_FOLDER) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
/**
|
|
26
|
-
* Retrieve the folder: if it exists, no additional operations are necessary.
|
|
27
|
-
*/
|
|
28
|
-
await aco.folder.get(entry.location.folderId);
|
|
29
|
-
return;
|
|
30
|
-
} catch (error) {
|
|
31
|
-
/**
|
|
32
|
-
* If the folder is not found, set ROOT_FOLDER as the location.
|
|
33
|
-
*/
|
|
34
|
-
if (error.code === "NOT_FOUND") {
|
|
35
|
-
entry.location.folderId = _constants.ROOT_FOLDER;
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
throw _error.default.from(error, {
|
|
39
|
-
message: "Error while executing onEntryBeforeRestoreFromBin hook",
|
|
40
|
-
code: "HCMS_ACO_BEFORE_RESTORE_FROM_BIN_HOOK"
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
exports.onEntryBeforeRestoreFromBinHook = onEntryBeforeRestoreFromBinHook;
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=onEntryBeforeRestoreFromBin.hook.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_constants","onEntryBeforeRestoreFromBinHook","context","aco","cms","onEntryBeforeRestoreFromBin","subscribe","entry","location","folderId","ROOT_FOLDER","folder","get","error","code","WebinyError","from","message","exports"],"sources":["onEntryBeforeRestoreFromBin.hook.ts"],"sourcesContent":["import type { HcmsAcoContext } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { ROOT_FOLDER } from \"@webiny/api-headless-cms/constants\";\n\nexport const onEntryBeforeRestoreFromBinHook = (context: HcmsAcoContext) => {\n const { aco, cms } = context;\n\n cms.onEntryBeforeRestoreFromBin.subscribe(async ({ entry }) => {\n /**\n * Skip further execution if folderId is falsy or equals ROOT_FOLDER.\n */\n if (!entry.location?.folderId || entry.location.folderId === ROOT_FOLDER) {\n return;\n }\n\n try {\n /**\n * Retrieve the folder: if it exists, no additional operations are necessary.\n */\n await aco.folder.get(entry.location.folderId);\n return;\n } catch (error) {\n /**\n * If the folder is not found, set ROOT_FOLDER as the location.\n */\n if (error.code === \"NOT_FOUND\") {\n entry.location.folderId = ROOT_FOLDER;\n return;\n }\n\n throw WebinyError.from(error, {\n message: \"Error while executing onEntryBeforeRestoreFromBin hook\",\n code: \"HCMS_ACO_BEFORE_RESTORE_FROM_BIN_HOOK\"\n });\n }\n });\n};\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEO,MAAME,+BAA+B,GAAIC,OAAuB,IAAK;EACxE,MAAM;IAAEC,GAAG;IAAEC;EAAI,CAAC,GAAGF,OAAO;EAE5BE,GAAG,CAACC,2BAA2B,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAM,CAAC,KAAK;IAC3D;AACR;AACA;IACQ,IAAI,CAACA,KAAK,CAACC,QAAQ,EAAEC,QAAQ,IAAIF,KAAK,CAACC,QAAQ,CAACC,QAAQ,KAAKC,sBAAW,EAAE;MACtE;IACJ;IAEA,IAAI;MACA;AACZ;AACA;MACY,MAAMP,GAAG,CAACQ,MAAM,CAACC,GAAG,CAACL,KAAK,CAACC,QAAQ,CAACC,QAAQ,CAAC;MAC7C;IACJ,CAAC,CAAC,OAAOI,KAAK,EAAE;MACZ;AACZ;AACA;MACY,IAAIA,KAAK,CAACC,IAAI,KAAK,WAAW,EAAE;QAC5BP,KAAK,CAACC,QAAQ,CAACC,QAAQ,GAAGC,sBAAW;QACrC;MACJ;MAEA,MAAMK,cAAW,CAACC,IAAI,CAACH,KAAK,EAAE;QAC1BI,OAAO,EAAE,wDAAwD;QACjEH,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACI,OAAA,CAAAjB,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|