@webiny/api-file-manager 0.0.0-mt-2 → 0.0.0-unstable.1e66d121db

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 (100) hide show
  1. package/handlers/download/index.d.ts +3 -3
  2. package/handlers/download/index.js +67 -60
  3. package/handlers/download/index.js.map +1 -0
  4. package/handlers/manage/index.d.ts +5 -3
  5. package/handlers/manage/index.js +48 -47
  6. package/handlers/manage/index.js.map +1 -0
  7. package/handlers/transform/index.d.ts +2 -3
  8. package/handlers/transform/index.js +65 -70
  9. package/handlers/transform/index.js.map +1 -0
  10. package/handlers/transform/loaders/imageLoader.d.ts +26 -9
  11. package/handlers/transform/loaders/imageLoader.js +3 -4
  12. package/handlers/transform/loaders/imageLoader.js.map +1 -0
  13. package/handlers/transform/loaders/index.d.ts +4 -9
  14. package/handlers/transform/loaders/index.js +1 -1
  15. package/handlers/transform/loaders/index.js.map +1 -0
  16. package/handlers/transform/loaders/sanitizeImageTransformations.d.ts +7 -3
  17. package/handlers/transform/loaders/sanitizeImageTransformations.js +27 -20
  18. package/handlers/transform/loaders/sanitizeImageTransformations.js.map +1 -0
  19. package/handlers/transform/managers/imageManager.d.ts +12 -6
  20. package/handlers/transform/managers/imageManager.js +25 -17
  21. package/handlers/transform/managers/imageManager.js.map +1 -0
  22. package/handlers/transform/managers/index.d.ts +2 -6
  23. package/handlers/transform/managers/index.js +1 -1
  24. package/handlers/transform/managers/index.js.map +1 -0
  25. package/handlers/transform/optimizeImage.d.ts +2 -1
  26. package/handlers/transform/optimizeImage.js +4 -1
  27. package/handlers/transform/optimizeImage.js.map +1 -0
  28. package/handlers/transform/transformImage.d.ts +5 -4
  29. package/handlers/transform/transformImage.js +4 -4
  30. package/handlers/transform/transformImage.js.map +1 -0
  31. package/handlers/transform/utils.d.ts +2 -2
  32. package/handlers/transform/utils.js +1 -1
  33. package/handlers/transform/utils.js.map +1 -0
  34. package/handlers/types.d.ts +8 -0
  35. package/handlers/types.js +5 -0
  36. package/handlers/types.js.map +1 -0
  37. package/handlers/utils/getEnvironment.js.map +1 -0
  38. package/handlers/utils/getObjectParams.d.ts +3 -4
  39. package/handlers/utils/getObjectParams.js +1 -3
  40. package/handlers/utils/getObjectParams.js.map +1 -0
  41. package/handlers/utils/index.d.ts +0 -1
  42. package/handlers/utils/index.js +1 -9
  43. package/handlers/utils/index.js.map +1 -0
  44. package/package.json +28 -27
  45. package/plugins/crud/files/validation.js +1 -1
  46. package/plugins/crud/files/validation.js.map +1 -0
  47. package/plugins/crud/files.crud.d.ts +1 -1
  48. package/plugins/crud/files.crud.js +48 -44
  49. package/plugins/crud/files.crud.js.map +1 -0
  50. package/plugins/crud/settings.crud.d.ts +1 -1
  51. package/plugins/crud/settings.crud.js +10 -9
  52. package/plugins/crud/settings.crud.js.map +1 -0
  53. package/plugins/crud/system.crud.d.ts +1 -1
  54. package/plugins/crud/system.crud.js +18 -10
  55. package/plugins/crud/system.crud.js.map +1 -0
  56. package/plugins/crud/utils/checkBasePermissions.js +1 -1
  57. package/plugins/crud/utils/checkBasePermissions.js.map +1 -0
  58. package/plugins/crud/utils/createFileModel.d.ts +3 -0
  59. package/plugins/crud/utils/createFileModel.js +13 -0
  60. package/plugins/crud/utils/createFileModel.js.map +1 -0
  61. package/plugins/crud/utils/lifecycleEvents.d.ts +2 -2
  62. package/plugins/crud/utils/lifecycleEvents.js +6 -1
  63. package/plugins/crud/utils/lifecycleEvents.js.map +1 -0
  64. package/plugins/definitions/FilePhysicalStoragePlugin.d.ts +10 -11
  65. package/plugins/definitions/FilePhysicalStoragePlugin.js +1 -1
  66. package/plugins/definitions/FilePhysicalStoragePlugin.js.map +1 -0
  67. package/plugins/definitions/FilePlugin.d.ts +6 -3
  68. package/plugins/definitions/FilePlugin.js +9 -3
  69. package/plugins/definitions/FilePlugin.js.map +1 -0
  70. package/plugins/definitions/FileStorageTransformPlugin.d.ts +9 -9
  71. package/plugins/definitions/FileStorageTransformPlugin.js +1 -1
  72. package/plugins/definitions/FileStorageTransformPlugin.js.map +1 -0
  73. package/plugins/definitions/FilesStorageOperationsProviderPlugin.d.ts +4 -4
  74. package/plugins/definitions/FilesStorageOperationsProviderPlugin.js +1 -1
  75. package/plugins/definitions/FilesStorageOperationsProviderPlugin.js.map +1 -0
  76. package/plugins/definitions/InstallationPlugin.d.ts +9 -9
  77. package/plugins/definitions/InstallationPlugin.js +5 -3
  78. package/plugins/definitions/InstallationPlugin.js.map +1 -0
  79. package/plugins/definitions/SettingsStorageOperationsProviderPlugin.d.ts +4 -4
  80. package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js +1 -1
  81. package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js.map +1 -0
  82. package/plugins/definitions/SystemStorageOperationsProviderPlugin.d.ts +4 -4
  83. package/plugins/definitions/SystemStorageOperationsProviderPlugin.js +1 -1
  84. package/plugins/definitions/SystemStorageOperationsProviderPlugin.js.map +1 -0
  85. package/plugins/graphql.js +20 -4
  86. package/plugins/graphql.js.map +1 -0
  87. package/plugins/index.d.ts +1 -1
  88. package/plugins/index.js +1 -1
  89. package/plugins/index.js.map +1 -0
  90. package/plugins/storage/FileStorage.d.ts +23 -24
  91. package/plugins/storage/FileStorage.js +28 -20
  92. package/plugins/storage/FileStorage.js.map +1 -0
  93. package/plugins/storage/index.d.ts +1 -1
  94. package/plugins/storage/index.js +6 -2
  95. package/plugins/storage/index.js.map +1 -0
  96. package/types.d.ts +16 -12
  97. package/types.js.map +1 -0
  98. package/utils.js.map +1 -0
  99. package/handlers/utils/createHandler.d.ts +0 -24
  100. package/handlers/utils/createHandler.js +0 -68
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FilePhysicalStoragePlugin","Plugin","constructor","params","_params","upload","WebinyError","delete"],"sources":["FilePhysicalStoragePlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport WebinyError from \"@webiny/error\";\nimport { FileManagerSettings } from \"~/types\";\n\nexport interface FilePhysicalStoragePluginParams<\n U extends FilePhysicalStoragePluginUploadParams,\n D extends FilePhysicalStoragePluginDeleteParams\n> {\n upload: (args: U) => Promise<any>;\n delete: (args: D) => Promise<void>;\n}\n\nexport interface FilePhysicalStoragePluginUploadParams {\n settings: FileManagerSettings;\n buffer: Buffer;\n}\n\nexport interface FilePhysicalStoragePluginDeleteParams {\n key: string;\n}\n\nexport class FilePhysicalStoragePlugin<\n U extends FilePhysicalStoragePluginUploadParams = FilePhysicalStoragePluginUploadParams,\n D extends FilePhysicalStoragePluginDeleteParams = FilePhysicalStoragePluginDeleteParams\n> extends Plugin {\n public static override readonly type: string = \"api-file-manager-storage\";\n private readonly _params: FilePhysicalStoragePluginParams<U, D>;\n\n public constructor(params: FilePhysicalStoragePluginParams<U, D>) {\n super();\n this._params = params;\n }\n\n public async upload(params: U): Promise<any> {\n if (!this._params.upload) {\n throw new WebinyError(\n `You must define the \"upload\" method of this plugin.`,\n \"UPLOAD_METHOD_ERROR\"\n );\n }\n return this._params.upload(params);\n }\n\n public async delete(params: D): Promise<any> {\n if (!this._params.delete) {\n throw new WebinyError(\n `You must define the \"delete\" method of this plugin.`,\n \"DELETE_METHOD_ERROR\"\n );\n }\n return this._params.delete(params);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAoBO,MAAMA,yBAAN,SAGGC,eAHH,CAGU;EAINC,WAAW,CAACC,MAAD,EAAgD;IAC9D;IAD8D;IAE9D,KAAKC,OAAL,GAAeD,MAAf;EACH;;EAEkB,MAANE,MAAM,CAACF,MAAD,EAA0B;IACzC,IAAI,CAAC,KAAKC,OAAL,CAAaC,MAAlB,EAA0B;MACtB,MAAM,IAAIC,cAAJ,CACD,qDADC,EAEF,qBAFE,CAAN;IAIH;;IACD,OAAO,KAAKF,OAAL,CAAaC,MAAb,CAAoBF,MAApB,CAAP;EACH;;EAEkB,MAANI,MAAM,CAACJ,MAAD,EAA0B;IACzC,IAAI,CAAC,KAAKC,OAAL,CAAaG,MAAlB,EAA0B;MACtB,MAAM,IAAID,cAAJ,CACD,qDADC,EAEF,qBAFE,CAAN;IAIH;;IACD,OAAO,KAAKF,OAAL,CAAaG,MAAb,CAAoBJ,MAApB,CAAP;EACH;;AA3BY;;;8BAHJH,yB,UAIsC,0B"}
@@ -107,7 +107,7 @@ export interface AfterDeleteParams {
107
107
  *
108
108
  * @category FilePlugin
109
109
  */
110
- export interface Params {
110
+ export interface FilePluginParams {
111
111
  beforeCreate?: (params: BeforeCreateParams) => Promise<void>;
112
112
  afterCreate?: (params: AfterCreateParams) => Promise<void>;
113
113
  beforeUpdate?: (params: BeforeUpdateParams) => Promise<void>;
@@ -118,9 +118,9 @@ export interface Params {
118
118
  afterDelete?: (params: AfterDeleteParams) => Promise<void>;
119
119
  }
120
120
  export declare class FilePlugin extends Plugin {
121
- static readonly type = "fm.file";
121
+ static readonly type: string;
122
122
  private readonly _params;
123
- constructor(params?: Params);
123
+ constructor(params?: FilePluginParams);
124
124
  beforeCreate(params: BeforeCreateParams): Promise<void>;
125
125
  afterCreate(params: AfterCreateParams): Promise<void>;
126
126
  beforeUpdate(params: BeforeUpdateParams): Promise<void>;
@@ -129,5 +129,8 @@ export declare class FilePlugin extends Plugin {
129
129
  afterBatchCreate(params: AfterBatchCreateParams): Promise<void>;
130
130
  beforeDelete(params: BeforeDeleteParams): Promise<void>;
131
131
  afterDelete(params: AfterDeleteParams): Promise<void>;
132
+ /**
133
+ * Keep any here because it can be a number of params. Method is internal so no need to complicate the code.
134
+ */
132
135
  private _execute;
133
136
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -49,13 +49,19 @@ class FilePlugin extends _plugins.Plugin {
49
49
  async afterDelete(params) {
50
50
  await this._execute("afterDelete", params);
51
51
  }
52
+ /**
53
+ * Keep any here because it can be a number of params. Method is internal so no need to complicate the code.
54
+ */
55
+
52
56
 
53
57
  async _execute(callback, params) {
54
- if (typeof this._params[callback] !== "function") {
58
+ const cb = this._params[callback];
59
+
60
+ if (typeof cb !== "function") {
55
61
  return;
56
62
  }
57
63
 
58
- await this._params[callback](params);
64
+ await cb(params);
59
65
  }
60
66
 
61
67
  }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FilePlugin","Plugin","constructor","params","_params","beforeCreate","_execute","afterCreate","beforeUpdate","afterUpdate","beforeBatchCreate","afterBatchCreate","beforeDelete","afterDelete","callback","cb"],"sources":["FilePlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { File, FileManagerContext } from \"~/types\";\n\n/**\n * Parameters for beforeCreate lifecycle.\n */\nexport interface BeforeCreateParams {\n context: FileManagerContext;\n /**\n * Data to be inserted into the storage.\n */\n data: File;\n}\n/**\n * Parameters for afterCreate lifecycle.\n */\nexport interface AfterCreateParams {\n context: FileManagerContext;\n /**\n * Data that was inserted into the storage.\n */\n data: File;\n /**\n * Result of the storage operations create method.\n * Possibly changed something on the \"data\".\n */\n file: File;\n}\n/**\n * Parameters for beforeUpdate lifecycle.\n */\nexport interface BeforeUpdateParams {\n context: FileManagerContext;\n /**\n * Original file from the storage.\n */\n original: File;\n /**\n * Data to be updated to the storage.\n */\n data: File;\n}\n/**\n * Parameters for afterUpdate lifecycle.\n */\nexport interface AfterUpdateParams {\n context: FileManagerContext;\n /**\n * Original file from the storage.\n */\n original: File;\n /**\n * Data that was updated in the storage.\n */\n data: File;\n /**\n * Result of the storage operations update method.\n * Possibly changed something on the \"data\".\n */\n file: File;\n}\n/**\n * Parameters for beforeBatchCreate lifecycle.\n */\nexport interface BeforeBatchCreateParams {\n context: FileManagerContext;\n /**\n * Files to be inserted into the storage.\n */\n data: File[];\n}\n\n/**\n * Parameters for afterBatchCreate lifecycle.\n */\nexport interface AfterBatchCreateParams {\n context: FileManagerContext;\n /**\n * Files that were inserted into the storage.\n */\n data: File[];\n /**\n * Results of the insert.\n */\n files: File[];\n}\n/**\n * Parameters for beforeDelete lifecycle.\n */\nexport interface BeforeDeleteParams {\n context: FileManagerContext;\n /**\n * File to be deleted from the storage.\n */\n file: File;\n}\n/**\n * Parameters for afterDelete lifecycle.\n */\nexport interface AfterDeleteParams {\n context: FileManagerContext;\n /**\n * File that was deleted from the storage.\n */\n file: File;\n}\n\n/**\n * Definition for the constructor parameters of the FilePlugin.\n *\n * @category FilePlugin\n */\nexport interface FilePluginParams {\n beforeCreate?: (params: BeforeCreateParams) => Promise<void>;\n afterCreate?: (params: AfterCreateParams) => Promise<void>;\n beforeUpdate?: (params: BeforeUpdateParams) => Promise<void>;\n afterUpdate?: (params: AfterUpdateParams) => Promise<void>;\n beforeBatchCreate?: (params: BeforeBatchCreateParams) => Promise<void>;\n afterBatchCreate?: (params: AfterBatchCreateParams) => Promise<void>;\n beforeDelete?: (params: BeforeDeleteParams) => Promise<void>;\n afterDelete?: (params: AfterDeleteParams) => Promise<void>;\n}\n\nexport class FilePlugin extends Plugin {\n public static override readonly type: string = \"fm.file\";\n private readonly _params: FilePluginParams;\n\n public constructor(params?: FilePluginParams) {\n super();\n this._params = params || ({} as any);\n }\n\n public async beforeCreate(params: BeforeCreateParams): Promise<void> {\n await this._execute(\"beforeCreate\", params);\n }\n\n public async afterCreate(params: AfterCreateParams): Promise<void> {\n await this._execute(\"afterCreate\", params);\n }\n\n public async beforeUpdate(params: BeforeUpdateParams): Promise<void> {\n await this._execute(\"beforeUpdate\", params);\n }\n\n public async afterUpdate(params: AfterUpdateParams): Promise<void> {\n await this._execute(\"afterUpdate\", params);\n }\n\n public async beforeBatchCreate(params: BeforeBatchCreateParams): Promise<void> {\n await this._execute(\"beforeBatchCreate\", params);\n }\n\n public async afterBatchCreate(params: AfterBatchCreateParams): Promise<void> {\n await this._execute(\"afterBatchCreate\", params);\n }\n\n public async beforeDelete(params: BeforeDeleteParams): Promise<void> {\n await this._execute(\"beforeDelete\", params);\n }\n\n public async afterDelete(params: AfterDeleteParams): Promise<void> {\n await this._execute(\"afterDelete\", params);\n }\n /**\n * Keep any here because it can be a number of params. Method is internal so no need to complicate the code.\n */\n private async _execute(callback: keyof FilePluginParams, params: any): Promise<void> {\n const cb = this._params[callback];\n if (typeof cb !== \"function\") {\n return;\n }\n await cb(params);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AA2HO,MAAMA,UAAN,SAAyBC,eAAzB,CAAgC;EAI5BC,WAAW,CAACC,MAAD,EAA4B;IAC1C;IAD0C;IAE1C,KAAKC,OAAL,GAAeD,MAAM,IAAK,EAA1B;EACH;;EAEwB,MAAZE,YAAY,CAACF,MAAD,EAA4C;IACjE,MAAM,KAAKG,QAAL,CAAc,cAAd,EAA8BH,MAA9B,CAAN;EACH;;EAEuB,MAAXI,WAAW,CAACJ,MAAD,EAA2C;IAC/D,MAAM,KAAKG,QAAL,CAAc,aAAd,EAA6BH,MAA7B,CAAN;EACH;;EAEwB,MAAZK,YAAY,CAACL,MAAD,EAA4C;IACjE,MAAM,KAAKG,QAAL,CAAc,cAAd,EAA8BH,MAA9B,CAAN;EACH;;EAEuB,MAAXM,WAAW,CAACN,MAAD,EAA2C;IAC/D,MAAM,KAAKG,QAAL,CAAc,aAAd,EAA6BH,MAA7B,CAAN;EACH;;EAE6B,MAAjBO,iBAAiB,CAACP,MAAD,EAAiD;IAC3E,MAAM,KAAKG,QAAL,CAAc,mBAAd,EAAmCH,MAAnC,CAAN;EACH;;EAE4B,MAAhBQ,gBAAgB,CAACR,MAAD,EAAgD;IACzE,MAAM,KAAKG,QAAL,CAAc,kBAAd,EAAkCH,MAAlC,CAAN;EACH;;EAEwB,MAAZS,YAAY,CAACT,MAAD,EAA4C;IACjE,MAAM,KAAKG,QAAL,CAAc,cAAd,EAA8BH,MAA9B,CAAN;EACH;;EAEuB,MAAXU,WAAW,CAACV,MAAD,EAA2C;IAC/D,MAAM,KAAKG,QAAL,CAAc,aAAd,EAA6BH,MAA7B,CAAN;EACH;EACD;AACJ;AACA;;;EAC0B,MAARG,QAAQ,CAACQ,QAAD,EAAmCX,MAAnC,EAA+D;IACjF,MAAMY,EAAE,GAAG,KAAKX,OAAL,CAAaU,QAAb,CAAX;;IACA,IAAI,OAAOC,EAAP,KAAc,UAAlB,EAA8B;MAC1B;IACH;;IACD,MAAMA,EAAE,CAACZ,MAAD,CAAR;EACH;;AAjDkC;;;8BAA1BH,U,UACsC,S"}
@@ -1,34 +1,34 @@
1
1
  import { Plugin } from "@webiny/plugins";
2
2
  import { File } from "../../types";
3
- export interface ToParams {
3
+ export interface FileStorageTransformPluginToParams {
4
4
  /**
5
5
  * File that is being sent to the storage operations method.
6
6
  */
7
7
  file: File & Record<string, any>;
8
8
  }
9
- export interface FromParams {
9
+ export interface FileStorageTransformPluginFromParams {
10
10
  /**
11
11
  * File that was fetched from the storage operations method.
12
12
  */
13
13
  file: File & Record<string, any>;
14
14
  }
15
- export interface Params {
16
- toStorage?: (params: ToParams) => Promise<File & Record<string, any>>;
17
- fromStorage?: (params: FromParams) => Promise<File & Record<string, any>>;
15
+ export interface FileStorageTransformPluginParams {
16
+ toStorage?: (params: FileStorageTransformPluginToParams) => Promise<File & Record<string, any>>;
17
+ fromStorage?: (params: FileStorageTransformPluginFromParams) => Promise<File & Record<string, any>>;
18
18
  }
19
19
  export declare class FileStorageTransformPlugin extends Plugin {
20
- static readonly type = "fm.files.storage.transform";
20
+ static readonly type: string;
21
21
  private readonly _params;
22
- constructor(params: Params);
22
+ constructor(params: FileStorageTransformPluginParams);
23
23
  /**
24
24
  * Transform the file value into something that can be stored.
25
25
  * Be aware that you must return the whole file object.
26
26
  */
27
- toStorage(params: ToParams): Promise<File & Record<string, any>>;
27
+ toStorage(params: FileStorageTransformPluginToParams): Promise<File & Record<string, any>>;
28
28
  /**
29
29
  * Transform the file value from the storage type to one required by our system.
30
30
  * Be aware that you must return the whole file object.
31
31
  * This method MUST reverse what ever toStorage method changed on the file object.
32
32
  */
33
- fromStorage(params: FromParams): Promise<File & Record<string, any>>;
33
+ fromStorage(params: FileStorageTransformPluginFromParams): Promise<File & Record<string, any>>;
34
34
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FileStorageTransformPlugin","Plugin","constructor","params","_params","toStorage","file","fromStorage"],"sources":["FileStorageTransformPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { File } from \"~/types\";\n\nexport interface FileStorageTransformPluginToParams {\n /**\n * File that is being sent to the storage operations method.\n */\n file: File & Record<string, any>;\n}\n\nexport interface FileStorageTransformPluginFromParams {\n /**\n * File that was fetched from the storage operations method.\n */\n file: File & Record<string, any>;\n}\n\nexport interface FileStorageTransformPluginParams {\n toStorage?: (params: FileStorageTransformPluginToParams) => Promise<File & Record<string, any>>;\n fromStorage?: (\n params: FileStorageTransformPluginFromParams\n ) => Promise<File & Record<string, any>>;\n}\n\nexport class FileStorageTransformPlugin extends Plugin {\n public static override readonly type: string = \"fm.files.storage.transform\";\n private readonly _params: FileStorageTransformPluginParams;\n\n public constructor(params: FileStorageTransformPluginParams) {\n super();\n\n this._params = params;\n }\n\n /**\n * Transform the file value into something that can be stored.\n * Be aware that you must return the whole file object.\n */\n public async toStorage(\n params: FileStorageTransformPluginToParams\n ): Promise<File & Record<string, any>> {\n if (!this._params.toStorage) {\n return params.file;\n }\n return this._params.toStorage(params);\n }\n /**\n * Transform the file value from the storage type to one required by our system.\n * Be aware that you must return the whole file object.\n * This method MUST reverse what ever toStorage method changed on the file object.\n */\n public async fromStorage(\n params: FileStorageTransformPluginFromParams\n ): Promise<File & Record<string, any>> {\n if (!this._params.fromStorage) {\n return params.file;\n }\n return this._params.fromStorage(params);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAwBO,MAAMA,0BAAN,SAAyCC,eAAzC,CAAgD;EAI5CC,WAAW,CAACC,MAAD,EAA2C;IACzD;IADyD;IAGzD,KAAKC,OAAL,GAAeD,MAAf;EACH;EAED;AACJ;AACA;AACA;;;EAC0B,MAATE,SAAS,CAClBF,MADkB,EAEiB;IACnC,IAAI,CAAC,KAAKC,OAAL,CAAaC,SAAlB,EAA6B;MACzB,OAAOF,MAAM,CAACG,IAAd;IACH;;IACD,OAAO,KAAKF,OAAL,CAAaC,SAAb,CAAuBF,MAAvB,CAAP;EACH;EACD;AACJ;AACA;AACA;AACA;;;EAC4B,MAAXI,WAAW,CACpBJ,MADoB,EAEe;IACnC,IAAI,CAAC,KAAKC,OAAL,CAAaG,WAAlB,EAA+B;MAC3B,OAAOJ,MAAM,CAACG,IAAd;IACH;;IACD,OAAO,KAAKF,OAAL,CAAaG,WAAb,CAAyBJ,MAAzB,CAAP;EACH;;AAlCkD;;;8BAA1CH,0B,UACsC,4B"}
@@ -1,9 +1,9 @@
1
1
  import { Plugin } from "@webiny/plugins";
2
2
  import { FileManagerContext, FileManagerFilesStorageOperations } from "../../types";
3
- export interface Params {
4
- context: FileManagerContext;
3
+ export interface FilesStorageOperationsProviderPluginParams<T = FileManagerContext> {
4
+ context: T;
5
5
  }
6
6
  export declare abstract class FilesStorageOperationsProviderPlugin extends Plugin {
7
- static readonly type = "fm.storageOperationsProvider.files";
8
- abstract provide(params: Params): Promise<FileManagerFilesStorageOperations>;
7
+ static readonly type: string;
8
+ abstract provide(params: FilesStorageOperationsProviderPluginParams): Promise<FileManagerFilesStorageOperations>;
9
9
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FilesStorageOperationsProviderPlugin","Plugin"],"sources":["FilesStorageOperationsProviderPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { FileManagerContext, FileManagerFilesStorageOperations } from \"~/types\";\n\nexport interface FilesStorageOperationsProviderPluginParams<T = FileManagerContext> {\n context: T;\n}\n\nexport abstract class FilesStorageOperationsProviderPlugin extends Plugin {\n public static override readonly type: string = \"fm.storageOperationsProvider.files\";\n\n public abstract provide(\n params: FilesStorageOperationsProviderPluginParams\n ): Promise<FileManagerFilesStorageOperations>;\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAOO,MAAeA,oCAAf,SAA4DC,eAA5D,CAAmE;;;8BAApDD,oC,UAC6B,oC"}
@@ -1,19 +1,19 @@
1
1
  import { FileManagerContext } from "../../types";
2
2
  import { Plugin } from "@webiny/plugins";
3
- export declare type CallbackFunction<TParams> = (params: TParams) => Promise<void>;
4
- export interface Params {
3
+ export interface InstallationPluginParams {
5
4
  context: FileManagerContext;
6
5
  }
7
- interface Config {
8
- beforeInstall?: CallbackFunction<Params>;
9
- afterInstall?: CallbackFunction<Params>;
6
+ export declare type CallbackFunction<TParams> = (params: TParams) => Promise<void>;
7
+ interface InstallationPluginConfig {
8
+ beforeInstall?: CallbackFunction<InstallationPluginParams>;
9
+ afterInstall?: CallbackFunction<InstallationPluginParams>;
10
10
  }
11
11
  export declare abstract class InstallationPlugin extends Plugin {
12
- static readonly type = "fm.install";
12
+ static readonly type: string;
13
13
  private readonly _config;
14
- constructor(config?: Partial<Config>);
15
- beforeInstall(params: Params): Promise<void>;
16
- afterInstall(params: Params): Promise<void>;
14
+ constructor(config?: Partial<InstallationPluginConfig>);
15
+ beforeInstall(params: InstallationPluginParams): Promise<void>;
16
+ afterInstall(params: InstallationPluginParams): Promise<void>;
17
17
  private _execute;
18
18
  }
19
19
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -27,11 +27,13 @@ class InstallationPlugin extends _plugins.Plugin {
27
27
  }
28
28
 
29
29
  async _execute(callback, params) {
30
- if (typeof this._config[callback] !== "function") {
30
+ const cb = this._config[callback];
31
+
32
+ if (!cb) {
31
33
  return;
32
34
  }
33
35
 
34
- return this._config[callback](params);
36
+ return cb(params);
35
37
  }
36
38
 
37
39
  }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["InstallationPlugin","Plugin","constructor","config","_config","beforeInstall","params","_execute","afterInstall","callback","cb"],"sources":["InstallationPlugin.ts"],"sourcesContent":["import { FileManagerContext } from \"~/types\";\nimport { Plugin } from \"@webiny/plugins\";\n\nexport interface InstallationPluginParams {\n context: FileManagerContext;\n}\nexport type CallbackFunction<TParams> = (params: TParams) => Promise<void>;\n\ninterface InstallationPluginConfig {\n beforeInstall?: CallbackFunction<InstallationPluginParams>;\n afterInstall?: CallbackFunction<InstallationPluginParams>;\n}\n\nexport abstract class InstallationPlugin extends Plugin {\n public static override readonly type: string = \"fm.install\";\n private readonly _config: Partial<InstallationPluginConfig>;\n\n constructor(config?: Partial<InstallationPluginConfig>) {\n super();\n this._config = config || {};\n }\n\n public async beforeInstall(params: InstallationPluginParams): Promise<void> {\n return this._execute(\"beforeInstall\", params);\n }\n\n public async afterInstall(params: InstallationPluginParams): Promise<void> {\n return this._execute(\"afterInstall\", params);\n }\n\n private async _execute(\n callback: keyof InstallationPluginConfig,\n params: InstallationPluginParams\n ): Promise<void> {\n const cb = this._config[callback];\n if (!cb) {\n return;\n }\n return cb(params);\n }\n}\n"],"mappings":";;;;;;;;;;;AACA;;AAYO,MAAeA,kBAAf,SAA0CC,eAA1C,CAAiD;EAIpDC,WAAW,CAACC,MAAD,EAA6C;IACpD;IADoD;IAEpD,KAAKC,OAAL,GAAeD,MAAM,IAAI,EAAzB;EACH;;EAEyB,MAAbE,aAAa,CAACC,MAAD,EAAkD;IACxE,OAAO,KAAKC,QAAL,CAAc,eAAd,EAA+BD,MAA/B,CAAP;EACH;;EAEwB,MAAZE,YAAY,CAACF,MAAD,EAAkD;IACvE,OAAO,KAAKC,QAAL,CAAc,cAAd,EAA8BD,MAA9B,CAAP;EACH;;EAEqB,MAARC,QAAQ,CAClBE,QADkB,EAElBH,MAFkB,EAGL;IACb,MAAMI,EAAE,GAAG,KAAKN,OAAL,CAAaK,QAAb,CAAX;;IACA,IAAI,CAACC,EAAL,EAAS;MACL;IACH;;IACD,OAAOA,EAAE,CAACJ,MAAD,CAAT;EACH;;AA1BmD;;;8BAAlCN,kB,UAC6B,Y"}
@@ -1,9 +1,9 @@
1
1
  import { Plugin } from "@webiny/plugins";
2
2
  import { FileManagerContext, FileManagerSettingsStorageOperations } from "../../types";
3
- export interface Params {
4
- context: FileManagerContext;
3
+ export interface SettingsStorageOperationsProviderPluginParams<T = FileManagerContext> {
4
+ context: T;
5
5
  }
6
6
  export declare abstract class SettingsStorageOperationsProviderPlugin extends Plugin {
7
- static readonly type = "fm.storageOperationsProvider.settings";
8
- abstract provide(params: Params): Promise<FileManagerSettingsStorageOperations>;
7
+ static readonly type: string;
8
+ abstract provide(params: SettingsStorageOperationsProviderPluginParams): Promise<FileManagerSettingsStorageOperations>;
9
9
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SettingsStorageOperationsProviderPlugin","Plugin"],"sources":["SettingsStorageOperationsProviderPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { FileManagerContext, FileManagerSettingsStorageOperations } from \"~/types\";\n\nexport interface SettingsStorageOperationsProviderPluginParams<T = FileManagerContext> {\n context: T;\n}\n\nexport abstract class SettingsStorageOperationsProviderPlugin extends Plugin {\n public static override readonly type: string = \"fm.storageOperationsProvider.settings\";\n\n public abstract provide(\n params: SettingsStorageOperationsProviderPluginParams\n ): Promise<FileManagerSettingsStorageOperations>;\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAOO,MAAeA,uCAAf,SAA+DC,eAA/D,CAAsE;;;8BAAvDD,uC,UAC6B,uC"}
@@ -1,9 +1,9 @@
1
1
  import { Plugin } from "@webiny/plugins";
2
2
  import { FileManagerContext, FileManagerSystemStorageOperations } from "../../types";
3
- export interface Params {
4
- context: FileManagerContext;
3
+ export interface SystemStorageOperationsProviderPluginParams<T = FileManagerContext> {
4
+ context: T;
5
5
  }
6
6
  export declare abstract class SystemStorageOperationsProviderPlugin extends Plugin {
7
- static readonly type = "fm.storageOperationsProvider.system";
8
- abstract provide(params: Params): Promise<FileManagerSystemStorageOperations>;
7
+ static readonly type: string;
8
+ abstract provide(params: SystemStorageOperationsProviderPluginParams): Promise<FileManagerSystemStorageOperations>;
9
9
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SystemStorageOperationsProviderPlugin","Plugin"],"sources":["SystemStorageOperationsProviderPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { FileManagerContext, FileManagerSystemStorageOperations } from \"~/types\";\n\nexport interface SystemStorageOperationsProviderPluginParams<T = FileManagerContext> {\n context: T;\n}\n\nexport abstract class SystemStorageOperationsProviderPlugin extends Plugin {\n public static override readonly type: string = \"fm.storageOperationsProvider.system\";\n\n public abstract provide(\n params: SystemStorageOperationsProviderPluginParams\n ): Promise<FileManagerSystemStorageOperations>;\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAOO,MAAeA,qCAAf,SAA6DC,eAA7D,CAAoE;;;8BAArDD,qC,UAC6B,qC"}
@@ -8,6 +8,11 @@ exports.default = void 0;
8
8
  var _handlerGraphql = require("@webiny/handler-graphql");
9
9
 
10
10
  const emptyResolver = () => ({});
11
+ /**
12
+ * Use any because it really can be any.
13
+ * TODO @ts-refactor maybe use generics at some point?
14
+ */
15
+
11
16
 
12
17
  const resolve = async fn => {
13
18
  try {
@@ -60,6 +65,7 @@ const plugin = {
60
65
  code: String
61
66
  message: String
62
67
  data: JSON
68
+ stack: String
63
69
  }
64
70
 
65
71
  type FileListResponse {
@@ -99,11 +105,13 @@ const plugin = {
99
105
  type FileManagerSettings {
100
106
  uploadMinFileSize: Number
101
107
  uploadMaxFileSize: Number
108
+ srcPrefix: String
102
109
  }
103
110
 
104
111
  input FileManagerSettingsInput {
105
112
  uploadMinFileSize: Number
106
113
  uploadMaxFileSize: Number
114
+ srcPrefix: String
107
115
  }
108
116
 
109
117
  type FileManagerSettingsResponse {
@@ -118,8 +126,16 @@ const plugin = {
118
126
  tag: String
119
127
  tag_in: [String!]
120
128
  tag_and_in: [String!]
129
+ tag_startsWith: String
130
+ tag_not_startsWith: String
121
131
  id_in: [ID!]
122
132
  id: ID
133
+ createdBy: ID
134
+ }
135
+
136
+ input TagWhereInput {
137
+ tag_startsWith: String
138
+ tag_not_startsWith: String
123
139
  }
124
140
 
125
141
  type FmQuery {
@@ -135,7 +151,7 @@ const plugin = {
135
151
  where: FileWhereInput
136
152
  ): FileListResponse
137
153
 
138
- listTags: [String]
154
+ listTags(where: TagWhereInput): [String]
139
155
 
140
156
  # Get installed version
141
157
  version: String
@@ -178,7 +194,7 @@ const plugin = {
178
194
  File: {
179
195
  async src(file, _, context) {
180
196
  const settings = await context.fileManager.settings.getSettings();
181
- return settings.srcPrefix + file.key;
197
+ return ((settings === null || settings === void 0 ? void 0 : settings.srcPrefix) || "") + file.key;
182
198
  }
183
199
 
184
200
  },
@@ -212,12 +228,12 @@ const plugin = {
212
228
 
213
229
  async version(_, __, context) {
214
230
  const {
215
- i18nContent,
231
+ i18n,
216
232
  tenancy,
217
233
  fileManager
218
234
  } = context;
219
235
 
220
- if (!tenancy.getCurrentTenant() || !i18nContent.getLocale()) {
236
+ if (!tenancy.getCurrentTenant() || !i18n.getContentLocale()) {
221
237
  return null;
222
238
  }
223
239
 
@@ -0,0 +1 @@
1
+ {"version":3,"names":["emptyResolver","resolve","fn","Response","e","ErrorResponse","plugin","type","schema","typeDefs","resolvers","File","src","file","_","context","settings","fileManager","getSettings","srcPrefix","key","Query","Mutation","FmQuery","getFile","args","files","id","listFiles","data","meta","ListResponse","listTags","error","version","__","i18n","tenancy","getCurrentTenant","getContentLocale","system","getVersion","FmMutation","createFile","updateFile","createFiles","createFilesInBatch","deleteFile","storage","delete","install","upgrade","updateSettings"],"sources":["graphql.ts"],"sourcesContent":["import { Response, ErrorResponse, ListResponse } from \"@webiny/handler-graphql\";\nimport { FileManagerContext, FilesListOpts } from \"~/types\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/types\";\n\nconst emptyResolver = () => ({});\n\n/**\n * Use any because it really can be any.\n * TODO @ts-refactor maybe use generics at some point?\n */\ninterface ResolveCallable {\n (): Promise<any>;\n}\n\nconst resolve = async (fn: ResolveCallable) => {\n try {\n return new Response(await fn());\n } catch (e) {\n return new ErrorResponse(e);\n }\n};\n\nconst plugin: GraphQLSchemaPlugin<FileManagerContext> = {\n type: \"graphql-schema\",\n schema: {\n typeDefs: /* GraphQL */ `\n type FmCreatedBy {\n id: ID\n displayName: String\n }\n\n input FileInput {\n key: String\n name: String\n size: Int\n type: String\n tags: [String]\n meta: JSON\n }\n\n type UploadFileResponseDataFile {\n name: String\n type: String\n size: Int\n key: String\n }\n\n type UploadFileResponseData {\n # Contains data that is necessary for initiating a file upload.\n data: JSON\n file: UploadFileResponseDataFile\n }\n\n type FileListMeta {\n cursor: String\n totalCount: Int\n hasMoreItems: Boolean\n }\n\n type FileError {\n code: String\n message: String\n data: JSON\n stack: String\n }\n\n type FileListResponse {\n data: [File]\n meta: FileListMeta\n error: FileError\n }\n\n type FileResponse {\n data: File\n error: FileError\n }\n\n type CreateFilesResponse {\n data: [File]!\n error: FileError\n }\n\n type File {\n id: ID\n key: String\n name: String\n size: Int\n type: String\n src: String\n tags: [String]\n meta: JSON\n createdOn: DateTime\n createdBy: FmCreatedBy\n }\n\n type FileManagerBooleanResponse {\n data: Boolean\n error: FileError\n }\n\n type FileManagerSettings {\n uploadMinFileSize: Number\n uploadMaxFileSize: Number\n srcPrefix: String\n }\n\n input FileManagerSettingsInput {\n uploadMinFileSize: Number\n uploadMaxFileSize: Number\n srcPrefix: String\n }\n\n type FileManagerSettingsResponse {\n data: FileManagerSettings\n error: FileError\n }\n\n input FileWhereInput {\n search: String\n type: String\n type_in: [String!]\n tag: String\n tag_in: [String!]\n tag_and_in: [String!]\n tag_startsWith: String\n tag_not_startsWith: String\n id_in: [ID!]\n id: ID\n createdBy: ID\n }\n\n input TagWhereInput {\n tag_startsWith: String\n tag_not_startsWith: String\n }\n\n type FmQuery {\n getFile(id: ID, where: JSON, sort: String): FileResponse\n\n listFiles(\n limit: Int\n after: String\n types: [String]\n tags: [String]\n ids: [ID]\n search: String\n where: FileWhereInput\n ): FileListResponse\n\n listTags(where: TagWhereInput): [String]\n\n # Get installed version\n version: String\n\n getSettings: FileManagerSettingsResponse\n }\n\n type FilesDeleteResponse {\n data: Boolean\n error: FileError\n }\n\n type FmMutation {\n createFile(data: FileInput!): FileResponse\n createFiles(data: [FileInput]!): CreateFilesResponse\n updateFile(id: ID!, data: FileInput!): FileResponse\n deleteFile(id: ID!): FilesDeleteResponse\n\n # Install File manager\n install(srcPrefix: String): FileManagerBooleanResponse\n\n upgrade(version: String!): FileManagerBooleanResponse\n\n updateSettings(data: FileManagerSettingsInput): FileManagerSettingsResponse\n }\n\n input FilesInstallInput {\n srcPrefix: String!\n }\n\n extend type Query {\n fileManager: FmQuery\n }\n\n extend type Mutation {\n fileManager: FmMutation\n }\n `,\n resolvers: {\n File: {\n async src(file, _, context: FileManagerContext) {\n const settings = await context.fileManager.settings.getSettings();\n return (settings?.srcPrefix || \"\") + file.key;\n }\n },\n Query: {\n fileManager: emptyResolver\n },\n Mutation: {\n fileManager: emptyResolver\n },\n FmQuery: {\n getFile(_, args: any, context) {\n return resolve(() => context.fileManager.files.getFile(args.id));\n },\n async listFiles(_, args: FilesListOpts, context) {\n try {\n const [data, meta] = await context.fileManager.files.listFiles(args);\n return new ListResponse(data, meta);\n } catch (e) {\n return new ErrorResponse(e);\n }\n },\n async listTags(_, args: any, context) {\n try {\n return await context.fileManager.files.listTags(args || {});\n } catch (error) {\n return new ErrorResponse(error);\n }\n },\n async version(_, __, context) {\n const { i18n, tenancy, fileManager } = context;\n if (!tenancy.getCurrentTenant() || !i18n.getContentLocale()) {\n return null;\n }\n\n return await fileManager.system.getVersion();\n },\n async getSettings(_, __, context) {\n return resolve(() => context.fileManager.settings.getSettings());\n }\n },\n FmMutation: {\n async createFile(_, args: any, context) {\n return resolve(() => context.fileManager.files.createFile(args.data));\n },\n async updateFile(_, args: any, context) {\n return resolve(() => context.fileManager.files.updateFile(args.id, args.data));\n },\n async createFiles(_, args: any, context) {\n return resolve(() => context.fileManager.files.createFilesInBatch(args.data));\n },\n async deleteFile(_, args: any, context) {\n return resolve(async () => {\n const file = await context.fileManager.files.getFile(args.id);\n return await context.fileManager.storage.delete({\n id: file.id,\n key: file.key\n });\n });\n },\n async install(_, args: any, context) {\n return resolve(() =>\n context.fileManager.system.install({ srcPrefix: args.srcPrefix })\n );\n },\n async upgrade(_, args: any, context) {\n return resolve(() => context.fileManager.system.upgrade(args.version));\n },\n async updateSettings(_, args: any, context) {\n return resolve(() => context.fileManager.settings.updateSettings(args.data));\n }\n }\n }\n }\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;AAAA;;AAIA,MAAMA,aAAa,GAAG,OAAO,EAAP,CAAtB;AAEA;AACA;AACA;AACA;;;AAKA,MAAMC,OAAO,GAAG,MAAOC,EAAP,IAA+B;EAC3C,IAAI;IACA,OAAO,IAAIC,wBAAJ,CAAa,MAAMD,EAAE,EAArB,CAAP;EACH,CAFD,CAEE,OAAOE,CAAP,EAAU;IACR,OAAO,IAAIC,6BAAJ,CAAkBD,CAAlB,CAAP;EACH;AACJ,CAND;;AAQA,MAAME,MAA+C,GAAG;EACpDC,IAAI,EAAE,gBAD8C;EAEpDC,MAAM,EAAE;IACJC,QAAQ;IAAE;IAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAnKY;IAoKJC,SAAS,EAAE;MACPC,IAAI,EAAE;QACF,MAAM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"}
@@ -1,2 +1,2 @@
1
- declare const _default: () => (import("@webiny/handler-graphql/types").GraphQLSchemaPlugin<import("../types").FileManagerContext> | import("./definitions/FilePlugin").FilePlugin[] | import("@webiny/handler/plugins/ContextPlugin").ContextPlugin<import("../types").FileManagerContext>)[];
1
+ declare const _default: () => (import("@webiny/handler-graphql/types").GraphQLSchemaPlugin<import("../types").FileManagerContext> | import("./definitions/FilePlugin").FilePlugin[] | import("@webiny/api").ContextPlugin<import("../types").FileManagerContext>)[];
2
2
  export default _default;
package/plugins/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -0,0 +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,31 +1,30 @@
1
1
  /// <reference types="node" />
2
2
  import { FileManagerContext } from "../../types";
3
- export declare type Args = {
4
- name: string;
5
- type: string;
6
- size: number;
3
+ export declare type Result = Record<string, any>;
4
+ export interface FileStorageUploadParams {
7
5
  buffer: Buffer;
8
- keyPrefix?: string;
9
- hideInFileManager?: boolean;
6
+ hideInFileManager: boolean | string;
10
7
  tags?: string[];
11
- };
12
- export declare type Result = Record<string, any>;
13
- export interface FileStoragePlugin {
14
- upload: (args: Args) => Promise<Result>;
15
- delete: (args: {
16
- key: string;
17
- }) => Promise<void>;
8
+ size: number;
9
+ name: string;
10
+ keyPrefix: string;
11
+ type: string;
18
12
  }
19
- export declare class FileStorage {
20
- storagePlugin: FileStoragePlugin;
13
+ export interface FileStorageDeleteParams {
14
+ id: string;
15
+ key: string;
16
+ }
17
+ export interface FileStorageUploadMultipleParams {
18
+ files: FileStorageUploadParams[];
19
+ }
20
+ export interface FileStorageParams {
21
21
  context: FileManagerContext;
22
- constructor({ context }: {
23
- context: any;
24
- });
25
- upload(args: any): Promise<Result>;
26
- uploadFiles(args: any): Promise<import("../../types").File[]>;
27
- delete(args: {
28
- id: string;
29
- key: string;
30
- }): Promise<boolean>;
22
+ }
23
+ export declare class FileStorage {
24
+ private readonly storagePlugin;
25
+ private readonly context;
26
+ constructor({ context }: FileStorageParams);
27
+ upload(params: FileStorageUploadParams): Promise<Result>;
28
+ uploadFiles(params: FileStorageUploadMultipleParams): Promise<import("../../types").File[]>;
29
+ delete(params: FileStorageDeleteParams): Promise<boolean>;
31
30
  }
@@ -1,20 +1,18 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.FileStorage = void 0;
9
9
 
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
10
12
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
13
 
12
14
  var _error = _interopRequireDefault(require("@webiny/error"));
13
15
 
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
15
-
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
17
-
18
16
  const storagePluginType = "api-file-manager-storage";
19
17
 
20
18
  class FileStorage {
@@ -23,43 +21,53 @@ class FileStorage {
23
21
  }) {
24
22
  (0, _defineProperty2.default)(this, "storagePlugin", void 0);
25
23
  (0, _defineProperty2.default)(this, "context", void 0);
26
- this.storagePlugin = context.plugins.byType(storagePluginType).pop();
24
+ const storagePlugin = context.plugins.byType(storagePluginType).pop();
27
25
 
28
- if (!this.storagePlugin) {
26
+ if (!storagePlugin) {
29
27
  throw new _error.default(`Missing plugin of type "${storagePluginType}".`, "STORAGE_PLUGIN_ERROR");
30
28
  }
31
29
 
30
+ this.storagePlugin = storagePlugin;
32
31
  this.context = context;
33
32
  }
34
33
 
35
- async upload(args) {
36
- const settings = await this.context.fileManager.settings.getSettings(); // Add file to cloud storage.
34
+ async upload(params) {
35
+ const settings = await this.context.fileManager.settings.getSettings();
36
+
37
+ if (!settings) {
38
+ throw new _error.default("Missing File Manager Settings.", "FILE_MANAGER_ERROR");
39
+ } // Add file to cloud storage.
40
+
37
41
 
38
42
  const {
39
43
  file: fileData
40
- } = await this.storagePlugin.upload(_objectSpread(_objectSpread({}, args), {}, {
44
+ } = await this.storagePlugin.upload((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
41
45
  settings
42
46
  }));
43
47
  const {
44
48
  fileManager
45
49
  } = this.context; // Save file in DB.
46
50
 
47
- return await fileManager.files.createFile(_objectSpread(_objectSpread({}, fileData), {}, {
51
+ return await fileManager.files.createFile((0, _objectSpread2.default)((0, _objectSpread2.default)({}, fileData), {}, {
48
52
  meta: {
49
- private: Boolean(args.hideInFileManager)
53
+ private: Boolean(params.hideInFileManager)
50
54
  },
51
- tags: Array.isArray(args.tags) ? args.tags : []
55
+ tags: Array.isArray(params.tags) ? params.tags : []
52
56
  }));
53
57
  }
54
58
 
55
- async uploadFiles(args) {
56
- const settings = await this.context.fileManager.settings.getSettings(); // Upload files to cloud storage.
59
+ async uploadFiles(params) {
60
+ const settings = await this.context.fileManager.settings.getSettings();
61
+
62
+ if (!settings) {
63
+ throw new _error.default("Missing File Manager Settings.", "FILE_MANAGER_ERROR");
64
+ } // Upload files to cloud storage.
65
+
57
66
 
58
67
  const promises = [];
59
68
 
60
- for (let i = 0; i < args.files.length; i++) {
61
- const item = args.files[i];
62
- promises.push(this.storagePlugin.upload(_objectSpread(_objectSpread({}, item), {}, {
69
+ for (const item of params.files) {
70
+ promises.push(this.storagePlugin.upload((0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
63
71
  settings
64
72
  })));
65
73
  } // Wait for all to resolve.
@@ -74,11 +82,11 @@ class FileStorage {
74
82
  return fileManager.files.createFilesInBatch(filesData);
75
83
  }
76
84
 
77
- async delete(args) {
85
+ async delete(params) {
78
86
  const {
79
87
  id,
80
88
  key
81
- } = args;
89
+ } = params;
82
90
  const {
83
91
  fileManager
84
92
  } = this.context; // Delete file from cloud storage.
@@ -0,0 +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,IAAkB,KAAKT,OAA7B,CAX2D,CAa3D;;IACA,OAAO,MAAMS,WAAW,CAACI,KAAZ,CAAkBC,UAAlB,6DACLF,QADK;MAETG,IAAI,EAAE;QACFC,OAAO,EAAEC,OAAO,CAACV,MAAM,CAACW,iBAAR;MADd,CAFG;MAKTC,IAAI,EAAEC,KAAK,CAACC,OAAN,CAAcd,MAAM,CAACY,IAArB,IAA6BZ,MAAM,CAACY,IAApC,GAA2C;IALxC,GAAb;EAOH;;EAEgB,MAAXG,WAAW,CAACf,MAAD,EAA0C;IACvD,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,CAJsD,CAKvD;;;IACA,MAAMkB,QAAQ,GAAG,EAAjB;;IACA,KAAK,MAAMC,IAAX,IAAmBjB,MAAM,CAACM,KAA1B,EAAiC;MAC7BU,QAAQ,CAACE,IAAT,CACI,KAAKxB,aAAL,CAAmBK,MAAnB,6DACOkB,IADP;QAEIhB;MAFJ,GADJ;IAMH,CAdsD,CAevD;;;IACA,MAAMkB,mBAAmB,GAAG,MAAMC,OAAO,CAACC,GAAR,CAAYL,QAAZ,CAAlC;IAEA,MAAMM,SAAS,GAAGH,mBAAmB,CAACI,GAApB,CAAwBC,QAAQ,IAAIA,QAAQ,CAACpB,IAA7C,CAAlB;IAEA,MAAM;MAAEF;IAAF,IAAkB,KAAKT,OAA7B,CApBuD,CAqBvD;;IACA,OAAOS,WAAW,CAACI,KAAZ,CAAkBmB,kBAAlB,CAAqCH,SAArC,CAAP;EACH;;EAEW,MAANI,MAAM,CAAC1B,MAAD,EAAkC;IAC1C,MAAM;MAAE2B,EAAF;MAAMC;IAAN,IAAc5B,MAApB;IACA,MAAM;MAAEE;IAAF,IAAkB,KAAKT,OAA7B,CAF0C,CAG1C;;IACA,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,4 +1,4 @@
1
1
  import { FileManagerContext } from "../../types";
2
- import { ContextPlugin } from "@webiny/handler/plugins/ContextPlugin";
2
+ import { ContextPlugin } from "@webiny/api";
3
3
  declare const fileStorageContextPlugin: ContextPlugin<FileManagerContext>;
4
4
  export default fileStorageContextPlugin;