@webiny/api-file-manager 6.2.0-beta.0 → 6.3.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.
Files changed (54) hide show
  1. package/domain/file/file.model.js +2 -1
  2. package/domain/file/file.model.js.map +1 -1
  3. package/domain/file/types.d.ts +2 -0
  4. package/domain/file/types.js.map +1 -1
  5. package/features/FileManagerFeature.d.ts +4 -1
  6. package/features/FileManagerFeature.js +2 -0
  7. package/features/FileManagerFeature.js.map +1 -1
  8. package/features/ai/AiImageEnrichmentAfterCreateHandler.d.ts +11 -0
  9. package/features/ai/AiImageEnrichmentAfterCreateHandler.js +28 -0
  10. package/features/ai/AiImageEnrichmentAfterCreateHandler.js.map +1 -0
  11. package/features/ai/AiImageEnrichmentFeature.d.ts +4 -0
  12. package/features/ai/AiImageEnrichmentFeature.js +12 -0
  13. package/features/ai/AiImageEnrichmentFeature.js.map +1 -0
  14. package/features/file/CreateFile/CreateFileUseCase.js +1 -0
  15. package/features/file/CreateFile/CreateFileUseCase.js.map +1 -1
  16. package/features/file/CreateFile/abstractions.d.ts +1 -0
  17. package/features/file/CreateFile/abstractions.js.map +1 -1
  18. package/features/file/CreateFile/feature.d.ts +4 -1
  19. package/features/file/CreateFilesInBatch/feature.d.ts +4 -1
  20. package/features/file/DeleteFile/feature.d.ts +4 -1
  21. package/features/file/GetFile/feature.d.ts +4 -1
  22. package/features/file/ListFiles/feature.d.ts +4 -1
  23. package/features/file/ListImagesByTagTool/ListImagesByTagTool.d.ts +27 -0
  24. package/features/file/ListImagesByTagTool/ListImagesByTagTool.js +39 -0
  25. package/features/file/ListImagesByTagTool/ListImagesByTagTool.js.map +1 -0
  26. package/features/file/ListImagesByTagTool/feature.d.ts +4 -0
  27. package/features/file/ListImagesByTagTool/feature.js +10 -0
  28. package/features/file/ListImagesByTagTool/feature.js.map +1 -0
  29. package/features/file/ListTags/feature.d.ts +4 -1
  30. package/features/file/UpdateFile/UpdateFileUseCase.js +1 -0
  31. package/features/file/UpdateFile/UpdateFileUseCase.js.map +1 -1
  32. package/features/file/UpdateFile/abstractions.d.ts +1 -0
  33. package/features/file/UpdateFile/abstractions.js.map +1 -1
  34. package/features/file/UpdateFile/feature.d.ts +4 -1
  35. package/features/file/shared/EntryToFileMapper.js +1 -0
  36. package/features/file/shared/EntryToFileMapper.js.map +1 -1
  37. package/features/file/shared/FileInputToEntryInputMapper.js +1 -0
  38. package/features/file/shared/FileInputToEntryInputMapper.js.map +1 -1
  39. package/features/file/shared/FileToEntryMapper.js +1 -0
  40. package/features/file/shared/FileToEntryMapper.js.map +1 -1
  41. package/features/permissions/feature.d.ts +4 -1
  42. package/features/settings/GetSettings/feature.d.ts +4 -1
  43. package/features/settings/SettingsInstaller/feature.d.ts +4 -1
  44. package/features/settings/UpdateSettings/feature.d.ts +4 -1
  45. package/index.d.ts +1 -1
  46. package/index.js +6 -0
  47. package/index.js.map +1 -1
  48. package/package.json +19 -16
  49. package/tasks/AiImageEnrichmentTask.d.ts +32 -0
  50. package/tasks/AiImageEnrichmentTask.js +130 -0
  51. package/tasks/AiImageEnrichmentTask.js.map +1 -0
  52. package/types.d.ts +1 -0
  53. package/types.js +1 -1
  54. package/types.js.map +1 -1
@@ -28,7 +28,8 @@ class FilePrivateModelImpl {
28
28
  // Store complete raw IPTC as JSON
29
29
  iptc: fields.searchableJson().label("IPTC Data")
30
30
  })),
31
- tags: fields.text().label("Tags").tags(["$bulk-edit"]).list().required("Value is required.")
31
+ tags: fields.text().label("Tags").tags(["$bulk-edit"]).list().required("Value is required."),
32
+ description: fields.text().label("Description").defaultValue("")
32
33
  }));
