@strapi/upload 5.0.6 → 5.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/_chunks/{index-p2ufusDD.mjs → index-24xAAxoi.mjs} +12 -9
  2. package/dist/_chunks/index-24xAAxoi.mjs.map +1 -0
  3. package/dist/_chunks/{index-BWoTIP6T.js → index-BCVXHM2B.js} +5 -2
  4. package/dist/_chunks/index-BCVXHM2B.js.map +1 -0
  5. package/dist/_chunks/{index-D0UI77ZE.mjs → index-BVvzCEIn.mjs} +2 -2
  6. package/dist/_chunks/{index-D0UI77ZE.mjs.map → index-BVvzCEIn.mjs.map} +1 -1
  7. package/dist/_chunks/{index-CZ3rXZbR.mjs → index-CAg5RL9X.mjs} +5 -2
  8. package/dist/_chunks/index-CAg5RL9X.mjs.map +1 -0
  9. package/dist/_chunks/{index-4dDBcT2s.js → index-Cni0ouV8.js} +370 -318
  10. package/dist/_chunks/index-Cni0ouV8.js.map +1 -0
  11. package/dist/_chunks/{index-DPWou2fL.js → index-Cu0crkx4.js} +2 -2
  12. package/dist/_chunks/{index-DPWou2fL.js.map → index-Cu0crkx4.js.map} +1 -1
  13. package/dist/_chunks/{index-POwhla6y.js → index-CuoYgn99.js} +12 -9
  14. package/dist/_chunks/index-CuoYgn99.js.map +1 -0
  15. package/dist/_chunks/{index-DKKpjnQN.mjs → index-LM-DLJqd.mjs} +370 -318
  16. package/dist/_chunks/index-LM-DLJqd.mjs.map +1 -0
  17. package/dist/admin/index.js +4 -1
  18. package/dist/admin/index.js.map +1 -1
  19. package/dist/admin/index.mjs +4 -1
  20. package/dist/admin/index.mjs.map +1 -1
  21. package/dist/admin/src/components/SelectTree/utils/flattenTree.d.ts +14 -0
  22. package/dist/admin/src/hooks/useAssets.d.ts +14 -0
  23. package/dist/admin/src/hooks/useBulkMove.d.ts +78 -0
  24. package/dist/admin/src/hooks/useBulkRemove.d.ts +73 -0
  25. package/dist/admin/src/hooks/useConfig.d.ts +5 -0
  26. package/dist/admin/src/hooks/useCropImg.d.ts +9 -0
  27. package/dist/admin/src/hooks/useEditAsset.d.ts +119 -0
  28. package/dist/admin/src/hooks/useEditFolder.d.ts +71 -0
  29. package/dist/admin/src/hooks/useFolder.d.ts +7 -0
  30. package/dist/admin/src/hooks/useFolderStructure.d.ts +12 -0
  31. package/dist/admin/src/hooks/useFolders.d.ts +11 -0
  32. package/dist/admin/src/hooks/useMediaLibraryPermissions.d.ts +3 -0
  33. package/dist/admin/src/hooks/useModalQueryParams.d.ts +21 -0
  34. package/dist/admin/src/hooks/usePersistentState.d.ts +1 -0
  35. package/dist/admin/src/hooks/useRemoveAsset.d.ts +66 -0
  36. package/dist/admin/src/hooks/useUpload.d.ts +12 -0
  37. package/dist/admin/src/hooks/utils/rename-keys.d.ts +6 -0
  38. package/dist/admin/src/newConstants.d.ts +45 -0
  39. package/dist/admin/src/pluginId.d.ts +2 -0
  40. package/dist/admin/src/utils/appendSearchParamsToUrl.d.ts +6 -0
  41. package/dist/admin/src/utils/containsAssetFilter.d.ts +2 -0
  42. package/dist/admin/src/utils/createAssetUrl.d.ts +2 -0
  43. package/dist/admin/src/utils/displayedFilters.d.ts +22 -0
  44. package/dist/admin/src/utils/downloadFile.d.ts +1 -0
  45. package/dist/admin/src/utils/findRecursiveFolderByValue.d.ts +10 -0
  46. package/dist/admin/src/utils/formatBytes.d.ts +1 -0
  47. package/dist/admin/src/utils/formatDuration.d.ts +1 -0
  48. package/dist/admin/src/utils/getAPIInnerErrors.d.ts +14 -0
  49. package/dist/admin/src/utils/getAllowedFiles.d.ts +15 -0
  50. package/dist/admin/src/utils/getBreadcrumbDataCM.d.ts +19 -0
  51. package/dist/admin/src/utils/getBreadcrumbDataML.d.ts +18 -0
  52. package/dist/admin/src/utils/getFileExtension.d.ts +1 -0
  53. package/dist/admin/src/utils/getFolderParents.d.ts +10 -0
  54. package/dist/admin/src/utils/getFolderURL.d.ts +5 -0
  55. package/dist/admin/src/utils/getTrad.d.ts +1 -0
  56. package/dist/admin/src/utils/index.d.ts +25 -0
  57. package/dist/admin/src/utils/moveElement.d.ts +1 -0
  58. package/dist/admin/src/utils/normalizeAPIError.d.ts +22 -0
  59. package/dist/admin/src/utils/prefixFileUrlWithBackendUrl.d.ts +1 -0
  60. package/dist/admin/src/utils/prefixPluginTranslations.d.ts +5 -0
  61. package/dist/admin/src/utils/rawFileToAsset.d.ts +14 -0
  62. package/dist/admin/src/utils/toSingularTypes.d.ts +2 -0
  63. package/dist/admin/src/utils/typeFromMime.d.ts +2 -0
  64. package/dist/admin/src/utils/urlYupSchema.d.ts +8 -0
  65. package/dist/admin/src/utils/urlsToAssets.d.ts +10 -0
  66. package/dist/shared/contracts/configuration.d.ts +44 -0
  67. package/dist/shared/contracts/files.d.ts +207 -0
  68. package/dist/shared/contracts/folders.d.ts +140 -0
  69. package/dist/shared/contracts/settings.d.ts +41 -0
  70. package/package.json +6 -6
  71. package/dist/_chunks/index-4dDBcT2s.js.map +0 -1
  72. package/dist/_chunks/index-BWoTIP6T.js.map +0 -1
  73. package/dist/_chunks/index-CZ3rXZbR.mjs.map +0 -1
  74. package/dist/_chunks/index-DKKpjnQN.mjs.map +0 -1
  75. package/dist/_chunks/index-POwhla6y.js.map +0 -1
  76. package/dist/_chunks/index-p2ufusDD.mjs.map +0 -1
  77. package/dist/admin/src/hooks/useClipboard.d.ts +0 -4
