@webiny/api-file-manager 0.0.0-unstable.78f581c1d2 → 0.0.0-unstable.7f63ea0744

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 (67) hide show
  1. package/handlers/download/index.js +7 -26
  2. package/handlers/download/index.js.map +1 -1
  3. package/handlers/manage/index.js +0 -16
  4. package/handlers/manage/index.js.map +1 -1
  5. package/handlers/transform/index.js +6 -16
  6. package/handlers/transform/index.js.map +1 -1
  7. package/handlers/transform/loaders/imageLoader.js +0 -17
  8. package/handlers/transform/loaders/imageLoader.js.map +1 -1
  9. package/handlers/transform/loaders/index.js +0 -3
  10. package/handlers/transform/loaders/index.js.map +1 -1
  11. package/handlers/transform/loaders/sanitizeImageTransformations.js +0 -13
  12. package/handlers/transform/loaders/sanitizeImageTransformations.js.map +1 -1
  13. package/handlers/transform/managers/imageManager.js +6 -14
  14. package/handlers/transform/managers/imageManager.js.map +1 -1
  15. package/handlers/transform/managers/index.js +0 -3
  16. package/handlers/transform/managers/index.js.map +1 -1
  17. package/handlers/transform/optimizeImage.js +0 -6
  18. package/handlers/transform/optimizeImage.js.map +1 -1
  19. package/handlers/transform/transformImage.js +0 -5
  20. package/handlers/transform/transformImage.js.map +1 -1
  21. package/handlers/transform/utils.js +0 -10
  22. package/handlers/transform/utils.js.map +1 -1
  23. package/handlers/utils/getEnvironment.js +0 -2
  24. package/handlers/utils/getEnvironment.js.map +1 -1
  25. package/handlers/utils/getObjectParams.js +0 -4
  26. package/handlers/utils/getObjectParams.js.map +1 -1
  27. package/handlers/utils/index.js +0 -3
  28. package/handlers/utils/index.js.map +1 -1
  29. package/package.json +19 -19
  30. package/plugins/crud/files/validation.js +0 -6
  31. package/plugins/crud/files/validation.js.map +1 -1
  32. package/plugins/crud/files.crud.js +2 -61
  33. package/plugins/crud/files.crud.js.map +1 -1
  34. package/plugins/crud/settings.crud.js +1 -18
  35. package/plugins/crud/settings.crud.js.map +1 -1
  36. package/plugins/crud/system.crud.js +2 -32
  37. package/plugins/crud/system.crud.js.map +1 -1
  38. package/plugins/crud/utils/checkBasePermissions.js +0 -8
  39. package/plugins/crud/utils/checkBasePermissions.js.map +1 -1
  40. package/plugins/crud/utils/createFileModel.js +0 -12
  41. package/plugins/crud/utils/createFileModel.js.map +1 -1
  42. package/plugins/crud/utils/lifecycleEvents.js +4 -12
  43. package/plugins/crud/utils/lifecycleEvents.js.map +1 -1
  44. package/plugins/definitions/FilePhysicalStoragePlugin.js +0 -11
  45. package/plugins/definitions/FilePhysicalStoragePlugin.js.map +1 -1
  46. package/plugins/definitions/FilePlugin.js +0 -18
  47. package/plugins/definitions/FilePlugin.js.map +1 -1
  48. package/plugins/definitions/FileStorageTransformPlugin.js +1 -12
  49. package/plugins/definitions/FileStorageTransformPlugin.js.map +1 -1
  50. package/plugins/definitions/FilesStorageOperationsProviderPlugin.js +0 -5
  51. package/plugins/definitions/FilesStorageOperationsProviderPlugin.js.map +1 -1
  52. package/plugins/definitions/InstallationPlugin.js +0 -11
  53. package/plugins/definitions/InstallationPlugin.js.map +1 -1
  54. package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js +0 -5
  55. package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js.map +1 -1
  56. package/plugins/definitions/SystemStorageOperationsProviderPlugin.js +0 -5
  57. package/plugins/definitions/SystemStorageOperationsProviderPlugin.js.map +1 -1
  58. package/plugins/graphql.js +2 -22
  59. package/plugins/graphql.js.map +1 -1
  60. package/plugins/index.js +0 -9
  61. package/plugins/index.js.map +1 -1
  62. package/plugins/storage/FileStorage.js +14 -32
  63. package/plugins/storage/FileStorage.js.map +1 -1
  64. package/plugins/storage/index.js +0 -4
  65. package/plugins/storage/index.js.map +1 -1
  66. package/utils.js +0 -2
  67. package/utils.js.map +1 -1