33
34
  if (privateFiles) {
34
35
  model.fields(fields => ({
@@ -1 +1 @@
1
- {"version":3,"names":["ModelFactory","WcpContext","FILE_MODEL_ID","process","env","WEBINY_API_LEGACY_MODELS","FilePrivateModelImpl","constructor","wcp","execute","builder","model","private","modelId","name","privateFiles","canUsePrivateFiles","fields","text","label","required","key","type","size","number","metadata","object","renderer","image","width","height","format","orientation","exif","searchableJson","iptc","tags","list","accessControl","predefinedValues","value","selected","FileModel","createImplementation","implementation","dependencies"],"sources":["file.model.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport { WcpContext } from \"@webiny/api-core/features/wcp/WcpContext/index.js\";\n\nexport const FILE_MODEL_ID = process.env.WEBINY_API_LEGACY_MODELS ? \"fmFile\" : \"wbyFmFile\";\n\nclass FilePrivateModelImpl implements ModelFactory.Interface {\n public constructor(private wcp: WcpContext.Interface) {}\n\n public async execute(builder: ModelFactory.Builder) {\n const model = builder.private({\n modelId: FILE_MODEL_ID,\n name: \"FmFile\"\n });\n const privateFiles = this.wcp.canUsePrivateFiles();\n\n model.fields(fields => ({\n name: fields.text().label(\"Name\").required(\"Value is required.\"),\n key: fields.text().label(\"Key\").required(\"Value is required.\"),\n type: fields.text().label(\"Type\").required(\"Value is required.\"),\n size: fields.number().label(\"Size\").required(\"Value is required.\"),\n metadata: fields\n .object()\n .label(\"Metadata\")\n .renderer(\"hidden\")\n .fields(fields => ({\n image: fields\n .object()\n .label(\"Image\")\n .fields(fields => ({\n width: fields.number().label(\"Width\"),\n height: fields.number().label(\"Height\"),\n format: fields.text().label(\"Format\"),\n orientation: fields.number().label(\"Orientation\")\n })),\n // Store complete raw EXIF as JSON\n exif: fields.searchableJson().label(\"EXIF Data\"),\n // Store complete raw IPTC as JSON\n iptc: fields.searchableJson().label(\"IPTC Data\")\n })),\n tags: fields\n .text()\n .label(\"Tags\")\n .tags([\"$bulk-edit\"])\n .list()\n .required(\"Value is required.\")\n }));\n\n if (privateFiles) {\n model.fields(fields => ({\n accessControl: fields\n .object()\n .label(\"Access Control\")\n .tags([\"$bulk-edit\"])\n .fields(fields => ({\n type: fields\n .text()\n .label(\"Type\")\n .predefinedValues([\n {\n label: \"Public\",\n value: \"public\",\n selected: true\n },\n {\n label: \"Private\",\n value: \"private-authenticated\",\n selected: false\n }\n ])\n }))\n }));\n }\n\n return [model];\n }\n}\n\nexport const FileModel = ModelFactory.createImplementation({\n implementation: FilePrivateModelImpl,\n dependencies: [WcpContext]\n});\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,yDAAyD;AACtF,SAASC,UAAU,QAAQ,mDAAmD;AAE9E,OAAO,MAAMC,aAAa,GAAGC,OAAO,CAACC,GAAG,CAACC,wBAAwB,GAAG,QAAQ,GAAG,WAAW;AAE1F,MAAMC,oBAAoB,CAAmC;EAClDC,WAAWA,CAASC,GAAyB,EAAE;IAAA,KAA3BA,GAAyB,GAAzBA,GAAyB;EAAG;EAEvD,MAAaC,OAAOA,CAACC,OAA6B,EAAE;IAChD,MAAMC,KAAK,GAAGD,OAAO,CAACE,OAAO,CAAC;MAC1BC,OAAO,EAAEX,aAAa;MACtBY,IAAI,EAAE;IACV,CAAC,CAAC;IACF,MAAMC,YAAY,GAAG,IAAI,CAACP,GAAG,CAACQ,kBAAkB,CAAC,CAAC;IAElDL,KAAK,CAACM,MAAM,CAACA,MAAM,KAAK;MACpBH,IAAI,EAAEG,MAAM,CAACC,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC,MAAM,CAAC,CAACC,QAAQ,CAAC,oBAAoB,CAAC;MAChEC,GAAG,EAAEJ,MAAM,CAACC,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC,KAAK,CAAC,CAACC,QAAQ,CAAC,oBAAoB,CAAC;MAC9DE,IAAI,EAAEL,MAAM,CAACC,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC,MAAM,CAAC,CAACC,QAAQ,CAAC,oBAAoB,CAAC;MAChEG,IAAI,EAAEN,MAAM,CAACO,MAAM,CAAC,CAAC,CAACL,KAAK,CAAC,MAAM,CAAC,CAACC,QAAQ,CAAC,oBAAoB,CAAC;MAClEK,QAAQ,EAAER,MAAM,CACXS,MAAM,CAAC,CAAC,CACRP,KAAK,CAAC,UAAU,CAAC,CACjBQ,QAAQ,CAAC,QAAQ,CAAC,CAClBV,MAAM,C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B,KAAK,EAAE,QAAQ;YACfC,QAAQ,EAAE;UACd,CAAC,EACD;YACItB,KAAK,EAAE,SAAS;YAChBqB,KAAK,EAAE,uBAAuB;YAC9BC,QAAQ,EAAE;UACd,CAAC,CACJ;QACT,CAAC,CAAC;MACV,CAAC,CAAC,CAAC;IACP;IAEA,OAAO,CAAC9B,KAAK,CAAC;EAClB;AACJ;AAEA,OAAO,MAAM+B,SAAS,GAAG1C,YAAY,CAAC2C,oBAAoB,CAAC;EACvDC,cAAc,EAAEtC,oBAAoB;EACpCuC,YAAY,EAAE,CAAC5C,UAAU;AAC7B,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ModelFactory","WcpContext","FILE_MODEL_ID","process","env","WEBINY_API_LEGACY_MODELS","FilePrivateModelImpl","constructor","wcp","execute","builder","model","private","modelId","name","privateFiles","canUsePrivateFiles","fields","text","label","required","key","type","size","number","metadata","object","renderer","image","width","height","format","orientation","exif","searchableJson","iptc","tags","list","description","defaultValue","accessControl","predefinedValues","value","selected","FileModel","createImplementation","implementation","dependencies"],"sources":["file.model.ts"],"sourcesContent":["import { ModelFactory } from \"@webiny/api-headless-cms/features/modelBuilder/index.js\";\nimport { WcpContext } from \"@webiny/api-core/features/wcp/WcpContext/index.js\";\n\nexport const FILE_MODEL_ID = process.env.WEBINY_API_LEGACY_MODELS ? \"fmFile\" : \"wbyFmFile\";\n\nclass FilePrivateModelImpl implements ModelFactory.Interface {\n public constructor(private wcp: WcpContext.Interface) {}\n\n public async execute(builder: ModelFactory.Builder) {\n const model = builder.private({\n modelId: FILE_MODEL_ID,\n name: \"FmFile\"\n });\n const privateFiles = this.wcp.canUsePrivateFiles();\n\n model.fields(fields => ({\n name: fields.text().label(\"Name\").required(\"Value is required.\"),\n key: fields.text().label(\"Key\").required(\"Value is required.\"),\n type: fields.text().label(\"Type\").required(\"Value is required.\"),\n size: fields.number().label(\"Size\").required(\"Value is required.\"),\n metadata: fields\n .object()\n .label(\"Metadata\")\n .renderer(\"hidden\")\n .fields(fields => ({\n image: fields\n .object()\n .label(\"Image\")\n .fields(fields => ({\n width: fields.number().label(\"Width\"),\n height: fields.number().label(\"Height\"),\n format: fields.text().label(\"Format\"),\n orientation: fields.number().label(\"Orientation\")\n })),\n // Store complete raw EXIF as JSON\n exif: fields.searchableJson().label(\"EXIF Data\"),\n // Store complete raw IPTC as JSON\n iptc: fields.searchableJson().label(\"IPTC Data\")\n })),\n tags: fields\n .text()\n .label(\"Tags\")\n .tags([\"$bulk-edit\"])\n .list()\n .required(\"Value is required.\"),\n description: fields.text().label(\"Description\").defaultValue(\"\")\n }));\n\n if (privateFiles) {\n model.fields(fields => ({\n accessControl: fields\n .object()\n .label(\"Access Control\")\n .tags([\"$bulk-edit\"])\n .fields(fields => ({\n type: fields\n .text()\n .label(\"Type\")\n .predefinedValues([\n {\n label: \"Public\",\n value: \"public\",\n selected: true\n },\n {\n label: \"Private\",\n value: \"private-authenticated\",\n selected: false\n }\n ])\n }))\n }));\n }\n\n return [model];\n }\n}\n\nexport const FileModel = ModelFactory.createImplementation({\n implementation: FilePrivateModelImpl,\n dependencies: [WcpContext]\n});\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,yDAAyD;AACtF,SAASC,UAAU,QAAQ,mDAAmD;AAE9E,OAAO,MAAMC,aAAa,GAAGC,OAAO,CAACC,GAAG,CAACC,wBAAwB,GAAG,QAAQ,GAAG,WAAW;AAE1F,MAAMC,oBAAoB,CAAmC;EAClDC,WAAWA,CAASC,GAAyB,EAAE;IAAA,KAA3BA,GAAyB,GAAzBA,GAAyB;EAAG;EAEvD,MAAaC,OAAOA,CAACC,OAA6B,EAAE;IAChD,MAAMC,KAAK,GAAGD,OAAO,CAACE,OAAO,CAAC;MAC1BC,OAAO,EAAEX,aAAa;MACtBY,IAAI,EAAE;IACV,CAAC,CAAC;IACF,MAAMC,YAAY,GAAG,IAAI,CAACP,GAAG,CAACQ,kBAAkB,CAAC,CAAC;IAElDL,KAAK,CAACM,MAAM,CAAC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AC,WAAW;MACnD,CAAC,CAAC,CAAC;MACPiB,IAAI,EAAEnB,MAAM,CACPC,IAAI,CAAC,CAAC,CACNC,KAAK,CAAC,MAAM,CAAC,CACbiB,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,CACpBC,IAAI,CAAC,CAAC,CACNjB,QAAQ,CAAC,oBAAoB,CAAC;MACnCkB,WAAW,EAAErB,MAAM,CAACC,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC,aAAa,CAAC,CAACoB,YAAY,CAAC,EAAE;IACnE,CAAC,CAAC,CAAC;IAEH,IAAIxB,YAAY,EAAE;MACdJ,KAAK,CAACM,MAAM,CAACA,MAAM,KAAK;QACpBuB,aAAa,EAAEvB,MAAM,CAChBS,MAAM,CAAC,CAAC,CACRP,KAAK,CAAC,gBAAgB,CAAC,CACvBiB,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,CACpBnB,MAAM,CAACA,MAAM,KAAK;UACfK,IAAI,EAAEL,MAAM,CACPC,IAAI,CAAC,CAAC,CACNC,KAAK,CAAC,MAAM,CAAC,CACbsB,gBAAgB,CAAC,CACd;YACItB,KAAK,EAAE,QAAQ;YACfuB,KAAK,EAAE,QAAQ;YACfC,QAAQ,EAAE;UACd,CAAC,EACD;YACIxB,KAAK,EAAE,SAAS;YAChBuB,KAAK,EAAE,uBAAuB;YAC9BC,QAAQ,EAAE;UACd,CAAC,CACJ;QACT,CAAC,CAAC;MACV,CAAC,CAAC,CAAC;IACP;IAEA,OAAO,CAAChC,KAAK,CAAC;EAClB;AACJ;AAEA,OAAO,MAAMiC,SAAS,GAAG5C,YAAY,CAAC6C,oBAAoB,CAAC;EACvDC,cAAc,EAAExC,oBAAoB;EACpCyC,YAAY,EAAE,CAAC9C,UAAU;AAC7B,CAAC,CAAC","ignoreList":[]}
@@ -22,6 +22,7 @@ export interface File {
22
22
  folderId: string;
23
23
  };
24
24
  tags: string[];
25
+ description: string;
25
26
  createdOn: string;
26
27
  modifiedOn: string | undefined;
27
28
  savedOn: string;
@@ -47,5 +48,6 @@ export interface FileInput {
47
48
  folderId: string;
48
49
  };
49
50
  tags: string[];
51
+ description?: string;
50
52
  extensions?: Record<string, any>;
51
53
  }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export type PublicAccess = {\n type: \"public\";\n};\n\nexport type PrivateAuthenticatedAccess = {\n type: \"private-authenticated\";\n};\n\nexport type FileAccess = PublicAccess | PrivateAuthenticatedAccess;\n\nexport interface CreatedBy {\n id: string;\n displayName: string;\n type: string;\n}\n\nexport interface File {\n id: string;\n key: string;\n size: number;\n type: string;\n name: string;\n metadata: Record<string, any>;\n accessControl?: FileAccess;\n location: {\n folderId: string;\n };\n tags: string[];\n createdOn: string;\n modifiedOn: string | undefined;\n savedOn: string;\n createdBy: CreatedBy;\n modifiedBy: CreatedBy | undefined;\n savedBy: CreatedBy;\n extensions?: Record<string, any>;\n}\n\nexport interface FileInput {\n id: string;\n\n // Entry-level fields (we don't use revisions for files)\n createdOn?: string;\n modifiedOn?: string;\n savedOn?: string;\n createdBy?: CreatedBy;\n modifiedBy?: CreatedBy;\n savedBy?: CreatedBy;\n\n key: string;\n name: string;\n size: number;\n type: string;\n metadata: Record<string, any>;\n location?: {\n folderId: string;\n };\n tags: string[];\n extensions?: Record<string, any>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export type PublicAccess = {\n type: \"public\";\n};\n\nexport type PrivateAuthenticatedAccess = {\n type: \"private-authenticated\";\n};\n\nexport type FileAccess = PublicAccess | PrivateAuthenticatedAccess;\n\nexport interface CreatedBy {\n id: string;\n displayName: string;\n type: string;\n}\n\nexport interface File {\n id: string;\n key: string;\n size: number;\n type: string;\n name: string;\n metadata: Record<string, any>;\n accessControl?: FileAccess;\n location: {\n folderId: string;\n };\n tags: string[];\n description: string;\n createdOn: string;\n modifiedOn: string | undefined;\n savedOn: string;\n createdBy: CreatedBy;\n modifiedBy: CreatedBy | undefined;\n savedBy: CreatedBy;\n extensions?: Record<string, any>;\n}\n\nexport interface FileInput {\n id: string;\n\n // Entry-level fields (we don't use revisions for files)\n createdOn?: string;\n modifiedOn?: string;\n savedOn?: string;\n createdBy?: CreatedBy;\n modifiedBy?: CreatedBy;\n savedBy?: CreatedBy;\n\n key: string;\n name: string;\n size: number;\n type: string;\n metadata: Record<string, any>;\n location?: {\n folderId: string;\n };\n tags: string[];\n description?: string;\n extensions?: Record<string, any>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -1 +1,4 @@
1
- export declare const FileManagerFeature: import("@webiny/feature/api/createFeature").FeatureDefinition<unknown>;
1
+ export declare const FileManagerFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -9,6 +9,7 @@ import { UpdateFileFeature } from "./file/UpdateFile/feature.js";
9
9
  import { SettingsInstallerFeature } from "./settings/SettingsInstaller/feature.js";
10
10
  import { GetSettingsFeature } from "./settings/GetSettings/feature.js";
11
11
  import { UpdateSettingsFeature } from "./settings/UpdateSettings/feature.js";
12
+ import { ListImagesByTagToolFeature } from "./file/ListImagesByTagTool/feature.js";
12
13
  export const FileManagerFeature = createFeature({
13
14
  name: "FileManager",
14
15
  register(container) {
@@ -22,6 +23,7 @@ export const FileManagerFeature = createFeature({
22
23
  SettingsInstallerFeature.register(container);
23
24
  GetSettingsFeature.register(container);
24
25
  UpdateSettingsFeature.register(container);
26
+ ListImagesByTagToolFeature.register(container);
25
27
  }
26
28
  });
27
29
 
@@ -1 +1 @@
1
- {"version":3,"names":["createFeature","CreateFileFeature","CreateFilesInBatchFeature","DeleteFileFeature","GetFileFeature","ListFilesFeature","ListTagsFeature","UpdateFileFeature","SettingsInstallerFeature","GetSettingsFeature","UpdateSettingsFeature","FileManagerFeature","name","register","container"],"sources":["FileManagerFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CreateFileFeature } from \"~/features/file/CreateFile/feature.js\";\nimport { CreateFilesInBatchFeature } from \"~/features/file/CreateFilesInBatch/feature.js\";\nimport { DeleteFileFeature } from \"~/features/file/DeleteFile/feature.js\";\nimport { GetFileFeature } from \"~/features/file/GetFile/feature.js\";\nimport { ListFilesFeature } from \"~/features/file/ListFiles/feature.js\";\nimport { ListTagsFeature } from \"~/features/file/ListTags/feature.js\";\nimport { UpdateFileFeature } from \"~/features/file/UpdateFile/feature.js\";\nimport { SettingsInstallerFeature } from \"~/features/settings/SettingsInstaller/feature.js\";\nimport { GetSettingsFeature } from \"~/features/settings/GetSettings/feature.js\";\nimport { UpdateSettingsFeature } from \"~/features/settings/UpdateSettings/feature.js\";\n\nexport const FileManagerFeature = createFeature({\n name: \"FileManager\",\n register(container) {\n CreateFileFeature.register(container);\n CreateFilesInBatchFeature.register(container);\n UpdateFileFeature.register(container);\n DeleteFileFeature.register(container);\n GetFileFeature.register(container);\n ListFilesFeature.register(container);\n ListTagsFeature.register(container);\n SettingsInstallerFeature.register(container);\n GetSettingsFeature.register(container);\n UpdateSettingsFeature.register(container);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,iBAAiB;AAC1B,SAASC,yBAAyB;AAClC,SAASC,iBAAiB;AAC1B,SAASC,cAAc;AACvB,SAASC,gBAAgB;AACzB,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,wBAAwB;AACjC,SAASC,kBAAkB;AAC3B,SAASC,qBAAqB;AAE9B,OAAO,MAAMC,kBAAkB,GAAGX,aAAa,CAAC;EAC5CY,IAAI,EAAE,aAAa;EACnBC,QAAQA,CAACC,SAAS,EAAE;IAChBb,iBAAiB,CAACY,QAAQ,CAACC,SAAS,CAAC;IACrCZ,yBAAyB,CAACW,QAAQ,CAACC,SAAS,CAAC;IAC7CP,iBAAiB,CAACM,QAAQ,CAACC,SAAS,CAAC;IACrCX,iBAAiB,CAACU,QAAQ,CAACC,SAAS,CAAC;IACrCV,cAAc,CAACS,QAAQ,CAACC,SAAS,CAAC;IAClCT,gBAAgB,CAACQ,QAAQ,CAACC,SAAS,CAAC;IACpCR,eAAe,CAACO,QAAQ,CAACC,SAAS,CAAC;IACnCN,wBAAwB,CAACK,QAAQ,CAACC,SAAS,CAAC;IAC5CL,kBAAkB,CAACI,QAAQ,CAACC,SAAS,CAAC;IACtCJ,qBAAqB,CAACG,QAAQ,CAACC,SAAS,CAAC;EAC7C;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createFeature","CreateFileFeature","CreateFilesInBatchFeature","DeleteFileFeature","GetFileFeature","ListFilesFeature","ListTagsFeature","UpdateFileFeature","SettingsInstallerFeature","GetSettingsFeature","UpdateSettingsFeature","ListImagesByTagToolFeature","FileManagerFeature","name","register","container"],"sources":["FileManagerFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CreateFileFeature } from \"~/features/file/CreateFile/feature.js\";\nimport { CreateFilesInBatchFeature } from \"~/features/file/CreateFilesInBatch/feature.js\";\nimport { DeleteFileFeature } from \"~/features/file/DeleteFile/feature.js\";\nimport { GetFileFeature } from \"~/features/file/GetFile/feature.js\";\nimport { ListFilesFeature } from \"~/features/file/ListFiles/feature.js\";\nimport { ListTagsFeature } from \"~/features/file/ListTags/feature.js\";\nimport { UpdateFileFeature } from \"~/features/file/UpdateFile/feature.js\";\nimport { SettingsInstallerFeature } from \"~/features/settings/SettingsInstaller/feature.js\";\nimport { GetSettingsFeature } from \"~/features/settings/GetSettings/feature.js\";\nimport { UpdateSettingsFeature } from \"~/features/settings/UpdateSettings/feature.js\";\nimport { ListImagesByTagToolFeature } from \"~/features/file/ListImagesByTagTool/feature.js\";\n\nexport const FileManagerFeature = createFeature({\n name: \"FileManager\",\n register(container) {\n CreateFileFeature.register(container);\n CreateFilesInBatchFeature.register(container);\n UpdateFileFeature.register(container);\n DeleteFileFeature.register(container);\n GetFileFeature.register(container);\n ListFilesFeature.register(container);\n ListTagsFeature.register(container);\n SettingsInstallerFeature.register(container);\n GetSettingsFeature.register(container);\n UpdateSettingsFeature.register(container);\n ListImagesByTagToolFeature.register(container);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,iBAAiB;AAC1B,SAASC,yBAAyB;AAClC,SAASC,iBAAiB;AAC1B,SAASC,cAAc;AACvB,SAASC,gBAAgB;AACzB,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,wBAAwB;AACjC,SAASC,kBAAkB;AAC3B,SAASC,qBAAqB;AAC9B,SAASC,0BAA0B;AAEnC,OAAO,MAAMC,kBAAkB,GAAGZ,aAAa,CAAC;EAC5Ca,IAAI,EAAE,aAAa;EACnBC,QAAQA,CAACC,SAAS,EAAE;IAChBd,iBAAiB,CAACa,QAAQ,CAACC,SAAS,CAAC;IACrCb,yBAAyB,CAACY,QAAQ,CAACC,SAAS,CAAC;IAC7CR,iBAAiB,CAACO,QAAQ,CAACC,SAAS,CAAC;IACrCZ,iBAAiB,CAACW,QAAQ,CAACC,SAAS,CAAC;IACrCX,cAAc,CAACU,QAAQ,CAACC,SAAS,CAAC;IAClCV,gBAAgB,CAACS,QAAQ,CAACC,SAAS,CAAC;IACpCT,eAAe,CAACQ,QAAQ,CAACC,SAAS,CAAC;IACnCP,wBAAwB,CAACM,QAAQ,CAACC,SAAS,CAAC;IAC5CN,kBAAkB,CAACK,QAAQ,CAACC,SAAS,CAAC;IACtCL,qBAAqB,CAACI,QAAQ,CAACC,SAAS,CAAC;IACzCJ,0BAA0B,CAACG,QAAQ,CAACC,SAAS,CAAC;EAClD;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import { FileAfterCreateEventHandler } from "../../features/file/CreateFile/events.js";
2
+ import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
3
+ declare class AiImageEnrichmentAfterCreateHandlerImpl implements FileAfterCreateEventHandler.Interface {
4
+ private taskService;
5
+ constructor(taskService: TaskService.Interface);
6
+ handle(event: FileAfterCreateEventHandler.Event): Promise<void>;
7
+ }
8
+ export declare const AiImageEnrichmentAfterCreateHandler: typeof AiImageEnrichmentAfterCreateHandlerImpl & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core/features/eventPublisher").IEventHandler<import("~/features/file/CreateFile/events.js").FileAfterCreateEvent>>;
10
+ };
11
+ export {};
@@ -0,0 +1,28 @@
1
+ import { FileAfterCreateEventHandler } from "../file/CreateFile/events.js";
2
+ import { TaskService } from "@webiny/api-core/features/task/TaskService/index.js";
3
+ import { AI_IMAGE_ENRICHMENT_TASK_ID } from "../../tasks/AiImageEnrichmentTask.js";
4
+ class AiImageEnrichmentAfterCreateHandlerImpl {
5
+ constructor(taskService) {
6
+ this.taskService = taskService;
7
+ }
8
+ async handle(event) {
9
+ const {
10
+ file
11
+ } = event.payload;
12
+ if (!file.type.startsWith("image/")) {
13
+ return;
14
+ }
15
+ await this.taskService.trigger({
16
+ definition: AI_IMAGE_ENRICHMENT_TASK_ID,
17
+ input: {
18
+ fileId: file.id
19
+ }
20
+ });
21
+ }
22
+ }
23
+ export const AiImageEnrichmentAfterCreateHandler = FileAfterCreateEventHandler.createImplementation({
24
+ implementation: AiImageEnrichmentAfterCreateHandlerImpl,
25
+ dependencies: [TaskService]
26
+ });
27
+
28
+ //# sourceMappingURL=AiImageEnrichmentAfterCreateHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FileAfterCreateEventHandler","TaskService","AI_IMAGE_ENRICHMENT_TASK_ID","AiImageEnrichmentAfterCreateHandlerImpl","constructor","taskService","handle","event","file","payload","type","startsWith","trigger","definition","input","fileId","id","AiImageEnrichmentAfterCreateHandler","createImplementation","implementation","dependencies"],"sources":["AiImageEnrichmentAfterCreateHandler.ts"],"sourcesContent":["import { FileAfterCreateEventHandler } from \"~/features/file/CreateFile/events.js\";\nimport { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport type { IAiImageEnrichmentTaskInput } from \"~/tasks/AiImageEnrichmentTask.js\";\nimport { AI_IMAGE_ENRICHMENT_TASK_ID } from \"~/tasks/AiImageEnrichmentTask.js\";\n\nclass AiImageEnrichmentAfterCreateHandlerImpl implements FileAfterCreateEventHandler.Interface {\n constructor(private taskService: TaskService.Interface) {}\n\n async handle(event: FileAfterCreateEventHandler.Event): Promise<void> {\n const { file } = event.payload;\n\n if (!file.type.startsWith(\"image/\")) {\n return;\n }\n\n await this.taskService.trigger<IAiImageEnrichmentTaskInput>({\n definition: AI_IMAGE_ENRICHMENT_TASK_ID,\n input: {\n fileId: file.id\n }\n });\n }\n}\n\nexport const AiImageEnrichmentAfterCreateHandler = FileAfterCreateEventHandler.createImplementation(\n {\n implementation: AiImageEnrichmentAfterCreateHandlerImpl,\n dependencies: [TaskService]\n }\n);\n"],"mappings":"AAAA,SAASA,2BAA2B;AACpC,SAASC,WAAW,QAAQ,qDAAqD;AAEjF,SAASC,2BAA2B;AAEpC,MAAMC,uCAAuC,CAAkD;EAC3FC,WAAWA,CAASC,WAAkC,EAAE;IAAA,KAApCA,WAAkC,GAAlCA,WAAkC;EAAG;EAEzD,MAAMC,MAAMA,CAACC,KAAwC,EAAiB;IAClE,MAAM;MAAEC;IAAK,CAAC,GAAGD,KAAK,CAACE,OAAO;IAE9B,IAAI,CAACD,IAAI,CAACE,IAAI,CAACC,UAAU,CAAC,QAAQ,CAAC,EAAE;MACjC;IACJ;IAEA,MAAM,IAAI,CAACN,WAAW,CAACO,OAAO,CAA8B;MACxDC,UAAU,EAAEX,2BAA2B;MACvCY,KAAK,EAAE;QACHC,MAAM,EAAEP,IAAI,CAACQ;MACjB;IACJ,CAAC,CAAC;EACN;AACJ;AAEA,OAAO,MAAMC,mCAAmC,GAAGjB,2BAA2B,CAACkB,oBAAoB,CAC/F;EACIC,cAAc,EAAEhB,uCAAuC;EACvDiB,YAAY,EAAE,CAACnB,WAAW;AAC9B,CACJ,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ export declare const AiImageEnrichmentFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,12 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { AiImageEnrichmentAfterCreateHandler } from "./AiImageEnrichmentAfterCreateHandler.js";
3
+ import { AiImageEnrichmentTask } from "../../tasks/AiImageEnrichmentTask.js";
4
+ export const AiImageEnrichmentFeature = createFeature({
5
+ name: "FileManagerAi/AiImageEnrichment",
6
+ register(container) {
7
+ container.register(AiImageEnrichmentAfterCreateHandler);
8
+ container.register(AiImageEnrichmentTask);
9
+ }
10
+ });
11
+
12
+ //# sourceMappingURL=AiImageEnrichmentFeature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createFeature","AiImageEnrichmentAfterCreateHandler","AiImageEnrichmentTask","AiImageEnrichmentFeature","name","register","container"],"sources":["AiImageEnrichmentFeature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { AiImageEnrichmentAfterCreateHandler } from \"./AiImageEnrichmentAfterCreateHandler.js\";\nimport { AiImageEnrichmentTask } from \"~/tasks/AiImageEnrichmentTask.js\";\n\nexport const AiImageEnrichmentFeature = createFeature({\n name: \"FileManagerAi/AiImageEnrichment\",\n register(container) {\n container.register(AiImageEnrichmentAfterCreateHandler);\n container.register(AiImageEnrichmentTask);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,mCAAmC;AAC5C,SAASC,qBAAqB;AAE9B,OAAO,MAAMC,wBAAwB,GAAGH,aAAa,CAAC;EAClDI,IAAI,EAAE,iCAAiC;EACvCC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACJ,mCAAmC,CAAC;IACvDK,SAAS,CAACD,QAAQ,CAACH,qBAAqB,CAAC;EAC7C;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -39,6 +39,7 @@ class CreateFileUseCaseImpl {
39
39
  folderId: "root"
40
40
  },
41
41
  tags: input.tags || [],
42
+ description: input.description ?? "",
42
43
  extensions: meta || {},
43
44
  // system attributes
44
45
  createdOn: input.createdOn,
@@ -1 +1 @@
1
- {"version":3,"names":["Result","CreateFileUseCase","UseCaseAbstraction","CreateFileRepository","GetSettingsUseCase","EventPublisher","FileNotAuthorizedError","InvalidFileSizeError","FileBeforeCreateEvent","FileAfterCreateEvent","FmPermissions","IdentityContext","Identity","CreateFileUseCaseImpl","constructor","identityContext","permissions","repository","getSettings","eventPublisher","execute","input","meta","hasPermission","canCreate","fail","validationResult","validateInput","isFail","error","id","key","split","currentIdentity","getIdentity","fileInput","name","size","type","metadata","location","folderId","tags","extensions","createdOn","modifiedOn","savedOn","createdBy","from","modifiedBy","undefined","savedBy","publish","file","result","value","ok","settingsResult","settings","uploadMinFileSize","uploadMaxFileSize","minSize","maxSize","createImplementation","implementation","dependencies"],"sources":["CreateFileUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n CreateFileUseCase as UseCaseAbstraction,\n CreateFileInput,\n CreateFileRepository\n} from \"./abstractions.js\";\nimport { GetSettingsUseCase } from \"../../settings/GetSettings/abstractions.js\";\nimport { EventPublisher } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { File, FileInput } from \"~/domain/file/types.js\";\nimport { FileNotAuthorizedError, InvalidFileSizeError } from \"~/domain/file/errors.js\";\nimport { FileBeforeCreateEvent, FileAfterCreateEvent } from \"./events.js\";\nimport { FmPermissions } from \"~/features/shared/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { Identity } from \"~/domain/identity/Identity.js\";\n\nclass CreateFileUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private permissions: FmPermissions.Interface,\n private repository: CreateFileRepository.Interface,\n private getSettings: GetSettingsUseCase.Interface,\n private eventPublisher: EventPublisher.Interface\n ) {}\n\n async execute(\n input: CreateFileInput,\n meta?: Record<string, any>\n ): Promise<Result<File, UseCaseAbstraction.Error>> {\n const hasPermission = await this.permissions.canCreate(\"file\");\n if (!hasPermission) {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n const validationResult = await this.validateInput(input);\n if (validationResult.isFail()) {\n return Result.fail(validationResult.error);\n }\n\n const [id] = input.key.split(\"/\");\n const currentIdentity = this.identityContext.getIdentity();\n\n // Prepare file input\n const fileInput: FileInput = {\n id: input.id || id,\n key: input.key,\n name: input.name,\n size: input.size,\n type: input.type,\n metadata: input.metadata || {},\n location: input.location || { folderId: \"root\" },\n tags: input.tags || [],\n extensions: meta || {},\n // system attributes\n createdOn: input.createdOn,\n modifiedOn: input.modifiedOn,\n savedOn: input.savedOn,\n createdBy: input.createdBy\n ? Identity.from(input.createdBy)\n : Identity.from(currentIdentity),\n modifiedBy: input.modifiedBy ? Identity.from(input.modifiedBy) : undefined,\n savedBy: input.savedBy ? Identity.from(input.savedBy) : Identity.from(currentIdentity)\n };\n\n await this.eventPublisher.publish(new FileBeforeCreateEvent({ file: fileInput, meta }));\n\n const result = await this.repository.execute(fileInput);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n await this.eventPublisher.publish(new FileAfterCreateEvent({ file: result.value, meta }));\n\n return Result.ok(result.value);\n }\n\n private async validateInput(\n input: CreateFileInput\n ): Promise<Result<void, InvalidFileSizeError>> {\n const settingsResult = await this.getSettings.execute();\n\n if (settingsResult.isFail()) {\n return Result.ok();\n }\n\n const settings = settingsResult.value;\n\n if (settings) {\n // Validate file size\n if (\n input.size < settings.uploadMinFileSize ||\n input.size > settings.uploadMaxFileSize\n ) {\n return Result.fail(\n new InvalidFileSizeError({\n size: input.size,\n minSize: settings.uploadMinFileSize,\n maxSize: settings.uploadMaxFileSize\n })\n );\n }\n }\n\n return Result.ok();\n }\n}\n\nexport const CreateFileUseCase = UseCaseAbstraction.createImplementation({\n implementation: CreateFileUseCaseImpl,\n dependencies: [\n IdentityContext,\n FmPermissions,\n CreateFileRepository,\n GetSettingsUseCase,\n EventPublisher\n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AAc;AAEtB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Result","CreateFileUseCase","UseCaseAbstraction","CreateFileRepository","GetSettingsUseCase","EventPublisher","FileNotAuthorizedError","InvalidFileSizeError","FileBeforeCreateEvent","FileAfterCreateEvent","FmPermissions","IdentityContext","Identity","CreateFileUseCaseImpl","constructor","identityContext","permissions","repository","getSettings","eventPublisher","execute","input","meta","hasPermission","canCreate","fail","validationResult","validateInput","isFail","error","id","key","split","currentIdentity","getIdentity","fileInput","name","size","type","metadata","location","folderId","tags","description","extensions","createdOn","modifiedOn","savedOn","createdBy","from","modifiedBy","undefined","savedBy","publish","file","result","value","ok","settingsResult","settings","uploadMinFileSize","uploadMaxFileSize","minSize","maxSize","createImplementation","implementation","dependencies"],"sources":["CreateFileUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n CreateFileUseCase as UseCaseAbstraction,\n CreateFileInput,\n CreateFileRepository\n} from \"./abstractions.js\";\nimport { GetSettingsUseCase } from \"../../settings/GetSettings/abstractions.js\";\nimport { EventPublisher } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { File, FileInput } from \"~/domain/file/types.js\";\nimport { FileNotAuthorizedError, InvalidFileSizeError } from \"~/domain/file/errors.js\";\nimport { FileBeforeCreateEvent, FileAfterCreateEvent } from \"./events.js\";\nimport { FmPermissions } from \"~/features/shared/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { Identity } from \"~/domain/identity/Identity.js\";\n\nclass CreateFileUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private permissions: FmPermissions.Interface,\n private repository: CreateFileRepository.Interface,\n private getSettings: GetSettingsUseCase.Interface,\n private eventPublisher: EventPublisher.Interface\n ) {}\n\n async execute(\n input: CreateFileInput,\n meta?: Record<string, any>\n ): Promise<Result<File, UseCaseAbstraction.Error>> {\n const hasPermission = await this.permissions.canCreate(\"file\");\n if (!hasPermission) {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n const validationResult = await this.validateInput(input);\n if (validationResult.isFail()) {\n return Result.fail(validationResult.error);\n }\n\n const [id] = input.key.split(\"/\");\n const currentIdentity = this.identityContext.getIdentity();\n\n // Prepare file input\n const fileInput: FileInput = {\n id: input.id || id,\n key: input.key,\n name: input.name,\n size: input.size,\n type: input.type,\n metadata: input.metadata || {},\n location: input.location || { folderId: \"root\" },\n tags: input.tags || [],\n description: input.description ?? \"\",\n extensions: meta || {},\n // system attributes\n createdOn: input.createdOn,\n modifiedOn: input.modifiedOn,\n savedOn: input.savedOn,\n createdBy: input.createdBy\n ? Identity.from(input.createdBy)\n : Identity.from(currentIdentity),\n modifiedBy: input.modifiedBy ? Identity.from(input.modifiedBy) : undefined,\n savedBy: input.savedBy ? Identity.from(input.savedBy) : Identity.from(currentIdentity)\n };\n\n await this.eventPublisher.publish(new FileBeforeCreateEvent({ file: fileInput, meta }));\n\n const result = await this.repository.execute(fileInput);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n await this.eventPublisher.publish(new FileAfterCreateEvent({ file: result.value, meta }));\n\n return Result.ok(result.value);\n }\n\n private async validateInput(\n input: CreateFileInput\n ): Promise<Result<void, InvalidFileSizeError>> {\n const settingsResult = await this.getSettings.execute();\n\n if (settingsResult.isFail()) {\n return Result.ok();\n }\n\n const settings = settingsResult.value;\n\n if (settings) {\n // Validate file size\n if (\n input.size < settings.uploadMinFileSize ||\n input.size > settings.uploadMaxFileSize\n ) {\n return Result.fail(\n new InvalidFileSizeError({\n size: input.size,\n minSize: settings.uploadMinFileSize,\n maxSize: settings.uploadMaxFileSize\n })\n );\n }\n }\n\n return Result.ok();\n }\n}\n\nexport const CreateFileUseCase = UseCaseAbstraction.createImplementation({\n implementation: CreateFileUseCaseImpl,\n dependencies: [\n IdentityContext,\n FmPermissions,\n CreateFileRepository,\n GetSettingsUseCase,\n EventPublisher\n ]\n});\n"],"mappings":"AAAA,SA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BAAoB,EACpBC,kBAAkB,EAClBC,cAAc;AAEtB,CAAC,CAAC","ignoreList":[]}
@@ -10,6 +10,7 @@ export interface CreateFileInput {
10
10
  metadata?: Record<string, any>;
11
11
  extensions?: Record<string, any>;
12
12
  tags?: string[];
13
+ description?: string;
13
14
  location?: {
14
15
  folderId: string;
15
16
  };
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","CreateFileRepository","CreateFileUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { CreatedBy, File, FileInput } from \"~/domain/file/types.js\";\nimport {\n type FilePersistenceError,\n type InvalidFileSizeError,\n type FileAlreadyExistsError,\n FileNotAuthorizedError\n} from \"~/domain/file/errors.js\";\n\nexport interface CreateFileInput {\n id?: string;\n key: string;\n size: number;\n type: string;\n name: string;\n metadata?: Record<string, any>;\n extensions?: Record<string, any>;\n tags?: string[];\n location?: { folderId: string };\n // System attributes\n createdOn?: string;\n createdBy?: CreatedBy;\n modifiedOn?: string;\n modifiedBy?: CreatedBy;\n savedOn?: string;\n savedBy?: CreatedBy;\n}\n\n/**\n * CreateFile repository interface\n */\nexport interface ICreateFileRepository {\n execute(data: FileInput): Promise<Result<File, RepositoryError>>;\n}\n\nexport interface ICreateFileRepositoryErrors {\n notAuthorized: FileNotAuthorizedError;\n persistence: FilePersistenceError;\n}\n\ntype RepositoryError = ICreateFileRepositoryErrors[keyof ICreateFileRepositoryErrors];\n\n/** Persist a newly created file. */\nexport const CreateFileRepository =\n createAbstraction<ICreateFileRepository>(\"CreateFileRepository\");\n\nexport namespace CreateFileRepository {\n export type Interface = ICreateFileRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * CreateFile use case interface\n */\nexport interface ICreateFileUseCase {\n execute(\n input: CreateFileInput,\n meta?: Record<string, any>\n ): Promise<Result<File, UseCaseError>>;\n}\n\nexport interface ICreateFileUseCaseErrors {\n notAuthorized: FileNotAuthorizedError;\n persistence: FilePersistenceError;\n invalidSize: InvalidFileSizeError;\n alreadyExists: FileAlreadyExistsError;\n}\n\ntype UseCaseError = ICreateFileUseCaseErrors[keyof ICreateFileUseCaseErrors];\n\n/** Upload and create a new file. */\nexport const CreateFileUseCase = createAbstraction<ICreateFileUseCase>(\"CreateFileUseCase\");\n\nexport namespace CreateFileUseCase {\n export type Interface = ICreateFileUseCase;\n export type Error = UseCaseError;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AA6BvD;AACA;AACA;;AAYA;AACA,OAAO,MAAMC,oBAAoB,GAC7BD,iBAAiB,CAAwB,sBAAsB,CAAC;;AAOpE;AACA;AACA;;AAiBA;AACA,OAAO,MAAME,iBAAiB,GAAGF,iBAAiB,CAAqB,mBAAmB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createAbstraction","CreateFileRepository","CreateFileUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { CreatedBy, File, FileInput } from \"~/domain/file/types.js\";\nimport {\n type FilePersistenceError,\n type InvalidFileSizeError,\n type FileAlreadyExistsError,\n FileNotAuthorizedError\n} from \"~/domain/file/errors.js\";\n\nexport interface CreateFileInput {\n id?: string;\n key: string;\n size: number;\n type: string;\n name: string;\n metadata?: Record<string, any>;\n extensions?: Record<string, any>;\n tags?: string[];\n description?: string;\n location?: { folderId: string };\n // System attributes\n createdOn?: string;\n createdBy?: CreatedBy;\n modifiedOn?: string;\n modifiedBy?: CreatedBy;\n savedOn?: string;\n savedBy?: CreatedBy;\n}\n\n/**\n * CreateFile repository interface\n */\nexport interface ICreateFileRepository {\n execute(data: FileInput): Promise<Result<File, RepositoryError>>;\n}\n\nexport interface ICreateFileRepositoryErrors {\n notAuthorized: FileNotAuthorizedError;\n persistence: FilePersistenceError;\n}\n\ntype RepositoryError = ICreateFileRepositoryErrors[keyof ICreateFileRepositoryErrors];\n\n/** Persist a newly created file. */\nexport const CreateFileRepository =\n createAbstraction<ICreateFileRepository>(\"CreateFileRepository\");\n\nexport namespace CreateFileRepository {\n export type Interface = ICreateFileRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * CreateFile use case interface\n */\nexport interface ICreateFileUseCase {\n execute(\n input: CreateFileInput,\n meta?: Record<string, any>\n ): Promise<Result<File, UseCaseError>>;\n}\n\nexport interface ICreateFileUseCaseErrors {\n notAuthorized: FileNotAuthorizedError;\n persistence: FilePersistenceError;\n invalidSize: InvalidFileSizeError;\n alreadyExists: FileAlreadyExistsError;\n}\n\ntype UseCaseError = ICreateFileUseCaseErrors[keyof ICreateFileUseCaseErrors];\n\n/** Upload and create a new file. */\nexport const CreateFileUseCase = createAbstraction<ICreateFileUseCase>(\"CreateFileUseCase\");\n\nexport namespace CreateFileUseCase {\n export type Interface = ICreateFileUseCase;\n export type Error = UseCaseError;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AA8BvD;AACA;AACA;;AAYA;AACA,OAAO,MAAMC,oBAAoB,GAC7BD,iBAAiB,CAAwB,sBAAsB,CAAC;;AAOpE;AACA;AACA;;AAiBA;AACA,OAAO,MAAME,iBAAiB,GAAGF,iBAAiB,CAAqB,mBAAmB,CAAC","ignoreList":[]}
@@ -1 +1,4 @@
1
- export declare const CreateFileFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const CreateFileFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -1 +1,4 @@
1
- export declare const CreateFilesInBatchFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const CreateFilesInBatchFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -1 +1,4 @@
1
- export declare const DeleteFileFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const DeleteFileFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -1 +1,4 @@
1
- export declare const GetFileFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const GetFileFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -1 +1,4 @@
1
- export declare const ListFilesFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const ListFilesFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ import { type IAiSdkTool } from "@webiny/api-core/features/ai/index.js";
3
+ import { ListFilesUseCase } from "../../../features/file/ListFiles/index.js";
4
+ declare const inputSchema: z.ZodObject<{
5
+ tag: z.ZodString;
6
+ }, z.core.$strip>;
7
+ type Input = z.infer<typeof inputSchema>;
8
+ interface ImageItem {
9
+ id: string;
10
+ name: string;
11
+ type: string;
12
+ tags: string[];
13
+ }
14
+ declare class ListImagesByTagToolImpl implements IAiSdkTool<Input> {
15
+ private listFiles;
16
+ readonly name = "listImagesByTag";
17
+ readonly description = "Lists images from the file manager filtered by a given tag. Returns name, type, and tags for each image.";
18
+ readonly inputSchema: z.ZodObject<{
19
+ tag: z.ZodString;
20
+ }, z.core.$strip>;
21
+ constructor(listFiles: ListFilesUseCase.Interface);
22
+ execute(input: Input): Promise<ImageItem[]>;
23
+ }
24
+ export declare const ListImagesByTagTool: typeof ListImagesByTagToolImpl & {
25
+ __abstraction: import("@webiny/di").Abstraction<IAiSdkTool<any>>;
26
+ };
27
+ export {};
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ import { AiSdkTool } from "@webiny/api-core/features/ai/index.js";
3
+ import { ListFilesUseCase } from "../ListFiles/index.js";
4
+ const inputSchema = z.object({
5
+ tag: z.string().describe("Tag to filter images by")
6
+ });
7
+ class ListImagesByTagToolImpl {
8
+ name = "listImagesByTag";
9
+ description = "Lists images from the file manager filtered by a given tag. Returns name, type, and tags for each image.";
10
+ inputSchema = inputSchema;
11
+ constructor(listFiles) {
12
+ this.listFiles = listFiles;
13
+ }
14
+ async execute(input) {
15
+ console.log("Call images tool", input);
16
+ const result = await this.listFiles.execute({
17
+ where: {
18
+ type_startsWith: "image/",
19
+ tags_in: [input.tag]
20
+ },
21
+ limit: 50
22
+ });
23
+ if (result.isFail()) {
24
+ return [];
25
+ }
26
+ return result.value.items.map(file => ({
27
+ id: file.id,
28
+ name: file.name,
29
+ type: file.type,
30
+ tags: file.tags
31
+ }));
32
+ }
33
+ }
34
+ export const ListImagesByTagTool = AiSdkTool.createImplementation({
35
+ implementation: ListImagesByTagToolImpl,
36
+ dependencies: [ListFilesUseCase]
37
+ });
38
+
39
+ //# sourceMappingURL=ListImagesByTagTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["z","AiSdkTool","ListFilesUseCase","inputSchema","object","tag","string","describe","ListImagesByTagToolImpl","name","description","constructor","listFiles","execute","input","console","log","result","where","type_startsWith","tags_in","limit","isFail","value","items","map","file","id","type","tags","ListImagesByTagTool","createImplementation","implementation","dependencies"],"sources":["ListImagesByTagTool.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { AiSdkTool, type IAiSdkTool } from \"@webiny/api-core/features/ai/index.js\";\nimport { ListFilesUseCase } from \"~/features/file/ListFiles/index.js\";\n\nconst inputSchema = z.object({\n tag: z.string().describe(\"Tag to filter images by\")\n});\n\ntype Input = z.infer<typeof inputSchema>;\n\ninterface ImageItem {\n id: string;\n name: string;\n type: string;\n tags: string[];\n}\n\nclass ListImagesByTagToolImpl implements IAiSdkTool<Input> {\n readonly name = \"listImagesByTag\";\n readonly description =\n \"Lists images from the file manager filtered by a given tag. Returns name, type, and tags for each image.\";\n readonly inputSchema = inputSchema;\n\n constructor(private listFiles: ListFilesUseCase.Interface) {}\n\n async execute(input: Input): Promise<ImageItem[]> {\n console.log(\"Call images tool\", input);\n const result = await this.listFiles.execute({\n where: {\n type_startsWith: \"image/\",\n tags_in: [input.tag]\n },\n limit: 50\n });\n\n if (result.isFail()) {\n return [];\n }\n\n return result.value.items.map(file => ({\n id: file.id,\n name: file.name,\n type: file.type,\n tags: file.tags\n }));\n }\n}\n\nexport const ListImagesByTagTool = AiSdkTool.createImplementation({\n implementation: ListImagesByTagToolImpl,\n dependencies: [ListFilesUseCase]\n});\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AACvB,SAASC,SAAS,QAAyB,uCAAuC;AAClF,SAASC,gBAAgB;AAEzB,MAAMC,WAAW,GAAGH,CAAC,CAACI,MAAM,CAAC;EACzBC,GAAG,EAAEL,CAAC,CAACM,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,yBAAyB;AACtD,CAAC,CAAC;AAWF,MAAMC,uBAAuB,CAA8B;EAC9CC,IAAI,GAAG,iBAAiB;EACxBC,WAAW,GAChB,0GAA0G;EACrGP,WAAW,GAAGA,WAAW;EAElCQ,WAAWA,CAASC,SAAqC,EAAE;IAAA,KAAvCA,SAAqC,GAArCA,SAAqC;EAAG;EAE5D,MAAMC,OAAOA,CAACC,KAAY,EAAwB;IAC9CC,OAAO,CAACC,GAAG,CAAC,kBAAkB,EAAEF,KAAK,CAAC;IACtC,MAAMG,MAAM,GAAG,MAAM,IAAI,CAACL,SAAS,CAACC,OAAO,CAAC;MACxCK,KAAK,EAAE;QACHC,eAAe,EAAE,QAAQ;QACzBC,OAAO,EAAE,CAACN,KAAK,CAACT,GAAG;MACvB,CAAC;MACDgB,KAAK,EAAE;IACX,CAAC,CAAC;IAEF,IAAIJ,MAAM,CAACK,MAAM,CAAC,CAAC,EAAE;MACjB,OAAO,EAAE;IACb;IAEA,OAAOL,MAAM,CAACM,KAAK,CAACC,KAAK,CAACC,GAAG,CAACC,IAAI,KAAK;MACnCC,EAAE,EAAED,IAAI,CAACC,EAAE;MACXlB,IAAI,EAAEiB,IAAI,CAACjB,IAAI;MACfmB,IAAI,EAAEF,IAAI,CAACE,IAAI;MACfC,IAAI,EAAEH,IAAI,CAACG;IACf,CAAC,CAAC,CAAC;EACP;AACJ;AAEA,OAAO,MAAMC,mBAAmB,GAAG7B,SAAS,CAAC8B,oBAAoB,CAAC;EAC9DC,cAAc,EAAExB,uBAAuB;EACvCyB,YAAY,EAAE,CAAC/B,gBAAgB;AACnC,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ export declare const ListImagesByTagToolFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -0,0 +1,10 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { ListImagesByTagTool } from "./ListImagesByTagTool.js";
3
+ export const ListImagesByTagToolFeature = createFeature({
4
+ name: "AiPowerUps/ListImagesByTagTool",
5
+ register(container) {
6
+ container.register(ListImagesByTagTool);
7
+ }
8
+ });
9
+
10
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createFeature","ListImagesByTagTool","ListImagesByTagToolFeature","name","register","container"],"sources":["feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { ListImagesByTagTool } from \"./ListImagesByTagTool.js\";\n\nexport const ListImagesByTagToolFeature = createFeature({\n name: \"AiPowerUps/ListImagesByTagTool\",\n register(container) {\n container.register(ListImagesByTagTool);\n }\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,mBAAmB;AAE5B,OAAO,MAAMC,0BAA0B,GAAGF,aAAa,CAAC;EACpDG,IAAI,EAAE,gCAAgC;EACtCC,QAAQA,CAACC,SAAS,EAAE;IAChBA,SAAS,CAACD,QAAQ,CAACH,mBAAmB,CAAC;EAC3C;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1 +1,4 @@
1
- export declare const ListTagsFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const ListTagsFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -44,6 +44,7 @@ class UpdateFileUseCaseImpl {
44
44
  type: original.type,
45
45
  // Update mutable fields.
46
46
  tags: input.tags !== undefined ? input.tags : original.tags,
47
+ description: input.description !== undefined ? input.description : original.description,
47
48
  location: input.location !== undefined ? input.location : original.location,
48
49
  // System fields.
49
50
  createdOn: input.createdOn ?? original.createdOn,
@@ -1 +1 @@
1
- {"version":3,"names":["Result","UpdateFileUseCase","UseCaseAbstraction","UpdateFileRepository","GetFileUseCase","EventPublisher","FileNotAuthorizedError","FileBeforeUpdateEvent","FileAfterUpdateEvent","FmPermissions","IdentityContext","Identity","UpdateFileUseCaseImpl","constructor","identityContext","permissions","getFile","repository","eventPublisher","execute","input","hasPermission","canEdit","fail","getResult","id","isFail","error","original","value","canEditFile","currentIdentity","getIdentity","file","key","size","type","tags","undefined","location","createdOn","modifiedOn","savedOn","createdBy","from","modifiedBy","savedBy","publish","result","update","ok","createImplementation","implementation","dependencies"],"sources":["UpdateFileUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n UpdateFileUseCase as UseCaseAbstraction,\n UpdateFileInput,\n UpdateFileRepository\n} from \"./abstractions.js\";\nimport { GetFileUseCase } from \"../GetFile/abstractions.js\";\nimport { EventPublisher } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { File } from \"~/domain/file/types.js\";\nimport { FileNotAuthorizedError } from \"~/domain/file/errors.js\";\nimport { FileBeforeUpdateEvent, FileAfterUpdateEvent } from \"./events.js\";\nimport { FmPermissions } from \"~/features/shared/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { Identity } from \"~/domain/identity/Identity.js\";\n\nclass UpdateFileUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private permissions: FmPermissions.Interface,\n private getFile: GetFileUseCase.Interface,\n private repository: UpdateFileRepository.Interface,\n private eventPublisher: EventPublisher.Interface\n ) {}\n\n async execute(input: UpdateFileInput): Promise<Result<File, UseCaseAbstraction.Error>> {\n const hasPermission = await this.permissions.canEdit(\"file\");\n if (!hasPermission) {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n // Get the original file (includes ownership check).\n const getResult = await this.getFile.execute(input.id);\n\n if (getResult.isFail()) {\n return Result.fail(getResult.error);\n }\n\n const original = getResult.value;\n\n // Check ownership-aware edit permission.\n const canEditFile = await this.permissions.canEdit(\"file\", original);\n if (!canEditFile) {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n const currentIdentity = this.identityContext.getIdentity();\n\n const file: File = {\n ...original,\n ...input,\n // Preserve immutable fields.\n id: original.id,\n key: original.key,\n size: original.size,\n type: original.type,\n // Update mutable fields.\n tags: input.tags !== undefined ? input.tags : original.tags,\n location: input.location !== undefined ? input.location : original.location,\n // System fields.\n createdOn: input.createdOn ?? original.createdOn,\n modifiedOn: input.modifiedOn ?? undefined,\n savedOn: input.savedOn ?? original.savedOn,\n createdBy: input.createdBy ? Identity.from(input.createdBy) : original.createdBy,\n modifiedBy: input.modifiedBy\n ? Identity.from(input.modifiedBy)\n : Identity.from(currentIdentity),\n savedBy: input.savedBy ? Identity.from(input.savedBy) : Identity.from(currentIdentity)\n };\n\n await this.eventPublisher.publish(new FileBeforeUpdateEvent({ original, file, input }));\n\n const result = await this.repository.update(file);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n await this.eventPublisher.publish(new FileAfterUpdateEvent({ original, file, input }));\n\n return Result.ok(file);\n }\n}\n\nexport const UpdateFileUseCase = UseCaseAbstraction.createImplementation({\n implementation: UpdateFileUseCaseImpl,\n dependencies: [\n IdentityContext,\n FmPermissions,\n GetFileUseCase,\n UpdateFileRepository,\n EventPublisher\n ]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SACIC,iBAAiB,IAAIC,kBAAkB,EAEvCC,oBAAoB;AAExB,SAASC,cAAc;AACvB,SAASC,cAAc,QAAQ,mDAAmD;AAElF,SAASC,sBAAsB;AAC/B,SAASC,qBAA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,CAAChB,IAAI,CAAC;IAEjD,IAAIe,MAAM,CAACtB,MAAM,CAAC,CAAC,EAAE;MACjB,OAAO1B,MAAM,CAACuB,IAAI,CAACyB,MAAM,CAACrB,KAAK,CAAC;IACpC;IAEA,MAAM,IAAI,CAACT,cAAc,CAAC6B,OAAO,CAAC,IAAIvC,oBAAoB,CAAC;MAAEoB,QAAQ;MAAEK,IAAI;MAAEb;IAAM,CAAC,CAAC,CAAC;IAEtF,OAAOpB,MAAM,CAACkD,EAAE,CAACjB,IAAI,CAAC;EAC1B;AACJ;AAEA,OAAO,MAAMhC,iBAAiB,GAAGC,kBAAkB,CAACiD,oBAAoB,CAAC;EACrEC,cAAc,EAAExC,qBAAqB;EACrCyC,YAAY,EAAE,CACV3C,eAAe,EACfD,aAAa,EACbL,cAAc,EACdD,oBAAoB,EACpBE,cAAc;AAEtB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Result","UpdateFileUseCase","UseCaseAbstraction","UpdateFileRepository","GetFileUseCase","EventPublisher","FileNotAuthorizedError","FileBeforeUpdateEvent","FileAfterUpdateEvent","FmPermissions","IdentityContext","Identity","UpdateFileUseCaseImpl","constructor","identityContext","permissions","getFile","repository","eventPublisher","execute","input","hasPermission","canEdit","fail","getResult","id","isFail","error","original","value","canEditFile","currentIdentity","getIdentity","file","key","size","type","tags","undefined","description","location","createdOn","modifiedOn","savedOn","createdBy","from","modifiedBy","savedBy","publish","result","update","ok","createImplementation","implementation","dependencies"],"sources":["UpdateFileUseCase.ts"],"sourcesContent":["import { Result } from \"@webiny/feature/api\";\nimport {\n UpdateFileUseCase as UseCaseAbstraction,\n UpdateFileInput,\n UpdateFileRepository\n} from \"./abstractions.js\";\nimport { GetFileUseCase } from \"../GetFile/abstractions.js\";\nimport { EventPublisher } from \"@webiny/api-core/features/eventPublisher/index.js\";\nimport type { File } from \"~/domain/file/types.js\";\nimport { FileNotAuthorizedError } from \"~/domain/file/errors.js\";\nimport { FileBeforeUpdateEvent, FileAfterUpdateEvent } from \"./events.js\";\nimport { FmPermissions } from \"~/features/shared/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { Identity } from \"~/domain/identity/Identity.js\";\n\nclass UpdateFileUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(\n private identityContext: IdentityContext.Interface,\n private permissions: FmPermissions.Interface,\n private getFile: GetFileUseCase.Interface,\n private repository: UpdateFileRepository.Interface,\n private eventPublisher: EventPublisher.Interface\n ) {}\n\n async execute(input: UpdateFileInput): Promise<Result<File, UseCaseAbstraction.Error>> {\n const hasPermission = await this.permissions.canEdit(\"file\");\n if (!hasPermission) {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n // Get the original file (includes ownership check).\n const getResult = await this.getFile.execute(input.id);\n\n if (getResult.isFail()) {\n return Result.fail(getResult.error);\n }\n\n const original = getResult.value;\n\n // Check ownership-aware edit permission.\n const canEditFile = await this.permissions.canEdit(\"file\", original);\n if (!canEditFile) {\n return Result.fail(new FileNotAuthorizedError());\n }\n\n const currentIdentity = this.identityContext.getIdentity();\n\n const file: File = {\n ...original,\n ...input,\n // Preserve immutable fields.\n id: original.id,\n key: original.key,\n size: original.size,\n type: original.type,\n // Update mutable fields.\n tags: input.tags !== undefined ? input.tags : original.tags,\n description: input.description !== undefined ? input.description : original.description,\n location: input.location !== undefined ? input.location : original.location,\n // System fields.\n createdOn: input.createdOn ?? original.createdOn,\n modifiedOn: input.modifiedOn ?? undefined,\n savedOn: input.savedOn ?? original.savedOn,\n createdBy: input.createdBy ? Identity.from(input.createdBy) : original.createdBy,\n modifiedBy: input.modifiedBy\n ? Identity.from(input.modifiedBy)\n : Identity.from(currentIdentity),\n savedBy: input.savedBy ? Identity.from(input.savedBy) : Identity.from(currentIdentity)\n };\n\n await this.eventPublisher.publish(new FileBeforeUpdateEvent({ original, file, input }));\n\n const result = await this.repository.update(file);\n\n if (result.isFail()) {\n return Result.fail(result.error);\n }\n\n await this.eventPublisher.publish(new FileAfterUpdateEvent({ original, file, input }));\n\n return Result.ok(file);\n }\n}\n\nexport const UpdateFileUseCase = UseCaseAbstraction.createImplementation({\n implementation: UpdateFileUseCaseImpl,\n dependencies: [\n IdentityContext,\n FmPermissions,\n GetFileUseCase,\n UpdateFileRepository,\n EventPublisher\n ]\n});\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,qBAAqB;AAC5C,SACIC,iBAAiB,IAAIC,kBAAkB,EAEvCC,oBAAoB;AAExB,SAASC,cAAc;AACvB,SAASC,cAAc,QAAQ,mDAAmD;AAElF,SAASC,sBAAsB;AAC/B,SAASC,qBAAqB,EAAEC,oBAAoB;AACpD,SAASC,aAAa;AACtB,SAASC,eAAe,QAAQ,6DAA6D;AAC7F,SAASC,QAAQ;AAEjB,MAAMC,qBAAqB,CAAyC;EAChEC,WAAWA,CACCC,eAA0C,EAC1CC,WAAoC,EACpCC,OAAiC,EACjCC,UAA0C,EAC1CC,cAAwC,EAClD;IAAA,KALUJ,eAA0C,GAA1CA,eAA0C;IAAA,KAC1CC,WAAoC,GAApCA,WAAoC;IAAA,KACpCC,OAAiC,GAAjCA,OAAiC;IAAA,KACjCC,UAA0C,GAA1CA,UAA0C;IAAA,KAC1CC,cAAwC,GAAxCA,cAAwC;EACjD;EAEH,MAAMC,OAAOA,CAACC,KAAsB,EAAmD;IACnF,MAAMC,aAAa,GAAG,MAAM,IAAI,CAACN,WAAW,CAACO,OAAO,CAAC,MAAM,CAAC;IAC5D,IAAI,CAACD,aAAa,EAAE;MAChB,OAAOrB,MAAM,CAACuB,IAAI,CAAC,IAAIjB,sBAAsB,CAAC,CAAC,CAAC;IACpD;;IAEA;IACA,MAAMkB,SAAS,GAAG,MAAM,IAAI,CAACR,OAAO,CAACG,OAAO,CAACC,KAAK,CAACK,EAAE,CAAC;IAEtD,IAAID,SAAS,CAACE,MAAM,CAAC,CAAC,EAAE;MACpB,OAAO1B,MAAM,CAACuB,IAAI,CAACC,SAAS,CAACG,KAAK,CAAC;I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U,EAAE1B,KAAK,CAAC0B,UAAU,GACtBnC,QAAQ,CAACkC,IAAI,CAACzB,KAAK,CAAC0B,UAAU,CAAC,GAC/BnC,QAAQ,CAACkC,IAAI,CAACd,eAAe,CAAC;MACpCgB,OAAO,EAAE3B,KAAK,CAAC2B,OAAO,GAAGpC,QAAQ,CAACkC,IAAI,CAACzB,KAAK,CAAC2B,OAAO,CAAC,GAAGpC,QAAQ,CAACkC,IAAI,CAACd,eAAe;IACzF,CAAC;IAED,MAAM,IAAI,CAACb,cAAc,CAAC8B,OAAO,CAAC,IAAIzC,qBAAqB,CAAC;MAAEqB,QAAQ;MAAEK,IAAI;MAAEb;IAAM,CAAC,CAAC,CAAC;IAEvF,MAAM6B,MAAM,GAAG,MAAM,IAAI,CAAChC,UAAU,CAACiC,MAAM,CAACjB,IAAI,CAAC;IAEjD,IAAIgB,MAAM,CAACvB,MAAM,CAAC,CAAC,EAAE;MACjB,OAAO1B,MAAM,CAACuB,IAAI,CAAC0B,MAAM,CAACtB,KAAK,CAAC;IACpC;IAEA,MAAM,IAAI,CAACT,cAAc,CAAC8B,OAAO,CAAC,IAAIxC,oBAAoB,CAAC;MAAEoB,QAAQ;MAAEK,IAAI;MAAEb;IAAM,CAAC,CAAC,CAAC;IAEtF,OAAOpB,MAAM,CAACmD,EAAE,CAAClB,IAAI,CAAC;EAC1B;AACJ;AAEA,OAAO,MAAMhC,iBAAiB,GAAGC,kBAAkB,CAACkD,oBAAoB,CAAC;EACrEC,cAAc,EAAEzC,qBAAqB;EACrC0C,YAAY,EAAE,CACV5C,eAAe,EACfD,aAAa,EACbL,cAAc,EACdD,oBAAoB,EACpBE,cAAc;AAEtB,CAAC,CAAC","ignoreList":[]}
@@ -6,6 +6,7 @@ export interface UpdateFileInput {
6
6
  name?: string;
7
7
  metadata?: Record<string, any>;
8
8
  tags?: string[];
9
+ description?: string;
9
10
  location?: {
10
11
  folderId: string;
11
12
  };
@@ -1 +1 @@
1
- {"version":3,"names":["createAbstraction","UpdateFileRepository","UpdateFileUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { CreatedBy, File } from \"~/domain/file/types.js\";\nimport {\n type FilePersistenceError,\n type FileNotFoundError,\n FileNotAuthorizedError\n} from \"~/domain/file/errors.js\";\n\nexport interface UpdateFileInput {\n id: string;\n name?: string;\n metadata?: Record<string, any>;\n tags?: string[];\n location?: { folderId: string };\n createdOn?: string;\n modifiedOn?: string;\n savedOn?: string;\n createdBy?: CreatedBy;\n modifiedBy?: CreatedBy;\n savedBy?: CreatedBy;\n}\n\n/**\n * UpdateFile repository interface\n */\nexport interface IUpdateFileRepository {\n update(file: File): Promise<Result<void, RepositoryError>>;\n}\n\nexport interface IUpdateFileRepositoryErrors {\n notFound: FileNotFoundError;\n notAuthorized: FileNotAuthorizedError;\n persistence: FilePersistenceError;\n}\n\ntype RepositoryError = IUpdateFileRepositoryErrors[keyof IUpdateFileRepositoryErrors];\n\n/** Persist file metadata updates. */\nexport const UpdateFileRepository =\n createAbstraction<IUpdateFileRepository>(\"UpdateFileRepository\");\n\nexport namespace UpdateFileRepository {\n export type Interface = IUpdateFileRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * UpdateFile use case interface\n */\nexport interface IUpdateFileUseCase {\n execute(input: UpdateFileInput): Promise<Result<File, UseCaseError>>;\n}\n\nexport interface IUpdateFileUseCaseErrors {\n notAuthorized: FileNotAuthorizedError;\n notFound: FileNotFoundError;\n persistence: FilePersistenceError;\n}\n\ntype UseCaseError = IUpdateFileUseCaseErrors[keyof IUpdateFileUseCaseErrors];\n\n/** Update file metadata. */\nexport const UpdateFileUseCase = createAbstraction<IUpdateFileUseCase>(\"UpdateFileUseCase\");\n\nexport namespace UpdateFileUseCase {\n export type Interface = IUpdateFileUseCase;\n export type Error = UseCaseError;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAuBvD;AACA;AACA;;AAaA;AACA,OAAO,MAAMC,oBAAoB,GAC7BD,iBAAiB,CAAwB,sBAAsB,CAAC;;AAOpE;AACA;AACA;;AAaA;AACA,OAAO,MAAME,iBAAiB,GAAGF,iBAAiB,CAAqB,mBAAmB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["createAbstraction","UpdateFileRepository","UpdateFileUseCase"],"sources":["abstractions.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/api\";\nimport type { Result } from \"@webiny/feature/api\";\nimport type { CreatedBy, File } from \"~/domain/file/types.js\";\nimport {\n type FilePersistenceError,\n type FileNotFoundError,\n FileNotAuthorizedError\n} from \"~/domain/file/errors.js\";\n\nexport interface UpdateFileInput {\n id: string;\n name?: string;\n metadata?: Record<string, any>;\n tags?: string[];\n description?: string;\n location?: { folderId: string };\n createdOn?: string;\n modifiedOn?: string;\n savedOn?: string;\n createdBy?: CreatedBy;\n modifiedBy?: CreatedBy;\n savedBy?: CreatedBy;\n}\n\n/**\n * UpdateFile repository interface\n */\nexport interface IUpdateFileRepository {\n update(file: File): Promise<Result<void, RepositoryError>>;\n}\n\nexport interface IUpdateFileRepositoryErrors {\n notFound: FileNotFoundError;\n notAuthorized: FileNotAuthorizedError;\n persistence: FilePersistenceError;\n}\n\ntype RepositoryError = IUpdateFileRepositoryErrors[keyof IUpdateFileRepositoryErrors];\n\n/** Persist file metadata updates. */\nexport const UpdateFileRepository =\n createAbstraction<IUpdateFileRepository>(\"UpdateFileRepository\");\n\nexport namespace UpdateFileRepository {\n export type Interface = IUpdateFileRepository;\n export type Error = RepositoryError;\n}\n\n/**\n * UpdateFile use case interface\n */\nexport interface IUpdateFileUseCase {\n execute(input: UpdateFileInput): Promise<Result<File, UseCaseError>>;\n}\n\nexport interface IUpdateFileUseCaseErrors {\n notAuthorized: FileNotAuthorizedError;\n notFound: FileNotFoundError;\n persistence: FilePersistenceError;\n}\n\ntype UseCaseError = IUpdateFileUseCaseErrors[keyof IUpdateFileUseCaseErrors];\n\n/** Update file metadata. */\nexport const UpdateFileUseCase = createAbstraction<IUpdateFileUseCase>(\"UpdateFileUseCase\");\n\nexport namespace UpdateFileUseCase {\n export type Interface = IUpdateFileUseCase;\n export type Error = UseCaseError;\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,qBAAqB;;AAwBvD;AACA;AACA;;AAaA;AACA,OAAO,MAAMC,oBAAoB,GAC7BD,iBAAiB,CAAwB,sBAAsB,CAAC;;AAOpE;AACA;AACA;;AAaA;AACA,OAAO,MAAME,iBAAiB,GAAGF,iBAAiB,CAAqB,mBAAmB,CAAC","ignoreList":[]}
@@ -1 +1,4 @@
1
- export declare const UpdateFileFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const UpdateFileFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -18,6 +18,7 @@ export class EntryToFileMapper {
18
18
  folderId: entry.location?.folderId ?? "root"
19
19
  },
20
20
  tags: entry.values.tags || [],
21
+ description: entry.values.description ?? "",
21
22
  extensions: entry.values.extensions
22
23
  };
23
24
  }
@@ -1 +1 @@
1
- {"version":3,"names":["EntryToFileMapper","toFile","entry","id","entryId","createdOn","modifiedOn","undefined","savedOn","createdBy","modifiedBy","savedBy","name","values","key","size","type","metadata","accessControl","location","folderId","tags","extensions"],"sources":["EntryToFileMapper.ts"],"sourcesContent":["import type { CmsEntry } from \"@webiny/api-headless-cms/types\";\nimport type { File } from \"~/domain/file/types.js\";\n\nexport class EntryToFileMapper {\n static toFile(entry: CmsEntry): File {\n return {\n id: entry.entryId,\n createdOn: entry.createdOn,\n modifiedOn: entry.modifiedOn ?? undefined,\n savedOn: entry.savedOn,\n createdBy: entry.createdBy,\n modifiedBy: entry.modifiedBy ?? undefined,\n savedBy: entry.savedBy,\n name: entry.values.name,\n key: entry.values.key,\n size: entry.values.size,\n type: entry.values.type,\n metadata: entry.values.metadata || {},\n accessControl: entry.values.accessControl,\n location: { folderId: entry.location?.folderId ?? \"root\" },\n tags: entry.values.tags || [],\n extensions: entry.values.extensions\n };\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,iBAAiB,CAAC;EAC3B,OAAOC,MAAMA,CAACC,KAAe,EAAQ;IACjC,OAAO;MACHC,EAAE,EAAED,KAAK,CAACE,OAAO;MACjBC,SAAS,EAAEH,KAAK,CAACG,SAAS;MAC1BC,UAAU,EAAEJ,KAAK,CAACI,UAAU,IAAIC,SAAS;MACzCC,OAAO,EAAEN,KAAK,CAACM,OAAO;MACtBC,SAAS,EAAEP,KAAK,CAACO,SAAS;MAC1BC,UAAU,EAAER,KAAK,CAACQ,UAAU,IAAIH,SAAS;MACzCI,OAAO,EAAET,KAAK,CAACS,OAAO;MACtBC,IAAI,EAAEV,KAAK,CAACW,MAAM,CAACD,IAAI;MACvBE,GAAG,EAAEZ,KAAK,CAACW,MAAM,CAACC,GAAG;MACrBC,IAAI,EAAEb,KAAK,CAACW,MAAM,CAACE,IAAI;MACvBC,IAAI,EAAEd,KAAK,CAACW,MAAM,CAACG,IAAI;MACvBC,QAAQ,EAAEf,KAAK,CAACW,MAAM,CAACI,QAAQ,IAAI,CAAC,CAAC;MACrCC,aAAa,EAAEhB,KAAK,CAACW,MAAM,CAACK,aAAa;MACzCC,QAAQ,EAAE;QAAEC,QAAQ,EAAElB,KAAK,CAACiB,QAAQ,EAAEC,QAAQ,IAAI;MAAO,CAAC;MAC1DC,IAAI,EAAEnB,KAAK,CAACW,MAAM,CAACQ,IAAI,IAAI,EAAE;MAC7BC,UAAU,EAAEpB,KAAK,CAACW,MAAM,CAACS;IAC7B,CAAC;EACL;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["EntryToFileMapper","toFile","entry","id","entryId","createdOn","modifiedOn","undefined","savedOn","createdBy","modifiedBy","savedBy","name","values","key","size","type","metadata","accessControl","location","folderId","tags","description","extensions"],"sources":["EntryToFileMapper.ts"],"sourcesContent":["import type { CmsEntry } from \"@webiny/api-headless-cms/types\";\nimport type { File } from \"~/domain/file/types.js\";\n\nexport class EntryToFileMapper {\n static toFile(entry: CmsEntry): File {\n return {\n id: entry.entryId,\n createdOn: entry.createdOn,\n modifiedOn: entry.modifiedOn ?? undefined,\n savedOn: entry.savedOn,\n createdBy: entry.createdBy,\n modifiedBy: entry.modifiedBy ?? undefined,\n savedBy: entry.savedBy,\n name: entry.values.name,\n key: entry.values.key,\n size: entry.values.size,\n type: entry.values.type,\n metadata: entry.values.metadata || {},\n accessControl: entry.values.accessControl,\n location: { folderId: entry.location?.folderId ?? \"root\" },\n tags: entry.values.tags || [],\n description: entry.values.description ?? \"\",\n extensions: entry.values.extensions\n };\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,iBAAiB,CAAC;EAC3B,OAAOC,MAAMA,CAACC,KAAe,EAAQ;IACjC,OAAO;MACHC,EAAE,EAAED,KAAK,CAACE,OAAO;MACjBC,SAAS,EAAEH,KAAK,CAACG,SAAS;MAC1BC,UAAU,EAAEJ,KAAK,CAACI,UAAU,IAAIC,SAAS;MACzCC,OAAO,EAAEN,KAAK,CAACM,OAAO;MACtBC,SAAS,EAAEP,KAAK,CAACO,SAAS;MAC1BC,UAAU,EAAER,KAAK,CAACQ,UAAU,IAAIH,SAAS;MACzCI,OAAO,EAAET,KAAK,CAACS,OAAO;MACtBC,IAAI,EAAEV,KAAK,CAACW,MAAM,CAACD,IAAI;MACvBE,GAAG,EAAEZ,KAAK,CAACW,MAAM,CAACC,GAAG;MACrBC,IAAI,EAAEb,KAAK,CAACW,MAAM,CAACE,IAAI;MACvBC,IAAI,EAAEd,KAAK,CAACW,MAAM,CAACG,IAAI;MACvBC,QAAQ,EAAEf,KAAK,CAACW,MAAM,CAACI,QAAQ,IAAI,CAAC,CAAC;MACrCC,aAAa,EAAEhB,KAAK,CAACW,MAAM,CAACK,aAAa;MACzCC,QAAQ,EAAE;QAAEC,QAAQ,EAAElB,KAAK,CAACiB,QAAQ,EAAEC,QAAQ,IAAI;MAAO,CAAC;MAC1DC,IAAI,EAAEnB,KAAK,CAACW,MAAM,CAACQ,IAAI,IAAI,EAAE;MAC7BC,WAAW,EAAEpB,KAAK,CAACW,MAAM,CAACS,WAAW,IAAI,EAAE;MAC3CC,UAAU,EAAErB,KAAK,CAACW,MAAM,CAACU;IAC7B,CAAC;EACL;AACJ","ignoreList":[]}
@@ -21,6 +21,7 @@ export class FileInputToEntryInputMapper {
21
21
  type: "public"
22
22
  },
23
23
  tags: file.tags || [],
24
+ description: file.description ?? "",
24
25
  extensions: file.extensions
25
26
  }
26
27
  };
@@ -1 +1 @@
1
- {"version":3,"names":["FileInputToEntryInputMapper","toEntry","file","id","createdOn","modifiedOn","savedOn","createdBy","modifiedBy","savedBy","location","folderId","values","name","key","size","type","metadata","accessControl","tags","extensions"],"sources":["FileInputToEntryInputMapper.ts"],"sourcesContent":["import type { CreateCmsEntryInput } from \"@webiny/api-headless-cms/types\";\nimport type { FileInput } from \"~/domain/file/types.js\";\n\nexport class FileInputToEntryInputMapper {\n static toEntry(file: FileInput): CreateCmsEntryInput {\n return {\n id: file.id,\n createdOn: file.createdOn,\n modifiedOn: file.modifiedOn,\n savedOn: file.savedOn,\n createdBy: file.createdBy,\n modifiedBy: file.modifiedBy,\n savedBy: file.savedBy,\n location: file.location || { folderId: \"root\" },\n values: {\n name: file.name,\n key: file.key,\n size: file.size,\n type: file.type,\n metadata: file.metadata || {},\n accessControl: {\n type: \"public\"\n },\n tags: file.tags || [],\n extensions: file.extensions\n }\n };\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,2BAA2B,CAAC;EACrC,OAAOC,OAAOA,CAACC,IAAe,EAAuB;IACjD,OAAO;MACHC,EAAE,EAAED,IAAI,CAACC,EAAE;MACXC,SAAS,EAAEF,IAAI,CAACE,SAAS;MACzBC,UAAU,EAAEH,IAAI,CAACG,UAAU;MAC3BC,OAAO,EAAEJ,IAAI,CAACI,OAAO;MACrBC,SAAS,EAAEL,IAAI,CAACK,SAAS;MACzBC,UAAU,EAAEN,IAAI,CAACM,UAAU;MAC3BC,OAAO,EAAEP,IAAI,CAACO,OAAO;MACrBC,QAAQ,EAAER,IAAI,CAACQ,QAAQ,IAAI;QAAEC,QAAQ,EAAE;MAAO,CAAC;MAC/CC,MAAM,EAAE;QACJC,IAAI,EAAEX,IAAI,CAACW,IAAI;QACfC,GAAG,EAAEZ,IAAI,CAACY,GAAG;QACbC,IAAI,EAAEb,IAAI,CAACa,IAAI;QACfC,IAAI,EAAEd,IAAI,CAACc,IAAI;QACfC,QAAQ,EAAEf,IAAI,CAACe,QAAQ,IAAI,CAAC,CAAC;QAC7BC,aAAa,EAAE;UACXF,IAAI,EAAE;QACV,CAAC;QACDG,IAAI,EAAEjB,IAAI,CAACiB,IAAI,IAAI,EAAE;QACrBC,UAAU,EAAElB,IAAI,CAACkB;MACrB;IACJ,CAAC;EACL;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["FileInputToEntryInputMapper","toEntry","file","id","createdOn","modifiedOn","savedOn","createdBy","modifiedBy","savedBy","location","folderId","values","name","key","size","type","metadata","accessControl","tags","description","extensions"],"sources":["FileInputToEntryInputMapper.ts"],"sourcesContent":["import type { CreateCmsEntryInput } from \"@webiny/api-headless-cms/types\";\nimport type { FileInput } from \"~/domain/file/types.js\";\n\nexport class FileInputToEntryInputMapper {\n static toEntry(file: FileInput): CreateCmsEntryInput {\n return {\n id: file.id,\n createdOn: file.createdOn,\n modifiedOn: file.modifiedOn,\n savedOn: file.savedOn,\n createdBy: file.createdBy,\n modifiedBy: file.modifiedBy,\n savedBy: file.savedBy,\n location: file.location || { folderId: \"root\" },\n values: {\n name: file.name,\n key: file.key,\n size: file.size,\n type: file.type,\n metadata: file.metadata || {},\n accessControl: {\n type: \"public\"\n },\n tags: file.tags || [],\n description: file.description ?? \"\",\n extensions: file.extensions\n }\n };\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,2BAA2B,CAAC;EACrC,OAAOC,OAAOA,CAACC,IAAe,EAAuB;IACjD,OAAO;MACHC,EAAE,EAAED,IAAI,CAACC,EAAE;MACXC,SAAS,EAAEF,IAAI,CAACE,SAAS;MACzBC,UAAU,EAAEH,IAAI,CAACG,UAAU;MAC3BC,OAAO,EAAEJ,IAAI,CAACI,OAAO;MACrBC,SAAS,EAAEL,IAAI,CAACK,SAAS;MACzBC,UAAU,EAAEN,IAAI,CAACM,UAAU;MAC3BC,OAAO,EAAEP,IAAI,CAACO,OAAO;MACrBC,QAAQ,EAAER,IAAI,CAACQ,QAAQ,IAAI;QAAEC,QAAQ,EAAE;MAAO,CAAC;MAC/CC,MAAM,EAAE;QACJC,IAAI,EAAEX,IAAI,CAACW,IAAI;QACfC,GAAG,EAAEZ,IAAI,CAACY,GAAG;QACbC,IAAI,EAAEb,IAAI,CAACa,IAAI;QACfC,IAAI,EAAEd,IAAI,CAACc,IAAI;QACfC,QAAQ,EAAEf,IAAI,CAACe,QAAQ,IAAI,CAAC,CAAC;QAC7BC,aAAa,EAAE;UACXF,IAAI,EAAE;QACV,CAAC;QACDG,IAAI,EAAEjB,IAAI,CAACiB,IAAI,IAAI,EAAE;QACrBC,WAAW,EAAElB,IAAI,CAACkB,WAAW,IAAI,EAAE;QACnCC,UAAU,EAAEnB,IAAI,CAACmB;MACrB;IACJ,CAAC;EACL;AACJ","ignoreList":[]}
@@ -20,6 +20,7 @@ export class FileToEntryMapper {
20
20
  metadata: file.metadata || {},
21
21
  accessControl: file.accessControl,
22
22
  tags: file.tags || [],
23
+ description: file.description ?? "",
23
24
  extensions: file.extensions
24
25
  }
25
26
  };
@@ -1 +1 @@
1
- {"version":3,"names":["FileToEntryMapper","toEntry","file","id","entryId","createdOn","modifiedOn","savedOn","createdBy","modifiedBy","savedBy","location","folderId","values","name","key","size","type","metadata","accessControl","tags","extensions"],"sources":["FileToEntryMapper.ts"],"sourcesContent":["import type { CmsEntry } from \"@webiny/api-headless-cms/types\";\nimport type { File } from \"~/domain/file/types.js\";\n\nexport class FileToEntryMapper {\n static toEntry(file: File): Partial<CmsEntry> {\n return {\n id: `${file.id}#0001`,\n entryId: file.id,\n createdOn: file.createdOn,\n modifiedOn: file.modifiedOn,\n savedOn: file.savedOn,\n createdBy: file.createdBy,\n modifiedBy: file.modifiedBy,\n savedBy: file.savedBy,\n location: file.location || { folderId: \"root\" },\n values: {\n name: file.name,\n key: file.key,\n size: file.size,\n type: file.type,\n metadata: file.metadata || {},\n accessControl: file.accessControl,\n tags: file.tags || [],\n extensions: file.extensions\n }\n };\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,iBAAiB,CAAC;EAC3B,OAAOC,OAAOA,CAACC,IAAU,EAAqB;IAC1C,OAAO;MACHC,EAAE,EAAE,GAAGD,IAAI,CAACC,EAAE,OAAO;MACrBC,OAAO,EAAEF,IAAI,CAACC,EAAE;MAChBE,SAAS,EAAEH,IAAI,CAACG,SAAS;MACzBC,UAAU,EAAEJ,IAAI,CAACI,UAAU;MAC3BC,OAAO,EAAEL,IAAI,CAACK,OAAO;MACrBC,SAAS,EAAEN,IAAI,CAACM,SAAS;MACzBC,UAAU,EAAEP,IAAI,CAACO,UAAU;MAC3BC,OAAO,EAAER,IAAI,CAACQ,OAAO;MACrBC,QAAQ,EAAET,IAAI,CAACS,QAAQ,IAAI;QAAEC,QAAQ,EAAE;MAAO,CAAC;MAC/CC,MAAM,EAAE;QACJC,IAAI,EAAEZ,IAAI,CAACY,IAAI;QACfC,GAAG,EAAEb,IAAI,CAACa,GAAG;QACbC,IAAI,EAAEd,IAAI,CAACc,IAAI;QACfC,IAAI,EAAEf,IAAI,CAACe,IAAI;QACfC,QAAQ,EAAEhB,IAAI,CAACgB,QAAQ,IAAI,CAAC,CAAC;QAC7BC,aAAa,EAAEjB,IAAI,CAACiB,aAAa;QACjCC,IAAI,EAAElB,IAAI,CAACkB,IAAI,IAAI,EAAE;QACrBC,UAAU,EAAEnB,IAAI,CAACmB;MACrB;IACJ,CAAC;EACL;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["FileToEntryMapper","toEntry","file","id","entryId","createdOn","modifiedOn","savedOn","createdBy","modifiedBy","savedBy","location","folderId","values","name","key","size","type","metadata","accessControl","tags","description","extensions"],"sources":["FileToEntryMapper.ts"],"sourcesContent":["import type { CmsEntry } from \"@webiny/api-headless-cms/types\";\nimport type { File } from \"~/domain/file/types.js\";\n\nexport class FileToEntryMapper {\n static toEntry(file: File): Partial<CmsEntry> {\n return {\n id: `${file.id}#0001`,\n entryId: file.id,\n createdOn: file.createdOn,\n modifiedOn: file.modifiedOn,\n savedOn: file.savedOn,\n createdBy: file.createdBy,\n modifiedBy: file.modifiedBy,\n savedBy: file.savedBy,\n location: file.location || { folderId: \"root\" },\n values: {\n name: file.name,\n key: file.key,\n size: file.size,\n type: file.type,\n metadata: file.metadata || {},\n accessControl: file.accessControl,\n tags: file.tags || [],\n description: file.description ?? \"\",\n extensions: file.extensions\n }\n };\n }\n}\n"],"mappings":"AAGA,OAAO,MAAMA,iBAAiB,CAAC;EAC3B,OAAOC,OAAOA,CAACC,IAAU,EAAqB;IAC1C,OAAO;MACHC,EAAE,EAAE,GAAGD,IAAI,CAACC,EAAE,OAAO;MACrBC,OAAO,EAAEF,IAAI,CAACC,EAAE;MAChBE,SAAS,EAAEH,IAAI,CAACG,SAAS;MACzBC,UAAU,EAAEJ,IAAI,CAACI,UAAU;MAC3BC,OAAO,EAAEL,IAAI,CAACK,OAAO;MACrBC,SAAS,EAAEN,IAAI,CAACM,SAAS;MACzBC,UAAU,EAAEP,IAAI,CAACO,UAAU;MAC3BC,OAAO,EAAER,IAAI,CAACQ,OAAO;MACrBC,QAAQ,EAAET,IAAI,CAACS,QAAQ,IAAI;QAAEC,QAAQ,EAAE;MAAO,CAAC;MAC/CC,MAAM,EAAE;QACJC,IAAI,EAAEZ,IAAI,CAACY,IAAI;QACfC,GAAG,EAAEb,IAAI,CAACa,GAAG;QACbC,IAAI,EAAEd,IAAI,CAACc,IAAI;QACfC,IAAI,EAAEf,IAAI,CAACe,IAAI;QACfC,QAAQ,EAAEhB,IAAI,CAACgB,QAAQ,IAAI,CAAC,CAAC;QAC7BC,aAAa,EAAEjB,IAAI,CAACiB,aAAa;QACjCC,IAAI,EAAElB,IAAI,CAACkB,IAAI,IAAI,EAAE;QACrBC,WAAW,EAAEnB,IAAI,CAACmB,WAAW,IAAI,EAAE;QACnCC,UAAU,EAAEpB,IAAI,CAACoB;MACrB;IACJ,CAAC;EACL;AACJ","ignoreList":[]}
@@ -1 +1,4 @@
1
- export declare const FmPermissionsFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const FmPermissionsFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -1 +1,4 @@
1
- export declare const GetSettingsFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const GetSettingsFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -1 +1,4 @@
1
- export declare const SettingsInstallerFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const SettingsInstallerFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
@@ -1 +1,4 @@
1
- export declare const UpdateSettingsFeature: import("@webiny/feature/api/createFeature.js").FeatureDefinition<unknown>;
1
+ export declare const UpdateSettingsFeature: {
2
+ name: string;
3
+ register(container: import("@webiny/di").Container): void;
4
+ };
package/index.d.ts CHANGED
@@ -4,4 +4,4 @@ export * from "./modelModifier/CmsModelModifier.js";
4
4
  export * from "./delivery/index.js";
5
5
  export declare const createFileManagerContext: () => ContextPlugin<ApiCoreContext>;
6
6
  export declare const createFileManagerGraphQL: () => (import("@webiny/handler-graphql/index.js").GraphQLSchemaPlugin<ApiCoreContext> | ContextPlugin<ApiCoreContext>)[];
7
- export declare const createAssetDelivery: () => (import("./delivery/index.js").AssetDeliveryConfigModifierPlugin | import("@webiny/handler/index.js").ModifyFastifyPlugin)[];
7
+ export declare const createAssetDelivery: () => (import("./index.js").AssetDeliveryConfigModifierPlugin | import("@webiny/handler/index.js").ModifyFastifyPlugin)[];
package/index.js CHANGED
@@ -3,9 +3,11 @@ import { setupAssetDelivery } from "./delivery/setupAssetDelivery.js";
3
3
  import { createGraphQLSchemaPlugin } from "./graphql/index.js";
4
4
  import { FileManagerFeature } from "./features/FileManagerFeature.js";
5
5
  import { FmPermissionsFeature } from "./features/permissions/feature.js";
6
+ import { AiImageEnrichmentFeature } from "./features/ai/AiImageEnrichmentFeature.js";
6
7
  import { GetModelUseCase } from "@webiny/api-headless-cms/features/contentModel/GetModel/index.js";
7
8
  import { FileModel as FileModelAbstraction } from "./domain/file/abstractions.js";
8
9
  import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
10
+ import { WcpContext } from "@webiny/api-core/features/wcp/WcpContext/index.js";
9
11
  import { FileModel, FILE_MODEL_ID } from "./domain/file/file.model.js";
10
12
  export * from "./modelModifier/CmsModelModifier.js";
11
13
  export * from "./delivery/index.js";
@@ -23,6 +25,10 @@ export const createFileManagerContext = () => {
23
25
  });
24
26
  FmPermissionsFeature.register(context.container);
25
27
  FileManagerFeature.register(context.container);
28
+ const wcpContext = context.container.resolve(WcpContext);
29
+ if (wcpContext.canUseAiImageEnrichment()) {
30
+ AiImageEnrichmentFeature.register(context.container);
31
+ }
26
32
  });
27
33
  plugin.name = "file-manager.createContext";
28
34
  return plugin;
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["ContextPlugin","setupAssetDelivery","createGraphQLSchemaPlugin","FileManagerFeature","FmPermissionsFeature","GetModelUseCase","FileModel","FileModelAbstraction","TenantContext","FILE_MODEL_ID","createFileManagerContext","plugin","context","tenantContext","container","resolve","getModel","getTenant","register","security","withoutAuthorization","fileModel","execute","registerInstance","value","name","createFileManagerGraphQL","createAssetDelivery"],"sources":["index.ts"],"sourcesContent":["import type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { setupAssetDelivery } from \"./delivery/setupAssetDelivery.js\";\nimport { createGraphQLSchemaPlugin } from \"./graphql/index.js\";\nimport { FileManagerFeature } from \"~/features/FileManagerFeature.js\";\nimport { FmPermissionsFeature } from \"~/features/permissions/feature.js\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { FileModel as FileModelAbstraction } from \"~/domain/file/abstractions.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { FileModel, FILE_MODEL_ID } from \"~/domain/file/file.model.js\";\n\nexport * from \"./modelModifier/CmsModelModifier.js\";\nexport * from \"./delivery/index.js\";\n\nexport const createFileManagerContext = () => {\n const plugin = new ContextPlugin<ApiCoreContext>(async context => {\n const tenantContext = context.container.resolve(TenantContext);\n const getModel = context.container.resolve(GetModelUseCase);\n\n if (!tenantContext.getTenant()) {\n return;\n }\n\n context.container.register(FileModel);\n\n await context.security.withoutAuthorization(async () => {\n const fileModel = await getModel.execute(FILE_MODEL_ID);\n context.container.registerInstance(FileModelAbstraction, fileModel.value);\n });\n\n FmPermissionsFeature.register(context.container);\n\n FileManagerFeature.register(context.container);\n });\n\n plugin.name = \"file-manager.createContext\";\n\n return plugin;\n};\n\nexport const createFileManagerGraphQL = () => {\n return createGraphQLSchemaPlugin();\n};\n\nexport const createAssetDelivery = () => {\n return setupAssetDelivery();\n};\n"],"mappings":"AACA,SAASA,aAAa,QAAQ,aAAa;AAC3C,SAASC,kBAAkB;AAC3B,SAASC,yBAAyB;AAClC,SAASC,kBAAkB;AAC3B,SAASC,oBAAoB;AAC7B,SAASC,eAAe,QAAQ,kEAAkE;AAClG,SAASC,SAAS,IAAIC,oBAAoB;AAC1C,SAASC,aAAa,QAAQ,0DAA0D;AACxF,SAASF,SAAS,EAAEG,aAAa;AAEjC;AACA;AAEA,OAAO,MAAMC,wBAAwB,GAAGA,CAAA,KAAM;EAC1C,MAAMC,MAAM,GAAG,IAAIX,aAAa,CAAiB,MAAMY,OAAO,IAAI;IAC9D,MAAMC,aAAa,GAAGD,OAAO,CAACE,SAAS,CAACC,OAAO,CAACP,aAAa,CAAC;IAC9D,MAAMQ,QAAQ,GAAGJ,OAAO,CAACE,SAAS,CAACC,OAAO,CAACV,eAAe,CAAC;IAE3D,IAAI,CAACQ,aAAa,CAACI,SAAS,CAAC,CAAC,EAAE;MAC5B;IACJ;IAEAL,OAAO,CAACE,SAAS,CAACI,QAAQ,CAACZ,SAAS,CAAC;IAErC,MAAMM,OAAO,CAACO,QAAQ,CAACC,oBAAoB,CAAC,YAAY;MACpD,MAAMC,SAAS,GAAG,MAAML,QAAQ,CAACM,OAAO,CAACb,aAAa,CAAC;MACvDG,OAAO,CAACE,SAAS,CAACS,gBAAgB,CAAChB,oBAAoB,EAAEc,SAAS,CAACG,KAAK,CAAC;IAC7E,CAAC,CAAC;IAEFpB,oBAAoB,CAACc,QAAQ,CAACN,OAAO,CAACE,SAAS,CAAC;IAEhDX,kBAAkB,CAACe,QAAQ,CAACN,OAAO,CAACE,SAAS,CAAC;EAClD,CAAC,CAAC;EAEFH,MAAM,CAACc,IAAI,GAAG,4BAA4B;EAE1C,OAAOd,MAAM;AACjB,CAAC;AAED,OAAO,MAAMe,wBAAwB,GAAGA,CAAA,KAAM;EAC1C,OAAOxB,yBAAyB,CAAC,CAAC;AACtC,CAAC;AAED,OAAO,MAAMyB,mBAAmB,GAAGA,CAAA,KAAM;EACrC,OAAO1B,kBAAkB,CAAC,CAAC;AAC/B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ContextPlugin","setupAssetDelivery","createGraphQLSchemaPlugin","FileManagerFeature","FmPermissionsFeature","AiImageEnrichmentFeature","GetModelUseCase","FileModel","FileModelAbstraction","TenantContext","WcpContext","FILE_MODEL_ID","createFileManagerContext","plugin","context","tenantContext","container","resolve","getModel","getTenant","register","security","withoutAuthorization","fileModel","execute","registerInstance","value","wcpContext","canUseAiImageEnrichment","name","createFileManagerGraphQL","createAssetDelivery"],"sources":["index.ts"],"sourcesContent":["import type { ApiCoreContext } from \"@webiny/api-core/types/core.js\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { setupAssetDelivery } from \"./delivery/setupAssetDelivery.js\";\nimport { createGraphQLSchemaPlugin } from \"./graphql/index.js\";\nimport { FileManagerFeature } from \"~/features/FileManagerFeature.js\";\nimport { FmPermissionsFeature } from \"~/features/permissions/feature.js\";\nimport { AiImageEnrichmentFeature } from \"~/features/ai/AiImageEnrichmentFeature.js\";\nimport { GetModelUseCase } from \"@webiny/api-headless-cms/features/contentModel/GetModel/index.js\";\nimport { FileModel as FileModelAbstraction } from \"~/domain/file/abstractions.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { WcpContext } from \"@webiny/api-core/features/wcp/WcpContext/index.js\";\nimport { FileModel, FILE_MODEL_ID } from \"~/domain/file/file.model.js\";\n\nexport * from \"./modelModifier/CmsModelModifier.js\";\nexport * from \"./delivery/index.js\";\n\nexport const createFileManagerContext = () => {\n const plugin = new ContextPlugin<ApiCoreContext>(async context => {\n const tenantContext = context.container.resolve(TenantContext);\n const getModel = context.container.resolve(GetModelUseCase);\n\n if (!tenantContext.getTenant()) {\n return;\n }\n\n context.container.register(FileModel);\n\n await context.security.withoutAuthorization(async () => {\n const fileModel = await getModel.execute(FILE_MODEL_ID);\n context.container.registerInstance(FileModelAbstraction, fileModel.value);\n });\n\n FmPermissionsFeature.register(context.container);\n FileManagerFeature.register(context.container);\n\n const wcpContext = context.container.resolve(WcpContext);\n if (wcpContext.canUseAiImageEnrichment()) {\n AiImageEnrichmentFeature.register(context.container);\n }\n });\n\n plugin.name = \"file-manager.createContext\";\n\n return plugin;\n};\n\nexport const createFileManagerGraphQL = () => {\n return createGraphQLSchemaPlugin();\n};\n\nexport const createAssetDelivery = () => {\n return setupAssetDelivery();\n};\n"],"mappings":"AACA,SAASA,aAAa,QAAQ,aAAa;AAC3C,SAASC,kBAAkB;AAC3B,SAASC,yBAAyB;AAClC,SAASC,k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EAE1C,OAAOhB,MAAM;AACjB,CAAC;AAED,OAAO,MAAMiB,wBAAwB,GAAGA,CAAA,KAAM;EAC1C,OAAO5B,yBAAyB,CAAC,CAAC;AACtC,CAAC;AAED,OAAO,MAAM6B,mBAAmB,GAAGA,CAAA,KAAM;EACrC,OAAO9B,kBAAkB,CAAC,CAAC;AAC/B,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-file-manager",
3
- "version": "6.2.0-beta.0",
3
+ "version": "6.3.0-beta.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -19,28 +19,31 @@
19
19
  ],
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@webiny/api": "6.2.0-beta.0",
23
- "@webiny/api-core": "6.2.0-beta.0",
24
- "@webiny/api-headless-cms": "6.2.0-beta.0",
25
- "@webiny/build-tools": "6.2.0-beta.0",
22
+ "@webiny/ai-powerups": "6.3.0-beta.0",
23
+ "@webiny/api": "6.3.0-beta.0",
24
+ "@webiny/api-core": "6.3.0-beta.0",
25
+ "@webiny/api-headless-cms": "6.3.0-beta.0",
26
+ "@webiny/api-websockets": "6.3.0-beta.0",
27
+ "@webiny/build-tools": "6.3.0-beta.0",
26
28
  "@webiny/di": "0.2.3",
27
- "@webiny/error": "6.2.0-beta.0",
28
- "@webiny/feature": "6.2.0-beta.0",
29
- "@webiny/handler": "6.2.0-beta.0",
30
- "@webiny/handler-graphql": "6.2.0-beta.0",
31
- "@webiny/plugins": "6.2.0-beta.0",
32
- "@webiny/wcp": "6.2.0-beta.0",
29
+ "@webiny/error": "6.3.0-beta.0",
30
+ "@webiny/feature": "6.3.0-beta.0",
31
+ "@webiny/handler": "6.3.0-beta.0",
32
+ "@webiny/handler-graphql": "6.3.0-beta.0",
33
+ "@webiny/plugins": "6.3.0-beta.0",
34
+ "@webiny/tasks": "6.3.0-beta.0",
35
+ "@webiny/wcp": "6.3.0-beta.0",
33
36
  "cache-control-parser": "2.2.0",
34
37
  "zod": "4.3.6"
35
38
  },
36
39
  "devDependencies": {
37
40
  "@types/object-hash": "3.0.6",
38
- "@webiny/handler-aws": "6.2.0-beta.0",
39
- "@webiny/project-utils": "6.2.0-beta.0",
40
- "@webiny/utils": "6.2.0-beta.0",
41
+ "@webiny/handler-aws": "6.3.0-beta.0",
42
+ "@webiny/project-utils": "6.3.0-beta.0",
43
+ "@webiny/utils": "6.3.0-beta.0",
41
44
  "@webiny/wcp": "0.0.0",
42
45
  "rimraf": "6.1.3",
43
- "typescript": "5.9.3"
46
+ "typescript": "6.0.3"
44
47
  },
45
48
  "publishConfig": {
46
49
  "access": "public",
@@ -59,5 +62,5 @@
59
62
  ]
60
63
  }
61
64
  },