@@ -0,0 +1,2 @@
1
+ import type { Query } from '../../../shared/contracts/files';
2
+ export declare const containsAssetFilter: (query: Query | null) => boolean;
@@ -0,0 +1,2 @@
1
+ import type { File } from '../../../shared/contracts/files';
2
+ export declare const createAssetUrl: (asset: File, forThumbnail?: boolean) => string | undefined;
@@ -0,0 +1,22 @@
1
+ export declare const displayedFilters: ({
2
+ name: string;
3
+ fieldSchema: {
4
+ type: string;
5
+ options?: undefined;
6
+ };
7
+ metadatas: {
8
+ label: string;
9
+ };
10
+ } | {
11
+ name: string;
12
+ fieldSchema: {
13
+ type: string;
14
+ options: {
15
+ label: string;
16
+ value: string;
17
+ }[];
18
+ };
19
+ metadatas: {
20
+ label: string;
21
+ };
22
+ })[];
@@ -0,0 +1 @@
1
+ export declare const downloadFile: (url: string, fileName: string) => Promise<void>;
@@ -0,0 +1,10 @@
1
+ import type { FolderNode } from '../../../shared/contracts/folders';
2
+ interface FolderStructureValue extends Omit<FolderNode, 'children'> {
3
+ value: number | null;
4
+ children?: FolderStructureValue[];
5
+ }
6
+ type Value = number | null | {
7
+ value: number | null;
8
+ };
9
+ export declare function findRecursiveFolderByValue(data: FolderStructureValue[], value: Value): undefined;
10
+ export {};
@@ -0,0 +1 @@
1
+ export declare function formatBytes(receivedBytes: number | string, decimals?: number): string;
@@ -0,0 +1 @@
1
+ export declare const formatDuration: (durationInSecond: number) => string;
@@ -0,0 +1,14 @@
1
+ import type { FetchError } from '@strapi/admin/strapi-admin';
2
+ import type { MessageDescriptor } from 'react-intl';
3
+ type GetAPIInnerErrorsReturn = {
4
+ [key: string]: MessageDescriptor;
5
+ };
6
+ /**
7
+ *
8
+ * Returns a normalized error message
9
+ *
10
+ */
11
+ export declare function getAPIInnerErrors(error: FetchError, { getTrad }: {
12
+ getTrad: (key: string) => string;
13
+ }): string | GetAPIInnerErrorsReturn | undefined;
14
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { File } from '../../../shared/contracts/files';
2
+ /**
3
+ * Returns the files that can be added to the media field
4
+ * @param {Object[]} pluralTypes Array of string (allowedTypes)
5
+ * @param {Object[]} files Array of files
6
+ * @returns Object[]
7
+ */
8
+ interface AllowedFiles extends File {
9
+ documentId: string;
10
+ isSelectable: boolean;
11
+ locale: string | null;
12
+ type: string;
13
+ }
14
+ export declare const getAllowedFiles: (pluralTypes: string[], files: AllowedFiles[]) => AllowedFiles[];
15
+ export {};
@@ -0,0 +1,19 @@
1
+ import type { Folder } from '../../../shared/contracts/folders';
2
+ import type { MessageDescriptor } from 'react-intl';
3
+ interface BreadcrumbDataFolder extends Omit<Folder, 'children' | 'files' | 'parent'> {
4
+ parent?: BreadcrumbDataFolder;
5
+ children?: {
6
+ count: number;
7
+ };
8
+ files?: {
9
+ count: number;
10
+ };
11
+ }
12
+ interface BreadcrumbItem {
13
+ id?: number | null;
14
+ label?: MessageDescriptor | string;
15
+ path?: string;
16
+ }
17
+ type BreadcrumbData = BreadcrumbItem | [];
18
+ export declare const getBreadcrumbDataCM: (folder: BreadcrumbDataFolder | null) => BreadcrumbData[];
19
+ export {};
@@ -0,0 +1,18 @@
1
+ import type { Query } from '../../../shared/contracts/files';
2
+ import type { Folder } from '../../../shared/contracts/folders';
3
+ import type { MessageDescriptor } from 'react-intl';
4
+ interface GetBreadcrumbDataMLProps {
5
+ folder: Folder;
6
+ options: {
7
+ pathname: string;
8
+ query?: Query;
9
+ };
10
+ }
11
+ interface GetBreadcrumbDataMLReturn {
12
+ id: number | null;
13
+ label: string | MessageDescriptor;
14
+ href?: string;
15
+ }
16
+ type BreadcrumbData = GetBreadcrumbDataMLReturn | [];
17
+ export declare const getBreadcrumbDataML: (folder: GetBreadcrumbDataMLProps['folder'] | null, { pathname, query }: GetBreadcrumbDataMLProps['options']) => BreadcrumbData[];
18
+ export default getBreadcrumbDataML;
@@ -0,0 +1 @@
1
+ export declare const getFileExtension: (ext?: string | null) => string | null | undefined;
@@ -0,0 +1,10 @@
1
+ import type { FolderNode } from '../../../shared/contracts/folders';
2
+ interface FolderStructureValue extends Omit<FolderNode, 'children'> {
3
+ value: number | null;
4
+ children?: FolderStructureValue[];
5
+ }
6
+ export declare const getFolderParents: (folders: FolderStructureValue[], currentFolderId: number) => {
7
+ id: number | null | undefined;
8
+ label: string | undefined;
9
+ }[];
10
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Query } from '../../../shared/contracts/files';
2
+ export declare const getFolderURL: (pathname: string, currentQuery: Query, { folder, folderPath }?: {
3
+ folder?: string;
4
+ folderPath?: string;
5
+ }) => string;
@@ -0,0 +1 @@
1
+ export declare const getTrad: (id: string) => string;
@@ -0,0 +1,25 @@
1
+ export * from './appendSearchParamsToUrl';
2
+ export * from './containsAssetFilter';
3
+ export * from './createAssetUrl';
4
+ export * from './displayedFilters';
5
+ export * from './downloadFile';
6
+ export * from './findRecursiveFolderByValue';
7
+ export * from './formatBytes';
8
+ export * from './formatDuration';
9
+ export * from './getAllowedFiles';
10
+ export * from './getAPIInnerErrors';
11
+ export * from './getBreadcrumbDataCM';
12
+ export * from './getBreadcrumbDataML';
13
+ export * from './getFileExtension';
14
+ export * from './getFolderParents';
15
+ export * from './getFolderURL';
16
+ export * from './getTrad';
17
+ export * from './moveElement';
18
+ export * from './normalizeAPIError';
19
+ export * from './prefixFileUrlWithBackendUrl';
20
+ export * from './prefixPluginTranslations';
21
+ export * from './rawFileToAsset';
22
+ export * from './toSingularTypes';
23
+ export * from './typeFromMime';
24
+ export * from './urlsToAssets';
25
+ export * from './urlYupSchema';
@@ -0,0 +1 @@
1
+ export declare const moveElement: (array: number[], index: number, offset: number) => number[];
@@ -0,0 +1,22 @@
1
+ import type { FetchError } from '@strapi/admin/strapi-admin';
2
+ interface NormalizeErrorOptions {
3
+ name?: string;
4
+ intlMessagePrefixCallback?: (id: string) => string;
5
+ }
6
+ interface NormalizeErrorReturn {
7
+ id: string;
8
+ defaultMessage: string;
9
+ name?: string;
10
+ values: Record<'path', string> | Record<string, never>;
11
+ }
12
+ /**
13
+ * Normalize the format of `ResponseError`
14
+ * in places where the hook `useAPIErrorHandler` can not called
15
+ * (e.g. outside of a React component).
16
+ */
17
+ export declare function normalizeAPIError(apiError: FetchError, intlMessagePrefixCallback?: NormalizeErrorOptions['intlMessagePrefixCallback']): NormalizeErrorReturn | {
18
+ name: string;
19
+ message: string | null;
20
+ errors: NormalizeErrorReturn[];
21
+ } | null;
22
+ export {};
@@ -0,0 +1 @@
1
+ export declare const prefixFileUrlWithBackendUrl: (fileURL?: string) => string | undefined;
@@ -0,0 +1,5 @@
1
+ type Translations = {
2
+ [key: string]: string;
3
+ };
4
+ export declare const prefixPluginTranslations: (trad: Translations, pluginId?: string) => Translations;
5
+ export {};
@@ -0,0 +1,14 @@
1
+ import { AssetSource } from '../newConstants';
2
+ import type { RawFile } from '../../../shared/contracts/files';
3
+ export declare const rawFileToAsset: (rawFile: RawFile, assetSource: AssetSource) => {
4
+ size: number;
5
+ createdAt: string;
6
+ name: string;
7
+ source: AssetSource;
8
+ type: import("../newConstants").AssetType;
9
+ url: string;
10
+ ext: string | undefined;
11
+ mime: string;
12
+ rawFile: RawFile;
13
+ isLocal: boolean;
14
+ };
@@ -0,0 +1,2 @@
1
+ export declare const toSingularTypes: (types?: string[]) => string[];
2
+ export default toSingularTypes;
@@ -0,0 +1,2 @@
1
+ import { AssetType } from '../newConstants';
2
+ export declare const typeFromMime: (mime: string) => AssetType;
@@ -0,0 +1,8 @@
1
+ import * as yup from 'yup';
2
+ export declare const urlSchema: yup.default<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ urls: yup.default<string | undefined, Record<string, any>, string | undefined>;
4
+ }>, Record<string, any>, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
5
+ urls: yup.default<string | undefined, Record<string, any>, string | undefined>;
6
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
+ urls: yup.default<string | undefined, Record<string, any>, string | undefined>;
8
+ }>>>;
@@ -0,0 +1,10 @@
1
+ import { AssetSource } from '../newConstants';
2
+ export declare const urlsToAssets: (urls: string[]) => Promise<{
3
+ source: AssetSource;
4
+ name: string;
5
+ type: import("../newConstants").AssetType;
6
+ url: string;
7
+ ext: string | undefined;
8
+ mime: string | null;
9
+ rawFile: File;
10
+ }[]>;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Used to store the media library configuration.
3
+ * E.g the page size, the sort.
4
+ */
5
+ import { errors } from '@strapi/utils';
6
+ import { Utils } from '@strapi/types';
7
+ type SortOrder = 'ASC' | 'DESC';
8
+ type SortKey = 'createdAt' | 'name' | 'updatedAt';
9
+ export interface Configuration {
10
+ pageSize: number;
11
+ sort: `${SortKey}:${SortOrder}`;
12
+ }
13
+ /**
14
+ * GET /upload/configuration
15
+ *
16
+ * Return the configuration for the media files.
17
+ */
18
+ export declare namespace GetConfiguration {
19
+ interface Request {
20
+ query?: {};
21
+ }
22
+ interface Response {
23
+ data: {
24
+ data: Configuration;
25
+ };
26
+ error?: errors.ApplicationError | errors.NotFoundError;
27
+ }
28
+ }
29
+ /**
30
+ * PUT /upload/configuration
31
+ *
32
+ * Update the configuration
33
+ */
34
+ export declare namespace UpdateConfiguration {
35
+ interface Request {
36
+ body: Configuration;
37
+ }
38
+ type Response = Utils.OneOf<{
39
+ data: Configuration;
40
+ }, {
41
+ error?: errors.ApplicationError | errors.ValidationError;
42
+ }>;
43
+ }
44
+ export {};
@@ -0,0 +1,207 @@
1
+ import { errors } from '@strapi/utils';
2
+ type SortOrder = 'ASC' | 'DESC';
3
+ type SortKey = 'createdAt' | 'name' | 'updatedAt';
4
+ type ComparisonOperators<T> = {
5
+ [operator: string]: T | T[] | boolean;
6
+ };
7
+ export type FilterCondition<T> = {
8
+ [field: string]: T | ComparisonOperators<T> | FilterCondition<T>;
9
+ };
10
+ type Filters<T> = {
11
+ [logicOperator: string]: FilterCondition<T>[];
12
+ };
13
+ export type Query = {
14
+ _q?: string;
15
+ folderPath?: string;
16
+ folder?: null | number | {
17
+ id: number;
18
+ };
19
+ page?: string | number | {
20
+ id: string | number;
21
+ };
22
+ pageSize?: string | number;
23
+ pagination?: {
24
+ pageSize: number;
25
+ };
26
+ sort?: `${SortKey}:${SortOrder}`;
27
+ filters?: Filters<string | number | boolean>;
28
+ state?: boolean;
29
+ };
30
+ type FileFormat = {
31
+ name: string;
32
+ hash: string;
33
+ ext: string;
34
+ mime: string;
35
+ path: null | string;
36
+ width: number;
37
+ height: number;
38
+ size: number;
39
+ sizeInBytes: number;
40
+ url: string;
41
+ };
42
+ export interface File {
43
+ id: number;
44
+ name: string;
45
+ alternativeText?: string | null;
46
+ caption?: string | null;
47
+ width?: number;
48
+ height?: number;
49
+ formats?: Record<string, FileFormat>;
50
+ hash: string;
51
+ ext?: string;
52
+ mime?: string;
53
+ size?: number;
54
+ sizeInBytes?: number;
55
+ url?: string;
56
+ previewUrl?: string;
57
+ path?: string | null;
58
+ provider?: string;
59
+ provider_metadata?: Record<string, unknown>;
60
+ isUrlSigned?: boolean;
61
+ folder?: number | null;
62
+ folderPath?: string;
63
+ related?: {
64
+ id: string | number;
65
+ __type: string;
66
+ __pivot: {
67
+ field: string;
68
+ };
69
+ }[];
70
+ createdAt?: string;
71
+ updatedAt?: string;
72
+ createdBy?: number;
73
+ publishedAt?: string;
74
+ updatedBy?: number;
75
+ isLocal?: boolean;
76
+ }
77
+ export interface RawFile extends Blob {
78
+ size: number;
79
+ lastModified: number;
80
+ name: string;
81
+ type: string;
82
+ }
83
+ export interface Pagination {
84
+ page: number;
85
+ pageSize: number;
86
+ pageCount: number;
87
+ total: number;
88
+ }
89
+ /**
90
+ * GET /upload/files - Get files
91
+ */
92
+ export declare namespace GetFiles {
93
+ interface Request {
94
+ body: {};
95
+ query: {
96
+ page?: string;
97
+ pageSize?: string;
98
+ folder: number | null;
99
+ sort?: `${SortKey}:${SortOrder}`;
100
+ };
101
+ }
102
+ interface Response {
103
+ data: {
104
+ results: File[];
105
+ pagination: Pagination;
106
+ };
107
+ error?: errors.ApplicationError | errors.NotFoundError;
108
+ }
109
+ }
110
+ /**
111
+ * GET /upload/files/:id - Get specific file
112
+ */
113
+ export declare namespace GetFile {
114
+ interface Request {
115
+ params: {
116
+ id: number;
117
+ };
118
+ query: {};
119
+ }
120
+ interface Response {
121
+ data: File;
122
+ error?: errors.ApplicationError | errors.NotFoundError;
123
+ }
124
+ }
125
+ /**
126
+ * POST /upload/actions/bulk-delete - Delete Files
127
+ */
128
+ export declare namespace BulkDeleteFiles {
129
+ interface Request {
130
+ body: {
131
+ fileIds: number[];
132
+ };
133
+ }
134
+ interface Response {
135
+ data: {
136
+ data: {
137
+ files: File[];
138
+ folders: [];
139
+ };
140
+ };
141
+ error?: errors.ApplicationError | errors.ValidationError;
142
+ }
143
+ }
144
+ /**
145
+ * POST /upload/actions/bulk-move - Move Files
146
+ */
147
+ export declare namespace BulkMoveFiles {
148
+ interface Request {
149
+ body: {
150
+ fileIds: number[];
151
+ destinationFolderId: number;
152
+ };
153
+ }
154
+ interface Response {
155
+ data: {
156
+ data: {
157
+ files: File[];
158
+ folders: [];
159
+ };
160
+ };
161
+ error?: errors.ApplicationError | errors.ValidationError;
162
+ }
163
+ }
164
+ /**
165
+ * DELETE /upload/files/:id - Delete a specific asset
166
+ */
167
+ export declare namespace DeleteFile {
168
+ interface Request {
169
+ params: {
170
+ id: number;
171
+ };
172
+ query: {};
173
+ }
174
+ interface Response {
175
+ data: File;
176
+ error?: errors.ApplicationError | errors.NotFoundError;
177
+ }
178
+ }
179
+ /**
180
+ * POST /upload - Create a file
181
+ */
182
+ export declare namespace CreateFile {
183
+ interface Request {
184
+ body: FormData;
185
+ files: File[];
186
+ }
187
+ interface Response {
188
+ data: File[];
189
+ error?: errors.ApplicationError | errors.ValidationError;
190
+ }
191
+ }
192
+ /**
193
+ * POST /upload?id=:id - Update asset
194
+ */
195
+ export declare namespace UpdateFile {
196
+ interface Request {
197
+ body: FormData;
198
+ params: {
199
+ id: number;
200
+ };
201
+ }
202
+ interface Response {
203
+ data: File;
204
+ error?: errors.ApplicationError | errors.ValidationError;
205
+ }
206
+ }
207
+ export {};
@@ -0,0 +1,140 @@
1
+ import { errors } from '@strapi/utils';
2
+ export type SortOrder = 'ASC' | 'DESC';
3
+ export type SortKey = 'createdAt' | 'name' | 'updatedAt';
4
+ import type { File } from './files';
5
+ export interface Folder {
6
+ id: number;
7
+ name: string;
8
+ pathId?: number;
9
+ /**
10
+ * parent id
11
+ */
12
+ parent?: number | null | Folder;
13
+ /**
14
+ * children ids
15
+ */
16
+ children?: number[];
17
+ path?: string;
18
+ files?: File[];
19
+ }
20
+ export type FolderNode = Partial<Omit<Folder, 'children'>> & {
21
+ children: FolderNode[];
22
+ };
23
+ /**
24
+ * GET /upload/folders/:id - Get specific folder
25
+ */
26
+ export declare namespace GetFolder {
27
+ interface Request {
28
+ params: {
29
+ id: number;
30
+ };
31
+ query: {};
32
+ }
33
+ interface Response {
34
+ data: Folder;
35
+ error?: errors.ApplicationError | errors.NotFoundError;
36
+ }
37
+ }
38
+ /**
39
+ * GET /upload/folders - Get folders
40
+ */
41
+ export declare namespace GetFolders {
42
+ interface Request {
43
+ body: {};
44
+ query: {
45
+ page?: string;
46
+ pageSize?: string;
47
+ sort?: `${SortKey}:${SortOrder}`;
48
+ };
49
+ }
50
+ interface Response {
51
+ data: Folder[];
52
+ error?: errors.ApplicationError | errors.NotFoundError;
53
+ }
54
+ }
55
+ /**
56
+ * POST /upload/folders - Create folders
57
+ */
58
+ export declare namespace CreateFolders {
59
+ interface Request {
60
+ body: Pick<Folder, 'name' | 'parent'>;
61
+ }
62
+ interface Response {
63
+ data: Folder;
64
+ error?: errors.ApplicationError | errors.ValidationError;
65
+ }
66
+ }
67
+ /**
68
+ * PUT /upload/folders/:id - Update a specific folder
69
+ */
70
+ export declare namespace UpdateFolder {
71
+ interface Request {
72
+ params: {
73
+ id: number;
74
+ };
75
+ query: {};
76
+ body: {
77
+ name: string;
78
+ parent: number | null;
79
+ };
80
+ }
81
+ interface Response {
82
+ data: Folder;
83
+ error?: errors.ApplicationError | errors.NotFoundError;
84
+ }
85
+ }
86
+ /**
87
+ * GET /upload/folder-structure
88
+ *
89
+ * Return the structure of a folder.
90
+ */
91
+ export declare namespace GetFolderStructure {
92
+ interface Request {
93
+ query?: {};
94
+ }
95
+ interface Response {
96
+ data: {
97
+ data: number[] & FolderNode[];
98
+ };
99
+ error?: errors.ApplicationError | errors.NotFoundError;
100
+ }
101
+ }
102
+ /**
103
+ * POST /upload/actions/bulk-delete - Delete Folder
104
+ */
105
+ export declare namespace BulkDeleteFolders {
106
+ interface Request {
107
+ body: {
108
+ folderIds: number[];
109
+ };
110
+ }
111
+ interface Response {
112
+ data: {
113
+ data: {
114
+ files: [];
115
+ folders: Folder[];
116
+ };
117
+ };
118
+ error?: errors.ApplicationError | errors.ValidationError;
119
+ }
120
+ }
121
+ /**
122
+ * POST /upload/actions/bulk-move - Move Folder
123
+ */
124
+ export declare namespace BulkMoveFolders {
125
+ interface Request {
126
+ body: {
127
+ folderIds: number[];
128
+ destinationFolderId: number;
129
+ };
130
+ }
131
+ interface Response {
132
+ data: {
133
+ data: {
134
+ files: [];
135
+ folders: Folder[];
136
+ };
137
+ };
138
+ error?: errors.ApplicationError | errors.ValidationError;
139
+ }
140
+ }