@webiny/api-file-manager 0.0.0-mt-1

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 (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +17 -0
  3. package/handlers/download/index.d.ts +3 -0
  4. package/handlers/download/index.js +125 -0
  5. package/handlers/manage/index.d.ts +3 -0
  6. package/handlers/manage/index.js +70 -0
  7. package/handlers/transform/index.d.ts +3 -0
  8. package/handlers/transform/index.js +96 -0
  9. package/handlers/transform/loaders/imageLoader.d.ts +13 -0
  10. package/handlers/transform/loaders/imageLoader.js +106 -0
  11. package/handlers/transform/loaders/index.d.ts +13 -0
  12. package/handlers/transform/loaders/index.js +13 -0
  13. package/handlers/transform/loaders/sanitizeImageTransformations.d.ts +7 -0
  14. package/handlers/transform/loaders/sanitizeImageTransformations.js +51 -0
  15. package/handlers/transform/managers/imageManager.d.ts +9 -0
  16. package/handlers/transform/managers/imageManager.js +55 -0
  17. package/handlers/transform/managers/index.d.ts +9 -0
  18. package/handlers/transform/managers/index.js +13 -0
  19. package/handlers/transform/optimizeImage.d.ts +2 -0
  20. package/handlers/transform/optimizeImage.js +45 -0
  21. package/handlers/transform/transformImage.d.ts +9 -0
  22. package/handlers/transform/transformImage.js +30 -0
  23. package/handlers/transform/utils.d.ts +12 -0
  24. package/handlers/transform/utils.js +46 -0
  25. package/handlers/utils/createHandler.d.ts +24 -0
  26. package/handlers/utils/createHandler.js +68 -0
  27. package/handlers/utils/getEnvironment.d.ts +5 -0
  28. package/handlers/utils/getEnvironment.js +13 -0
  29. package/handlers/utils/getObjectParams.d.ts +10 -0
  30. package/handlers/utils/getObjectParams.js +27 -0
  31. package/handlers/utils/index.d.ts +3 -0
  32. package/handlers/utils/index.js +31 -0
  33. package/package.json +75 -0
  34. package/plugins/crud/files/validation.d.ts +3 -0
  35. package/plugins/crud/files/validation.js +41 -0
  36. package/plugins/crud/files.crud.d.ts +4 -0
  37. package/plugins/crud/files.crud.js +427 -0
  38. package/plugins/crud/settings.crud.d.ts +5 -0
  39. package/plugins/crud/settings.crud.js +115 -0
  40. package/plugins/crud/system.crud.d.ts +4 -0
  41. package/plugins/crud/system.crud.js +145 -0
  42. package/plugins/crud/utils/checkBasePermissions.d.ts +5 -0
  43. package/plugins/crud/utils/checkBasePermissions.js +33 -0
  44. package/plugins/crud/utils/createFileModel.d.ts +2 -0
  45. package/plugins/crud/utils/createFileModel.js +64 -0
  46. package/plugins/crud/utils/lifecycleEvents.d.ts +6 -0
  47. package/plugins/crud/utils/lifecycleEvents.js +33 -0
  48. package/plugins/definitions/FilePhysicalStoragePlugin.d.ts +22 -0
  49. package/plugins/definitions/FilePhysicalStoragePlugin.js +42 -0
  50. package/plugins/definitions/FilePlugin.d.ts +133 -0
  51. package/plugins/definitions/FilePlugin.js +64 -0
  52. package/plugins/definitions/FileStorageTransformPlugin.d.ts +34 -0
  53. package/plugins/definitions/FileStorageTransformPlugin.js +51 -0
  54. package/plugins/definitions/FilesStorageOperationsProviderPlugin.d.ts +9 -0
  55. package/plugins/definitions/FilesStorageOperationsProviderPlugin.js +17 -0
  56. package/plugins/definitions/InstallationPlugin.d.ts +19 -0
  57. package/plugins/definitions/InstallationPlugin.js +40 -0
  58. package/plugins/definitions/SettingsStorageOperationsProviderPlugin.d.ts +9 -0
  59. package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js +17 -0
  60. package/plugins/definitions/SystemStorageOperationsProviderPlugin.d.ts +9 -0
  61. package/plugins/definitions/SystemStorageOperationsProviderPlugin.js +17 -0
  62. package/plugins/graphql.d.ts +4 -0
  63. package/plugins/graphql.js +274 -0
  64. package/plugins/index.d.ts +2 -0
  65. package/plugins/index.js +24 -0
  66. package/plugins/storage/FileStorage.d.ts +31 -0
  67. package/plugins/storage/FileStorage.js +95 -0
  68. package/plugins/storage/index.d.ts +4 -0
  69. package/plugins/storage/index.js +22 -0
  70. package/types.d.ts +357 -0
  71. package/types.js +5 -0
  72. package/utils.d.ts +4 -0
  73. package/utils.js +16 -0
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _apiSecurity = require("@webiny/api-security");
9
+
10
+ var _default = async (context, check = {}) => {
11
+ await context.i18nContent.checkI18NContentPermission();
12
+ const filePermission = await context.security.getPermission("fm.file");
13
+
14
+ if (!filePermission) {
15
+ throw new _apiSecurity.NotAuthorizedError();
16
+ }
17
+
18
+ if (check.rwd && !hasRwd(filePermission, check.rwd)) {
19
+ throw new _apiSecurity.NotAuthorizedError();
20
+ }
21
+
22
+ return filePermission;
23
+ };
24
+
25
+ exports.default = _default;
26
+
27
+ const hasRwd = (filesFilePermission, rwd) => {
28
+ if (typeof filesFilePermission.rwd !== "string") {
29
+ return true;
30
+ }
31
+
32
+ return filesFilePermission.rwd.includes(rwd);
33
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: (create?: boolean) => any;
2
+ export default _default;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _fields = require("@commodo/fields");
9
+
10
+ var _commodoFieldsObject = require("commodo-fields-object");
11
+
12
+ var _validation = require("@webiny/validation");
13
+
14
+ var _default = (create = true) => {
15
+ return (0, _fields.withFields)({
16
+ key: (0, _fields.string)({
17
+ validation: _validation.validation.create(`${create ? "required," : ""}maxLength:1000`)
18
+ }),
19
+ name: (0, _fields.string)({
20
+ validation: _validation.validation.create("maxLength:1000")
21
+ }),
22
+ size: (0, _fields.number)(),
23
+ type: (0, _fields.string)({
24
+ validation: _validation.validation.create("maxLength:255")
25
+ }),
26
+ meta: (0, _commodoFieldsObject.object)({
27
+ value: {
28
+ private: false
29
+ }
30
+ }),
31
+ tags: (0, _fields.onSet)(value => {
32
+ if (!Array.isArray(value)) {
33
+ return null;
34
+ }
35
+
36
+ return value.map(item => item.toLowerCase());
37
+ })((0, _fields.string)({
38
+ list: true,
39
+ validation: tags => {
40
+ if (!Array.isArray(tags)) {
41
+ return;
42
+ }
43
+
44
+ if (tags.length > 15) {
45
+ throw Error("You cannot set more than 15 tags.");
46
+ }
47
+
48
+ for (let i = 0; i < tags.length; i++) {
49
+ const tag = tags[i];
50
+
51
+ if (typeof tag !== "string") {
52
+ throw Error("Tag must be typeof string.");
53
+ }
54
+
55
+ if (tag.length > 50) {
56
+ throw Error(`Tag ${tag} is more than 50 characters long.`);
57
+ }
58
+ }
59
+ }
60
+ }))
61
+ })();
62
+ };
63
+
64
+ exports.default = _default;
@@ -0,0 +1,6 @@
1
+ import { FilePlugin } from "../../definitions/FilePlugin";
2
+ import { FileManagerContext } from "../../../types";
3
+ export declare const runLifecycleEvent: (hook: string, params: {
4
+ context: FileManagerContext;
5
+ plugins: FilePlugin[];
6
+ } & Record<string, any>) => Promise<void>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.runLifecycleEvent = void 0;
9
+
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+
12
+ const _excluded = ["plugins"];
13
+
14
+ const runLifecycleEvent = async (hook, params) => {
15
+ const {
16
+ plugins
17
+ } = params,
18
+ rest = (0, _objectWithoutProperties2.default)(params, _excluded);
19
+
20
+ if (plugins.length === 0) {
21
+ return;
22
+ }
23
+
24
+ for (const plugin of plugins) {
25
+ if (!plugin[hook]) {
26
+ continue;
27
+ }
28
+
29
+ await plugin[hook](rest);
30
+ }
31
+ };
32
+
33
+ exports.runLifecycleEvent = runLifecycleEvent;
@@ -0,0 +1,22 @@
1
+ /// <reference types="node" />
2
+ import { Plugin } from "@webiny/plugins";
3
+ import { FileManagerSettings } from "../../types";
4
+ export interface Params {
5
+ upload: (args: UploadParams) => Promise<any>;
6
+ delete: (args: DeleteParams) => Promise<void>;
7
+ }
8
+ export interface UploadParams {
9
+ settings: FileManagerSettings;
10
+ buffer: Buffer;
11
+ [key: string]: any;
12
+ }
13
+ export interface DeleteParams {
14
+ key: string;
15
+ }
16
+ export declare class FilePhysicalStoragePlugin extends Plugin {
17
+ static readonly type = "api-file-manager-storage";
18
+ private readonly _params;
19
+ constructor(params: Params);
20
+ upload(params: UploadParams): Promise<any>;
21
+ delete(params: DeleteParams): Promise<any>;
22
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.FilePhysicalStoragePlugin = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _plugins = require("@webiny/plugins");
13
+
14
+ var _error = _interopRequireDefault(require("@webiny/error"));
15
+
16
+ class FilePhysicalStoragePlugin extends _plugins.Plugin {
17
+ constructor(params) {
18
+ super();
19
+ (0, _defineProperty2.default)(this, "_params", void 0);
20
+ this._params = params;
21
+ }
22
+
23
+ async upload(params) {
24
+ if (!this._params.upload) {
25
+ throw new _error.default(`You must define the "upload" method of this plugin.`, "UPLOAD_METHOD_ERROR");
26
+ }
27
+
28
+ return this._params.upload(params);
29
+ }
30
+
31
+ async delete(params) {
32
+ if (!this._params.delete) {
33
+ throw new _error.default(`You must define the "delete" method of this plugin.`, "DELETE_METHOD_ERROR");
34
+ }
35
+
36
+ return this._params.delete(params);
37
+ }
38
+
39
+ }
40
+
41
+ exports.FilePhysicalStoragePlugin = FilePhysicalStoragePlugin;
42
+ (0, _defineProperty2.default)(FilePhysicalStoragePlugin, "type", "api-file-manager-storage");
@@ -0,0 +1,133 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import { File, FileManagerContext } from "../../types";
3
+ /**
4
+ * Parameters for beforeCreate lifecycle.
5
+ */
6
+ export interface BeforeCreateParams {
7
+ context: FileManagerContext;
8
+ /**
9
+ * Data to be inserted into the storage.
10
+ */
11
+ data: File;
12
+ }
13
+ /**
14
+ * Parameters for afterCreate lifecycle.
15
+ */
16
+ export interface AfterCreateParams {
17
+ context: FileManagerContext;
18
+ /**
19
+ * Data that was inserted into the storage.
20
+ */
21
+ data: File;
22
+ /**
23
+ * Result of the storage operations create method.
24
+ * Possibly changed something on the "data".
25
+ */
26
+ file: File;
27
+ }
28
+ /**
29
+ * Parameters for beforeUpdate lifecycle.
30
+ */
31
+ export interface BeforeUpdateParams {
32
+ context: FileManagerContext;
33
+ /**
34
+ * Original file from the storage.
35
+ */
36
+ original: File;
37
+ /**
38
+ * Data to be updated to the storage.
39
+ */
40
+ data: File;
41
+ }
42
+ /**
43
+ * Parameters for afterUpdate lifecycle.
44
+ */
45
+ export interface AfterUpdateParams {
46
+ context: FileManagerContext;
47
+ /**
48
+ * Original file from the storage.
49
+ */
50
+ original: File;
51
+ /**
52
+ * Data that was updated in the storage.
53
+ */
54
+ data: File;
55
+ /**
56
+ * Result of the storage operations update method.
57
+ * Possibly changed something on the "data".
58
+ */
59
+ file: File;
60
+ }
61
+ /**
62
+ * Parameters for beforeBatchCreate lifecycle.
63
+ */
64
+ export interface BeforeBatchCreateParams {
65
+ context: FileManagerContext;
66
+ /**
67
+ * Files to be inserted into the storage.
68
+ */
69
+ data: File[];
70
+ }
71
+ /**
72
+ * Parameters for afterBatchCreate lifecycle.
73
+ */
74
+ export interface AfterBatchCreateParams {
75
+ context: FileManagerContext;
76
+ /**
77
+ * Files that were inserted into the storage.
78
+ */
79
+ data: File[];
80
+ /**
81
+ * Results of the insert.
82
+ */
83
+ files: File[];
84
+ }
85
+ /**
86
+ * Parameters for beforeDelete lifecycle.
87
+ */
88
+ export interface BeforeDeleteParams {
89
+ context: FileManagerContext;
90
+ /**
91
+ * File to be deleted from the storage.
92
+ */
93
+ file: File;
94
+ }
95
+ /**
96
+ * Parameters for afterDelete lifecycle.
97
+ */
98
+ export interface AfterDeleteParams {
99
+ context: FileManagerContext;
100
+ /**
101
+ * File that was deleted from the storage.
102
+ */
103
+ file: File;
104
+ }
105
+ /**
106
+ * Definition for the constructor parameters of the FilePlugin.
107
+ *
108
+ * @category FilePlugin
109
+ */
110
+ export interface Params {
111
+ beforeCreate?: (params: BeforeCreateParams) => Promise<void>;
112
+ afterCreate?: (params: AfterCreateParams) => Promise<void>;
113
+ beforeUpdate?: (params: BeforeUpdateParams) => Promise<void>;
114
+ afterUpdate?: (params: AfterUpdateParams) => Promise<void>;
115
+ beforeBatchCreate?: (params: BeforeBatchCreateParams) => Promise<void>;
116
+ afterBatchCreate?: (params: AfterBatchCreateParams) => Promise<void>;
117
+ beforeDelete?: (params: BeforeDeleteParams) => Promise<void>;
118
+ afterDelete?: (params: AfterDeleteParams) => Promise<void>;
119
+ }
120
+ export declare class FilePlugin extends Plugin {
121
+ static readonly type = "fm.file";
122
+ private readonly _params;
123
+ constructor(params?: Params);
124
+ beforeCreate(params: BeforeCreateParams): Promise<void>;
125
+ afterCreate(params: AfterCreateParams): Promise<void>;
126
+ beforeUpdate(params: BeforeUpdateParams): Promise<void>;
127
+ afterUpdate(params: AfterUpdateParams): Promise<void>;
128
+ beforeBatchCreate(params: BeforeBatchCreateParams): Promise<void>;
129
+ afterBatchCreate(params: AfterBatchCreateParams): Promise<void>;
130
+ beforeDelete(params: BeforeDeleteParams): Promise<void>;
131
+ afterDelete(params: AfterDeleteParams): Promise<void>;
132
+ private _execute;
133
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.FilePlugin = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _plugins = require("@webiny/plugins");
13
+
14
+ class FilePlugin extends _plugins.Plugin {
15
+ constructor(params) {
16
+ super();
17
+ (0, _defineProperty2.default)(this, "_params", void 0);
18
+ this._params = params || {};
19
+ }
20
+
21
+ async beforeCreate(params) {
22
+ await this._execute("beforeCreate", params);
23
+ }
24
+
25
+ async afterCreate(params) {
26
+ await this._execute("afterCreate", params);
27
+ }
28
+
29
+ async beforeUpdate(params) {
30
+ await this._execute("beforeUpdate", params);
31
+ }
32
+
33
+ async afterUpdate(params) {
34
+ await this._execute("afterUpdate", params);
35
+ }
36
+
37
+ async beforeBatchCreate(params) {
38
+ await this._execute("beforeBatchCreate", params);
39
+ }
40
+
41
+ async afterBatchCreate(params) {
42
+ await this._execute("afterBatchCreate", params);
43
+ }
44
+
45
+ async beforeDelete(params) {
46
+ await this._execute("beforeDelete", params);
47
+ }
48
+
49
+ async afterDelete(params) {
50
+ await this._execute("afterDelete", params);
51
+ }
52
+
53
+ async _execute(callback, params) {
54
+ if (typeof this._params[callback] !== "function") {
55
+ return;
56
+ }
57
+
58
+ await this._params[callback](params);
59
+ }
60
+
61
+ }
62
+
63
+ exports.FilePlugin = FilePlugin;
64
+ (0, _defineProperty2.default)(FilePlugin, "type", "fm.file");
@@ -0,0 +1,34 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import { File } from "../../types";
3
+ export interface ToParams {
4
+ /**
5
+ * File that is being sent to the storage operations method.
6
+ */
7
+ file: File & Record<string, any>;
8
+ }
9
+ export interface FromParams {
10
+ /**
11
+ * File that was fetched from the storage operations method.
12
+ */
13
+ file: File & Record<string, any>;
14
+ }
15
+ export interface Params {
16
+ toStorage?: (params: ToParams) => Promise<File & Record<string, any>>;
17
+ fromStorage?: (params: FromParams) => Promise<File & Record<string, any>>;
18
+ }
19
+ export declare class FileStorageTransformPlugin extends Plugin {
20
+ static readonly type = "fm.files.storage.transform";
21
+ private readonly _params;
22
+ constructor(params: Params);
23
+ /**
24
+ * Transform the file value into something that can be stored.
25
+ * Be aware that you must return the whole file object.
26
+ */
27
+ toStorage(params: ToParams): Promise<File & Record<string, any>>;
28
+ /**
29
+ * Transform the file value from the storage type to one required by our system.
30
+ * Be aware that you must return the whole file object.
31
+ * This method MUST reverse what ever toStorage method changed on the file object.
32
+ */
33
+ fromStorage(params: FromParams): Promise<File & Record<string, any>>;
34
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.FileStorageTransformPlugin = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _plugins = require("@webiny/plugins");
13
+
14
+ class FileStorageTransformPlugin extends _plugins.Plugin {
15
+ constructor(params) {
16
+ super();
17
+ (0, _defineProperty2.default)(this, "_params", void 0);
18
+ this._params = params;
19
+ }
20
+ /**
21
+ * Transform the file value into something that can be stored.
22
+ * Be aware that you must return the whole file object.
23
+ */
24
+
25
+
26
+ async toStorage(params) {
27
+ if (!this._params.toStorage) {
28
+ return params.file;
29
+ }
30
+
31
+ return this._params.toStorage(params);
32
+ }
33
+ /**
34
+ * Transform the file value from the storage type to one required by our system.
35
+ * Be aware that you must return the whole file object.
36
+ * This method MUST reverse what ever toStorage method changed on the file object.
37
+ */
38
+
39
+
40
+ async fromStorage(params) {
41
+ if (!this._params.fromStorage) {
42
+ return params.file;
43
+ }
44
+
45
+ return this._params.fromStorage(params);
46
+ }
47
+
48
+ }
49
+
50
+ exports.FileStorageTransformPlugin = FileStorageTransformPlugin;
51
+ (0, _defineProperty2.default)(FileStorageTransformPlugin, "type", "fm.files.storage.transform");
@@ -0,0 +1,9 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import { FileManagerContext, FileManagerFilesStorageOperations } from "../../types";
3
+ export interface Params {
4
+ context: FileManagerContext;
5
+ }
6
+ export declare abstract class FilesStorageOperationsProviderPlugin extends Plugin {
7
+ static readonly type = "fm.storageOperationsProvider.files";
8
+ abstract provide(params: Params): Promise<FileManagerFilesStorageOperations>;
9
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.FilesStorageOperationsProviderPlugin = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _plugins = require("@webiny/plugins");
13
+
14
+ class FilesStorageOperationsProviderPlugin extends _plugins.Plugin {}
15
+
16
+ exports.FilesStorageOperationsProviderPlugin = FilesStorageOperationsProviderPlugin;
17
+ (0, _defineProperty2.default)(FilesStorageOperationsProviderPlugin, "type", "fm.storageOperationsProvider.files");
@@ -0,0 +1,19 @@
1
+ import { FileManagerContext } from "../../types";
2
+ import { Plugin } from "@webiny/plugins";
3
+ export declare type CallbackFunction<TParams> = (params: TParams) => Promise<void>;
4
+ export interface Params {
5
+ context: FileManagerContext;
6
+ }
7
+ interface Config {
8
+ beforeInstall?: CallbackFunction<Params>;
9
+ afterInstall?: CallbackFunction<Params>;
10
+ }
11
+ export declare abstract class InstallationPlugin extends Plugin {
12
+ static readonly type = "fm.install";
13
+ private readonly _config;
14
+ constructor(config?: Partial<Config>);
15
+ beforeInstall(params: Params): Promise<void>;
16
+ afterInstall(params: Params): Promise<void>;
17
+ private _execute;
18
+ }
19
+ export {};
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.InstallationPlugin = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _plugins = require("@webiny/plugins");
13
+
14
+ class InstallationPlugin extends _plugins.Plugin {
15
+ constructor(config) {
16
+ super();
17
+ (0, _defineProperty2.default)(this, "_config", void 0);
18
+ this._config = config || {};
19
+ }
20
+
21
+ async beforeInstall(params) {
22
+ return this._execute("beforeInstall", params);
23
+ }
24
+
25
+ async afterInstall(params) {
26
+ return this._execute("afterInstall", params);
27
+ }
28
+
29
+ async _execute(callback, params) {
30
+ if (typeof this._config[callback] !== "function") {
31
+ return;
32
+ }
33
+
34
+ return this._config[callback](params);
35
+ }
36
+
37
+ }
38
+
39
+ exports.InstallationPlugin = InstallationPlugin;
40
+ (0, _defineProperty2.default)(InstallationPlugin, "type", "fm.install");
@@ -0,0 +1,9 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import { FileManagerContext, FileManagerSettingsStorageOperations } from "../../types";
3
+ export interface Params {
4
+ context: FileManagerContext;
5
+ }
6
+ export declare abstract class SettingsStorageOperationsProviderPlugin extends Plugin {
7
+ static readonly type = "fm.storageOperationsProvider.settings";
8
+ abstract provide(params: Params): Promise<FileManagerSettingsStorageOperations>;
9
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.SettingsStorageOperationsProviderPlugin = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _plugins = require("@webiny/plugins");
13
+
14
+ class SettingsStorageOperationsProviderPlugin extends _plugins.Plugin {}
15
+
16
+ exports.SettingsStorageOperationsProviderPlugin = SettingsStorageOperationsProviderPlugin;
17
+ (0, _defineProperty2.default)(SettingsStorageOperationsProviderPlugin, "type", "fm.storageOperationsProvider.settings");
@@ -0,0 +1,9 @@
1
+ import { Plugin } from "@webiny/plugins";
2
+ import { FileManagerContext, FileManagerSystemStorageOperations } from "../../types";
3
+ export interface Params {
4
+ context: FileManagerContext;
5
+ }
6
+ export declare abstract class SystemStorageOperationsProviderPlugin extends Plugin {
7
+ static readonly type = "fm.storageOperationsProvider.system";
8
+ abstract provide(params: Params): Promise<FileManagerSystemStorageOperations>;
9
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.SystemStorageOperationsProviderPlugin = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _plugins = require("@webiny/plugins");
13
+
14
+ class SystemStorageOperationsProviderPlugin extends _plugins.Plugin {}
15
+
16
+ exports.SystemStorageOperationsProviderPlugin = SystemStorageOperationsProviderPlugin;
17
+ (0, _defineProperty2.default)(SystemStorageOperationsProviderPlugin, "type", "fm.storageOperationsProvider.system");
@@ -0,0 +1,4 @@
1
+ import { FileManagerContext } from "../types";
2
+ import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/types";
3
+ declare const plugin: GraphQLSchemaPlugin<FileManagerContext>;
4
+ export default plugin;