62
- "gitHead": "3d3148358b6febbc857371930871743bec3b3939"
65
+ "gitHead": "94c21e58aebc9855bf1ae972423281faa0f5c135"
63
66
  }
@@ -0,0 +1,32 @@
1
+ import "~/types.js";
2
+ import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
3
+ import { Ai } from "@webiny/api-core/features/ai/index.js";
4
+ import { GetFileUseCase } from "../features/file/GetFile/index.js";
5
+ import { UpdateFileUseCase } from "../features/file/UpdateFile/index.js";
6
+ import { GetSettingsUseCase } from "../features/settings/GetSettings/abstractions.js";
7
+ import { GetSettingsUseCase as AiPowerUpsGetSettingsUseCase } from "@webiny/ai-powerups/api/features/GetSettings/index.js";
8
+ import { WebsocketService } from "@webiny/api-websockets/features/WebsocketService/index.js";
9
+ export declare const AI_IMAGE_ENRICHMENT_TASK_ID = "fmAiImageEnrichment";
10
+ export interface IAiImageEnrichmentTaskInput {
11
+ fileId: string;
12
+ }
13
+ declare class AiImageEnrichmentTaskImpl implements TaskDefinition.Interface<IAiImageEnrichmentTaskInput> {
14
+ private getFile;
15
+ private getSettings;
16
+ private updateFile;
17
+ private ai;
18
+ private aiPowerUpsSettings;
19
+ private websocketService?;
20
+ id: string;
21
+ title: string;
22
+ description: string;
23
+ maxIterations: number;
24
+ isPrivate: boolean;
25
+ databaseLogs: boolean;
26
+ constructor(getFile: GetFileUseCase.Interface, getSettings: GetSettingsUseCase.Interface, updateFile: UpdateFileUseCase.Interface, ai: Ai.Interface, aiPowerUpsSettings: AiPowerUpsGetSettingsUseCase.Interface, websocketService?: WebsocketService.Interface | undefined);
27
+ run({ input, controller }: TaskDefinition.RunParams<IAiImageEnrichmentTaskInput>): Promise<TaskDefinition.Result<IAiImageEnrichmentTaskInput>>;
28
+ }
29
+ export declare const AiImageEnrichmentTask: typeof AiImageEnrichmentTaskImpl & {
30
+ __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>>;
31
+ };
32
+ export {};
@@ -0,0 +1,130 @@
1
+ import "../types.js";
2
+ import { TaskDefinition } from "@webiny/api-core/features/task/TaskDefinition/index.js";
3
+ import { Ai } from "@webiny/api-core/features/ai/index.js";
4
+ import { GetFileUseCase } from "../features/file/GetFile/index.js";
5
+ import { UpdateFileUseCase } from "../features/file/UpdateFile/index.js";
6
+ import { GetSettingsUseCase } from "../features/settings/GetSettings/abstractions.js";
7
+ import { GetSettingsUseCase as AiPowerUpsGetSettingsUseCase } from "@webiny/ai-powerups/api/features/GetSettings/index.js";
8
+ import { WebsocketService } from "@webiny/api-websockets/features/WebsocketService/index.js";
9
+ export const AI_IMAGE_ENRICHMENT_TASK_ID = "fmAiImageEnrichment";
10
+ const AI_PROMPT = 'Analyze this image and return a JSON object with two keys: "tags" (array of up to 5 lowercase descriptive tags) and "description" (one short sentence describing the image). Return only the JSON object, nothing else. Example: {"tags":["nature","landscape","mountain"],"description":"A mountain landscape with a clear blue sky."}';
11
+ class AiImageEnrichmentTaskImpl {
12
+ id = AI_IMAGE_ENRICHMENT_TASK_ID;
13
+ title = "File Manager - AI Image Enrichment";
14
+ description = "Automatically enriches uploaded images with AI-generated tags and description.";
15
+ maxIterations = 1;
16
+ isPrivate = true;
17
+ databaseLogs = false;
18
+ constructor(getFile, getSettings, updateFile, ai, aiPowerUpsSettings, websocketService) {
19
+ this.getFile = getFile;
20
+ this.getSettings = getSettings;
21
+ this.updateFile = updateFile;
22
+ this.ai = ai;
23
+ this.aiPowerUpsSettings = aiPowerUpsSettings;
24
+ this.websocketService = websocketService;
25
+ }
26
+ async run({
27
+ input,
28
+ controller
29
+ }) {
30
+ if (controller.runtime.isAborted()) {
31
+ return controller.response.aborted();
32
+ }
33
+ const fileResult = await this.getFile.execute(input.fileId);
34
+ if (fileResult.isFail()) {
35
+ return controller.response.error({
36
+ message: `File not found: ${input.fileId}`
37
+ });
38
+ }
39
+ const file = fileResult.value;
40
+ if (!file.type.startsWith("image/")) {
41
+ return controller.response.done("File is not an image; skipping AI enrichment.");
42
+ }
43
+ const settingsResult = await this.getSettings.execute();
44
+ const srcPrefix = settingsResult.isOk() ? settingsResult.value.srcPrefix ?? "" : "";
45
+ const imageUrl = `${srcPrefix}${file.key}`;
46
+ const aiSettingsResult = await this.aiPowerUpsSettings.execute();
47
+ if (aiSettingsResult.isFail()) {
48
+ return controller.response.error({
49
+ message: "No AI provider configured. Add a provider in AI Power Ups settings."
50
+ });
51
+ }
52
+ const aiSettings = aiSettingsResult.value;
53
+
54
+ // TODO: for now we're loading first provider, but later we'll be loading
55
+ // TODO: the right provider via AI Powerups settings.
56
+ const firstProvider = aiSettings.providers.presets[0];
57
+ if (!firstProvider) {
58
+ return controller.response.done({
59
+ message: "No AI provider configured. Add a provider in AI Power Ups settings."
60
+ });
61
+ }
62
+ let tags = [];
63
+ let description = "";
64
+ try {
65
+ const aiResult = await this.ai.generateText({
66
+ model: firstProvider.model,
67
+ connection: {
68
+ sdkName: firstProvider.model.split("/")[0],
69
+ apiKey: firstProvider.apiKey
70
+ },
71
+ messages: [{
72
+ role: "user",
73
+ content: [{
74
+ type: "image",
75
+ image: new URL(imageUrl)
76
+ }, {
77
+ type: "text",
78
+ text: AI_PROMPT
79
+ }]
80
+ }]
81
+ });
82
+ const parsed = JSON.parse(aiResult.text);
83
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
84
+ if (Array.isArray(parsed.tags)) {
85
+ tags = parsed.tags.filter(t => typeof t === "string");
86
+ }
87
+ if (typeof parsed.description === "string") {
88
+ description = parsed.description;
89
+ }
90
+ }
91
+ } catch (error) {
92
+ return controller.response.error({
93
+ message: `AI enrichment failed: ${error instanceof Error ? error.message : String(error)}`
94
+ });
95
+ }
96
+ const mergedTags = [...new Set([...file.tags, ...tags])];
97
+ const updateResult = await this.updateFile.execute({
98
+ id: file.id,
99
+ tags: mergedTags,
100
+ description
101
+ });
102
+ if (updateResult.isFail()) {
103
+ return controller.response.error({
104
+ message: `Failed to update file: ${updateResult.error.message}`
105
+ });
106
+ }
107
+ if (this.websocketService) {
108
+ const connectionsResult = await this.websocketService.listConnections();
109
+ if (connectionsResult.isOk() && connectionsResult.value.length > 0) {
110
+ await this.websocketService.sendToConnections(connectionsResult.value, {
111
+ action: "fm.file.enrichment",
112
+ data: {
113
+ id: file.id,
114
+ tags: mergedTags,
115
+ description
116
+ }
117
+ });
118
+ }
119
+ }
120
+ return controller.response.done("AI image enrichment completed successfully.");
121
+ }
122
+ }
123
+ export const AiImageEnrichmentTask = TaskDefinition.createImplementation({
124
+ implementation: AiImageEnrichmentTaskImpl,
125
+ dependencies: [GetFileUseCase, GetSettingsUseCase, UpdateFileUseCase, Ai, AiPowerUpsGetSettingsUseCase, [WebsocketService, {
126
+ optional: true
127
+ }]]
128
+ });
129
+
130
+ //# sourceMappingURL=AiImageEnrichmentTask.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TaskDefinition","Ai","GetFileUseCase","UpdateFileUseCase","GetSettingsUseCase","AiPowerUpsGetSettingsUseCase","WebsocketService","AI_IMAGE_ENRICHMENT_TASK_ID","AI_PROMPT","AiImageEnrichmentTaskImpl","id","title","description","maxIterations","isPrivate","databaseLogs","constructor","getFile","getSettings","updateFile","ai","aiPowerUpsSettings","websocketService","run","input","controller","runtime","isAborted","response","aborted","fileResult","execute","fileId","isFail","error","message","file","value","type","startsWith","done","settingsResult","srcPrefix","isOk","imageUrl","key","aiSettingsResult","aiSettings","firstProvider","providers","presets","tags","aiResult","generateText","model","connection","sdkName","split","apiKey","messages","role","content","image","URL","text","parsed","JSON","parse","Array","isArray","filter","t","Error","String","mergedTags","Set","updateResult","connectionsResult","listConnections","length","sendToConnections","action","data","AiImageEnrichmentTask","createImplementation","implementation","dependencies","optional"],"sources":["AiImageEnrichmentTask.ts"],"sourcesContent":["import \"~/types.js\";\nimport { TaskDefinition } from \"@webiny/api-core/features/task/TaskDefinition/index.js\";\nimport { Ai } from \"@webiny/api-core/features/ai/index.js\";\nimport { GetFileUseCase } from \"~/features/file/GetFile/index.js\";\nimport { UpdateFileUseCase } from \"~/features/file/UpdateFile/index.js\";\nimport { GetSettingsUseCase } from \"~/features/settings/GetSettings/abstractions.js\";\nimport { GetSettingsUseCase as AiPowerUpsGetSettingsUseCase } from \"@webiny/ai-powerups/api/features/GetSettings/index.js\";\nimport { WebsocketService } from \"@webiny/api-websockets/features/WebsocketService/index.js\";\n\nexport const AI_IMAGE_ENRICHMENT_TASK_ID = \"fmAiImageEnrichment\";\n\nconst AI_PROMPT =\n 'Analyze this image and return a JSON object with two keys: \"tags\" (array of up to 5 lowercase descriptive tags) and \"description\" (one short sentence describing the image). Return only the JSON object, nothing else. Example: {\"tags\":[\"nature\",\"landscape\",\"mountain\"],\"description\":\"A mountain landscape with a clear blue sky.\"}';\n\nexport interface IAiImageEnrichmentTaskInput {\n fileId: string;\n}\n\nclass AiImageEnrichmentTaskImpl implements TaskDefinition.Interface<IAiImageEnrichmentTaskInput> {\n id = AI_IMAGE_ENRICHMENT_TASK_ID;\n title = \"File Manager - AI Image Enrichment\";\n description = \"Automatically enriches uploaded images with AI-generated tags and description.\";\n maxIterations = 1;\n isPrivate = true;\n databaseLogs = false;\n\n constructor(\n private getFile: GetFileUseCase.Interface,\n private getSettings: GetSettingsUseCase.Interface,\n private updateFile: UpdateFileUseCase.Interface,\n private ai: Ai.Interface,\n private aiPowerUpsSettings: AiPowerUpsGetSettingsUseCase.Interface,\n private websocketService?: WebsocketService.Interface\n ) {}\n\n async run({\n input,\n controller\n }: TaskDefinition.RunParams<IAiImageEnrichmentTaskInput>): Promise<\n TaskDefinition.Result<IAiImageEnrichmentTaskInput>\n > {\n if (controller.runtime.isAborted()) {\n return controller.response.aborted();\n }\n\n const fileResult = await this.getFile.execute(input.fileId);\n if (fileResult.isFail()) {\n return controller.response.error({\n message: `File not found: ${input.fileId}`\n });\n }\n\n const file = fileResult.value;\n\n if (!file.type.startsWith(\"image/\")) {\n return controller.response.done(\"File is not an image; skipping AI enrichment.\");\n }\n\n const settingsResult = await this.getSettings.execute();\n const srcPrefix = settingsResult.isOk() ? (settingsResult.value.srcPrefix ?? \"\") : \"\";\n const imageUrl = `${srcPrefix}${file.key}`;\n\n const aiSettingsResult = await this.aiPowerUpsSettings.execute();\n\n if (aiSettingsResult.isFail()) {\n return controller.response.error({\n message: \"No AI provider configured. Add a provider in AI Power Ups settings.\"\n });\n }\n\n const aiSettings = aiSettingsResult.value;\n\n // TODO: for now we're loading first provider, but later we'll be loading\n // TODO: the right provider via AI Powerups settings.\n const firstProvider = aiSettings.providers.presets[0];\n\n if (!firstProvider) {\n return controller.response.done({\n message: \"No AI provider configured. Add a provider in AI Power Ups settings.\"\n });\n }\n\n let tags: string[] = [];\n let description = \"\";\n try {\n const aiResult = await this.ai.generateText({\n model: firstProvider.model,\n connection: {\n sdkName: firstProvider.model.split(\"/\")[0],\n apiKey: firstProvider.apiKey\n },\n messages: [\n {\n role: \"user\",\n content: [\n {\n type: \"image\",\n image: new URL(imageUrl)\n },\n {\n type: \"text\",\n text: AI_PROMPT\n }\n ]\n }\n ]\n });\n\n const parsed = JSON.parse(aiResult.text);\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n if (Array.isArray(parsed.tags)) {\n tags = parsed.tags.filter((t: unknown): t is string => typeof t === \"string\");\n }\n if (typeof parsed.description === \"string\") {\n description = parsed.description;\n }\n }\n } catch (error) {\n return controller.response.error({\n message: `AI enrichment failed: ${error instanceof Error ? error.message : String(error)}`\n });\n }\n\n const mergedTags = [...new Set([...file.tags, ...tags])];\n\n const updateResult = await this.updateFile.execute({\n id: file.id,\n tags: mergedTags,\n description\n });\n\n if (updateResult.isFail()) {\n return controller.response.error({\n message: `Failed to update file: ${updateResult.error.message}`\n });\n }\n\n if (this.websocketService) {\n const connectionsResult = await this.websocketService.listConnections();\n if (connectionsResult.isOk() && connectionsResult.value.length > 0) {\n await this.websocketService.sendToConnections(connectionsResult.value, {\n action: \"fm.file.enrichment\",\n data: {\n id: file.id,\n tags: mergedTags,\n description\n }\n });\n }\n }\n\n return controller.response.done(\"AI image enrichment completed successfully.\");\n }\n}\n\nexport const AiImageEnrichmentTask = TaskDefinition.createImplementation({\n implementation: AiImageEnrichmentTaskImpl,\n dependencies: [\n GetFileUseCase,\n GetSettingsUseCase,\n UpdateFileUseCase,\n Ai,\n AiPowerUpsGetSettingsUseCase,\n [WebsocketService, { optional: true }]\n ]\n});\n"],"mappings":"AAAA;AACA,SAASA,cAAc,QAAQ,wDAAwD;AACvF,SAASC,EAAE,QAAQ,uCAAuC;AAC1D,SAASC,cAAc;AACvB,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB;AAC3B,SAASA,kBAAkB,IAAIC,4BAA4B,QAAQ,uDAAuD;AAC1H,SAASC,gBAAgB,QAAQ,2DAA2D;AAE5F,OAAO,MAAMC,2BAA2B,GAAG,qBAAqB;AAEhE,MAAMC,SAAS,GACX,yUAAyU;AAM7U,MAAMC,yBAAyB,CAAkE;EAC7FC,EAAE,GAAGH,2BAA2B;EAChCI,KAAK,GAAG,oCAAoC;EAC5CC,WAAW,GAAG,gFAAgF;EAC9FC,aAAa,GAAG,CA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C,IAAI,CAAC,CAAC,IAAIkC,iBAAiB,CAACxC,KAAK,CAAC0C,MAAM,GAAG,CAAC,EAAE;QAChE,MAAM,IAAI,CAACzD,gBAAgB,CAAC0D,iBAAiB,CAACH,iBAAiB,CAACxC,KAAK,EAAE;UACnE4C,MAAM,EAAE,oBAAoB;UAC5BC,IAAI,EAAE;YACFxE,EAAE,EAAE0B,IAAI,CAAC1B,EAAE;YACXyC,IAAI,EAAEuB,UAAU;YAChB9D;UACJ;QACJ,CAAC,CAAC;MACN;IACJ;IAEA,OAAOa,UAAU,CAACG,QAAQ,CAACY,IAAI,CAAC,6CAA6C,CAAC;EAClF;AACJ;AAEA,OAAO,MAAM2C,qBAAqB,GAAGnF,cAAc,CAACoF,oBAAoB,CAAC;EACrEC,cAAc,EAAE5E,yBAAyB;EACzC6E,YAAY,EAAE,CACVpF,cAAc,EACdE,kBAAkB,EAClBD,iBAAiB,EACjBF,EAAE,EACFI,4BAA4B,EAC5B,CAACC,gBAAgB,EAAE;IAAEiF,QAAQ,EAAE;EAAK,CAAC,CAAC;AAE9C,CAAC,CAAC","ignoreList":[]}
package/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import "@webiny/tasks/features/TaskController/augmentation.js";
1
2
  import type { SecurityPermission } from "@webiny/api-core/types/security.js";
2
3
  export interface FilePermission extends SecurityPermission {
3
4
  name: "fm.file";
package/types.js CHANGED
@@ -1,3 +1,3 @@
1
- export {};
1
+ import "@webiny/tasks/features/TaskController/augmentation.js";
2
2
 
3
3
  //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { SecurityPermission } from \"@webiny/api-core/types/security.js\";\n\nexport interface FilePermission extends SecurityPermission {\n name: \"fm.file\";\n rwd?: string;\n own?: boolean;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import \"@webiny/tasks/features/TaskController/augmentation.js\";\nimport type { SecurityPermission } from \"@webiny/api-core/types/security.js\";\n\nexport interface FilePermission extends SecurityPermission {\n name: \"fm.file\";\n rwd?: string;\n own?: boolean;\n}\n"],"mappings":"AAAA,OAAO,uDAAuD","ignoreList":[]}