@webiny/api-file-manager 0.0.0-unstable.97a151f74d → 0.0.0-unstable.99666aeb00
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/FileManagerContextSetup.d.ts +13 -0
- package/FileManagerContextSetup.js +113 -0
- package/FileManagerContextSetup.js.map +1 -0
- package/cmsFileStorage/CmsFilesStorage.d.ts +27 -0
- package/cmsFileStorage/CmsFilesStorage.js +173 -0
- package/cmsFileStorage/CmsFilesStorage.js.map +1 -0
- package/cmsFileStorage/ListFilesWhereProcessor.d.ts +7 -0
- package/cmsFileStorage/ListFilesWhereProcessor.js +35 -0
- package/cmsFileStorage/ListFilesWhereProcessor.js.map +1 -0
- package/cmsFileStorage/ListTagsWhereProcessor.d.ts +7 -0
- package/cmsFileStorage/ListTagsWhereProcessor.js +35 -0
- package/cmsFileStorage/ListTagsWhereProcessor.js.map +1 -0
- package/cmsFileStorage/createFileManagerPlugins.d.ts +5 -0
- package/cmsFileStorage/createFileManagerPlugins.js +34 -0
- package/cmsFileStorage/createFileManagerPlugins.js.map +1 -0
- package/cmsFileStorage/createModelField.d.ts +5 -0
- package/cmsFileStorage/createModelField.js +37 -0
- package/cmsFileStorage/createModelField.js.map +1 -0
- package/cmsFileStorage/file.model.d.ts +4 -0
- package/cmsFileStorage/file.model.js +118 -0
- package/cmsFileStorage/file.model.js.map +1 -0
- package/cmsFileStorage/isInstallationPending.d.ts +4 -0
- package/cmsFileStorage/isInstallationPending.js +21 -0
- package/cmsFileStorage/isInstallationPending.js.map +1 -0
- package/contants.d.ts +1 -0
- package/contants.js +8 -0
- package/contants.js.map +1 -0
- package/createFileManager/files.crud.d.ts +3 -0
- package/createFileManager/files.crud.js +300 -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 +15 -0
- package/createFileManager/index.js +20 -0
- package/createFileManager/index.js.map +1 -0
- package/createFileManager/permissions/FilesPermissions.d.ts +4 -0
- package/createFileManager/permissions/FilesPermissions.js +9 -0
- package/createFileManager/permissions/FilesPermissions.js.map +1 -0
- package/createFileManager/settings.crud.d.ts +3 -0
- package/{plugins/crud → createFileManager}/settings.crud.js +27 -52
- 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/baseSchema.d.ts +3 -0
- package/graphql/baseSchema.js +117 -0
- package/graphql/baseSchema.js.map +1 -0
- package/graphql/createFilesTypeDefs.d.ts +7 -0
- package/graphql/createFilesTypeDefs.js +162 -0
- package/graphql/createFilesTypeDefs.js.map +1 -0
- package/graphql/filesSchema.d.ts +4 -0
- package/graphql/filesSchema.js +83 -0
- package/graphql/filesSchema.js.map +1 -0
- package/graphql/index.d.ts +3 -0
- package/graphql/index.js +33 -0
- package/graphql/index.js.map +1 -0
- package/graphql/utils.d.ts +11 -0
- package/graphql/utils.js +22 -0
- package/graphql/utils.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 +12 -0
- package/handlers/download/getS3Object.js +72 -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 +24 -23
- 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.d.ts +5 -2
- package/handlers/transform/transformImage.js +6 -8
- package/handlers/transform/transformImage.js.map +1 -1
- package/handlers/transform/utils.d.ts +1 -1
- package/handlers/transform/utils.js +9 -19
- 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 +7 -0
- package/index.js +52 -0
- package/index.js.map +1 -0
- package/modelModifier/CmsModelModifier.d.ts +24 -0
- package/modelModifier/CmsModelModifier.js +59 -0
- package/modelModifier/CmsModelModifier.js.map +1 -0
- package/package.json +31 -32
- package/plugins/{definitions/FilePhysicalStoragePlugin.d.ts → FilePhysicalStoragePlugin.d.ts} +1 -1
- package/plugins/{definitions/FilePhysicalStoragePlugin.js → FilePhysicalStoragePlugin.js} +0 -11
- package/plugins/{definitions/FilePhysicalStoragePlugin.js.map → FilePhysicalStoragePlugin.js.map} +1 -1
- package/plugins/{definitions/FileStorageTransformPlugin.d.ts → FileStorageTransformPlugin.d.ts} +1 -1
- package/plugins/{definitions/FileStorageTransformPlugin.js → FileStorageTransformPlugin.js} +1 -12
- package/plugins/{definitions/FileStorageTransformPlugin.js.map → FileStorageTransformPlugin.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/{plugins/storage → storage}/FileStorage.d.ts +6 -4
- package/{plugins/storage → storage}/FileStorage.js +29 -46
- package/storage/FileStorage.js.map +1 -0
- package/types/file.d.ts +37 -0
- package/types/file.js +5 -0
- package/types/file.js.map +1 -0
- package/types/file.lifecycle.d.ts +44 -0
- package/types/file.lifecycle.js +5 -0
- package/types/file.lifecycle.js.map +1 -0
- package/types.d.ts +62 -73
- package/types.js +22 -0
- package/types.js.map +1 -1
- package/plugins/crud/files/validation.d.ts +0 -3
- package/plugins/crud/files/validation.js +0 -41
- package/plugins/crud/files/validation.js.map +0 -1
- package/plugins/crud/files.crud.d.ts +0 -4
- package/plugins/crud/files.crud.js +0 -431
- package/plugins/crud/files.crud.js.map +0 -1
- package/plugins/crud/settings.crud.d.ts +0 -5
- package/plugins/crud/settings.crud.js.map +0 -1
- package/plugins/crud/system.crud.d.ts +0 -4
- package/plugins/crud/system.crud.js +0 -153
- package/plugins/crud/system.crud.js.map +0 -1
- package/plugins/crud/utils/checkBasePermissions.d.ts +0 -5
- package/plugins/crud/utils/checkBasePermissions.js +0 -33
- package/plugins/crud/utils/checkBasePermissions.js.map +0 -1
- package/plugins/crud/utils/createFileModel.d.ts +0 -5
- package/plugins/crud/utils/createFileModel.js +0 -77
- package/plugins/crud/utils/createFileModel.js.map +0 -1
- package/plugins/crud/utils/lifecycleEvents.d.ts +0 -6
- package/plugins/crud/utils/lifecycleEvents.js +0 -38
- package/plugins/crud/utils/lifecycleEvents.js.map +0 -1
- package/plugins/definitions/FilePlugin.d.ts +0 -136
- package/plugins/definitions/FilePlugin.js +0 -70
- package/plugins/definitions/FilePlugin.js.map +0 -1
- package/plugins/definitions/FilesStorageOperationsProviderPlugin.d.ts +0 -9
- package/plugins/definitions/FilesStorageOperationsProviderPlugin.js +0 -17
- package/plugins/definitions/FilesStorageOperationsProviderPlugin.js.map +0 -1
- package/plugins/definitions/InstallationPlugin.d.ts +0 -19
- package/plugins/definitions/InstallationPlugin.js +0 -42
- package/plugins/definitions/InstallationPlugin.js.map +0 -1
- package/plugins/definitions/SettingsStorageOperationsProviderPlugin.d.ts +0 -9
- package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js +0 -17
- package/plugins/definitions/SettingsStorageOperationsProviderPlugin.js.map +0 -1
- package/plugins/definitions/SystemStorageOperationsProviderPlugin.d.ts +0 -9
- package/plugins/definitions/SystemStorageOperationsProviderPlugin.js +0 -17
- package/plugins/definitions/SystemStorageOperationsProviderPlugin.js.map +0 -1
- package/plugins/graphql.d.ts +0 -4
- package/plugins/graphql.js +0 -290
- package/plugins/graphql.js.map +0 -1
- package/plugins/storage/FileStorage.js.map +0 -1
- package/plugins/storage/index.d.ts +0 -4
- package/plugins/storage/index.js +0 -26
- package/plugins/storage/index.js.map +0 -1
- package/utils.d.ts +0 -4
- package/utils.js +0 -16
- package/utils.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["file.lifecycle.ts"],"sourcesContent":["import { Topic } from \"@webiny/pubsub/types\";\nimport { File } from \"./file\";\n\nexport interface OnFileBeforeCreateTopicParams<TFile extends File = File> {\n file: TFile;\n meta?: Record<string, any>;\n}\n\nexport interface OnFileAfterCreateTopicParams<TFile extends File = File> {\n file: TFile;\n meta?: Record<string, any>;\n}\n\nexport interface OnFileBeforeBatchCreateTopicParams<TFile extends File = File> {\n files: TFile[];\n meta?: Record<string, any>;\n}\n\nexport interface OnFileAfterBatchCreateTopicParams<TFile extends File = File> {\n files: TFile[];\n meta?: Record<string, any>;\n}\n\nexport interface OnFileBeforeUpdateTopicParams<TFile extends File = File> {\n original: TFile;\n file: TFile;\n input: Record<string, any>;\n}\n\nexport interface OnFileAfterUpdateTopicParams<TFile extends File = File> {\n original: TFile;\n file: TFile;\n input: Record<string, any>;\n}\n\nexport interface OnFileBeforeDeleteTopicParams<TFile extends File = File> {\n file: TFile;\n}\n\nexport interface OnFileAfterDeleteTopicParams<TFile extends File = File> {\n file: TFile;\n}\n\nexport interface FileLifecycleEvents {\n onFileBeforeCreate: Topic<OnFileBeforeCreateTopicParams>;\n onFileAfterCreate: Topic<OnFileAfterCreateTopicParams>;\n onFileBeforeBatchCreate: Topic<OnFileBeforeBatchCreateTopicParams>;\n onFileAfterBatchCreate: Topic<OnFileAfterBatchCreateTopicParams>;\n onFileBeforeUpdate: Topic<OnFileBeforeUpdateTopicParams>;\n onFileAfterUpdate: Topic<OnFileAfterUpdateTopicParams>;\n onFileBeforeDelete: Topic<OnFileBeforeDeleteTopicParams>;\n onFileAfterDelete: Topic<OnFileAfterDeleteTopicParams>;\n}\n"],"mappings":""}
|
package/types.d.ts
CHANGED
|
@@ -1,70 +1,46 @@
|
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
import { FileLifecycleEvents } from "./types/file.lifecycle";
|
|
7
|
+
import { File } from "./types/file";
|
|
8
|
+
import { Topic } from "@webiny/pubsub/types";
|
|
9
|
+
import { CmsContext } from "@webiny/api-headless-cms/types";
|
|
10
|
+
export * from "./types/file.lifecycle";
|
|
11
|
+
export * from "./types/file";
|
|
12
|
+
export interface FileManagerContextObject extends FilesCRUD, SettingsCRUD, SystemCRUD {
|
|
13
|
+
storage: FileStorage;
|
|
14
|
+
}
|
|
15
|
+
export interface FileManagerContext extends Context, SecurityContext, TenancyContext, I18NContext, CmsContext {
|
|
16
|
+
fileManager: FileManagerContextObject;
|
|
13
17
|
}
|
|
14
18
|
export interface FilePermission extends SecurityPermission {
|
|
15
19
|
name: "fm.file";
|
|
16
20
|
rwd?: string;
|
|
17
21
|
own?: boolean;
|
|
18
22
|
}
|
|
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
23
|
export interface FileInput {
|
|
24
|
+
id: string;
|
|
46
25
|
key: string;
|
|
47
26
|
name: string;
|
|
48
27
|
size: number;
|
|
49
28
|
type: string;
|
|
50
29
|
meta: Record<string, any>;
|
|
30
|
+
location?: {
|
|
31
|
+
folderId: string;
|
|
32
|
+
};
|
|
51
33
|
tags: string[];
|
|
34
|
+
aliases: string[];
|
|
35
|
+
extensions?: Record<string, any>;
|
|
52
36
|
}
|
|
53
37
|
export interface FileListWhereParams {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
tag?: string;
|
|
58
|
-
tag_in?: string[];
|
|
59
|
-
tag_and_in?: string[];
|
|
60
|
-
id_in?: string[];
|
|
61
|
-
id?: string;
|
|
38
|
+
AND?: FileListWhereParams[];
|
|
39
|
+
OR?: FileListWhereParams[];
|
|
40
|
+
[key: string]: any;
|
|
62
41
|
}
|
|
63
42
|
export interface FilesListOpts {
|
|
64
43
|
search?: string;
|
|
65
|
-
types?: string[];
|
|
66
|
-
tags?: string[];
|
|
67
|
-
ids?: string[];
|
|
68
44
|
limit?: number;
|
|
69
45
|
after?: string;
|
|
70
46
|
where?: FileListWhereParams;
|
|
@@ -87,24 +63,30 @@ interface FilesCrudListTagsParams {
|
|
|
87
63
|
limit?: number;
|
|
88
64
|
after?: string;
|
|
89
65
|
}
|
|
90
|
-
export interface
|
|
66
|
+
export interface ListTagsResponse {
|
|
67
|
+
tag: string;
|
|
68
|
+
count: number;
|
|
69
|
+
}
|
|
70
|
+
export interface FilesCRUD extends FileLifecycleEvents {
|
|
91
71
|
getFile(id: string): Promise<File>;
|
|
92
72
|
listFiles(opts?: FilesListOpts): Promise<[File[], FileListMeta]>;
|
|
93
|
-
listTags(params: FilesCrudListTagsParams): Promise<
|
|
94
|
-
createFile(data: FileInput): Promise<File>;
|
|
73
|
+
listTags(params: FilesCrudListTagsParams): Promise<ListTagsResponse[]>;
|
|
74
|
+
createFile(data: FileInput, meta?: Record<string, any>): Promise<File>;
|
|
95
75
|
updateFile(id: string, data: Partial<FileInput>): Promise<File>;
|
|
96
76
|
deleteFile(id: string): Promise<boolean>;
|
|
97
|
-
createFilesInBatch(data: FileInput[]): Promise<File[]>;
|
|
77
|
+
createFilesInBatch(data: FileInput[], meta?: Record<string, any>): Promise<File[]>;
|
|
98
78
|
}
|
|
99
79
|
export interface SystemCRUD {
|
|
80
|
+
onSystemBeforeInstall: Topic;
|
|
81
|
+
onSystemAfterInstall: Topic;
|
|
100
82
|
getVersion(): Promise<string | null>;
|
|
101
83
|
setVersion(version: string): Promise<void>;
|
|
102
84
|
install(args: {
|
|
103
85
|
srcPrefix: string;
|
|
104
86
|
}): Promise<boolean>;
|
|
105
|
-
upgrade(version: string, data?: Record<string, any>): Promise<boolean>;
|
|
106
87
|
}
|
|
107
88
|
export interface FileManagerSettings {
|
|
89
|
+
tenant: string;
|
|
108
90
|
key: string;
|
|
109
91
|
uploadMinFileSize: number;
|
|
110
92
|
uploadMaxFileSize: number;
|
|
@@ -149,6 +131,9 @@ export interface FileManagerSystemStorageOperationsCreateParams {
|
|
|
149
131
|
*/
|
|
150
132
|
data: FileManagerSystem;
|
|
151
133
|
}
|
|
134
|
+
export interface FileManagerSystemStorageOperationsGetParams {
|
|
135
|
+
tenant: string;
|
|
136
|
+
}
|
|
152
137
|
/**
|
|
153
138
|
* @category StorageOperations
|
|
154
139
|
* @category SystemStorageOperations
|
|
@@ -157,7 +142,7 @@ export interface FileManagerSystemStorageOperations {
|
|
|
157
142
|
/**
|
|
158
143
|
* Get the FileManager system data.
|
|
159
144
|
*/
|
|
160
|
-
get: () => Promise<FileManagerSystem | null>;
|
|
145
|
+
get: (params: FileManagerSystemStorageOperationsGetParams) => Promise<FileManagerSystem | null>;
|
|
161
146
|
/**
|
|
162
147
|
* Update the FileManager system data..
|
|
163
148
|
*/
|
|
@@ -193,6 +178,12 @@ export interface FileManagerSettingsStorageOperationsCreateParams {
|
|
|
193
178
|
*/
|
|
194
179
|
data: FileManagerSettings;
|
|
195
180
|
}
|
|
181
|
+
export interface FileManagerStorageOperationsGetSettingsParams {
|
|
182
|
+
tenant: string;
|
|
183
|
+
}
|
|
184
|
+
export interface FileManagerStorageOperationsDeleteSettings {
|
|
185
|
+
tenant: string;
|
|
186
|
+
}
|
|
196
187
|
/**
|
|
197
188
|
* @category StorageOperations
|
|
198
189
|
* @category SettingsStorageOperations
|
|
@@ -201,7 +192,7 @@ export interface FileManagerSettingsStorageOperations {
|
|
|
201
192
|
/**
|
|
202
193
|
* Get the FileManager system data.
|
|
203
194
|
*/
|
|
204
|
-
get: () => Promise<FileManagerSettings | null>;
|
|
195
|
+
get: (params: FileManagerStorageOperationsGetSettingsParams) => Promise<FileManagerSettings | null>;
|
|
205
196
|
/**
|
|
206
197
|
* Create the FileManagerSettingsData
|
|
207
198
|
*/
|
|
@@ -213,7 +204,7 @@ export interface FileManagerSettingsStorageOperations {
|
|
|
213
204
|
/**
|
|
214
205
|
* Delete the existing settings.
|
|
215
206
|
*/
|
|
216
|
-
delete: () => Promise<void>;
|
|
207
|
+
delete: (params: FileManagerStorageOperationsDeleteSettings) => Promise<void>;
|
|
217
208
|
}
|
|
218
209
|
/**
|
|
219
210
|
* @category StorageOperations
|
|
@@ -266,20 +257,7 @@ export interface FileManagerFilesStorageOperationsCreateBatchParams {
|
|
|
266
257
|
* @category FilesStorageOperationsParams
|
|
267
258
|
*/
|
|
268
259
|
export interface FileManagerFilesStorageOperationsListParamsWhere {
|
|
269
|
-
|
|
270
|
-
id_in?: string[];
|
|
271
|
-
name?: string;
|
|
272
|
-
name_contains?: string;
|
|
273
|
-
tag?: string;
|
|
274
|
-
tag_contains?: string;
|
|
275
|
-
tag_in?: string[];
|
|
276
|
-
createdBy?: string;
|
|
277
|
-
locale: string;
|
|
278
|
-
tenant: string;
|
|
279
|
-
private?: boolean;
|
|
280
|
-
type?: string;
|
|
281
|
-
type_in?: string[];
|
|
282
|
-
search?: string;
|
|
260
|
+
[key: string]: any;
|
|
283
261
|
}
|
|
284
262
|
/**
|
|
285
263
|
* @category StorageOperations
|
|
@@ -291,6 +269,7 @@ export interface FileManagerFilesStorageOperationsListParams {
|
|
|
291
269
|
sort: string[];
|
|
292
270
|
limit: number;
|
|
293
271
|
after: string | null;
|
|
272
|
+
search?: string;
|
|
294
273
|
}
|
|
295
274
|
/**
|
|
296
275
|
* @category StorageOperations
|
|
@@ -306,10 +285,10 @@ export declare type FileManagerFilesStorageOperationsListResponse = [
|
|
|
306
285
|
File[],
|
|
307
286
|
FileManagerFilesStorageOperationsListResponseMeta
|
|
308
287
|
];
|
|
309
|
-
export
|
|
310
|
-
string
|
|
311
|
-
|
|
312
|
-
|
|
288
|
+
export interface FileManagerFilesStorageOperationsTagsResponse {
|
|
289
|
+
tag: string;
|
|
290
|
+
count: number;
|
|
291
|
+
}
|
|
313
292
|
export interface FileManagerFilesStorageOperationsTagsParamsWhere extends FilesCrudListTagsWhere {
|
|
314
293
|
locale: string;
|
|
315
294
|
tenant: string;
|
|
@@ -356,6 +335,16 @@ export interface FileManagerFilesStorageOperations {
|
|
|
356
335
|
/**
|
|
357
336
|
* Get a list of all file tags filtered by given parameters.
|
|
358
337
|
*/
|
|
359
|
-
tags: (params: FileManagerFilesStorageOperationsTagsParams) => Promise<FileManagerFilesStorageOperationsTagsResponse>;
|
|
338
|
+
tags: (params: FileManagerFilesStorageOperationsTagsParams) => Promise<FileManagerFilesStorageOperationsTagsResponse[]>;
|
|
339
|
+
}
|
|
340
|
+
export interface FileManagerAliasesStorageOperations {
|
|
341
|
+
storeAliases(file: File): Promise<void>;
|
|
342
|
+
deleteAliases(file: File): Promise<void>;
|
|
343
|
+
}
|
|
344
|
+
export interface FileManagerStorageOperations<TContext = FileManagerContext> {
|
|
345
|
+
beforeInit?: (context: TContext) => Promise<void>;
|
|
346
|
+
files: FileManagerFilesStorageOperations;
|
|
347
|
+
aliases: FileManagerAliasesStorageOperations;
|
|
348
|
+
settings: FileManagerSettingsStorageOperations;
|
|
349
|
+
system: FileManagerSystemStorageOperations;
|
|
360
350
|
}
|
|
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\";\nimport { CmsContext } from \"@webiny/api-headless-cms/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\n extends Context,\n SecurityContext,\n TenancyContext,\n I18NContext,\n CmsContext {\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 location?: {\n folderId: string;\n };\n tags: string[];\n aliases: string[];\n extensions?: Record<string, any>;\n}\n\nexport interface FileListWhereParams {\n AND?: FileListWhereParams[];\n OR?: FileListWhereParams[];\n [key: string]: any;\n}\nexport interface FilesListOpts {\n search?: 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, meta?: Record<string, any>): Promise<File>;\n updateFile(id: string, data: Partial<FileInput>): Promise<File>;\n deleteFile(id: string): Promise<boolean>;\n createFilesInBatch(data: FileInput[], meta?: Record<string, any>): 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 [key: string]: any;\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 search?: string;\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 FileManagerAliasesStorageOperations {\n storeAliases(file: File): Promise<void>;\n deleteAliases(file: File): Promise<void>;\n}\n\nexport interface FileManagerStorageOperations<TContext = FileManagerContext> {\n beforeInit?: (context: TContext) => Promise<void>;\n files: FileManagerFilesStorageOperations;\n aliases: FileManagerAliasesStorageOperations;\n settings: FileManagerSettingsStorageOperations;\n system: FileManagerSystemStorageOperations;\n}\n"],"mappings":";;;;;AASA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1,41 +0,0 @@
|
|
|
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 _FilePlugin = require("../../definitions/FilePlugin");
|
|
11
|
-
|
|
12
|
-
var _createFileModel = _interopRequireDefault(require("../utils/createFileModel"));
|
|
13
|
-
|
|
14
|
-
var _default = () => [new _FilePlugin.FilePlugin({
|
|
15
|
-
beforeCreate: async ({
|
|
16
|
-
data
|
|
17
|
-
}) => {
|
|
18
|
-
const FileModel = (0, _createFileModel.default)();
|
|
19
|
-
const fileData = new FileModel().populate(data);
|
|
20
|
-
await fileData.validate();
|
|
21
|
-
},
|
|
22
|
-
beforeUpdate: async ({
|
|
23
|
-
data
|
|
24
|
-
}) => {
|
|
25
|
-
const FileModel = (0, _createFileModel.default)(false);
|
|
26
|
-
const updatedFileData = new FileModel().populate(data);
|
|
27
|
-
await updatedFileData.validate();
|
|
28
|
-
},
|
|
29
|
-
beforeBatchCreate: async ({
|
|
30
|
-
data
|
|
31
|
-
}) => {
|
|
32
|
-
const FileModel = (0, _createFileModel.default)();
|
|
33
|
-
|
|
34
|
-
for (const input of data) {
|
|
35
|
-
const fileInstance = new FileModel().populate(input);
|
|
36
|
-
await fileInstance.validate();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
})];
|
|
40
|
-
|
|
41
|
-
exports.default = _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["FilePlugin","beforeCreate","data","FileModel","createFileModel","fileData","populate","validate","beforeUpdate","updatedFileData","beforeBatchCreate","input","fileInstance"],"sources":["validation.ts"],"sourcesContent":["import { FilePlugin } from \"~/plugins/definitions/FilePlugin\";\nimport createFileModel from \"~/plugins/crud/utils/createFileModel\";\n\nexport default (): FilePlugin[] => [\n new FilePlugin({\n beforeCreate: async ({ data }) => {\n const FileModel = createFileModel();\n const fileData = new FileModel().populate(data);\n await fileData.validate();\n },\n beforeUpdate: async ({ data }) => {\n const FileModel = createFileModel(false);\n const updatedFileData = new FileModel().populate(data);\n await updatedFileData.validate();\n },\n beforeBatchCreate: async ({ data }) => {\n const FileModel = createFileModel();\n for (const input of data) {\n const fileInstance = new FileModel().populate(input);\n await fileInstance.validate();\n }\n }\n })\n];\n"],"mappings":";;;;;;;;;AAAA;;AACA;;eAEe,MAAoB,CAC/B,IAAIA,sBAAJ,CAAe;EACXC,YAAY,EAAE,OAAO;IAAEC;EAAF,CAAP,KAAoB;IAC9B,MAAMC,SAAS,GAAG,IAAAC,wBAAA,GAAlB;IACA,MAAMC,QAAQ,GAAG,IAAIF,SAAJ,GAAgBG,QAAhB,CAAyBJ,IAAzB,CAAjB;IACA,MAAMG,QAAQ,CAACE,QAAT,EAAN;EACH,CALU;EAMXC,YAAY,EAAE,OAAO;IAAEN;EAAF,CAAP,KAAoB;IAC9B,MAAMC,SAAS,GAAG,IAAAC,wBAAA,EAAgB,KAAhB,CAAlB;IACA,MAAMK,eAAe,GAAG,IAAIN,SAAJ,GAAgBG,QAAhB,CAAyBJ,IAAzB,CAAxB;IACA,MAAMO,eAAe,CAACF,QAAhB,EAAN;EACH,CAVU;EAWXG,iBAAiB,EAAE,OAAO;IAAER;EAAF,CAAP,KAAoB;IACnC,MAAMC,SAAS,GAAG,IAAAC,wBAAA,GAAlB;;IACA,KAAK,MAAMO,KAAX,IAAoBT,IAApB,EAA0B;MACtB,MAAMU,YAAY,GAAG,IAAIT,SAAJ,GAAgBG,QAAhB,CAAyBK,KAAzB,CAArB;MACA,MAAMC,YAAY,CAACL,QAAb,EAAN;IACH;EACJ;AAjBU,CAAf,CAD+B,C"}
|