package/plugins/index.js CHANGED
@@ -1,24 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _graphql = _interopRequireDefault(require("./graphql"));
11
-
12
9
  var _files = _interopRequireDefault(require("./crud/files.crud"));
13
-
14
10
  var _validation = _interopRequireDefault(require("./crud/files/validation"));
15
-
16
11
  var _settings = _interopRequireDefault(require("./crud/settings.crud"));
17
-
18
12
  var _system = _interopRequireDefault(require("./crud/system.crud"));
19
-
20
13
  var _storage = _interopRequireDefault(require("./storage"));
21
-
22
14
  var _default = () => [_system.default, _settings.default, _files.default, _storage.default, _graphql.default, (0, _validation.default)()];
23
-
24
15
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["systemCRUD","settingsCRUD","filesCRUD","storage","graphql","fileValidationPlugin"],"sources":["index.ts"],"sourcesContent":["import graphql from \"./graphql\";\nimport filesCRUD from \"./crud/files.crud\";\nimport fileValidationPlugin from \"./crud/files/validation\";\nimport settingsCRUD from \"./crud/settings.crud\";\nimport systemCRUD from \"./crud/system.crud\";\nimport storage from \"./storage\";\n\nexport default () => [\n systemCRUD,\n settingsCRUD,\n filesCRUD,\n storage,\n graphql,\n fileValidationPlugin()\n];\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;eAEe,MAAM,CACjBA,eADiB,EAEjBC,iBAFiB,EAGjBC,cAHiB,EAIjBC,gBAJiB,EAKjBC,gBALiB,EAMjB,IAAAC,mBAAA,GANiB,C"}
1
+ {"version":3,"names":["systemCRUD","settingsCRUD","filesCRUD","storage","graphql","fileValidationPlugin"],"sources":["index.ts"],"sourcesContent":["import graphql from \"./graphql\";\nimport filesCRUD from \"./crud/files.crud\";\nimport fileValidationPlugin from \"./crud/files/validation\";\nimport settingsCRUD from \"./crud/settings.crud\";\nimport systemCRUD from \"./crud/system.crud\";\nimport storage from \"./storage\";\n\nexport default () => [\n systemCRUD,\n settingsCRUD,\n filesCRUD,\n storage,\n graphql,\n fileValidationPlugin()\n];\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAAgC,eAEjB,MAAM,CACjBA,eAAU,EACVC,iBAAY,EACZC,cAAS,EACTC,gBAAO,EACPC,gBAAO,EACP,IAAAC,mBAAoB,GAAE,CACzB;AAAA"}
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.FileStorage = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
-
14
10
  var _error = _interopRequireDefault(require("@webiny/error"));
15
-
16
11
  const storagePluginType = "api-file-manager-storage";
17
-
18
12
  class FileStorage {
19
13
  constructor({
20
14
  context
@@ -22,23 +16,18 @@ class FileStorage {
22
16
  (0, _defineProperty2.default)(this, "storagePlugin", void 0);
23
17
  (0, _defineProperty2.default)(this, "context", void 0);
24
18
  const storagePlugin = context.plugins.byType(storagePluginType).pop();
25
-
26
19
  if (!storagePlugin) {
27
20
  throw new _error.default(`Missing plugin of type "${storagePluginType}".`, "STORAGE_PLUGIN_ERROR");
28
21
  }
29
-
30
22
  this.storagePlugin = storagePlugin;
31
23
  this.context = context;
32
24
  }
33
-
34
25
  async upload(params) {
35
26
  const settings = await this.context.fileManager.settings.getSettings();
36
-
37
27
  if (!settings) {
38
28
  throw new _error.default("Missing File Manager Settings.", "FILE_MANAGER_ERROR");
39
- } // Add file to cloud storage.
40
-
41
-
29
+ }
30
+ // Add file to cloud storage.
42
31
  const {
43
32
  file: fileData
44
33
  } = await this.storagePlugin.upload((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
@@ -46,8 +35,9 @@ class FileStorage {
46
35
  }));
47
36
  const {
48
37
  fileManager
49
- } = this.context; // Save file in DB.
38
+ } = this.context;
50
39
 
40
+ // Save file in DB.
51
41
  return await fileManager.files.createFile((0, _objectSpread2.default)((0, _objectSpread2.default)({}, fileData), {}, {
52
42
  meta: {
53
43
  private: Boolean(params.hideInFileManager)
@@ -55,33 +45,27 @@ class FileStorage {
55
45
  tags: Array.isArray(params.tags) ? params.tags : []
56
46
  }));
57
47
  }
58
-
59
48
  async uploadFiles(params) {
60
49
  const settings = await this.context.fileManager.settings.getSettings();
61
-
62
50
  if (!settings) {
63
51
  throw new _error.default("Missing File Manager Settings.", "FILE_MANAGER_ERROR");
64
- } // Upload files to cloud storage.
65
-
66
-
52
+ }
53
+ // Upload files to cloud storage.
67
54
  const promises = [];
68
-
69
55
  for (const item of params.files) {
70
56
  promises.push(this.storagePlugin.upload((0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
71
57
  settings
72
58
  })));
73
- } // Wait for all to resolve.
74
-
75
-
59
+ }
60
+ // Wait for all to resolve.
76
61
  const uploadFileResponses = await Promise.all(promises);
77
62
  const filesData = uploadFileResponses.map(response => response.file);
78
63
  const {
79
64
  fileManager
80
- } = this.context; // Save files in DB.
81
-
65
+ } = this.context;
66
+ // Save files in DB.
82
67
  return fileManager.files.createFilesInBatch(filesData);
83
68
  }
