@webiny/api-headless-cms-aco 6.3.0-beta.4 → 6.4.0-beta.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.
@@ -1,38 +1,23 @@
1
1
  import { ROOT_FOLDER } from "@webiny/api-headless-cms/constants.js";
2
2
  import { EntryBeforeRestoreFromBinEventHandler } from "@webiny/api-headless-cms/features/contentEntry/RestoreEntryFromBin/events.js";
3
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;
4
+ class SetLocationOnEntryRestore {
5
+ constructor(getFolderUseCase){
6
+ this.getFolderUseCase = getFolderUseCase;
18
7
  }
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;
8
+ async handle(event) {
9
+ const { entry } = event.payload;
10
+ if (!entry.location?.folderId || entry.location.folderId === ROOT_FOLDER) return;
11
+ const result = await this.getFolderUseCase.execute(entry.location.folderId);
12
+ if (result.isFail()) entry.location.folderId = ROOT_FOLDER;
30
13
  }
31
- }
32
14
  }
33
- export const SetLocationOnEntryRestoreImpl = EntryBeforeRestoreFromBinEventHandler.createImplementation({
34
- implementation: SetLocationOnEntryRestore,
35
- dependencies: [GetFolderUseCase]
15
+ const SetLocationOnEntryRestoreImpl = EntryBeforeRestoreFromBinEventHandler.createImplementation({
16
+ implementation: SetLocationOnEntryRestore,
17
+ dependencies: [
18
+ GetFolderUseCase
19
+ ]
36
20
  });
21
+ export { SetLocationOnEntryRestore, SetLocationOnEntryRestoreImpl };
37
22
 
38
23
  //# sourceMappingURL=SetLocationOnEntryRestore.js.map
@@ -1 +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":[]}
1
+ {"version":3,"file":"features/SetLocationOnEntryRestore/SetLocationOnEntryRestore.js","sources":["../../../src/features/SetLocationOnEntryRestore/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"],"names":["SetLocationOnEntryRestore","getFolderUseCase","event","entry","ROOT_FOLDER","result","SetLocationOnEntryRestoreImpl","EntryBeforeRestoreFromBinEventHandler","GetFolderUseCase"],"mappings":";;;AAIO,MAAMA;IACT,YAAoBC,gBAA4C,CAAE;aAA9CA,gBAAgB,GAAhBA;IAA+C;IAEnE,MAAM,OAAOC,KAAkD,EAAiB;QAC5E,MAAM,EAAEC,KAAK,EAAE,GAAGD,MAAM,OAAO;QAK/B,IAAI,CAACC,MAAM,QAAQ,EAAE,YAAYA,MAAM,QAAQ,CAAC,QAAQ,KAAKC,aACzD;QAMJ,MAAMC,SAAS,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAACF,MAAM,QAAQ,CAAC,QAAQ;QAK1E,IAAIE,OAAO,MAAM,IACbF,MAAM,QAAQ,CAAC,QAAQ,GAAGC;IAElC;AACJ;AAEO,MAAME,gCACTC,sCAAsC,oBAAoB,CAAC;IACvD,gBAAgBP;IAChB,cAAc;QAACQ;KAAiB;AACpC"}
@@ -1,10 +1,11 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
2
  import { SetLocationOnEntryRestoreImpl } from "./SetLocationOnEntryRestore.js";
3
- export const SetLocationOnEntryRestoreFeature = createFeature({
4
- name: "SetLocationOnEntryRestore",
5
- register(container) {
6
- container.register(SetLocationOnEntryRestoreImpl);
7
- }
3
+ const SetLocationOnEntryRestoreFeature = createFeature({
4
+ name: "SetLocationOnEntryRestore",
5
+ register (container) {
6
+ container.register(SetLocationOnEntryRestoreImpl);
7
+ }
8
8
  });
9
+ export { SetLocationOnEntryRestoreFeature };
9
10
 
10
11
  //# sourceMappingURL=feature.js.map
@@ -1 +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":[]}
1
+ {"version":3,"file":"features/SetLocationOnEntryRestore/feature.js","sources":["../../../src/features/SetLocationOnEntryRestore/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"],"names":["SetLocationOnEntryRestoreFeature","createFeature","container","SetLocationOnEntryRestoreImpl"],"mappings":";;AAGO,MAAMA,mCAAmCC,cAAc;IAC1D,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
@@ -1,3 +1 @@
1
1
  export { SetLocationOnEntryRestoreFeature } from "./feature.js";
2
-
3
- //# sourceMappingURL=index.js.map
package/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import { ContextPlugin } from "@webiny/api";
2
2
  import { SetLocationOnEntryRestoreFeature } from "./features/SetLocationOnEntryRestore/index.js";
3
- export const createAcoHcmsContext = () => {
4
- const plugin = new ContextPlugin(context => {
5
- SetLocationOnEntryRestoreFeature.register(context.container);
6
- });
7
- plugin.name = "hcms-aco.createContext";
8
- return plugin;
9
- };
10
3
  export * from "./plugins/index.js";
4
+ const createAcoHcmsContext = ()=>{
5
+ const plugin = new ContextPlugin((context)=>{
6
+ SetLocationOnEntryRestoreFeature.register(context.container);
7
+ });
8
+ plugin.name = "hcms-aco.createContext";
9
+ return plugin;
10
+ };
11
+ export { createAcoHcmsContext };
11
12
 
12
13
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
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":[]}
1
+ {"version":3,"file":"index.js","sources":["../src/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"],"names":["createAcoHcmsContext","plugin","ContextPlugin","context","SetLocationOnEntryRestoreFeature"],"mappings":";;;AAIO,MAAMA,uBAAuB;IAChC,MAAMC,SAAS,IAAIC,cAA8BC,CAAAA;QAC7CC,iCAAiC,QAAQ,CAACD,QAAQ,SAAS;IAC/D;IAEAF,OAAO,IAAI,GAAG;IAEd,OAAOA;AACX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-aco",
3
- "version": "6.3.0-beta.4",
3
+ "version": "6.4.0-beta.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -22,23 +22,23 @@
22
22
  "directory": "dist"
23
23
  },
24
24
  "devDependencies": {
25
- "@webiny/api-core": "6.3.0-beta.4",
26
- "@webiny/build-tools": "6.3.0-beta.4",
27
- "@webiny/handler-aws": "6.3.0-beta.4",
28
- "@webiny/handler-graphql": "6.3.0-beta.4",
29
- "@webiny/plugins": "6.3.0-beta.4",
30
- "@webiny/project-utils": "6.3.0-beta.4",
31
- "@webiny/wcp": "6.3.0-beta.4",
32
- "graphql": "16.13.2",
25
+ "@webiny/api-core": "6.4.0-beta.0",
26
+ "@webiny/build-tools": "6.4.0-beta.0",
27
+ "@webiny/handler-aws": "6.4.0-beta.0",
28
+ "@webiny/handler-graphql": "6.4.0-beta.0",
29
+ "@webiny/plugins": "6.4.0-beta.0",
30
+ "@webiny/project-utils": "6.4.0-beta.0",
31
+ "@webiny/wcp": "6.4.0-beta.0",
32
+ "graphql": "16.14.0",
33
33
  "typescript": "6.0.3"
34
34
  },
35
35
  "dependencies": {
36
- "@webiny/api": "6.3.0-beta.4",
37
- "@webiny/api-aco": "6.3.0-beta.4",
38
- "@webiny/api-headless-cms": "6.3.0-beta.4",
39
- "@webiny/feature": "6.3.0-beta.4",
40
- "@webiny/handler": "6.3.0-beta.4",
41
- "vitest": "4.1.5"
36
+ "@webiny/api": "6.4.0-beta.0",
37
+ "@webiny/api-aco": "6.4.0-beta.0",
38
+ "@webiny/api-headless-cms": "6.4.0-beta.0",
39
+ "@webiny/feature": "6.4.0-beta.0",
40
+ "@webiny/handler": "6.4.0-beta.0",
41
+ "vitest": "4.1.6"
42
42
  },
43
- "gitHead": "7cefe15431dbd65504e1f58147dc9e55bcbfa693"
43
+ "gitHead": "a545d7529828af07d08d49c3da1bcb967483b9ce"
44
44
  }
@@ -1,44 +1,42 @@
1
1
  import { FolderCmsModelModifierPlugin } from "@webiny/api-aco";
2
2
  class FolderModelFieldsModifier {
3
- fields = [];
4
- namespace = "cms";
5
- setFields(fields) {
6
- this.fields = fields;
7
- }
8
- addField(field) {
9
- const {
10
- tags,
11
- modelIds = [],
12
- ...rest
13
- } = field;
14
- const baseTags = [`$namespace:${this.namespace}`];
15
- if (modelIds.length > 0) {
16
- modelIds.forEach(modelId => {
17
- this.fields.push({
18
- ...rest,
19
- id: `${this.namespace}_${modelId}_${field.id}`,
20
- fieldId: `${this.namespace}_${modelId}_${field.fieldId}`,
21
- storageId: `${field.type}@${this.namespace}_${modelId}_${field.id}`,
22
- tags: (tags ?? []).concat(baseTags, `$modelId:${modelId}`)
3
+ setFields(fields) {
4
+ this.fields = fields;
5
+ }
6
+ addField(field) {
7
+ const { tags, modelIds = [], ...rest } = field;
8
+ const baseTags = [
9
+ `$namespace:${this.namespace}`
10
+ ];
11
+ if (modelIds.length > 0) modelIds.forEach((modelId)=>{
12
+ this.fields.push({
13
+ ...rest,
14
+ id: `${this.namespace}_${modelId}_${field.id}`,
15
+ fieldId: `${this.namespace}_${modelId}_${field.fieldId}`,
16
+ storageId: `${field.type}@${this.namespace}_${modelId}_${field.id}`,
17
+ tags: (tags ?? []).concat(baseTags, `$modelId:${modelId}`)
18
+ });
19
+ });
20
+ else this.fields.push({
21
+ ...rest,
22
+ id: `${this.namespace}_${field.id}`,
23
+ fieldId: `${this.namespace}_${field.fieldId}`,
24
+ storageId: `${field.type}@${this.namespace}_${field.id}`,
25
+ tags: (tags ?? []).concat(baseTags)
23
26
  });
24
- });
25
- } else {
26
- this.fields.push({
27
- ...rest,
28
- id: `${this.namespace}_${field.id}`,
29
- fieldId: `${this.namespace}_${field.fieldId}`,
30
- storageId: `${field.type}@${this.namespace}_${field.id}`,
31
- tags: (tags ?? []).concat(baseTags)
32
- });
33
27
  }
34
- }
28
+ constructor(){
29
+ this.fields = [];
30
+ this.namespace = "cms";
31
+ }
35
32
  }
36
- export const createCmsFolderModelModifier = callback => {
37
- const modifier = new FolderModelFieldsModifier();
38
- return new FolderCmsModelModifierPlugin({
39
- callback,
40
- modifier
41
- });
33
+ const createCmsFolderModelModifier = (callback)=>{
34
+ const modifier = new FolderModelFieldsModifier();
35
+ return new FolderCmsModelModifierPlugin({
36
+ callback,
37
+ modifier
38
+ });
42
39
  };
40
+ export { createCmsFolderModelModifier };
43
41
 
44
42
  //# sourceMappingURL=createCmsFolderModelModifier.js.map
@@ -1 +1 @@
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":[]}
1
+ {"version":3,"file":"plugins/createCmsFolderModelModifier.js","sources":["../../src/plugins/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"],"names":["FolderModelFieldsModifier","fields","field","tags","modelIds","rest","baseTags","modelId","createCmsFolderModelModifier","callback","modifier","FolderCmsModelModifierPlugin"],"mappings":";AAOA,MAAMA;IAIF,UAAUC,MAAwB,EAAE;QAChC,IAAI,CAAC,MAAM,GAAGA;IAClB;IAEA,SAASC,KAAoB,EAAE;QAC3B,MAAM,EAAEC,IAAI,EAAEC,WAAW,EAAE,EAAE,GAAGC,MAAM,GAAGH;QACzC,MAAMI,WAAW;YAAC,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,EAAE;SAAC;QAEjD,IAAIF,SAAS,MAAM,GAAG,GAClBA,SAAS,OAAO,CAACG,CAAAA;YACb,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;gBACb,GAAGF,IAAI;gBACP,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAEE,QAAQ,CAAC,EAAEL,MAAM,EAAE,EAAE;gBAC9C,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAEK,QAAQ,CAAC,EAAEL,MAAM,OAAO,EAAE;gBACxD,WAAW,GAAGA,MAAM,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EAAEK,QAAQ,CAAC,EAAEL,MAAM,EAAE,EAAE;gBACnE,MAAOC,AAAAA,CAAAA,QAAQ,EAAC,EAAG,MAAM,CAACG,UAAU,CAAC,SAAS,EAAEC,SAAS;YAC7D;QACJ;aAEA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YACb,GAAGF,IAAI;YACP,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAEH,MAAM,EAAE,EAAE;YACnC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAEA,MAAM,OAAO,EAAE;YAC7C,WAAW,GAAGA,MAAM,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,EAAEA,MAAM,EAAE,EAAE;YACxD,MAAOC,AAAAA,CAAAA,QAAQ,EAAC,EAAG,MAAM,CAACG;QAC9B;IAER;;aA9BQ,MAAM,GAAqB,EAAE;aACpB,SAAS,GAAG;;AA8BjC;AAUO,MAAME,+BAA+B,CAACC;IACzC,MAAMC,WAAW,IAAIV;IAErB,OAAO,IAAIW,6BAA6B;QACpCF;QACAC;IACJ;AACJ"}
package/plugins/index.js CHANGED
@@ -1,3 +1 @@
1
1
  export * from "./createCmsFolderModelModifier.js";
2
-
3
- //# sourceMappingURL=index.js.map
package/types.js CHANGED
@@ -1,3 +0,0 @@
1
- export {};
2
-
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["SetLocationOnEntryRestoreFeature"],"sources":["index.ts"],"sourcesContent":["export { SetLocationOnEntryRestoreFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,gCAAgC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./createCmsFolderModelModifier.js\";\n"],"mappings":"AAAA","ignoreList":[]}
package/types.js.map DELETED
@@ -1 +0,0 @@
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":[]}