@webiny/api-file-manager 5.34.8 → 5.35.0-beta.0
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/createFileManager/checkBasePermissions.d.ts +5 -0
- package/createFileManager/checkBasePermissions.js +24 -0
- package/createFileManager/checkBasePermissions.js.map +1 -0
- package/createFileManager/files.crud.d.ts +3 -0
- package/createFileManager/files.crud.js +318 -0
- package/createFileManager/files.crud.js.map +1 -0
- package/createFileManager/filevalidation.disabled.d.ts +0 -0
- package/createFileManager/filevalidation.disabled.js +55 -0
- package/createFileManager/filevalidation.disabled.js.map +1 -0
- package/createFileManager/index.d.ts +13 -0
- package/createFileManager/index.js +20 -0
- package/createFileManager/index.js.map +1 -0
- package/createFileManager/settings.crud.d.ts +3 -0
- package/createFileManager/settings.crud.js +91 -0
- package/createFileManager/settings.crud.js.map +1 -0
- package/createFileManager/system.crud.d.ts +3 -0
- package/createFileManager/system.crud.js +86 -0
- package/createFileManager/system.crud.js.map +1 -0
- package/graphql/index.d.ts +3 -0
- package/graphql/index.js +288 -0
- package/graphql/index.js.map +1 -0
- package/handlers/download/byAlias.d.ts +6 -0
- package/handlers/download/byAlias.js +89 -0
- package/handlers/download/byAlias.js.map +1 -0
- package/handlers/download/byExactKey.d.ts +2 -0
- package/handlers/download/byExactKey.js +57 -0
- package/handlers/download/byExactKey.js.map +1 -0
- package/handlers/download/extractFileInformation.d.ts +9 -0
- package/handlers/download/extractFileInformation.js +20 -0
- package/handlers/download/extractFileInformation.js.map +1 -0
- package/handlers/download/getS3Object.d.ts +10 -0
- package/handlers/download/getS3Object.js +57 -0
- package/handlers/download/getS3Object.js.map +1 -0
- package/handlers/download/index.d.ts +2 -3
- package/handlers/download/index.js +21 -126
- 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 +12 -19
- package/handlers/transform/index.js.map +1 -1
- package/handlers/transform/legacyUtils.d.ts +17 -0
- package/handlers/transform/legacyUtils.js +42 -0
- package/handlers/transform/legacyUtils.js.map +1 -0
- package/handlers/transform/loaders/imageLoader.d.ts +1 -1
- package/handlers/transform/loaders/imageLoader.js +12 -23
- package/handlers/transform/loaders/imageLoader.js.map +1 -1
- package/handlers/transform/loaders/index.d.ts +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 +32 -21
- 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.d.ts +1 -1
- package/handlers/transform/utils.js +7 -17
- 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/index.d.ts +6 -0
- package/index.js +68 -0
- package/index.js.map +1 -0
- package/package.json +21 -23
- package/plugins/FilePhysicalStoragePlugin.d.ts +21 -0
- package/plugins/FilePhysicalStoragePlugin.js +31 -0
- package/plugins/FilePhysicalStoragePlugin.js.map +1 -0
- package/plugins/FileStorageTransformPlugin.d.ts +34 -0
- package/plugins/FileStorageTransformPlugin.js +40 -0
- package/plugins/FileStorageTransformPlugin.js.map +1 -0
- package/plugins/graphql.js +3 -3
- package/plugins/graphql.js.map +1 -1
- package/plugins/index.d.ts +2 -2
- package/plugins/index.js +22 -19
- package/plugins/index.js.map +1 -1
- package/storage/FileStorage.d.ts +32 -0
- package/storage/FileStorage.js +86 -0
- package/storage/FileStorage.js.map +1 -0
- package/types/file.d.ts +33 -0
- package/types/file.js +5 -0
- package/types/file.js.map +1 -0
- package/types/file.lifecycle.d.ts +40 -0
- package/types/file.lifecycle.js +5 -0
- package/types/file.lifecycle.js.map +1 -0
- package/types.d.ts +44 -45
- package/types.js +22 -0
- package/types.js.map +1 -1
package/types.d.ts
CHANGED
|
@@ -1,54 +1,33 @@
|
|
|
1
1
|
import { I18NContext } from "@webiny/api-i18n/types";
|
|
2
|
-
import { FileStorage } from "./
|
|
2
|
+
import { FileStorage } from "./storage/FileStorage";
|
|
3
3
|
import { TenancyContext } from "@webiny/api-tenancy/types";
|
|
4
4
|
import { SecurityContext, SecurityPermission } from "@webiny/api-security/types";
|
|
5
5
|
import { Context } from "@webiny/api/types";
|
|
6
|
+
import { FileLifecycleEvents } from "./types/file.lifecycle";
|
|
7
|
+
import { File } from "./types/file";
|
|
8
|
+
import { Topic } from "@webiny/pubsub/types";
|
|
9
|
+
export * from "./types/file.lifecycle";
|
|
10
|
+
export * from "./types/file";
|
|
11
|
+
export interface FileManagerContextObject extends FilesCRUD, SettingsCRUD, SystemCRUD {
|
|
12
|
+
storage: FileStorage;
|
|
13
|
+
}
|
|
6
14
|
export interface FileManagerContext extends Context, SecurityContext, TenancyContext, I18NContext {
|
|
7
|
-
fileManager:
|
|
8
|
-
files: FilesCRUD;
|
|
9
|
-
settings: SettingsCRUD;
|
|
10
|
-
storage: FileStorage;
|
|
11
|
-
system: SystemCRUD;
|
|
12
|
-
};
|
|
15
|
+
fileManager: FileManagerContextObject;
|
|
13
16
|
}
|
|
14
17
|
export interface FilePermission extends SecurityPermission {
|
|
15
18
|
name: "fm.file";
|
|
16
19
|
rwd?: string;
|
|
17
20
|
own?: boolean;
|
|
18
21
|
}
|
|
19
|
-
export interface File {
|
|
20
|
-
id: string;
|
|
21
|
-
key: string;
|
|
22
|
-
size: number;
|
|
23
|
-
type: string;
|
|
24
|
-
name: string;
|
|
25
|
-
meta: Record<string, any>;
|
|
26
|
-
tags: string[];
|
|
27
|
-
createdOn: string;
|
|
28
|
-
createdBy: CreatedBy;
|
|
29
|
-
/**
|
|
30
|
-
* Added with new storage operations refactoring.
|
|
31
|
-
*/
|
|
32
|
-
tenant: string;
|
|
33
|
-
locale: string;
|
|
34
|
-
webinyVersion: string;
|
|
35
|
-
/**
|
|
36
|
-
* User can add new fields to the File object so we must allow it in the types.
|
|
37
|
-
*/
|
|
38
|
-
[key: string]: any;
|
|
39
|
-
}
|
|
40
|
-
export interface CreatedBy {
|
|
41
|
-
id: string;
|
|
42
|
-
displayName: string | null;
|
|
43
|
-
type: string;
|
|
44
|
-
}
|
|
45
22
|
export interface FileInput {
|
|
23
|
+
id: string;
|
|
46
24
|
key: string;
|
|
47
25
|
name: string;
|
|
48
26
|
size: number;
|
|
49
27
|
type: string;
|
|
50
28
|
meta: Record<string, any>;
|
|
51
29
|
tags: string[];
|
|
30
|
+
aliases: string[];
|
|
52
31
|
}
|
|
53
32
|
export interface FileListWhereParams {
|
|
54
33
|
search?: string;
|
|
@@ -87,24 +66,30 @@ interface FilesCrudListTagsParams {
|
|
|
87
66
|
limit?: number;
|
|
88
67
|
after?: string;
|
|
89
68
|
}
|
|
90
|
-
export interface
|
|
69
|
+
export interface ListTagsResponse {
|
|
70
|
+
tag: string;
|
|
71
|
+
count: number;
|
|
72
|
+
}
|
|
73
|
+
export interface FilesCRUD extends FileLifecycleEvents {
|
|
91
74
|
getFile(id: string): Promise<File>;
|
|
92
75
|
listFiles(opts?: FilesListOpts): Promise<[File[], FileListMeta]>;
|
|
93
|
-
listTags(params: FilesCrudListTagsParams): Promise<
|
|
76
|
+
listTags(params: FilesCrudListTagsParams): Promise<ListTagsResponse[]>;
|
|
94
77
|
createFile(data: FileInput): Promise<File>;
|
|
95
78
|
updateFile(id: string, data: Partial<FileInput>): Promise<File>;
|
|
96
79
|
deleteFile(id: string): Promise<boolean>;
|
|
97
80
|
createFilesInBatch(data: FileInput[]): Promise<File[]>;
|
|
98
81
|
}
|
|
99
82
|
export interface SystemCRUD {
|
|
83
|
+
onSystemBeforeInstall: Topic;
|
|
84
|
+
onSystemAfterInstall: Topic;
|
|
100
85
|
getVersion(): Promise<string | null>;
|
|
101
86
|
setVersion(version: string): Promise<void>;
|
|
102
87
|
install(args: {
|
|
103
88
|
srcPrefix: string;
|
|
104
89
|
}): Promise<boolean>;
|
|
105
|
-
upgrade(version: string, data?: Record<string, any>): Promise<boolean>;
|
|
106
90
|
}
|
|
107
91
|
export interface FileManagerSettings {
|
|
92
|
+
tenant: string;
|
|
108
93
|
key: string;
|
|
109
94
|
uploadMinFileSize: number;
|
|
110
95
|
uploadMaxFileSize: number;
|
|
@@ -149,6 +134,9 @@ export interface FileManagerSystemStorageOperationsCreateParams {
|
|
|
149
134
|
*/
|
|
150
135
|
data: FileManagerSystem;
|
|
151
136
|
}
|
|
137
|
+
export interface FileManagerSystemStorageOperationsGetParams {
|
|
138
|
+
tenant: string;
|
|
139
|
+
}
|
|
152
140
|
/**
|
|
153
141
|
* @category StorageOperations
|
|
154
142
|
* @category SystemStorageOperations
|
|
@@ -157,7 +145,7 @@ export interface FileManagerSystemStorageOperations {
|
|
|
157
145
|
/**
|
|
158
146
|
* Get the FileManager system data.
|
|
159
147
|
*/
|
|
160
|
-
get: () => Promise<FileManagerSystem | null>;
|
|
148
|
+
get: (params: FileManagerSystemStorageOperationsGetParams) => Promise<FileManagerSystem | null>;
|
|
161
149
|
/**
|
|
162
150
|
* Update the FileManager system data..
|
|
163
151
|
*/
|
|
@@ -193,6 +181,12 @@ export interface FileManagerSettingsStorageOperationsCreateParams {
|
|
|
193
181
|
*/
|
|
194
182
|
data: FileManagerSettings;
|
|
195
183
|
}
|
|
184
|
+
export interface FileManagerStorageOperationsGetSettingsParams {
|
|
185
|
+
tenant: string;
|
|
186
|
+
}
|
|
187
|
+
export interface FileManagerStorageOperationsDeleteSettings {
|
|
188
|
+
tenant: string;
|
|
189
|
+
}
|
|
196
190
|
/**
|
|
197
191
|
* @category StorageOperations
|
|
198
192
|
* @category SettingsStorageOperations
|
|
@@ -201,7 +195,7 @@ export interface FileManagerSettingsStorageOperations {
|
|
|
201
195
|
/**
|
|
202
196
|
* Get the FileManager system data.
|
|
203
197
|
*/
|
|
204
|
-
get: () => Promise<FileManagerSettings | null>;
|
|
198
|
+
get: (params: FileManagerStorageOperationsGetSettingsParams) => Promise<FileManagerSettings | null>;
|
|
205
199
|
/**
|
|
206
200
|
* Create the FileManagerSettingsData
|
|
207
201
|
*/
|
|
@@ -213,7 +207,7 @@ export interface FileManagerSettingsStorageOperations {
|
|
|
213
207
|
/**
|
|
214
208
|
* Delete the existing settings.
|
|
215
209
|
*/
|
|
216
|
-
delete: () => Promise<void>;
|
|
210
|
+
delete: (params: FileManagerStorageOperationsDeleteSettings) => Promise<void>;
|
|
217
211
|
}
|
|
218
212
|
/**
|
|
219
213
|
* @category StorageOperations
|
|
@@ -306,10 +300,10 @@ export declare type FileManagerFilesStorageOperationsListResponse = [
|
|
|
306
300
|
File[],
|
|
307
301
|
FileManagerFilesStorageOperationsListResponseMeta
|
|
308
302
|
];
|
|
309
|
-
export
|
|
310
|
-
string
|
|
311
|
-
|
|
312
|
-
|
|
303
|
+
export interface FileManagerFilesStorageOperationsTagsResponse {
|
|
304
|
+
tag: string;
|
|
305
|
+
count: number;
|
|
306
|
+
}
|
|
313
307
|
export interface FileManagerFilesStorageOperationsTagsParamsWhere extends FilesCrudListTagsWhere {
|
|
314
308
|
locale: string;
|
|
315
309
|
tenant: string;
|
|
@@ -356,6 +350,11 @@ export interface FileManagerFilesStorageOperations {
|
|
|
356
350
|
/**
|
|
357
351
|
* Get a list of all file tags filtered by given parameters.
|
|
358
352
|
*/
|
|
359
|
-
tags: (params: FileManagerFilesStorageOperationsTagsParams) => Promise<FileManagerFilesStorageOperationsTagsResponse>;
|
|
353
|
+
tags: (params: FileManagerFilesStorageOperationsTagsParams) => Promise<FileManagerFilesStorageOperationsTagsResponse[]>;
|
|
354
|
+
}
|
|
355
|
+
export interface FileManagerStorageOperations<TContext = FileManagerContext> {
|
|
356
|
+
beforeInit?: (context: TContext) => Promise<void>;
|
|
357
|
+
files: FileManagerFilesStorageOperations;
|
|
358
|
+
settings: FileManagerSettingsStorageOperations;
|
|
359
|
+
system: FileManagerSystemStorageOperations;
|
|
360
360
|
}
|
|
361
|
-
export {};
|
package/types.js
CHANGED
|
@@ -2,4 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
+
});
|
|
6
|
+
var _file = require("./types/file.lifecycle");
|
|
7
|
+
Object.keys(_file).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _file[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _file[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _file2 = require("./types/file");
|
|
18
|
+
Object.keys(_file2).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _file2[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _file2[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
5
27
|
});
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { I18NContext } from \"@webiny/api-i18n/types\";\nimport { FileStorage } from \"./plugins/storage/FileStorage\";\nimport { TenancyContext } from \"@webiny/api-tenancy/types\";\nimport { SecurityContext, SecurityPermission } from \"@webiny/api-security/types\";\nimport { Context } from \"@webiny/api/types\";\n\nexport interface FileManagerContext extends Context, SecurityContext, TenancyContext, I18NContext {\n fileManager: {\n files: FilesCRUD;\n settings: SettingsCRUD;\n storage: FileStorage;\n system: SystemCRUD;\n };\n}\n\nexport interface FilePermission extends SecurityPermission {\n name: \"fm.file\";\n rwd?: string;\n own?: boolean;\n}\n\nexport interface File {\n id: string;\n key: string;\n size: number;\n type: string;\n name: string;\n meta: Record<string, any>;\n tags: string[];\n createdOn: string;\n createdBy: CreatedBy;\n /**\n * Added with new storage operations refactoring.\n */\n tenant: string;\n locale: string;\n webinyVersion: string;\n /**\n * User can add new fields to the File object so we must allow it in the types.\n */\n [key: string]: any;\n}\n\nexport interface CreatedBy {\n id: string;\n displayName: string | null;\n type: string;\n}\n\nexport interface FileInput {\n key: string;\n name: string;\n size: number;\n type: string;\n meta: Record<string, any>;\n tags: string[];\n}\n\nexport interface FileListWhereParams {\n search?: string;\n type?: string;\n type_in?: string[];\n tag?: string;\n tag_in?: string[];\n tag_and_in?: string[];\n id_in?: string[];\n id?: string;\n}\nexport interface FilesListOpts {\n search?: string;\n types?: string[];\n tags?: string[];\n ids?: string[];\n limit?: number;\n after?: string;\n where?: FileListWhereParams;\n sort?: string[];\n}\n\nexport interface FileListMeta {\n cursor: string | null;\n totalCount: number;\n hasMoreItems: boolean;\n}\n\ninterface FilesCrudListTagsWhere {\n tag?: string;\n tag_contains?: string;\n tag_in?: string[];\n tag_not_startsWith?: string;\n tag_startsWith?: string;\n}\ninterface FilesCrudListTagsParams {\n where?: FilesCrudListTagsWhere;\n limit?: number;\n after?: string;\n}\n\nexport interface FilesCRUD {\n getFile(id: string): Promise<File>;\n listFiles(opts?: FilesListOpts): Promise<[File[], FileListMeta]>;\n listTags(params: FilesCrudListTagsParams): Promise<string[]>;\n createFile(data: FileInput): Promise<File>;\n updateFile(id: string, data: Partial<FileInput>): Promise<File>;\n deleteFile(id: string): Promise<boolean>;\n createFilesInBatch(data: FileInput[]): Promise<File[]>;\n}\n\nexport interface SystemCRUD {\n getVersion(): Promise<string | null>;\n setVersion(version: string): Promise<void>;\n install(args: { srcPrefix: string }): Promise<boolean>;\n upgrade(version: string, data?: Record<string, any>): Promise<boolean>;\n}\n\nexport interface FileManagerSettings {\n key: string;\n uploadMinFileSize: number;\n uploadMaxFileSize: number;\n srcPrefix: string;\n}\n\nexport interface FileManagerSystem {\n version: string;\n tenant: string;\n}\n\nexport type SettingsCRUD = {\n getSettings(): Promise<FileManagerSettings | null>;\n createSettings(data?: Partial<FileManagerSettings>): Promise<FileManagerSettings>;\n updateSettings(data: Partial<FileManagerSettings>): Promise<FileManagerSettings>;\n deleteSettings(): Promise<boolean>;\n};\n/********\n * Storage operations\n *******/\n\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n * @category SystemStorageOperationsParams\n */\nexport interface FileManagerSystemStorageOperationsUpdateParams {\n /**\n * The system data to be updated.\n */\n original: FileManagerSystem;\n /**\n * The system data with the updated fields.\n */\n data: FileManagerSystem;\n}\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n * @category SystemStorageOperationsParams\n */\nexport interface FileManagerSystemStorageOperationsCreateParams {\n /**\n * The system fields.\n */\n data: FileManagerSystem;\n}\n\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n */\nexport interface FileManagerSystemStorageOperations {\n /**\n * Get the FileManager system data.\n */\n get: () => Promise<FileManagerSystem | null>;\n /**\n * Update the FileManager system data..\n */\n update: (params: FileManagerSystemStorageOperationsUpdateParams) => Promise<FileManagerSystem>;\n /**\n * Create the FileManagerSystemData\n */\n create: (params: FileManagerSystemStorageOperationsCreateParams) => Promise<FileManagerSystem>;\n}\n\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n * @category SettingsStorageOperationsParams\n */\nexport interface FileManagerSettingsStorageOperationsUpdateParams {\n /**\n * Original settings to be updated.\n */\n original: FileManagerSettings;\n /**\n * The settings with the updated fields.\n */\n data: FileManagerSettings;\n}\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n * @category SettingsStorageOperationsParams\n */\nexport interface FileManagerSettingsStorageOperationsCreateParams {\n /**\n * The settings fields.\n */\n data: FileManagerSettings;\n}\n\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n */\nexport interface FileManagerSettingsStorageOperations {\n /**\n * Get the FileManager system data.\n */\n get: () => Promise<FileManagerSettings | null>;\n /**\n * Create the FileManagerSettingsData\n */\n create: (\n params: FileManagerSettingsStorageOperationsCreateParams\n ) => Promise<FileManagerSettings>;\n /**\n * Update the FileManager system data..\n */\n update: (\n params: FileManagerSettingsStorageOperationsUpdateParams\n ) => Promise<FileManagerSettings>;\n /**\n * Delete the existing settings.\n */\n delete: () => Promise<void>;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsGetParams {\n where: {\n id: string;\n tenant: string;\n locale: string;\n };\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsCreateParams {\n file: File;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsUpdateParams {\n original: File;\n file: File;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsDeleteParams {\n file: File;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsCreateBatchParams {\n files: File[];\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListParamsWhere {\n id?: string;\n id_in?: string[];\n name?: string;\n name_contains?: string;\n tag?: string;\n tag_contains?: string;\n tag_in?: string[];\n createdBy?: string;\n locale: string;\n tenant: string;\n private?: boolean;\n type?: string;\n type_in?: string[];\n search?: string;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListParams {\n where: FileManagerFilesStorageOperationsListParamsWhere;\n sort: string[];\n limit: number;\n after: string | null;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListResponseMeta {\n hasMoreItems: boolean;\n totalCount: number;\n cursor: string | null;\n}\nexport type FileManagerFilesStorageOperationsListResponse = [\n File[],\n FileManagerFilesStorageOperationsListResponseMeta\n];\n\nexport type FileManagerFilesStorageOperationsTagsResponse = [\n string[],\n FileManagerFilesStorageOperationsListResponseMeta\n];\n\nexport interface FileManagerFilesStorageOperationsTagsParamsWhere extends FilesCrudListTagsWhere {\n locale: string;\n tenant: string;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsTagsParams {\n where: FileManagerFilesStorageOperationsTagsParamsWhere;\n limit: number;\n after?: string;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n */\nexport interface FileManagerFilesStorageOperations {\n /**\n * Get a single file with given ID from the storage.\n */\n get: (params: FileManagerFilesStorageOperationsGetParams) => Promise<File | null>;\n /**\n * Insert the file data into the database.\n */\n create: (params: FileManagerFilesStorageOperationsCreateParams) => Promise<File>;\n /**\n * Update the file data in the database.\n */\n update: (params: FileManagerFilesStorageOperationsUpdateParams) => Promise<File>;\n /**\n * Delete the file from the database.\n */\n delete: (params: FileManagerFilesStorageOperationsDeleteParams) => Promise<void>;\n /**\n * Store multiple files at once to the database.\n */\n createBatch: (params: FileManagerFilesStorageOperationsCreateBatchParams) => Promise<File[]>;\n /**\n * Get a list of files filtered by given parameters.\n */\n list: (\n params: FileManagerFilesStorageOperationsListParams\n ) => Promise<FileManagerFilesStorageOperationsListResponse>;\n /**\n * Get a list of all file tags filtered by given parameters.\n */\n tags: (\n params: FileManagerFilesStorageOperationsTagsParams\n ) => Promise<FileManagerFilesStorageOperationsTagsResponse>;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { I18NContext } from \"@webiny/api-i18n/types\";\nimport { FileStorage } from \"./storage/FileStorage\";\nimport { TenancyContext } from \"@webiny/api-tenancy/types\";\nimport { SecurityContext, SecurityPermission } from \"@webiny/api-security/types\";\nimport { Context } from \"@webiny/api/types\";\nimport { FileLifecycleEvents } from \"./types/file.lifecycle\";\nimport { File } from \"./types/file\";\nimport { Topic } from \"@webiny/pubsub/types\";\nexport * from \"./types/file.lifecycle\";\nexport * from \"./types/file\";\n\nexport interface FileManagerContextObject extends FilesCRUD, SettingsCRUD, SystemCRUD {\n storage: FileStorage;\n}\n\nexport interface FileManagerContext extends Context, SecurityContext, TenancyContext, I18NContext {\n fileManager: FileManagerContextObject;\n}\n\nexport interface FilePermission extends SecurityPermission {\n name: \"fm.file\";\n rwd?: string;\n own?: boolean;\n}\n\nexport interface FileInput {\n id: string;\n key: string;\n name: string;\n size: number;\n type: string;\n meta: Record<string, any>;\n tags: string[];\n aliases: string[];\n}\n\nexport interface FileListWhereParams {\n search?: string;\n type?: string;\n type_in?: string[];\n tag?: string;\n tag_in?: string[];\n tag_and_in?: string[];\n id_in?: string[];\n id?: string;\n}\nexport interface FilesListOpts {\n search?: string;\n types?: string[];\n tags?: string[];\n ids?: string[];\n limit?: number;\n after?: string;\n where?: FileListWhereParams;\n sort?: string[];\n}\n\nexport interface FileListMeta {\n cursor: string | null;\n totalCount: number;\n hasMoreItems: boolean;\n}\n\ninterface FilesCrudListTagsWhere {\n tag?: string;\n tag_contains?: string;\n tag_in?: string[];\n tag_not_startsWith?: string;\n tag_startsWith?: string;\n}\ninterface FilesCrudListTagsParams {\n where?: FilesCrudListTagsWhere;\n limit?: number;\n after?: string;\n}\n\nexport interface ListTagsResponse {\n tag: string;\n count: number;\n}\nexport interface FilesCRUD extends FileLifecycleEvents {\n getFile(id: string): Promise<File>;\n listFiles(opts?: FilesListOpts): Promise<[File[], FileListMeta]>;\n listTags(params: FilesCrudListTagsParams): Promise<ListTagsResponse[]>;\n createFile(data: FileInput): Promise<File>;\n updateFile(id: string, data: Partial<FileInput>): Promise<File>;\n deleteFile(id: string): Promise<boolean>;\n createFilesInBatch(data: FileInput[]): Promise<File[]>;\n}\n\nexport interface SystemCRUD {\n onSystemBeforeInstall: Topic;\n onSystemAfterInstall: Topic;\n getVersion(): Promise<string | null>;\n setVersion(version: string): Promise<void>;\n install(args: { srcPrefix: string }): Promise<boolean>;\n}\n\nexport interface FileManagerSettings {\n tenant: string;\n key: string;\n uploadMinFileSize: number;\n uploadMaxFileSize: number;\n srcPrefix: string;\n}\n\nexport interface FileManagerSystem {\n version: string;\n tenant: string;\n}\n\nexport type SettingsCRUD = {\n getSettings(): Promise<FileManagerSettings | null>;\n createSettings(data?: Partial<FileManagerSettings>): Promise<FileManagerSettings>;\n updateSettings(data: Partial<FileManagerSettings>): Promise<FileManagerSettings>;\n deleteSettings(): Promise<boolean>;\n};\n/********\n * Storage operations\n *******/\n\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n * @category SystemStorageOperationsParams\n */\nexport interface FileManagerSystemStorageOperationsUpdateParams {\n /**\n * The system data to be updated.\n */\n original: FileManagerSystem;\n /**\n * The system data with the updated fields.\n */\n data: FileManagerSystem;\n}\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n * @category SystemStorageOperationsParams\n */\nexport interface FileManagerSystemStorageOperationsCreateParams {\n /**\n * The system fields.\n */\n data: FileManagerSystem;\n}\n\nexport interface FileManagerSystemStorageOperationsGetParams {\n tenant: string;\n}\n\n/**\n * @category StorageOperations\n * @category SystemStorageOperations\n */\nexport interface FileManagerSystemStorageOperations {\n /**\n * Get the FileManager system data.\n */\n get: (params: FileManagerSystemStorageOperationsGetParams) => Promise<FileManagerSystem | null>;\n /**\n * Update the FileManager system data..\n */\n update: (params: FileManagerSystemStorageOperationsUpdateParams) => Promise<FileManagerSystem>;\n /**\n * Create the FileManagerSystemData\n */\n create: (params: FileManagerSystemStorageOperationsCreateParams) => Promise<FileManagerSystem>;\n}\n\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n * @category SettingsStorageOperationsParams\n */\nexport interface FileManagerSettingsStorageOperationsUpdateParams {\n /**\n * Original settings to be updated.\n */\n original: FileManagerSettings;\n /**\n * The settings with the updated fields.\n */\n data: FileManagerSettings;\n}\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n * @category SettingsStorageOperationsParams\n */\nexport interface FileManagerSettingsStorageOperationsCreateParams {\n /**\n * The settings fields.\n */\n data: FileManagerSettings;\n}\n\nexport interface FileManagerStorageOperationsGetSettingsParams {\n tenant: string;\n}\n\nexport interface FileManagerStorageOperationsDeleteSettings {\n tenant: string;\n}\n\n/**\n * @category StorageOperations\n * @category SettingsStorageOperations\n */\nexport interface FileManagerSettingsStorageOperations {\n /**\n * Get the FileManager system data.\n */\n get: (\n params: FileManagerStorageOperationsGetSettingsParams\n ) => Promise<FileManagerSettings | null>;\n /**\n * Create the FileManagerSettingsData\n */\n create: (\n params: FileManagerSettingsStorageOperationsCreateParams\n ) => Promise<FileManagerSettings>;\n /**\n * Update the FileManager system data..\n */\n update: (\n params: FileManagerSettingsStorageOperationsUpdateParams\n ) => Promise<FileManagerSettings>;\n /**\n * Delete the existing settings.\n */\n delete: (params: FileManagerStorageOperationsDeleteSettings) => Promise<void>;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsGetParams {\n where: {\n id: string;\n tenant: string;\n locale: string;\n };\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsCreateParams {\n file: File;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsUpdateParams {\n original: File;\n file: File;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsDeleteParams {\n file: File;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsCreateBatchParams {\n files: File[];\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListParamsWhere {\n id?: string;\n id_in?: string[];\n name?: string;\n name_contains?: string;\n tag?: string;\n tag_contains?: string;\n tag_in?: string[];\n createdBy?: string;\n locale: string;\n tenant: string;\n private?: boolean;\n type?: string;\n type_in?: string[];\n search?: string;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListParams {\n where: FileManagerFilesStorageOperationsListParamsWhere;\n sort: string[];\n limit: number;\n after: string | null;\n}\n\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsListResponseMeta {\n hasMoreItems: boolean;\n totalCount: number;\n cursor: string | null;\n}\nexport type FileManagerFilesStorageOperationsListResponse = [\n File[],\n FileManagerFilesStorageOperationsListResponseMeta\n];\n\nexport interface FileManagerFilesStorageOperationsTagsResponse {\n tag: string;\n count: number;\n}\n\nexport interface FileManagerFilesStorageOperationsTagsParamsWhere extends FilesCrudListTagsWhere {\n locale: string;\n tenant: string;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n * @category FilesStorageOperationsParams\n */\nexport interface FileManagerFilesStorageOperationsTagsParams {\n where: FileManagerFilesStorageOperationsTagsParamsWhere;\n limit: number;\n after?: string;\n}\n/**\n * @category StorageOperations\n * @category FilesStorageOperations\n */\nexport interface FileManagerFilesStorageOperations {\n /**\n * Get a single file with given ID from the storage.\n */\n get: (params: FileManagerFilesStorageOperationsGetParams) => Promise<File | null>;\n /**\n * Insert the file data into the database.\n */\n create: (params: FileManagerFilesStorageOperationsCreateParams) => Promise<File>;\n /**\n * Update the file data in the database.\n */\n update: (params: FileManagerFilesStorageOperationsUpdateParams) => Promise<File>;\n /**\n * Delete the file from the database.\n */\n delete: (params: FileManagerFilesStorageOperationsDeleteParams) => Promise<void>;\n /**\n * Store multiple files at once to the database.\n */\n createBatch: (params: FileManagerFilesStorageOperationsCreateBatchParams) => Promise<File[]>;\n /**\n * Get a list of files filtered by given parameters.\n */\n list: (\n params: FileManagerFilesStorageOperationsListParams\n ) => Promise<FileManagerFilesStorageOperationsListResponse>;\n /**\n * Get a list of all file tags filtered by given parameters.\n */\n tags: (\n params: FileManagerFilesStorageOperationsTagsParams\n ) => Promise<FileManagerFilesStorageOperationsTagsResponse[]>;\n}\n\nexport interface FileManagerStorageOperations<TContext = FileManagerContext> {\n beforeInit?: (context: TContext) => Promise<void>;\n files: FileManagerFilesStorageOperations;\n settings: FileManagerSettingsStorageOperations;\n system: FileManagerSystemStorageOperations;\n}\n"],"mappings":";;;;;AAQA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|