@webiny/api-file-manager-aco 6.3.0 → 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.
@@ -3,50 +3,39 @@ import { FolderBeforeDeleteEventHandler } from "@webiny/api-aco/features/folder/
3
3
  import { ListFilesUseCase } from "@webiny/api-file-manager/features/file/ListFiles/index.js";
4
4
  import { EnsureFolderIsEmpty } from "@webiny/api-aco/features/folder/EnsureFolderIsEmpty/index.js";
5
5
  class EnsureFolderIsEmptyBeforeDeleteImpl {
6
- constructor(ensureFolderIsEmpty, listFiles) {
7
- this.ensureFolderIsEmpty = ensureFolderIsEmpty;
8
- this.listFiles = listFiles;
9
- }
10
- async handle(event) {
11
- const {
12
- folder
13
- } = event.payload;
14
- const {
15
- id,
16
- type
17
- } = folder;
18
-
19
- /**
20
- * Exit if the folder type is not related to File Manager
21
- */
22
- if (type !== "FmFile") {
23
- return;
6
+ constructor(ensureFolderIsEmpty, listFiles){
7
+ this.ensureFolderIsEmpty = ensureFolderIsEmpty;
8
+ this.listFiles = listFiles;
24
9
  }
25
- const result = await this.ensureFolderIsEmpty.execute(type, id, async () => {
26
- const result = await this.listFiles.execute({
27
- where: {
28
- location: {
29
- folderId: id
30
- }
31
- },
32
- limit: 1
33
- });
34
- const {
35
- items
36
- } = result.value;
37
- return items.length > 0;
38
- });
39
- if (result.isFail()) {
40
- throw WebinyError.from(result.error, {
41
- message: "Error while ensuring folder is empty before delete.",
42
- code: "ACO_BEFORE_FOLDER_DELETE_FILE_HANDLER"
43
- });
10
+ async handle(event) {
11
+ const { folder } = event.payload;
12
+ const { id, type } = folder;
13
+ if ("FmFile" !== type) return;
14
+ const result = await this.ensureFolderIsEmpty.execute(type, id, async ()=>{
15
+ const result = await this.listFiles.execute({
16
+ where: {
17
+ location: {
18
+ folderId: id
19
+ }
20
+ },
21
+ limit: 1
22
+ });
23
+ const { items } = result.value;
24
+ return items.length > 0;
25
+ });
26
+ if (result.isFail()) throw WebinyError.from(result.error, {
27
+ message: "Error while ensuring folder is empty before delete.",
28
+ code: "ACO_BEFORE_FOLDER_DELETE_FILE_HANDLER"
29
+ });
44
30
  }
45
- }
46
31
  }
47
- export const EnsureFolderIsEmptyBeforeDelete = FolderBeforeDeleteEventHandler.createImplementation({
48
- implementation: EnsureFolderIsEmptyBeforeDeleteImpl,
49
- dependencies: [EnsureFolderIsEmpty, ListFilesUseCase]
32
+ const EnsureFolderIsEmptyBeforeDelete = FolderBeforeDeleteEventHandler.createImplementation({
33
+ implementation: EnsureFolderIsEmptyBeforeDeleteImpl,
34
+ dependencies: [
35
+ EnsureFolderIsEmpty,
36
+ ListFilesUseCase
37
+ ]
50
38
  });
39
+ export { EnsureFolderIsEmptyBeforeDelete };
51
40
 
52
41
  //# sourceMappingURL=EnsureFolderIsEmptyBeforeDelete.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["WebinyError","FolderBeforeDeleteEventHandler","ListFilesUseCase","EnsureFolderIsEmpty","EnsureFolderIsEmptyBeforeDeleteImpl","constructor","ensureFolderIsEmpty","listFiles","handle","event","folder","payload","id","type","result","execute","where","location","folderId","limit","items","value","length","isFail","from","error","message","code","EnsureFolderIsEmptyBeforeDelete","createImplementation","implementation","dependencies"],"sources":["EnsureFolderIsEmptyBeforeDelete.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { FolderBeforeDeleteEventHandler } from \"@webiny/api-aco/features/folder/DeleteFolder/index.js\";\nimport { ListFilesUseCase } from \"@webiny/api-file-manager/features/file/ListFiles/index.js\";\nimport { EnsureFolderIsEmpty } from \"@webiny/api-aco/features/folder/EnsureFolderIsEmpty/index.js\";\n\nclass EnsureFolderIsEmptyBeforeDeleteImpl implements FolderBeforeDeleteEventHandler.Interface {\n constructor(\n private ensureFolderIsEmpty: EnsureFolderIsEmpty.Interface,\n private listFiles: ListFilesUseCase.Interface\n ) {}\n\n async handle(event: FolderBeforeDeleteEventHandler.Event): Promise<void> {\n const { folder } = event.payload;\n\n const { id, type } = folder;\n\n /**\n * Exit if the folder type is not related to File Manager\n */\n if (type !== \"FmFile\") {\n return;\n }\n\n const result = await this.ensureFolderIsEmpty.execute(type, id, async () => {\n const result = await this.listFiles.execute({\n where: {\n location: {\n folderId: id\n }\n },\n limit: 1\n });\n\n const { items } = result.value;\n\n return items.length > 0;\n });\n\n if (result.isFail()) {\n throw WebinyError.from(result.error, {\n message: \"Error while ensuring folder is empty before delete.\",\n code: \"ACO_BEFORE_FOLDER_DELETE_FILE_HANDLER\"\n });\n }\n }\n}\n\nexport const EnsureFolderIsEmptyBeforeDelete = FolderBeforeDeleteEventHandler.createImplementation({\n implementation: EnsureFolderIsEmptyBeforeDeleteImpl,\n dependencies: [EnsureFolderIsEmpty, ListFilesUseCase]\n});\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,eAAe;AAC3C,SAASC,8BAA8B,QAAQ,uDAAuD;AACtG,SAASC,gBAAgB,QAAQ,2DAA2D;AAC5F,SAASC,mBAAmB,QAAQ,8DAA8D;AAElG,MAAMC,mCAAmC,CAAqD;EAC1FC,WAAWA,CACCC,mBAAkD,EAClDC,SAAqC,EAC/C;IAAA,KAFUD,mBAAkD,GAAlDA,mBAAkD;IAAA,KAClDC,SAAqC,GAArCA,SAAqC;EAC9C;EAEH,MAAMC,MAAMA,CAACC,KAA2C,EAAiB;IACrE,MAAM;MAAEC;IAAO,CAAC,GAAGD,KAAK,CAACE,OAAO;IAEhC,MAAM;MAAEC,EAAE;MAAEC;IAAK,CAAC,GAAGH,MAAM;;IAE3B;AACR;AACA;IACQ,IAAIG,IAAI,KAAK,QAAQ,EAAE;MACnB;IACJ;IAEA,MAAMC,MAAM,GAAG,MAAM,IAAI,CAACR,mBAAmB,CAACS,OAAO,CAACF,IAAI,EAAED,EAAE,EAAE,YAAY;MACxE,MAAME,MAAM,GAAG,MAAM,IAAI,CAACP,SAAS,CAACQ,OAAO,CAAC;QACxCC,KAAK,EAAE;UACHC,QAAQ,EAAE;YACNC,QAAQ,EAAEN;UACd;QACJ,CAAC;QACDO,KAAK,EAAE;MACX,CAAC,CAAC;MAEF,MAAM;QAAEC;MAAM,CAAC,GAAGN,MAAM,CAACO,KAAK;MAE9B,OAAOD,KAAK,CAACE,MAAM,GAAG,CAAC;IAC3B,CAAC,CAAC;IAEF,IAAIR,MAAM,CAACS,MAAM,CAAC,CAAC,EAAE;MACjB,MAAMvB,WAAW,CAACwB,IAAI,CAACV,MAAM,CAACW,KAAK,EAAE;QACjCC,OAAO,EAAE,qDAAqD;QAC9DC,IAAI,EAAE;MACV,CAAC,CAAC;IACN;EACJ;AACJ;AAEA,OAAO,MAAMC,+BAA+B,GAAG3B,8BAA8B,CAAC4B,oBAAoB,CAAC;EAC/FC,cAAc,EAAE1B,mCAAmC;EACnD2B,YAAY,EAAE,CAAC5B,mBAAmB,EAAED,gBAAgB;AACxD,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/EnsureFolderIsEmptyBeforeDelete/EnsureFolderIsEmptyBeforeDelete.js","sources":["../../../src/features/EnsureFolderIsEmptyBeforeDelete/EnsureFolderIsEmptyBeforeDelete.ts"],"sourcesContent":["import { WebinyError } from \"@webiny/error\";\nimport { FolderBeforeDeleteEventHandler } from \"@webiny/api-aco/features/folder/DeleteFolder/index.js\";\nimport { ListFilesUseCase } from \"@webiny/api-file-manager/features/file/ListFiles/index.js\";\nimport { EnsureFolderIsEmpty } from \"@webiny/api-aco/features/folder/EnsureFolderIsEmpty/index.js\";\n\nclass EnsureFolderIsEmptyBeforeDeleteImpl implements FolderBeforeDeleteEventHandler.Interface {\n constructor(\n private ensureFolderIsEmpty: EnsureFolderIsEmpty.Interface,\n private listFiles: ListFilesUseCase.Interface\n ) {}\n\n async handle(event: FolderBeforeDeleteEventHandler.Event): Promise<void> {\n const { folder } = event.payload;\n\n const { id, type } = folder;\n\n /**\n * Exit if the folder type is not related to File Manager\n */\n if (type !== \"FmFile\") {\n return;\n }\n\n const result = await this.ensureFolderIsEmpty.execute(type, id, async () => {\n const result = await this.listFiles.execute({\n where: {\n location: {\n folderId: id\n }\n },\n limit: 1\n });\n\n const { items } = result.value;\n\n return items.length > 0;\n });\n\n if (result.isFail()) {\n throw WebinyError.from(result.error, {\n message: \"Error while ensuring folder is empty before delete.\",\n code: \"ACO_BEFORE_FOLDER_DELETE_FILE_HANDLER\"\n });\n }\n }\n}\n\nexport const EnsureFolderIsEmptyBeforeDelete = FolderBeforeDeleteEventHandler.createImplementation({\n implementation: EnsureFolderIsEmptyBeforeDeleteImpl,\n dependencies: [EnsureFolderIsEmpty, ListFilesUseCase]\n});\n"],"names":["EnsureFolderIsEmptyBeforeDeleteImpl","ensureFolderIsEmpty","listFiles","event","folder","id","type","result","items","WebinyError","EnsureFolderIsEmptyBeforeDelete","FolderBeforeDeleteEventHandler","EnsureFolderIsEmpty","ListFilesUseCase"],"mappings":";;;;AAKA,MAAMA;IACF,YACYC,mBAAkD,EAClDC,SAAqC,CAC/C;aAFUD,mBAAmB,GAAnBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,OAAOC,KAA2C,EAAiB;QACrE,MAAM,EAAEC,MAAM,EAAE,GAAGD,MAAM,OAAO;QAEhC,MAAM,EAAEE,EAAE,EAAEC,IAAI,EAAE,GAAGF;QAKrB,IAAIE,AAAS,aAATA,MACA;QAGJ,MAAMC,SAAS,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAACD,MAAMD,IAAI;YAC5D,MAAME,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;gBACxC,OAAO;oBACH,UAAU;wBACN,UAAUF;oBACd;gBACJ;gBACA,OAAO;YACX;YAEA,MAAM,EAAEG,KAAK,EAAE,GAAGD,OAAO,KAAK;YAE9B,OAAOC,MAAM,MAAM,GAAG;QAC1B;QAEA,IAAID,OAAO,MAAM,IACb,MAAME,YAAY,IAAI,CAACF,OAAO,KAAK,EAAE;YACjC,SAAS;YACT,MAAM;QACV;IAER;AACJ;AAEO,MAAMG,kCAAkCC,+BAA+B,oBAAoB,CAAC;IAC/F,gBAAgBX;IAChB,cAAc;QAACY;QAAqBC;KAAiB;AACzD"}
@@ -1,10 +1,11 @@
1
1
  import { createFeature } from "@webiny/feature/api";
2
2
  import { EnsureFolderIsEmptyBeforeDelete } from "./EnsureFolderIsEmptyBeforeDelete.js";
3
- export const EnsureFolderIsEmptyBeforeDeleteFeature = createFeature({
4
- name: "EnsureFolderIsEmptyBeforeDelete",
5
- register(container) {
6
- container.register(EnsureFolderIsEmptyBeforeDelete);
7
- }
3
+ const EnsureFolderIsEmptyBeforeDeleteFeature = createFeature({
4
+ name: "EnsureFolderIsEmptyBeforeDelete",
5
+ register (container) {
6
+ container.register(EnsureFolderIsEmptyBeforeDelete);
7
+ }
8
8
  });
9
+ export { EnsureFolderIsEmptyBeforeDeleteFeature };
9
10
 
10
11
  //# sourceMappingURL=feature.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createFeature","EnsureFolderIsEmptyBeforeDelete","EnsureFolderIsEmptyBeforeDeleteFeature","name","register","container"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { EnsureFolderIsEmptyBeforeDelete } from \"./EnsureFolderIsEmptyBeforeDelete.js\";\n\nexport const EnsureFolderIsEmptyBeforeDeleteFeature = createFeature({\n name: \"EnsureFolderIsEmptyBeforeDelete\",\n register(container) {\n container.register(EnsureFolderIsEmptyBeforeDelete);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,+BAA+B;AAExC,OAAO,MAAMC,sCAAsC,GAAGF,aAAa,CAAC;EAChEG,IAAI,EAAE,iCAAiC;EACvCC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,+BAA+B,CAAC;EACvD;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"features/EnsureFolderIsEmptyBeforeDelete/feature.js","sources":["../../../src/features/EnsureFolderIsEmptyBeforeDelete/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { EnsureFolderIsEmptyBeforeDelete } from \"./EnsureFolderIsEmptyBeforeDelete.js\";\n\nexport const EnsureFolderIsEmptyBeforeDeleteFeature = createFeature({\n name: \"EnsureFolderIsEmptyBeforeDelete\",\n register(container) {\n container.register(EnsureFolderIsEmptyBeforeDelete);\n }\n});\n"],"names":["EnsureFolderIsEmptyBeforeDeleteFeature","createFeature","container","EnsureFolderIsEmptyBeforeDelete"],"mappings":";;AAGO,MAAMA,yCAAyCC,cAAc;IAChE,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;IACvB;AACJ"}
package/index.js CHANGED
@@ -1,10 +1,9 @@
1
1
  import { createContextPlugin } from "@webiny/api";
2
2
  import { EnsureFolderIsEmptyBeforeDeleteFeature } from "./features/EnsureFolderIsEmptyBeforeDelete/feature.js";
3
3
  export * from "./plugins/index.js";
4
- export const createFileManagerAco = () => {
5
- return createContextPlugin(context => {
6
- EnsureFolderIsEmptyBeforeDeleteFeature.register(context.container);
7
- });
8
- };
4
+ const createFileManagerAco = ()=>createContextPlugin((context)=>{
5
+ EnsureFolderIsEmptyBeforeDeleteFeature.register(context.container);
6
+ });
7
+ export { createFileManagerAco };
9
8
 
10
9
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["createContextPlugin","EnsureFolderIsEmptyBeforeDeleteFeature","createFileManagerAco","context","register","container"],"sources":["index.ts"],"sourcesContent":["import { createContextPlugin } from \"@webiny/api\";\nimport { EnsureFolderIsEmptyBeforeDeleteFeature } from \"~/features/EnsureFolderIsEmptyBeforeDelete/feature.js\";\n\nexport * from \"./plugins/index.js\";\n\nexport const createFileManagerAco = () => {\n return createContextPlugin(context => {\n EnsureFolderIsEmptyBeforeDeleteFeature.register(context.container);\n });\n};\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,aAAa;AACjD,SAASC,sCAAsC;AAE/C;AAEA,OAAO,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACtC,OAAOF,mBAAmB,CAACG,OAAO,IAAI;IAClCF,sCAAsC,CAACG,QAAQ,CAACD,OAAO,CAACE,SAAS,CAAC;EACtE,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { createContextPlugin } from \"@webiny/api\";\nimport { EnsureFolderIsEmptyBeforeDeleteFeature } from \"~/features/EnsureFolderIsEmptyBeforeDelete/feature.js\";\n\nexport * from \"./plugins/index.js\";\n\nexport const createFileManagerAco = () => {\n return createContextPlugin(context => {\n EnsureFolderIsEmptyBeforeDeleteFeature.register(context.container);\n });\n};\n"],"names":["createFileManagerAco","createContextPlugin","context","EnsureFolderIsEmptyBeforeDeleteFeature"],"mappings":";;;AAKO,MAAMA,uBAAuB,IACzBC,oBAAoBC,CAAAA;QACvBC,uCAAuC,QAAQ,CAACD,QAAQ,SAAS;IACrE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-file-manager-aco",
3
- "version": "6.3.0",
3
+ "version": "6.4.0-beta.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -22,26 +22,26 @@
22
22
  "directory": "dist"
23
23
  },
24
24
  "dependencies": {
25
- "@webiny/api-aco": "6.3.0",
26
- "@webiny/api-file-manager": "6.3.0",
27
- "@webiny/error": "6.3.0",
28
- "@webiny/feature": "6.3.0"
25
+ "@webiny/api-aco": "6.4.0-beta.0",
26
+ "@webiny/api-file-manager": "6.4.0-beta.0",
27
+ "@webiny/error": "6.4.0-beta.0",
28
+ "@webiny/feature": "6.4.0-beta.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@webiny/api": "6.3.0",
32
- "@webiny/api-core": "6.3.0",
33
- "@webiny/api-headless-cms": "6.3.0",
34
- "@webiny/build-tools": "6.3.0",
35
- "@webiny/handler": "6.3.0",
36
- "@webiny/handler-aws": "6.3.0",
37
- "@webiny/handler-graphql": "6.3.0",
38
- "@webiny/plugins": "6.3.0",
39
- "@webiny/project-utils": "6.3.0",
40
- "@webiny/utils": "6.3.0",
41
- "@webiny/wcp": "6.3.0",
42
- "graphql": "16.13.2",
31
+ "@webiny/api": "6.4.0-beta.0",
32
+ "@webiny/api-core": "6.4.0-beta.0",
33
+ "@webiny/api-headless-cms": "6.4.0-beta.0",
34
+ "@webiny/build-tools": "6.4.0-beta.0",
35
+ "@webiny/handler": "6.4.0-beta.0",
36
+ "@webiny/handler-aws": "6.4.0-beta.0",
37
+ "@webiny/handler-graphql": "6.4.0-beta.0",
38
+ "@webiny/plugins": "6.4.0-beta.0",
39
+ "@webiny/project-utils": "6.4.0-beta.0",
40
+ "@webiny/utils": "6.4.0-beta.0",
41
+ "@webiny/wcp": "6.4.0-beta.0",
42
+ "graphql": "16.14.0",
43
43
  "typescript": "6.0.3",
44
- "vitest": "4.1.5"
44
+ "vitest": "4.1.6"
45
45
  },
46
- "gitHead": "7cefe15431dbd65504e1f58147dc9e55bcbfa693"
46
+ "gitHead": "a545d7529828af07d08d49c3da1bcb967483b9ce"
47
47
  }
@@ -1,32 +1,32 @@
1
1
  import { FolderCmsModelModifierPlugin } from "@webiny/api-aco";
2
- export class FolderModelFieldsModifier {
3
- fields = [];
4
- constructor(namespace) {
5
- this.namespace = namespace;
6
- }
7
- setFields(fields) {
8
- this.fields = fields;
9
- }
10
- addField(field) {
11
- const {
12
- tags,
13
- ...rest
14
- } = field;
15
- this.fields.push({
16
- ...rest,
17
- id: `${this.namespace}_${field.id}`,
18
- fieldId: `${this.namespace}_${field.fieldId}`,
19
- storageId: `${field.type}@${this.namespace}_${field.id}`,
20
- tags: (tags ?? []).concat([`$namespace:${this.namespace}`])
21
- });
22
- }
2
+ class FolderModelFieldsModifier {
3
+ constructor(namespace){
4
+ this.fields = [];
5
+ this.namespace = namespace;
6
+ }
7
+ setFields(fields) {
8
+ this.fields = fields;
9
+ }
10
+ addField(field) {
11
+ const { tags, ...rest } = field;
12
+ this.fields.push({
13
+ ...rest,
14
+ id: `${this.namespace}_${field.id}`,
15
+ fieldId: `${this.namespace}_${field.fieldId}`,
16
+ storageId: `${field.type}@${this.namespace}_${field.id}`,
17
+ tags: (tags ?? []).concat([
18
+ `$namespace:${this.namespace}`
19
+ ])
20
+ });
21
+ }
23
22
  }
24
- export const createFmFileFolderModelModifier = callback => {
25
- const modifier = new FolderModelFieldsModifier("fm_file");
26
- return new FolderCmsModelModifierPlugin({
27
- callback,
28
- modifier
29
- });
23
+ const createFmFileFolderModelModifier = (callback)=>{
24
+ const modifier = new FolderModelFieldsModifier("fm_file");
25
+ return new FolderCmsModelModifierPlugin({
26
+ callback,
27
+ modifier
28
+ });
30
29
  };
30
+ export { FolderModelFieldsModifier, createFmFileFolderModelModifier };
31
31
 
32
32
  //# sourceMappingURL=createFmFileFolderModelModifier.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["FolderCmsModelModifierPlugin","FolderModelFieldsModifier","fields","constructor","namespace","setFields","addField","field","tags","rest","push","id","fieldId","storageId","type","concat","createFmFileFolderModelModifier","callback","modifier"],"sources":["createFmFileFolderModelModifier.ts"],"sourcesContent":["import {\n type CmsModelField,\n type CmsModelModifierCallable,\n FolderCmsModelModifierPlugin,\n type IFolderModelFieldsModifier\n} from \"@webiny/api-aco\";\nimport type { CmsModelField as BaseModelField } from \"@webiny/api-headless-cms/types/index.js\";\n\nexport class FolderModelFieldsModifier implements IFolderModelFieldsModifier {\n private fields: BaseModelField[] = [];\n private readonly namespace: string;\n\n constructor(namespace: string) {\n this.namespace = namespace;\n }\n\n setFields(fields: BaseModelField[]) {\n this.fields = fields;\n }\n\n addField(field: CmsModelField) {\n const { tags, ...rest } = field;\n\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([`$namespace:${this.namespace}`])\n });\n }\n}\n\nexport const createFmFileFolderModelModifier = (callback: CmsModelModifierCallable) => {\n const modifier = new FolderModelFieldsModifier(\"fm_file\");\n\n return new FolderCmsModelModifierPlugin({\n callback,\n modifier\n });\n};\n"],"mappings":"AAAA,SAGIA,4BAA4B,QAEzB,iBAAiB;AAGxB,OAAO,MAAMC,yBAAyB,CAAuC;EACjEC,MAAM,GAAqB,EAAE;EAGrCC,WAAWA,CAACC,SAAiB,EAAE;IAC3B,IAAI,CAACA,SAAS,GAAGA,SAAS;EAC9B;EAEAC,SAASA,CAACH,MAAwB,EAAE;IAChC,IAAI,CAACA,MAAM,GAAGA,MAAM;EACxB;EAEAI,QAAQA,CAACC,KAAoB,EAAE;IAC3B,MAAM;MAAEC,IAAI;MAAE,GAAGC;IAAK,CAAC,GAAGF,KAAK;IAE/B,IAAI,CAACL,MAAM,CAACQ,IAAI,CAAC;MACb,GAAGD,IAAI;MACPE,EAAE,EAAE,GAAG,IAAI,CAACP,SAAS,IAAIG,KAAK,CAACI,EAAE,EAAE;MACnCC,OAAO,EAAE,GAAG,IAAI,CAACR,SAAS,IAAIG,KAAK,CAACK,OAAO,EAAE;MAC7CC,SAAS,EAAE,GAAGN,KAAK,CAACO,IAAI,IAAI,IAAI,CAACV,SAAS,IAAIG,KAAK,CAACI,EAAE,EAAE;MACxDH,IAAI,EAAE,CAACA,IAAI,IAAI,EAAE,EAAEO,MAAM,CAAC,CAAC,cAAc,IAAI,CAACX,SAAS,EAAE,CAAC;IAC9D,CAAC,CAAC;EACN;AACJ;AAEA,OAAO,MAAMY,+BAA+B,GAAIC,QAAkC,IAAK;EACnF,MAAMC,QAAQ,GAAG,IAAIjB,yBAAyB,CAAC,SAAS,CAAC;EAEzD,OAAO,IAAID,4BAA4B,CAAC;IACpCiB,QAAQ;IACRC;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"plugins/createFmFileFolderModelModifier.js","sources":["../../src/plugins/createFmFileFolderModelModifier.ts"],"sourcesContent":["import {\n type CmsModelField,\n type CmsModelModifierCallable,\n FolderCmsModelModifierPlugin,\n type IFolderModelFieldsModifier\n} from \"@webiny/api-aco\";\nimport type { CmsModelField as BaseModelField } from \"@webiny/api-headless-cms/types/index.js\";\n\nexport class FolderModelFieldsModifier implements IFolderModelFieldsModifier {\n private fields: BaseModelField[] = [];\n private readonly namespace: string;\n\n constructor(namespace: string) {\n this.namespace = namespace;\n }\n\n setFields(fields: BaseModelField[]) {\n this.fields = fields;\n }\n\n addField(field: CmsModelField) {\n const { tags, ...rest } = field;\n\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([`$namespace:${this.namespace}`])\n });\n }\n}\n\nexport const createFmFileFolderModelModifier = (callback: CmsModelModifierCallable) => {\n const modifier = new FolderModelFieldsModifier(\"fm_file\");\n\n return new FolderCmsModelModifierPlugin({\n callback,\n modifier\n });\n};\n"],"names":["FolderModelFieldsModifier","namespace","fields","field","tags","rest","createFmFileFolderModelModifier","callback","modifier","FolderCmsModelModifierPlugin"],"mappings":";AAQO,MAAMA;IAIT,YAAYC,SAAiB,CAAE;aAHvB,MAAM,GAAqB,EAAE;QAIjC,IAAI,CAAC,SAAS,GAAGA;IACrB;IAEA,UAAUC,MAAwB,EAAE;QAChC,IAAI,CAAC,MAAM,GAAGA;IAClB;IAEA,SAASC,KAAoB,EAAE;QAC3B,MAAM,EAAEC,IAAI,EAAE,GAAGC,MAAM,GAAGF;QAE1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YACb,GAAGE,IAAI;YACP,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAEF,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,CAAC;gBAAC,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,EAAE;aAAC;QAC9D;IACJ;AACJ;AAEO,MAAME,kCAAkC,CAACC;IAC5C,MAAMC,WAAW,IAAIR,0BAA0B;IAE/C,OAAO,IAAIS,6BAA6B;QACpCF;QACAC;IACJ;AACJ"}
package/plugins/index.js CHANGED
@@ -1,3 +1 @@
1
1
  export * from "./createFmFileFolderModelModifier.js";
2
-
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./createFmFileFolderModelModifier.js\";\n"],"mappings":"AAAA","ignoreList":[]}