@webiny/api-file-manager 0.0.0-ee-vpcs.549378cf03
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.
- package/LICENSE +21 -0
- package/README.md +17 -0
- package/handlers/download/index.d.ts +3 -0
- package/handlers/download/index.js +132 -0
- package/handlers/download/index.js.map +1 -0
- package/handlers/manage/index.d.ts +5 -0
- package/handlers/manage/index.js +71 -0
- package/handlers/manage/index.js.map +1 -0
- package/handlers/transform/index.d.ts +2 -0
- package/handlers/transform/index.js +91 -0
- package/handlers/transform/index.js.map +1 -0
- package/handlers/transform/loaders/imageLoader.d.ts +30 -0
- package/handlers/transform/loaders/imageLoader.js +105 -0
- package/handlers/transform/loaders/imageLoader.js.map +1 -0
- package/handlers/transform/loaders/index.d.ts +8 -0
- package/handlers/transform/loaders/index.js +13 -0
- package/handlers/transform/loaders/index.js.map +1 -0
- package/handlers/transform/loaders/sanitizeImageTransformations.d.ts +11 -0
- package/handlers/transform/loaders/sanitizeImageTransformations.js +58 -0
- package/handlers/transform/loaders/sanitizeImageTransformations.js.map +1 -0
- package/handlers/transform/managers/imageManager.d.ts +15 -0
- package/handlers/transform/managers/imageManager.js +63 -0
- package/handlers/transform/managers/imageManager.js.map +1 -0
- package/handlers/transform/managers/index.d.ts +5 -0
- package/handlers/transform/managers/index.js +13 -0
- package/handlers/transform/managers/index.js.map +1 -0
- package/handlers/transform/optimizeImage.d.ts +3 -0
- package/handlers/transform/optimizeImage.js +48 -0
- package/handlers/transform/optimizeImage.js.map +1 -0
- package/handlers/transform/transformImage.d.ts +10 -0
- package/handlers/transform/transformImage.js +30 -0
- package/handlers/transform/transformImage.js.map +1 -0
- package/handlers/transform/utils.d.ts +12 -0
- package/handlers/transform/utils.js +46 -0
- package/handlers/transform/utils.js.map +1 -0
- package/handlers/types.d.ts +8 -0
- package/handlers/types.js +5 -0
- package/handlers/types.js.map +1 -0
- package/handlers/utils/getEnvironment.d.ts +5 -0
- package/handlers/utils/getEnvironment.js +13 -0
- package/handlers/utils/getEnvironment.js.map +1 -0
- package/handlers/utils/getObjectParams.d.ts +9 -0
- package/handlers/utils/getObjectParams.js +25 -0
- package/handlers/utils/getObjectParams.js.map +1 -0
- package/handlers/utils/index.d.ts +2 -0
- package/handlers/utils/index.js +23 -0
- package/handlers/utils/index.js.map +1 -0
- package/package.json +76 -0
- package/plugins/crud/files/validation.d.ts +3 -0
- package/plugins/crud/files/validation.js +41 -0
- package/plugins/crud/files/validation.js.map +1 -0
- package/plugins/crud/files.crud.d.ts +4 -0
- package/plugins/crud/files.crud.js +431 -0
- package/plugins/crud/files.crud.js.map +1 -0
- package/plugins/crud/settings.crud.d.ts +5 -0
- package/plugins/crud/settings.crud.js +116 -0
- package/plugins/crud/settings.crud.js.map +1 -0
- package/plugins/crud/system.crud.d.ts +4 -0
- package/plugins/crud/system.crud.js +153 -0
- package/plugins/crud/system.crud.js.map +1 -0
- package/plugins/crud/utils/checkBasePermissions.d.ts +5 -0
- package/plugins/crud/utils/checkBasePermissions.js +33 -0
- package/plugins/crud/utils/checkBasePermissions.js.map +1 -0
- package/plugins/crud/utils/createFileModel.d.ts +5 -0
- package/plugins/crud/utils/createFileModel.js +77 -0
- package/plugins/crud/utils/createFileModel.js.map +1 -0
- package/plugins/crud/utils/lifecycleEvents.d.ts +6 -0
- package/plugins/crud/utils/lifecycleEvents.js +38 -0
- package/plugins/crud/utils/lifecycleEvents.js.map +1 -0
- package/plugins/definitions/FilePhysicalStoragePlugin.d.ts +21 -0
- package/plugins/definitions/FilePhysicalStoragePlugin.js +42 -0
- package/plugins/definitions/FilePhysicalStoragePlugin.js.map +1 -0
- package/plugins/definitions/FilePlugin.d.ts +136 -0
- package/plugins/definitions/FilePlugin.js +70 -0
- package/plugins/definitions/FilePlugin.js.map +1 -0
- package/plugins/definitions/FileStorageTransformPlugin.d.ts +34 -0
- package/plugins/definitions/FileStorageTransformPlugin.js +51 -0
- package/plugins/definitions/FileStorageTransformPlugin.js.map +1 -0
- package/plugins/definitions/FilesStorageOperationsProviderPlugin.d.ts +9 -0
- package/plugins/definitions/FilesStorageOperationsProviderPlugin.js +17 -0
- package/plugins/definitions/FilesStorageOperationsProviderPlugin.js.map +1 -0
- package/plugins/definitions/InstallationPlugin.d.ts +19 -0
- package/plugins/definitions/InstallationPlugin.js +42 -0
- package/plugins/definitions/InstallationPlugin.js.map +1 -0
- package/plugins/definitions/SettingsStorageOperationsProviderPlugin.d.ts +9 -0
- package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js +17 -0
- package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js.map +1 -0
- package/plugins/definitions/SystemStorageOperationsProviderPlugin.d.ts +9 -0
- package/plugins/definitions/SystemStorageOperationsProviderPlugin.js +17 -0
- package/plugins/definitions/SystemStorageOperationsProviderPlugin.js.map +1 -0
- package/plugins/graphql.d.ts +4 -0
- package/plugins/graphql.js +290 -0
- package/plugins/graphql.js.map +1 -0
- package/plugins/index.d.ts +2 -0
- package/plugins/index.js +24 -0
- package/plugins/index.js.map +1 -0
- package/plugins/storage/FileStorage.d.ts +30 -0
- package/plugins/storage/FileStorage.js +103 -0
- package/plugins/storage/FileStorage.js.map +1 -0
- package/plugins/storage/index.d.ts +4 -0
- package/plugins/storage/index.js +26 -0
- package/plugins/storage/index.js.map +1 -0
- package/types.d.ts +361 -0
- package/types.js +5 -0
- package/types.js.map +1 -0
- package/utils.d.ts +4 -0
- package/utils.js +16 -0
- package/utils.js.map +1 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
import { File } from "../../types";
|
|
3
|
+
export interface FileStorageTransformPluginToParams {
|
|
4
|
+
/**
|
|
5
|
+
* File that is being sent to the storage operations method.
|
|
6
|
+
*/
|
|
7
|
+
file: File & Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export interface FileStorageTransformPluginFromParams {
|
|
10
|
+
/**
|
|
11
|
+
* File that was fetched from the storage operations method.
|
|
12
|
+
*/
|
|
13
|
+
file: File & Record<string, any>;
|
|
14
|
+
}
|
|
15
|
+
export interface FileStorageTransformPluginParams {
|
|
16
|
+
toStorage?: (params: FileStorageTransformPluginToParams) => Promise<File & Record<string, any>>;
|
|
17
|
+
fromStorage?: (params: FileStorageTransformPluginFromParams) => Promise<File & Record<string, any>>;
|
|
18
|
+
}
|
|
19
|
+
export declare class FileStorageTransformPlugin extends Plugin {
|
|
20
|
+
static readonly type: string;
|
|
21
|
+
private readonly _params;
|
|
22
|
+
constructor(params: FileStorageTransformPluginParams);
|
|
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: FileStorageTransformPluginToParams): 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: FileStorageTransformPluginFromParams): Promise<File & Record<string, any>>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
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 @@
|
|
|
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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
import { FileManagerContext, FileManagerFilesStorageOperations } from "../../types";
|
|
3
|
+
export interface FilesStorageOperationsProviderPluginParams<T = FileManagerContext> {
|
|
4
|
+
context: T;
|
|
5
|
+
}
|
|
6
|
+
export declare abstract class FilesStorageOperationsProviderPlugin extends Plugin {
|
|
7
|
+
static readonly type: string;
|
|
8
|
+
abstract provide(params: FilesStorageOperationsProviderPluginParams): Promise<FileManagerFilesStorageOperations>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
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 @@
|
|
|
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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FileManagerContext } from "../../types";
|
|
2
|
+
import { Plugin } from "@webiny/plugins";
|
|
3
|
+
export interface InstallationPluginParams {
|
|
4
|
+
context: FileManagerContext;
|
|
5
|
+
}
|
|
6
|
+
export declare type CallbackFunction<TParams> = (params: TParams) => Promise<void>;
|
|
7
|
+
interface InstallationPluginConfig {
|
|
8
|
+
beforeInstall?: CallbackFunction<InstallationPluginParams>;
|
|
9
|
+
afterInstall?: CallbackFunction<InstallationPluginParams>;
|
|
10
|
+
}
|
|
11
|
+
export declare abstract class InstallationPlugin extends Plugin {
|
|
12
|
+
static readonly type: string;
|
|
13
|
+
private readonly _config;
|
|
14
|
+
constructor(config?: Partial<InstallationPluginConfig>);
|
|
15
|
+
beforeInstall(params: InstallationPluginParams): Promise<void>;
|
|
16
|
+
afterInstall(params: InstallationPluginParams): Promise<void>;
|
|
17
|
+
private _execute;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
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
|
+
const cb = this._config[callback];
|
|
31
|
+
|
|
32
|
+
if (!cb) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return cb(params);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
exports.InstallationPlugin = InstallationPlugin;
|
|
42
|
+
(0, _defineProperty2.default)(InstallationPlugin, "type", "fm.install");
|
|
@@ -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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
import { FileManagerContext, FileManagerSettingsStorageOperations } from "../../types";
|
|
3
|
+
export interface SettingsStorageOperationsProviderPluginParams<T = FileManagerContext> {
|
|
4
|
+
context: T;
|
|
5
|
+
}
|
|
6
|
+
export declare abstract class SettingsStorageOperationsProviderPlugin extends Plugin {
|
|
7
|
+
static readonly type: string;
|
|
8
|
+
abstract provide(params: SettingsStorageOperationsProviderPluginParams): Promise<FileManagerSettingsStorageOperations>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
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 @@
|
|
|
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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Plugin } from "@webiny/plugins";
|
|
2
|
+
import { FileManagerContext, FileManagerSystemStorageOperations } from "../../types";
|
|
3
|
+
export interface SystemStorageOperationsProviderPluginParams<T = FileManagerContext> {
|
|
4
|
+
context: T;
|
|
5
|
+
}
|
|
6
|
+
export declare abstract class SystemStorageOperationsProviderPlugin extends Plugin {
|
|
7
|
+
static readonly type: string;
|
|
8
|
+
abstract provide(params: SystemStorageOperationsProviderPluginParams): Promise<FileManagerSystemStorageOperations>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
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 @@
|
|
|
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"}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _handlerGraphql = require("@webiny/handler-graphql");
|
|
9
|
+
|
|
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
|
+
|
|
16
|
+
|
|
17
|
+
const resolve = async fn => {
|
|
18
|
+
try {
|
|
19
|
+
return new _handlerGraphql.Response(await fn());
|
|
20
|
+
} catch (e) {
|
|
21
|
+
return new _handlerGraphql.ErrorResponse(e);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const plugin = {
|
|
26
|
+
type: "graphql-schema",
|
|
27
|
+
schema: {
|
|
28
|
+
typeDefs:
|
|
29
|
+
/* GraphQL */
|
|
30
|
+
`
|
|
31
|
+
type FmCreatedBy {
|
|
32
|
+
id: ID
|
|
33
|
+
displayName: String
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
input FileInput {
|
|
37
|
+
key: String
|
|
38
|
+
name: String
|
|
39
|
+
size: Int
|
|
40
|
+
type: String
|
|
41
|
+
tags: [String]
|
|
42
|
+
meta: JSON
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type UploadFileResponseDataFile {
|
|
46
|
+
name: String
|
|
47
|
+
type: String
|
|
48
|
+
size: Int
|
|
49
|
+
key: String
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type UploadFileResponseData {
|
|
53
|
+
# Contains data that is necessary for initiating a file upload.
|
|
54
|
+
data: JSON
|
|
55
|
+
file: UploadFileResponseDataFile
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
type FileListMeta {
|
|
59
|
+
cursor: String
|
|
60
|
+
totalCount: Int
|
|
61
|
+
hasMoreItems: Boolean
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type FileError {
|
|
65
|
+
code: String
|
|
66
|
+
message: String
|
|
67
|
+
data: JSON
|
|
68
|
+
stack: String
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type FileListResponse {
|
|
72
|
+
data: [File]
|
|
73
|
+
meta: FileListMeta
|
|
74
|
+
error: FileError
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
type FileResponse {
|
|
78
|
+
data: File
|
|
79
|
+
error: FileError
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
type CreateFilesResponse {
|
|
83
|
+
data: [File]!
|
|
84
|
+
error: FileError
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
type File {
|
|
88
|
+
id: ID
|
|
89
|
+
key: String
|
|
90
|
+
name: String
|
|
91
|
+
size: Int
|
|
92
|
+
type: String
|
|
93
|
+
src: String
|
|
94
|
+
tags: [String]
|
|
95
|
+
meta: JSON
|
|
96
|
+
createdOn: DateTime
|
|
97
|
+
createdBy: FmCreatedBy
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
type FileManagerBooleanResponse {
|
|
101
|
+
data: Boolean
|
|
102
|
+
error: FileError
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
type FileManagerSettings {
|
|
106
|
+
uploadMinFileSize: Number
|
|
107
|
+
uploadMaxFileSize: Number
|
|
108
|
+
srcPrefix: String
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
input FileManagerSettingsInput {
|
|
112
|
+
uploadMinFileSize: Number
|
|
113
|
+
uploadMaxFileSize: Number
|
|
114
|
+
srcPrefix: String
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
type FileManagerSettingsResponse {
|
|
118
|
+
data: FileManagerSettings
|
|
119
|
+
error: FileError
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
input FileWhereInput {
|
|
123
|
+
search: String
|
|
124
|
+
type: String
|
|
125
|
+
type_in: [String!]
|
|
126
|
+
tag: String
|
|
127
|
+
tag_in: [String!]
|
|
128
|
+
tag_and_in: [String!]
|
|
129
|
+
tag_startsWith: String
|
|
130
|
+
tag_not_startsWith: String
|
|
131
|
+
id_in: [ID!]
|
|
132
|
+
id: ID
|
|
133
|
+
createdBy: ID
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
input TagWhereInput {
|
|
137
|
+
tag_startsWith: String
|
|
138
|
+
tag_not_startsWith: String
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
type FmQuery {
|
|
142
|
+
getFile(id: ID, where: JSON, sort: String): FileResponse
|
|
143
|
+
|
|
144
|
+
listFiles(
|
|
145
|
+
limit: Int
|
|
146
|
+
after: String
|
|
147
|
+
types: [String]
|
|
148
|
+
tags: [String]
|
|
149
|
+
ids: [ID]
|
|
150
|
+
search: String
|
|
151
|
+
where: FileWhereInput
|
|
152
|
+
): FileListResponse
|
|
153
|
+
|
|
154
|
+
listTags(where: TagWhereInput): [String]
|
|
155
|
+
|
|
156
|
+
# Get installed version
|
|
157
|
+
version: String
|
|
158
|
+
|
|
159
|
+
getSettings: FileManagerSettingsResponse
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
type FilesDeleteResponse {
|
|
163
|
+
data: Boolean
|
|
164
|
+
error: FileError
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
type FmMutation {
|
|
168
|
+
createFile(data: FileInput!): FileResponse
|
|
169
|
+
createFiles(data: [FileInput]!): CreateFilesResponse
|
|
170
|
+
updateFile(id: ID!, data: FileInput!): FileResponse
|
|
171
|
+
deleteFile(id: ID!): FilesDeleteResponse
|
|
172
|
+
|
|
173
|
+
# Install File manager
|
|
174
|
+
install(srcPrefix: String): FileManagerBooleanResponse
|
|
175
|
+
|
|
176
|
+
upgrade(version: String!): FileManagerBooleanResponse
|
|
177
|
+
|
|
178
|
+
updateSettings(data: FileManagerSettingsInput): FileManagerSettingsResponse
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
input FilesInstallInput {
|
|
182
|
+
srcPrefix: String!
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
extend type Query {
|
|
186
|
+
fileManager: FmQuery
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
extend type Mutation {
|
|
190
|
+
fileManager: FmMutation
|
|
191
|
+
}
|
|
192
|
+
`,
|
|
193
|
+
resolvers: {
|
|
194
|
+
File: {
|
|
195
|
+
async src(file, _, context) {
|
|
196
|
+
const settings = await context.fileManager.settings.getSettings();
|
|
197
|
+
return ((settings === null || settings === void 0 ? void 0 : settings.srcPrefix) || "") + file.key;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
},
|
|
201
|
+
Query: {
|
|
202
|
+
fileManager: emptyResolver
|
|
203
|
+
},
|
|
204
|
+
Mutation: {
|
|
205
|
+
fileManager: emptyResolver
|
|
206
|
+
},
|
|
207
|
+
FmQuery: {
|
|
208
|
+
getFile(_, args, context) {
|
|
209
|
+
return resolve(() => context.fileManager.files.getFile(args.id));
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
async listFiles(_, args, context) {
|
|
213
|
+
try {
|
|
214
|
+
const [data, meta] = await context.fileManager.files.listFiles(args);
|
|
215
|
+
return new _handlerGraphql.ListResponse(data, meta);
|
|
216
|
+
} catch (e) {
|
|
217
|
+
return new _handlerGraphql.ErrorResponse(e);
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
async listTags(_, args, context) {
|
|
222
|
+
try {
|
|
223
|
+
return await context.fileManager.files.listTags(args || {});
|
|
224
|
+
} catch (error) {
|
|
225
|
+
return new _handlerGraphql.ErrorResponse(error);
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
async version(_, __, context) {
|
|
230
|
+
const {
|
|
231
|
+
i18n,
|
|
232
|
+
tenancy,
|
|
233
|
+
fileManager
|
|
234
|
+
} = context;
|
|
235
|
+
|
|
236
|
+
if (!tenancy.getCurrentTenant() || !i18n.getContentLocale()) {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
return await fileManager.system.getVersion();
|
|
241
|
+
},
|
|
242
|
+
|
|
243
|
+
async getSettings(_, __, context) {
|
|
244
|
+
return resolve(() => context.fileManager.settings.getSettings());
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
},
|
|
248
|
+
FmMutation: {
|
|
249
|
+
async createFile(_, args, context) {
|
|
250
|
+
return resolve(() => context.fileManager.files.createFile(args.data));
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
async updateFile(_, args, context) {
|
|
254
|
+
return resolve(() => context.fileManager.files.updateFile(args.id, args.data));
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
async createFiles(_, args, context) {
|
|
258
|
+
return resolve(() => context.fileManager.files.createFilesInBatch(args.data));
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
async deleteFile(_, args, context) {
|
|
262
|
+
return resolve(async () => {
|
|
263
|
+
const file = await context.fileManager.files.getFile(args.id);
|
|
264
|
+
return await context.fileManager.storage.delete({
|
|
265
|
+
id: file.id,
|
|
266
|
+
key: file.key
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
async install(_, args, context) {
|
|
272
|
+
return resolve(() => context.fileManager.system.install({
|
|
273
|
+
srcPrefix: args.srcPrefix
|
|
274
|
+
}));
|
|
275
|
+
},
|
|
276
|
+
|
|
277
|
+
async upgrade(_, args, context) {
|
|
278
|
+
return resolve(() => context.fileManager.system.upgrade(args.version));
|
|
279
|
+
},
|
|
280
|
+
|
|
281
|
+
async updateSettings(_, args, context) {
|
|
282
|
+
return resolve(() => context.fileManager.settings.updateSettings(args.data));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
var _default = plugin;
|
|
290
|
+
exports.default = _default;
|
|
@@ -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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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
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
|
+
export default _default;
|
package/plugins/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _graphql = _interopRequireDefault(require("./graphql"));
|
|
11
|
+
|
|
12
|
+
var _files = _interopRequireDefault(require("./crud/files.crud"));
|
|
13
|
+
|
|
14
|
+
var _validation = _interopRequireDefault(require("./crud/files/validation"));
|
|
15
|
+
|
|
16
|
+
var _settings = _interopRequireDefault(require("./crud/settings.crud"));
|
|
17
|
+
|
|
18
|
+
var _system = _interopRequireDefault(require("./crud/system.crud"));
|
|
19
|
+
|
|
20
|
+
var _storage = _interopRequireDefault(require("./storage"));
|
|
21
|
+
|
|
22
|
+
var _default = () => [_system.default, _settings.default, _files.default, _storage.default, _graphql.default, (0, _validation.default)()];
|
|
23
|
+
|
|
24
|
+
exports.default = _default;
|
|
@@ -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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { FileManagerContext } from "../../types";
|
|
3
|
+
export declare type Result = Record<string, any>;
|
|
4
|
+
export interface FileStorageUploadParams {
|
|
5
|
+
buffer: Buffer;
|
|
6
|
+
hideInFileManager: boolean | string;
|
|
7
|
+
tags?: string[];
|
|
8
|
+
size: number;
|
|
9
|
+
name: string;
|
|
10
|
+
keyPrefix: string;
|
|
11
|
+
type: string;
|
|
12
|
+
}
|
|
13
|
+
export interface FileStorageDeleteParams {
|
|
14
|
+
id: string;
|
|
15
|
+
key: string;
|
|
16
|
+
}
|
|
17
|
+
export interface FileStorageUploadMultipleParams {
|
|
18
|
+
files: FileStorageUploadParams[];
|
|
19
|
+
}
|
|
20
|
+
export interface FileStorageParams {
|
|
21
|
+
context: FileManagerContext;
|
|
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>;
|
|
30
|
+
}
|