@webiny/api-file-manager 0.0.0-unstable.78f581c1d2 → 0.0.0-unstable.7f63ea0744
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/handlers/download/index.js +7 -26
- package/handlers/download/index.js.map +1 -1
- package/handlers/manage/index.js +0 -16
- package/handlers/manage/index.js.map +1 -1
- package/handlers/transform/index.js +6 -16
- package/handlers/transform/index.js.map +1 -1
- package/handlers/transform/loaders/imageLoader.js +0 -17
- package/handlers/transform/loaders/imageLoader.js.map +1 -1
- package/handlers/transform/loaders/index.js +0 -3
- package/handlers/transform/loaders/index.js.map +1 -1
- package/handlers/transform/loaders/sanitizeImageTransformations.js +0 -13
- package/handlers/transform/loaders/sanitizeImageTransformations.js.map +1 -1
- package/handlers/transform/managers/imageManager.js +6 -14
- package/handlers/transform/managers/imageManager.js.map +1 -1
- package/handlers/transform/managers/index.js +0 -3
- package/handlers/transform/managers/index.js.map +1 -1
- package/handlers/transform/optimizeImage.js +0 -6
- package/handlers/transform/optimizeImage.js.map +1 -1
- package/handlers/transform/transformImage.js +0 -5
- package/handlers/transform/transformImage.js.map +1 -1
- package/handlers/transform/utils.js +0 -10
- package/handlers/transform/utils.js.map +1 -1
- package/handlers/utils/getEnvironment.js +0 -2
- package/handlers/utils/getEnvironment.js.map +1 -1
- package/handlers/utils/getObjectParams.js +0 -4
- package/handlers/utils/getObjectParams.js.map +1 -1
- package/handlers/utils/index.js +0 -3
- package/handlers/utils/index.js.map +1 -1
- package/package.json +19 -19
- package/plugins/crud/files/validation.js +0 -6
- package/plugins/crud/files/validation.js.map +1 -1
- package/plugins/crud/files.crud.js +2 -61
- package/plugins/crud/files.crud.js.map +1 -1
- package/plugins/crud/settings.crud.js +1 -18
- package/plugins/crud/settings.crud.js.map +1 -1
- package/plugins/crud/system.crud.js +2 -32
- package/plugins/crud/system.crud.js.map +1 -1
- package/plugins/crud/utils/checkBasePermissions.js +0 -8
- package/plugins/crud/utils/checkBasePermissions.js.map +1 -1
- package/plugins/crud/utils/createFileModel.js +0 -12
- package/plugins/crud/utils/createFileModel.js.map +1 -1
- package/plugins/crud/utils/lifecycleEvents.js +4 -12
- package/plugins/crud/utils/lifecycleEvents.js.map +1 -1
- package/plugins/definitions/FilePhysicalStoragePlugin.js +0 -11
- package/plugins/definitions/FilePhysicalStoragePlugin.js.map +1 -1
- package/plugins/definitions/FilePlugin.js +0 -18
- package/plugins/definitions/FilePlugin.js.map +1 -1
- package/plugins/definitions/FileStorageTransformPlugin.js +1 -12
- package/plugins/definitions/FileStorageTransformPlugin.js.map +1 -1
- package/plugins/definitions/FilesStorageOperationsProviderPlugin.js +0 -5
- package/plugins/definitions/FilesStorageOperationsProviderPlugin.js.map +1 -1
- package/plugins/definitions/InstallationPlugin.js +0 -11
- package/plugins/definitions/InstallationPlugin.js.map +1 -1
- package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js +0 -5
- package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js.map +1 -1
- package/plugins/definitions/SystemStorageOperationsProviderPlugin.js +0 -5
- package/plugins/definitions/SystemStorageOperationsProviderPlugin.js.map +1 -1
- package/plugins/graphql.js +2 -22
- package/plugins/graphql.js.map +1 -1
- package/plugins/index.js +0 -9
- package/plugins/index.js.map +1 -1
- package/plugins/storage/FileStorage.js +14 -32
- package/plugins/storage/FileStorage.js.map +1 -1
- package/plugins/storage/index.js +0 -4
- package/plugins/storage/index.js.map +1 -1
- package/utils.js +0 -2
- package/utils.js.map +1 -1
package/plugins/index.js
CHANGED
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _graphql = _interopRequireDefault(require("./graphql"));
|
|
11
|
-
|
|
12
9
|
var _files = _interopRequireDefault(require("./crud/files.crud"));
|
|
13
|
-
|
|
14
10
|
var _validation = _interopRequireDefault(require("./crud/files/validation"));
|
|
15
|
-
|
|
16
11
|
var _settings = _interopRequireDefault(require("./crud/settings.crud"));
|
|
17
|
-
|
|
18
12
|
var _system = _interopRequireDefault(require("./crud/system.crud"));
|
|
19
|
-
|
|
20
13
|
var _storage = _interopRequireDefault(require("./storage"));
|
|
21
|
-
|
|
22
14
|
var _default = () => [_system.default, _settings.default, _files.default, _storage.default, _graphql.default, (0, _validation.default)()];
|
|
23
|
-
|
|
24
15
|
exports.default = _default;
|
package/plugins/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["systemCRUD","settingsCRUD","filesCRUD","storage","graphql","fileValidationPlugin"],"sources":["index.ts"],"sourcesContent":["import graphql from \"./graphql\";\nimport filesCRUD from \"./crud/files.crud\";\nimport fileValidationPlugin from \"./crud/files/validation\";\nimport settingsCRUD from \"./crud/settings.crud\";\nimport systemCRUD from \"./crud/system.crud\";\nimport storage from \"./storage\";\n\nexport default () => [\n systemCRUD,\n settingsCRUD,\n filesCRUD,\n storage,\n graphql,\n fileValidationPlugin()\n];\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["systemCRUD","settingsCRUD","filesCRUD","storage","graphql","fileValidationPlugin"],"sources":["index.ts"],"sourcesContent":["import graphql from \"./graphql\";\nimport filesCRUD from \"./crud/files.crud\";\nimport fileValidationPlugin from \"./crud/files/validation\";\nimport settingsCRUD from \"./crud/settings.crud\";\nimport systemCRUD from \"./crud/system.crud\";\nimport storage from \"./storage\";\n\nexport default () => [\n systemCRUD,\n settingsCRUD,\n filesCRUD,\n storage,\n graphql,\n fileValidationPlugin()\n];\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAAgC,eAEjB,MAAM,CACjBA,eAAU,EACVC,iBAAY,EACZC,cAAS,EACTC,gBAAO,EACPC,gBAAO,EACP,IAAAC,mBAAoB,GAAE,CACzB;AAAA"}
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.FileStorage = void 0;
|
|
9
|
-
|
|
10
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
-
|
|
12
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
10
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
15
|
-
|
|
16
11
|
const storagePluginType = "api-file-manager-storage";
|
|
17
|
-
|
|
18
12
|
class FileStorage {
|
|
19
13
|
constructor({
|
|
20
14
|
context
|
|
@@ -22,23 +16,18 @@ class FileStorage {
|
|
|
22
16
|
(0, _defineProperty2.default)(this, "storagePlugin", void 0);
|
|
23
17
|
(0, _defineProperty2.default)(this, "context", void 0);
|
|
24
18
|
const storagePlugin = context.plugins.byType(storagePluginType).pop();
|
|
25
|
-
|
|
26
19
|
if (!storagePlugin) {
|
|
27
20
|
throw new _error.default(`Missing plugin of type "${storagePluginType}".`, "STORAGE_PLUGIN_ERROR");
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
this.storagePlugin = storagePlugin;
|
|
31
23
|
this.context = context;
|
|
32
24
|
}
|
|
33
|
-
|
|
34
25
|
async upload(params) {
|
|
35
26
|
const settings = await this.context.fileManager.settings.getSettings();
|
|
36
|
-
|
|
37
27
|
if (!settings) {
|
|
38
28
|
throw new _error.default("Missing File Manager Settings.", "FILE_MANAGER_ERROR");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
}
|
|
30
|
+
// Add file to cloud storage.
|
|
42
31
|
const {
|
|
43
32
|
file: fileData
|
|
44
33
|
} = await this.storagePlugin.upload((0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
|
|
@@ -46,8 +35,9 @@ class FileStorage {
|
|
|
46
35
|
}));
|
|
47
36
|
const {
|
|
48
37
|
fileManager
|
|
49
|
-
} = this.context;
|
|
38
|
+
} = this.context;
|
|
50
39
|
|
|
40
|
+
// Save file in DB.
|
|
51
41
|
return await fileManager.files.createFile((0, _objectSpread2.default)((0, _objectSpread2.default)({}, fileData), {}, {
|
|
52
42
|
meta: {
|
|
53
43
|
private: Boolean(params.hideInFileManager)
|
|
@@ -55,33 +45,27 @@ class FileStorage {
|
|
|
55
45
|
tags: Array.isArray(params.tags) ? params.tags : []
|
|
56
46
|
}));
|
|
57
47
|
}
|
|
58
|
-
|
|
59
48
|
async uploadFiles(params) {
|
|
60
49
|
const settings = await this.context.fileManager.settings.getSettings();
|
|
61
|
-
|
|
62
50
|
if (!settings) {
|
|
63
51
|
throw new _error.default("Missing File Manager Settings.", "FILE_MANAGER_ERROR");
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
52
|
+
}
|
|
53
|
+
// Upload files to cloud storage.
|
|
67
54
|
const promises = [];
|
|
68
|
-
|
|
69
55
|
for (const item of params.files) {
|
|
70
56
|
promises.push(this.storagePlugin.upload((0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
71
57
|
settings
|
|
72
58
|
})));
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
59
|
+
}
|
|
60
|
+
// Wait for all to resolve.
|
|
76
61
|
const uploadFileResponses = await Promise.all(promises);
|
|
77
62
|
const filesData = uploadFileResponses.map(response => response.file);
|
|
78
63
|
const {
|
|
79
64
|
fileManager
|
|
80
|
-
} = this.context;
|
|
81
|
-
|
|
65
|
+
} = this.context;
|
|
66
|
+
// Save files in DB.
|
|
82
67
|
return fileManager.files.createFilesInBatch(filesData);
|
|
83
68
|
}
|
|
84
|
-
|
|
85
69
|
async delete(params) {
|
|
86
70
|
const {
|
|
87
71
|
id,
|
|
@@ -89,15 +73,13 @@ class FileStorage {
|
|
|
89
73
|
} = params;
|
|
90
74
|
const {
|
|
91
75
|
fileManager
|
|
92
|
-
} = this.context;
|
|
93
|
-
|
|
76
|
+
} = this.context;
|
|
77
|
+
// Delete file from cloud storage.
|
|
94
78
|
await this.storagePlugin.delete({
|
|
95
79
|
key
|
|
96
|
-
});
|
|
97
|
-
|
|
80
|
+
});
|
|
81
|
+
// Delete file from the DB.
|
|
98
82
|
return await fileManager.files.deleteFile(id);
|
|
99
83
|
}
|
|
100
|
-
|
|
101
84
|
}
|
|
102
|
-
|
|
103
85
|
exports.FileStorage = FileStorage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["storagePluginType","FileStorage","constructor","context","storagePlugin","plugins","byType","pop","WebinyError","upload","params","settings","fileManager","getSettings","file","fileData","files","createFile","meta","private","Boolean","hideInFileManager","tags","Array","isArray","uploadFiles","promises","item","push","uploadFileResponses","Promise","all","filesData","map","response","createFilesInBatch","delete","id","key","deleteFile"],"sources":["FileStorage.ts"],"sourcesContent":["import { FileManagerContext } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { FilePhysicalStoragePlugin } from \"~/plugins/definitions/FilePhysicalStoragePlugin\";\n\nexport type Result = Record<string, any>;\n\nconst storagePluginType = \"api-file-manager-storage\";\n\nexport interface FileStorageUploadParams {\n buffer: Buffer;\n hideInFileManager: boolean | string;\n tags?: string[];\n size: number;\n name: string;\n keyPrefix: string;\n type: string;\n}\nexport interface FileStorageDeleteParams {\n id: string;\n key: string;\n}\n\nexport interface FileStorageUploadMultipleParams {\n files: FileStorageUploadParams[];\n}\n\nexport interface FileStorageParams {\n context: FileManagerContext;\n}\nexport class FileStorage {\n private readonly storagePlugin: FilePhysicalStoragePlugin;\n private readonly context: FileManagerContext;\n\n constructor({ context }: FileStorageParams) {\n const storagePlugin = context.plugins\n .byType<FilePhysicalStoragePlugin>(storagePluginType)\n .pop();\n if (!storagePlugin) {\n throw new WebinyError(\n `Missing plugin of type \"${storagePluginType}\".`,\n \"STORAGE_PLUGIN_ERROR\"\n );\n }\n this.storagePlugin = storagePlugin;\n this.context = context;\n }\n\n async upload(params: FileStorageUploadParams): Promise<Result> {\n const settings = await this.context.fileManager.settings.getSettings();\n if (!settings) {\n throw new WebinyError(\"Missing File Manager Settings.\", \"FILE_MANAGER_ERROR\");\n }\n // Add file to cloud storage.\n const { file: fileData } = await this.storagePlugin.upload({\n ...params,\n settings\n });\n\n const { fileManager } = this.context;\n\n // Save file in DB.\n return await fileManager.files.createFile({\n ...(fileData as any),\n meta: {\n private: Boolean(params.hideInFileManager)\n },\n tags: Array.isArray(params.tags) ? params.tags : []\n });\n }\n\n async uploadFiles(params: FileStorageUploadMultipleParams) {\n const settings = await this.context.fileManager.settings.getSettings();\n if (!settings) {\n throw new WebinyError(\"Missing File Manager Settings.\", \"FILE_MANAGER_ERROR\");\n }\n // Upload files to cloud storage.\n const promises = [];\n for (const item of params.files) {\n promises.push(\n this.storagePlugin.upload({\n ...item,\n settings\n })\n );\n }\n // Wait for all to resolve.\n const uploadFileResponses = await Promise.all(promises);\n\n const filesData = uploadFileResponses.map(response => response.file);\n\n const { fileManager } = this.context;\n // Save files in DB.\n return fileManager.files.createFilesInBatch(filesData);\n }\n\n async delete(params: FileStorageDeleteParams) {\n const { id, key } = params;\n const { fileManager } = this.context;\n // Delete file from cloud storage.\n await this.storagePlugin.delete({\n key\n });\n // Delete file from the DB.\n return await fileManager.files.deleteFile(id);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["storagePluginType","FileStorage","constructor","context","storagePlugin","plugins","byType","pop","WebinyError","upload","params","settings","fileManager","getSettings","file","fileData","files","createFile","meta","private","Boolean","hideInFileManager","tags","Array","isArray","uploadFiles","promises","item","push","uploadFileResponses","Promise","all","filesData","map","response","createFilesInBatch","delete","id","key","deleteFile"],"sources":["FileStorage.ts"],"sourcesContent":["import { FileManagerContext } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { FilePhysicalStoragePlugin } from \"~/plugins/definitions/FilePhysicalStoragePlugin\";\n\nexport type Result = Record<string, any>;\n\nconst storagePluginType = \"api-file-manager-storage\";\n\nexport interface FileStorageUploadParams {\n buffer: Buffer;\n hideInFileManager: boolean | string;\n tags?: string[];\n size: number;\n name: string;\n keyPrefix: string;\n type: string;\n}\nexport interface FileStorageDeleteParams {\n id: string;\n key: string;\n}\n\nexport interface FileStorageUploadMultipleParams {\n files: FileStorageUploadParams[];\n}\n\nexport interface FileStorageParams {\n context: FileManagerContext;\n}\nexport class FileStorage {\n private readonly storagePlugin: FilePhysicalStoragePlugin;\n private readonly context: FileManagerContext;\n\n constructor({ context }: FileStorageParams) {\n const storagePlugin = context.plugins\n .byType<FilePhysicalStoragePlugin>(storagePluginType)\n .pop();\n if (!storagePlugin) {\n throw new WebinyError(\n `Missing plugin of type \"${storagePluginType}\".`,\n \"STORAGE_PLUGIN_ERROR\"\n );\n }\n this.storagePlugin = storagePlugin;\n this.context = context;\n }\n\n async upload(params: FileStorageUploadParams): Promise<Result> {\n const settings = await this.context.fileManager.settings.getSettings();\n if (!settings) {\n throw new WebinyError(\"Missing File Manager Settings.\", \"FILE_MANAGER_ERROR\");\n }\n // Add file to cloud storage.\n const { file: fileData } = await this.storagePlugin.upload({\n ...params,\n settings\n });\n\n const { fileManager } = this.context;\n\n // Save file in DB.\n return await fileManager.files.createFile({\n ...(fileData as any),\n meta: {\n private: Boolean(params.hideInFileManager)\n },\n tags: Array.isArray(params.tags) ? params.tags : []\n });\n }\n\n async uploadFiles(params: FileStorageUploadMultipleParams) {\n const settings = await this.context.fileManager.settings.getSettings();\n if (!settings) {\n throw new WebinyError(\"Missing File Manager Settings.\", \"FILE_MANAGER_ERROR\");\n }\n // Upload files to cloud storage.\n const promises = [];\n for (const item of params.files) {\n promises.push(\n this.storagePlugin.upload({\n ...item,\n settings\n })\n );\n }\n // Wait for all to resolve.\n const uploadFileResponses = await Promise.all(promises);\n\n const filesData = uploadFileResponses.map(response => response.file);\n\n const { fileManager } = this.context;\n // Save files in DB.\n return fileManager.files.createFilesInBatch(filesData);\n }\n\n async delete(params: FileStorageDeleteParams) {\n const { id, key } = params;\n const { fileManager } = this.context;\n // Delete file from cloud storage.\n await this.storagePlugin.delete({\n key\n });\n // Delete file from the DB.\n return await fileManager.files.deleteFile(id);\n }\n}\n"],"mappings":";;;;;;;;;AACA;AAKA,MAAMA,iBAAiB,GAAG,0BAA0B;AAuB7C,MAAMC,WAAW,CAAC;EAIrBC,WAAW,CAAC;IAAEC;EAA2B,CAAC,EAAE;IAAA;IAAA;IACxC,MAAMC,aAAa,GAAGD,OAAO,CAACE,OAAO,CAChCC,MAAM,CAA4BN,iBAAiB,CAAC,CACpDO,GAAG,EAAE;IACV,IAAI,CAACH,aAAa,EAAE;MAChB,MAAM,IAAII,cAAW,CAChB,2BAA0BR,iBAAkB,IAAG,EAChD,sBAAsB,CACzB;IACL;IACA,IAAI,CAACI,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACD,OAAO,GAAGA,OAAO;EAC1B;EAEA,MAAMM,MAAM,CAACC,MAA+B,EAAmB;IAC3D,MAAMC,QAAQ,GAAG,MAAM,IAAI,CAACR,OAAO,CAACS,WAAW,CAACD,QAAQ,CAACE,WAAW,EAAE;IACtE,IAAI,CAACF,QAAQ,EAAE;MACX,MAAM,IAAIH,cAAW,CAAC,gCAAgC,EAAE,oBAAoB,CAAC;IACjF;IACA;IACA,MAAM;MAAEM,IAAI,EAAEC;IAAS,CAAC,GAAG,MAAM,IAAI,CAACX,aAAa,CAACK,MAAM,6DACnDC,MAAM;MACTC;IAAQ,GACV;IAEF,MAAM;MAAEC;IAAY,CAAC,GAAG,IAAI,CAACT,OAAO;;IAEpC;IACA,OAAO,MAAMS,WAAW,CAACI,KAAK,CAACC,UAAU,6DACjCF,QAAQ;MACZG,IAAI,EAAE;QACFC,OAAO,EAAEC,OAAO,CAACV,MAAM,CAACW,iBAAiB;MAC7C,CAAC;MACDC,IAAI,EAAEC,KAAK,CAACC,OAAO,CAACd,MAAM,CAACY,IAAI,CAAC,GAAGZ,MAAM,CAACY,IAAI,GAAG;IAAE,GACrD;EACN;EAEA,MAAMG,WAAW,CAACf,MAAuC,EAAE;IACvD,MAAMC,QAAQ,GAAG,MAAM,IAAI,CAACR,OAAO,CAACS,WAAW,CAACD,QAAQ,CAACE,WAAW,EAAE;IACtE,IAAI,CAACF,QAAQ,EAAE;MACX,MAAM,IAAIH,cAAW,CAAC,gCAAgC,EAAE,oBAAoB,CAAC;IACjF;IACA;IACA,MAAMkB,QAAQ,GAAG,EAAE;IACnB,KAAK,MAAMC,IAAI,IAAIjB,MAAM,CAACM,KAAK,EAAE;MAC7BU,QAAQ,CAACE,IAAI,CACT,IAAI,CAACxB,aAAa,CAACK,MAAM,6DAClBkB,IAAI;QACPhB;MAAQ,GACV,CACL;IACL;IACA;IACA,MAAMkB,mBAAmB,GAAG,MAAMC,OAAO,CAACC,GAAG,CAACL,QAAQ,CAAC;IAEvD,MAAMM,SAAS,GAAGH,mBAAmB,CAACI,GAAG,CAACC,QAAQ,IAAIA,QAAQ,CAACpB,IAAI,CAAC;IAEpE,MAAM;MAAEF;IAAY,CAAC,GAAG,IAAI,CAACT,OAAO;IACpC;IACA,OAAOS,WAAW,CAACI,KAAK,CAACmB,kBAAkB,CAACH,SAAS,CAAC;EAC1D;EAEA,MAAMI,MAAM,CAAC1B,MAA+B,EAAE;IAC1C,MAAM;MAAE2B,EAAE;MAAEC;IAAI,CAAC,GAAG5B,MAAM;IAC1B,MAAM;MAAEE;IAAY,CAAC,GAAG,IAAI,CAACT,OAAO;IACpC;IACA,MAAM,IAAI,CAACC,aAAa,CAACgC,MAAM,CAAC;MAC5BE;IACJ,CAAC,CAAC;IACF;IACA,OAAO,MAAM1B,WAAW,CAACI,KAAK,CAACuB,UAAU,CAACF,EAAE,CAAC;EACjD;AACJ;AAAC"}
|
package/plugins/storage/index.js
CHANGED
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _api = require("@webiny/api");
|
|
9
|
-
|
|
10
8
|
var _FileStorage = require("./FileStorage");
|
|
11
|
-
|
|
12
9
|
const fileStorageContextPlugin = new _api.ContextPlugin(async context => {
|
|
13
10
|
if (!context.fileManager) {
|
|
14
11
|
/**
|
|
@@ -17,7 +14,6 @@ const fileStorageContextPlugin = new _api.ContextPlugin(async context => {
|
|
|
17
14
|
*/
|
|
18
15
|
context.fileManager = {};
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
context.fileManager.storage = new _FileStorage.FileStorage({
|
|
22
18
|
context
|
|
23
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fileStorageContextPlugin","ContextPlugin","context","fileManager","storage","FileStorage"],"sources":["index.ts"],"sourcesContent":["import { FileManagerContext } from \"~/types\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { FileStorage } from \"./FileStorage\";\n\nconst fileStorageContextPlugin = new ContextPlugin<FileManagerContext>(async context => {\n if (!context.fileManager) {\n /**\n * We need to define the fileManager initial property as empty object.\n * When casting as FileManagerContext, typescript is complaining.\n */\n context.fileManager = {} as any;\n }\n context.fileManager.storage = new FileStorage({\n context\n });\n});\n\nexport default fileStorageContextPlugin;\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["fileStorageContextPlugin","ContextPlugin","context","fileManager","storage","FileStorage"],"sources":["index.ts"],"sourcesContent":["import { FileManagerContext } from \"~/types\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { FileStorage } from \"./FileStorage\";\n\nconst fileStorageContextPlugin = new ContextPlugin<FileManagerContext>(async context => {\n if (!context.fileManager) {\n /**\n * We need to define the fileManager initial property as empty object.\n * When casting as FileManagerContext, typescript is complaining.\n */\n context.fileManager = {} as any;\n }\n context.fileManager.storage = new FileStorage({\n context\n });\n});\n\nexport default fileStorageContextPlugin;\n"],"mappings":";;;;;;AACA;AACA;AAEA,MAAMA,wBAAwB,GAAG,IAAIC,kBAAa,CAAqB,MAAMC,OAAO,IAAI;EACpF,IAAI,CAACA,OAAO,CAACC,WAAW,EAAE;IACtB;AACR;AACA;AACA;IACQD,OAAO,CAACC,WAAW,GAAG,CAAC,CAAQ;EACnC;EACAD,OAAO,CAACC,WAAW,CAACC,OAAO,GAAG,IAAIC,wBAAW,CAAC;IAC1CH;EACJ,CAAC,CAAC;AACN,CAAC,CAAC;AAAC,eAEYF,wBAAwB;AAAA"}
|
package/utils.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.executeCallbacks = void 0;
|
|
7
|
-
|
|
8
7
|
const executeCallbacks = async (plugins, hook, args) => {
|
|
9
8
|
for (const plugin of plugins) {
|
|
10
9
|
if (typeof plugin[hook] === "function") {
|
|
@@ -12,5 +11,4 @@ const executeCallbacks = async (plugins, hook, args) => {
|
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
};
|
|
15
|
-
|
|
16
14
|
exports.executeCallbacks = executeCallbacks;
|
package/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["executeCallbacks","plugins","hook","args","plugin"],"sources":["utils.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/types\";\n\ntype CallbackFallback = (args: any) => void | Promise<void>;\n\nexport const executeCallbacks = async <\n TCallbackFunction extends CallbackFallback = CallbackFallback\n>(\n plugins: Plugin[],\n hook: string,\n args: Parameters<TCallbackFunction>[0]\n) => {\n for (const plugin of plugins) {\n if (typeof plugin[hook] === \"function\") {\n await plugin[hook](args);\n }\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["executeCallbacks","plugins","hook","args","plugin"],"sources":["utils.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins/types\";\n\ntype CallbackFallback = (args: any) => void | Promise<void>;\n\nexport const executeCallbacks = async <\n TCallbackFunction extends CallbackFallback = CallbackFallback\n>(\n plugins: Plugin[],\n hook: string,\n args: Parameters<TCallbackFunction>[0]\n) => {\n for (const plugin of plugins) {\n if (typeof plugin[hook] === \"function\") {\n await plugin[hook](args);\n }\n }\n};\n"],"mappings":";;;;;;AAIO,MAAMA,gBAAgB,GAAG,OAG5BC,OAAiB,EACjBC,IAAY,EACZC,IAAsC,KACrC;EACD,KAAK,MAAMC,MAAM,IAAIH,OAAO,EAAE;IAC1B,IAAI,OAAOG,MAAM,CAACF,IAAI,CAAC,KAAK,UAAU,EAAE;MACpC,MAAME,MAAM,CAACF,IAAI,CAAC,CAACC,IAAI,CAAC;IAC5B;EACJ;AACJ,CAAC;AAAC"}
|