84
-
85
69
  async delete(params) {
86
70
  const {
87
71
  id,
@@ -89,15 +73,13 @@ class FileStorage {
89
73
  } = params;
90
74
  const {
91
75
  fileManager
92
- } = this.context; // Delete file from cloud storage.
93
-
76
+ } = this.context;
77
+ // Delete file from cloud storage.
94
78
  await this.storagePlugin.delete({
95
79
  key
96
- }); // Delete file from the DB.
97
-
80
+ });
81
+ // Delete file from the DB.
98
82
  return await fileManager.files.deleteFile(id);
99
83
  }
100
-
101
84
  }
102
-
103
85
  exports.FileStorage = FileStorage;
@@ -1 +1 @@
1
- {"version":3,"names":["storagePluginType","FileStorage","constructor","context","storagePlugin","plugins","byType","pop","WebinyError","upload","params","settings","fileManager","getSettings","file","fileData","files","createFile","meta","private","Boolean","hideInFileManager","tags","Array","isArray","uploadFiles","promises","item","push","uploadFileResponses","Promise","all","filesData","map","response","createFilesInBatch","delete","id","key","deleteFile"],"sources":["FileStorage.ts"],"sourcesContent":["import { FileManagerContext } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { FilePhysicalStoragePlugin } from \"~/plugins/definitions/FilePhysicalStoragePlugin\";\n\nexport type Result = Record<string, any>;\n\nconst storagePluginType = \"api-file-manager-storage\";\n\nexport interface FileStorageUploadParams {\n buffer: Buffer;\n hideInFileManager: boolean | string;\n tags?: string[];\n size: number;\n name: string;\n keyPrefix: string;\n type: string;\n}\nexport interface FileStorageDeleteParams {\n id: string;\n key: string;\n}\n\nexport interface FileStorageUploadMultipleParams {\n files: FileStorageUploadParams[];\n}\n\nexport interface FileStorageParams {\n context: FileManagerContext;\n}\nexport class FileStorage {\n private readonly storagePlugin: FilePhysicalStoragePlugin;\n private readonly context: FileManagerContext;\n\n constructor({ context }: FileStorageParams) {\n const storagePlugin = context.plugins\n .byType<FilePhysicalStoragePlugin>(storagePluginType)\n .pop();\n if (!storagePlugin) {\n throw new WebinyError(\n `Missing plugin of type \"${storagePluginType}\".`,\n \"STORAGE_PLUGIN_ERROR\"\n );\n }\n this.storagePlugin = storagePlugin;\n this.context = context;\n }\n\n async upload(params: FileStorageUploadParams): Promise<Result> {\n const settings = await this.context.fileManager.settings.getSettings();\n if (!settings) {\n throw new WebinyError(\"Missing File Manager Settings.\", \"FILE_MANAGER_ERROR\");\n }\n // Add file to cloud storage.\n const { file: fileData } = await this.storagePlugin.upload({\n ...params,\n settings\n });\n\n const { fileManager } = this.context;\n\n // Save file in DB.\n return await fileManager.files.createFile({\n ...(fileData as any),\n meta: {\n private: Boolean(params.hideInFileManager)\n },\n tags: Array.isArray(params.tags) ? params.tags : []\n });\n }\n\n async uploadFiles(params: FileStorageUploadMultipleParams) {\n const settings = await this.context.fileManager.settings.getSettings();\n if (!settings) {\n throw new WebinyError(\"Missing File Manager Settings.\", \"FILE_MANAGER_ERROR\");\n }\n // Upload files to cloud storage.\n const promises = [];\n for (const item of params.files) {\n promises.push(\n this.storagePlugin.upload({\n ...item,\n settings\n })\n );\n }\n // Wait for all to resolve.\n const uploadFileResponses = await Promise.all(promises);\n\n const filesData = uploadFileResponses.map(response => response.file);\n\n const { fileManager } = this.context;\n // Save files in DB.\n return fileManager.files.createFilesInBatch(filesData);\n }\n\n async delete(params: FileStorageDeleteParams) {\n const { id, key } = params;\n const { fileManager } = this.context;\n // Delete file from cloud storage.\n await this.storagePlugin.delete({\n key\n });\n // Delete file from the DB.\n return await fileManager.files.deleteFile(id);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA;;AAKA,MAAMA,iBAAiB,GAAG,0BAA1B;;AAuBO,MAAMC,WAAN,CAAkB;EAIrBC,WAAW,CAAC;IAAEC;EAAF,CAAD,EAAiC;IAAA;IAAA;IACxC,MAAMC,aAAa,GAAGD,OAAO,CAACE,OAAR,CACjBC,MADiB,CACiBN,iBADjB,EAEjBO,GAFiB,EAAtB;;IAGA,IAAI,CAACH,aAAL,EAAoB;MAChB,MAAM,IAAII,cAAJ,CACD,2BAA0BR,iBAAkB,IAD3C,EAEF,sBAFE,CAAN;IAIH;;IACD,KAAKI,aAAL,GAAqBA,aAArB;IACA,KAAKD,OAAL,GAAeA,OAAf;EACH;;EAEW,MAANM,MAAM,CAACC,MAAD,EAAmD;IAC3D,MAAMC,QAAQ,GAAG,MAAM,KAAKR,OAAL,CAAaS,WAAb,CAAyBD,QAAzB,CAAkCE,WAAlC,EAAvB;;IACA,IAAI,CAACF,QAAL,EAAe;MACX,MAAM,IAAIH,cAAJ,CAAgB,gCAAhB,EAAkD,oBAAlD,CAAN;IACH,CAJ0D,CAK3D;;;IACA,MAAM;MAAEM,IAAI,EAAEC;IAAR,IAAqB,MAAM,KAAKX,aAAL,CAAmBK,MAAnB,6DAC1BC,MAD0B;MAE7BC;IAF6B,GAAjC;IAKA,MAAM;MAAEC;IAAF,IAA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ACA,MAAM,KAAKC,aAAL,CAAmBgC,MAAnB,CAA0B;MAC5BE;IAD4B,CAA1B,CAAN,CAJ0C,CAO1C;;IACA,OAAO,MAAM1B,WAAW,CAACI,KAAZ,CAAkBuB,UAAlB,CAA6BF,EAA7B,CAAb;EACH;;AA3EoB"}
1
+ {"version":3,"names":["storagePluginType","FileStorage","constructor","context","storagePlugin","plugins","byType","pop","WebinyError","upload","params","settings","fileManager","getSettings","file","fileData","files","createFile","meta","private","Boolean","hideInFileManager","tags","Array","isArray","uploadFiles","promises","item","push","uploadFileResponses","Promise","all","filesData","map","response","createFilesInBatch","delete","id","key","deleteFile"],"sources":["FileStorage.ts"],"sourcesContent":["import { FileManagerContext } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { FilePhysicalStoragePlugin } from \"~/plugins/definitions/FilePhysicalStoragePlugin\";\n\nexport type Result = Record<string, any>;\n\nconst storagePluginType = \"api-file-manager-storage\";\n\nexport interface FileStorageUploadParams {\n buffer: Buffer;\n hideInFileManager: boolean | string;\n tags?: string[];\n size: number;\n name: string;\n keyPrefix: string;\n type: string;\n}\nexport interface FileStorageDeleteParams {\n id: string;\n key: string;\n}\n\nexport interface FileStorageUploadMultipleParams {\n files: FileStorageUploadParams[];\n}\n\nexport interface FileStorageParams {\n context: FileManagerContext;\n}\nexport class FileStorage {\n private readonly storagePlugin: FilePhysicalStoragePlugin;\n private readonly context: FileManagerContext;\n\n constructor({ context }: FileStorageParams) {\n const storagePlugin = context.plugins\n .byType<FilePhysicalStoragePlugin>(storagePluginType)\n .pop();\n if (!storagePlugin) {\n throw new WebinyError(\n `Missing plugin of type \"${storagePluginType}\".`,\n \"STORAGE_PLUGIN_ERROR\"\n );\n }\n this.storagePlugin = storagePlugin;\n this.context = context;\n }\n\n async upload(params: FileStorageUploadParams): Promise<Result> {\n const settings = await this.context.fileManager.settings.getSettings();\n if (!settings) {\n throw new WebinyError(\"Missing File Manager Settings.\", \"FILE_MANAGER_ERROR\");\n }\n // Add file to cloud storage.\n const { file: fileData } = await this.storagePlugin.upload({\n ...params,\n settings\n });\n\n const { fileManager } = this.context;\n\n // Save file in DB.\n return await fileManager.files.createFile({\n ...(fileData as any),\n meta: {\n private: Boolean(params.hideInFileManager)\n },\n tags: Array.isArray(params.tags) ? params.tags : []\n });\n }\n\n async uploadFiles(params: FileStorageUploadMultipleParams) {\n const settings = await this.context.fileManager.settings.getSettings();\n if (!settings) {\n throw new WebinyError(\"Missing File Manager Settings.\", \"FILE_MANAGER_ERROR\");\n }\n // Upload files to cloud storage.\n const promises = [];\n for (const item of params.files) {\n promises.push(\n this.storagePlugin.upload({\n ...item,\n settings\n })\n );\n }\n // Wait for all to resolve.\n const uploadFileResponses = await Promise.all(promises);\n\n const filesData = uploadFileResponses.map(response => response.file);\n\n const { fileManager } = this.context;\n // Save files in DB.\n return fileManager.files.createFilesInBatch(filesData);\n }\n\n async delete(params: FileStorageDeleteParams) {\n const { id, key } = params;\n const { fileManager } = this.context;\n // Delete file from cloud storage.\n await this.storagePlugin.delete({\n key\n });\n // Delete file from the DB.\n return await fileManager.files.deleteFile(id);\n }\n}\n"],"mappings":";;;;;;;;;AACA;AAKA,MAAMA,iBAAiB,GAAG,0BAA0B;AAuB7C,MAAMC,WAAW,CAAC;EAIrBC,WAAW,CAAC;IAAEC;EAA2B,CAAC,EAAE;IAAA;IAAA;IACxC,MAAMC,aAAa,GAAGD,OAAO,CAACE,OAAO,CAChCC,MAAM,CAA4BN,iBAAiB,CAAC,CACpDO,GAAG,EAAE;IACV,IAAI,CAACH,aAAa,EAAE;MAChB,MAAM,IAAII,cAAW,CAChB,2BAA0BR,iBAAkB,IAAG,EAChD,sBAAsB,CACzB;IACL;IACA,IAAI,CAACI,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACD,OAAO,GAAGA,OAAO;EAC1B;EAEA,MAAMM,MAAM,CAACC,MAA+B,EAAmB;IAC3D,MAAMC,QAAQ,GAAG,MAAM,IAAI,CAACR,OAAO,CAACS,WAAW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,OAAO;IACpC;IACA,OAAOS,WAAW,CAACI,KAAK,CAACmB,kBAAkB,CAACH,SAAS,CAAC;EAC1D;EAEA,MAAMI,MAAM,CAAC1B,MAA+B,EAAE;IAC1C,MAAM;MAAE2B,EAAE;MAAEC;IAAI,CAAC,GAAG5B,MAAM;IAC1B,MAAM;MAAEE;IAAY,CAAC,GAAG,IAAI,CAACT,OAAO;IACpC;IACA,MAAM,IAAI,CAACC,aAAa,CAACgC,MAAM,CAAC;MAC5BE;IACJ,CAAC,CAAC;IACF;IACA,OAAO,MAAM1B,WAAW,CAACI,KAAK,CAACuB,UAAU,CAACF,EAAE,CAAC;EACjD;AACJ;AAAC"}
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _api = require("@webiny/api");
9
-
10
8
  var _FileStorage = require("./FileStorage");
11
-
12
9
  const fileStorageContextPlugin = new _api.ContextPlugin(async context => {
13
10
  if (!context.fileManager) {
14
11
  /**
@@ -17,7 +14,6 @@ const fileStorageContextPlugin = new _api.ContextPlugin(async context => {
17
14
  */
18
15
  context.fileManager = {};
19
16
  }
20
-
21
17
  context.fileManager.storage = new _FileStorage.FileStorage({
22
18
  context
23
19
  });
@@ -1 +1 @@
1
- {"version":3,"names":["fileStorageContextPlugin","ContextPlugin","context","fileManager","storage","FileStorage"],"sources":["index.ts"],"sourcesContent":["import { FileManagerContext } from \"~/types\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { FileStorage } from \"./FileStorage\";\n\nconst fileStorageContextPlugin = new ContextPlugin<FileManagerContext>(async context => {\n if (!context.fileManager) {\n /**\n * We need to define the fileManager initial property as empty object.\n * When casting as FileManagerContext, typescript is complaining.\n */\n context.fileManager = {} as any;\n }\n context.fileManager.storage = new FileStorage({\n context\n });\n});\n\nexport default fileStorageContextPlugin;\n"],"mappings":";;;;;;;AACA;;AACA;;AAEA,MAAMA,wBAAwB,GAAG,IAAIC,kBAAJ,CAAsC,MAAMC,OAAN,IAAiB;EACpF,IAAI,CAACA,OAAO,CAACC,WAAb,EAA0B;IACtB;AACR;AACA;AACA;IACQD,OAAO,CAACC,WAAR,GAAsB,EAAtB;EACH;;EACDD,OAAO,CAACC,WAAR,CAAoBC,OAApB,GAA8B,IAAIC,wBAAJ,CAAgB;IAC1CH;EAD0C,CAAhB,CAA9B;AAGH,CAXgC,CAAjC;eAaeF,wB"}
1
+ {"version":3,"names":["fileStorageContextPlugin","ContextPlugin","context","fileManager","storage","FileStorage"],"sources":["index.ts"],"sourcesContent":["import { FileManagerContext } from \"~/types\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { FileStorage } from \"./FileStorage\";\n\nconst fileStorageContextPlugin = new ContextPlugin<FileManagerContext>(async context => {\n if (!context.fileManager) {\n /**\n * We need to define the fileManager initial property as empty object.\n * When casting as FileManagerContext, typescript is complaining.\n */\n context.fileManager = {} as any;\n }\n context.fileManager.storage = new FileStorage({\n context\n });\n});\n\nexport default fileStorageContextPlugin;\n"],"mappings":";;;;;;AACA;AACA;AAEA,MAAMA,wBAAwB,GAAG,IAAIC,kBAAa,CAAqB,MAAMC,OAAO,IAAI;EACpF,IAAI,CAACA,OAAO,CAACC,WAAW,EAAE;IACtB;AACR;AACA;AACA;IACQD,OAAO,CAACC,WAAW,GAAG,CAAC,CAAQ;EACnC;EACAD,OAAO,CAACC,WAAW,CAACC,OAAO,GAAG,IAAIC,wBAAW,CAAC;IAC1CH;EACJ,CAAC,CAAC;AACN,CAAC,CAAC;AAAC,eAEYF,wBAAwB;AAAA"}
package/utils.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.executeCallbacks = void 0;
7
-
8
7
  const executeCallbacks = async (plugins, hook, args) => {
9
8
  for (const plugin of plugins) {
10
9
  if (typeof plugin[hook] === "function") {
@@ -12,5 +11,4 @@ const executeCallbacks = async (plugins, hook, args) => {
12
11
  }
13
12
  }
14
13
  };
15
-
16
14
  exports.executeCallbacks = executeCallbacks;
package/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["executeCallbacks","plugins","hook","args","plugin"],"sources":["utils.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/types\";\n\ntype CallbackFallback = (args: any) => void | Promise<void>;\n\nexport const executeCallbacks = async <\n TCallbackFunction extends CallbackFallback = CallbackFallback\n>(\n plugins: Plugin[],\n hook: string,\n args: Parameters<TCallbackFunction>[0]\n) => {\n for (const plugin of plugins) {\n if (typeof plugin[hook] === \"function\") {\n await plugin[hook](args);\n }\n }\n};\n"],"mappings":";;;;;;;AAIO,MAAMA,gBAAgB,GAAG,OAG5BC,OAH4B,EAI5BC,IAJ4B,EAK5BC,IAL4B,KAM3B;EACD,KAAK,MAAMC,MAAX,IAAqBH,OAArB,EAA8B;IAC1B,IAAI,OAAOG,MAAM,CAACF,IAAD,CAAb,KAAwB,UAA5B,EAAwC;MACpC,MAAME,MAAM,CAACF,IAAD,CAAN,CAAaC,IAAb,CAAN;IACH;EACJ;AACJ,CAZM"}
1
+ {"version":3,"names":["executeCallbacks","plugins","hook","args","plugin"],"sources":["utils.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/types\";\n\ntype CallbackFallback = (args: any) => void | Promise<void>;\n\nexport const executeCallbacks = async <\n TCallbackFunction extends CallbackFallback = CallbackFallback\n>(\n plugins: Plugin[],\n hook: string,\n args: Parameters<TCallbackFunction>[0]\n) => {\n for (const plugin of plugins) {\n if (typeof plugin[hook] === \"function\") {\n await plugin[hook](args);\n }\n }\n};\n"],"mappings":";;;;;;AAIO,MAAMA,gBAAgB,GAAG,OAG5BC,OAAiB,EACjBC,IAAY,EACZC,IAAsC,KACrC;EACD,KAAK,MAAMC,MAAM,IAAIH,OAAO,EAAE;IAC1B,IAAI,OAAOG,MAAM,CAACF,IAAI,CAAC,KAAK,UAAU,EAAE;MACpC,MAAME,MAAM,CAACF,IAAI,CAAC,CAACC,IAAI,CAAC;IAC5B;EACJ;AACJ,CAAC;AAAC"}