@strapi/upload 5.0.6 → 5.1.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/dist/_chunks/{index-POwhla6y.js → index-99duBF3G.js} +12 -9
- package/dist/_chunks/index-99duBF3G.js.map +1 -0
- package/dist/_chunks/{index-DKKpjnQN.mjs → index-BWGv83Ll.mjs} +370 -318
- package/dist/_chunks/index-BWGv83Ll.mjs.map +1 -0
- package/dist/_chunks/{index-CZ3rXZbR.mjs → index-C9ULowyk.mjs} +5 -2
- package/dist/_chunks/index-C9ULowyk.mjs.map +1 -0
- package/dist/_chunks/{index-D0UI77ZE.mjs → index-DPuAwzl_.mjs} +2 -2
- package/dist/_chunks/{index-D0UI77ZE.mjs.map → index-DPuAwzl_.mjs.map} +1 -1
- package/dist/_chunks/{index-4dDBcT2s.js → index-Ds7imRns.js} +370 -318
- package/dist/_chunks/index-Ds7imRns.js.map +1 -0
- package/dist/_chunks/{index-DPWou2fL.js → index-QKcj2FTB.js} +2 -2
- package/dist/_chunks/{index-DPWou2fL.js.map → index-QKcj2FTB.js.map} +1 -1
- package/dist/_chunks/{index-p2ufusDD.mjs → index-fPsIi9fE.mjs} +12 -9
- package/dist/_chunks/index-fPsIi9fE.mjs.map +1 -0
- package/dist/_chunks/{index-BWoTIP6T.js → index-yGjFe6bK.js} +5 -2
- package/dist/_chunks/index-yGjFe6bK.js.map +1 -0
- package/dist/admin/index.js +4 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +4 -1
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/src/components/SelectTree/utils/flattenTree.d.ts +14 -0
- package/dist/admin/src/hooks/useAssets.d.ts +14 -0
- package/dist/admin/src/hooks/useBulkMove.d.ts +78 -0
- package/dist/admin/src/hooks/useBulkRemove.d.ts +73 -0
- package/dist/admin/src/hooks/useConfig.d.ts +5 -0
- package/dist/admin/src/hooks/useCropImg.d.ts +9 -0
- package/dist/admin/src/hooks/useEditAsset.d.ts +119 -0
- package/dist/admin/src/hooks/useEditFolder.d.ts +71 -0
- package/dist/admin/src/hooks/useFolder.d.ts +7 -0
- package/dist/admin/src/hooks/useFolderStructure.d.ts +12 -0
- package/dist/admin/src/hooks/useFolders.d.ts +11 -0
- package/dist/admin/src/hooks/useMediaLibraryPermissions.d.ts +3 -0
- package/dist/admin/src/hooks/useModalQueryParams.d.ts +21 -0
- package/dist/admin/src/hooks/usePersistentState.d.ts +1 -0
- package/dist/admin/src/hooks/useRemoveAsset.d.ts +66 -0
- package/dist/admin/src/hooks/useUpload.d.ts +12 -0
- package/dist/admin/src/hooks/utils/rename-keys.d.ts +6 -0
- package/dist/admin/src/newConstants.d.ts +45 -0
- package/dist/admin/src/pluginId.d.ts +2 -0
- package/dist/admin/src/utils/appendSearchParamsToUrl.d.ts +6 -0
- package/dist/admin/src/utils/containsAssetFilter.d.ts +2 -0
- package/dist/admin/src/utils/createAssetUrl.d.ts +2 -0
- package/dist/admin/src/utils/displayedFilters.d.ts +22 -0
- package/dist/admin/src/utils/downloadFile.d.ts +1 -0
- package/dist/admin/src/utils/findRecursiveFolderByValue.d.ts +10 -0
- package/dist/admin/src/utils/formatBytes.d.ts +1 -0
- package/dist/admin/src/utils/formatDuration.d.ts +1 -0
- package/dist/admin/src/utils/getAPIInnerErrors.d.ts +14 -0
- package/dist/admin/src/utils/getAllowedFiles.d.ts +15 -0
- package/dist/admin/src/utils/getBreadcrumbDataCM.d.ts +19 -0
- package/dist/admin/src/utils/getBreadcrumbDataML.d.ts +18 -0
- package/dist/admin/src/utils/getFileExtension.d.ts +1 -0
- package/dist/admin/src/utils/getFolderParents.d.ts +10 -0
- package/dist/admin/src/utils/getFolderURL.d.ts +5 -0
- package/dist/admin/src/utils/getTrad.d.ts +1 -0
- package/dist/admin/src/utils/index.d.ts +25 -0
- package/dist/admin/src/utils/moveElement.d.ts +1 -0
- package/dist/admin/src/utils/normalizeAPIError.d.ts +22 -0
- package/dist/admin/src/utils/prefixFileUrlWithBackendUrl.d.ts +1 -0
- package/dist/admin/src/utils/prefixPluginTranslations.d.ts +5 -0
- package/dist/admin/src/utils/rawFileToAsset.d.ts +14 -0
- package/dist/admin/src/utils/toSingularTypes.d.ts +2 -0
- package/dist/admin/src/utils/typeFromMime.d.ts +2 -0
- package/dist/admin/src/utils/urlYupSchema.d.ts +8 -0
- package/dist/admin/src/utils/urlsToAssets.d.ts +10 -0
- package/dist/shared/contracts/configuration.d.ts +44 -0
- package/dist/shared/contracts/files.d.ts +207 -0
- package/dist/shared/contracts/folders.d.ts +140 -0
- package/dist/shared/contracts/settings.d.ts +41 -0
- package/package.json +6 -6
- package/dist/_chunks/index-4dDBcT2s.js.map +0 -1
- package/dist/_chunks/index-BWoTIP6T.js.map +0 -1
- package/dist/_chunks/index-CZ3rXZbR.mjs.map +0 -1
- package/dist/_chunks/index-DKKpjnQN.mjs.map +0 -1
- package/dist/_chunks/index-POwhla6y.js.map +0 -1
- package/dist/_chunks/index-p2ufusDD.mjs.map +0 -1
- package/dist/admin/src/hooks/useClipboard.d.ts +0 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const useCropImg: () => {
|
|
2
|
+
width?: number | undefined;
|
|
3
|
+
height?: number | undefined;
|
|
4
|
+
crop: (image: HTMLImageElement) => void;
|
|
5
|
+
produceFile: (name: string, mimeType: string, lastModifiedDate: string) => Promise<unknown>;
|
|
6
|
+
stopCropping: () => void;
|
|
7
|
+
isCropping: boolean;
|
|
8
|
+
isCropperReady: boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { File as FileAsset } from '../../../shared/contracts/files';
|
|
2
|
+
export type ErrorMutation = {
|
|
3
|
+
message: string;
|
|
4
|
+
response: {
|
|
5
|
+
status: number;
|
|
6
|
+
data: {
|
|
7
|
+
error: Error;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
} | null;
|
|
11
|
+
export declare const useEditAsset: () => {
|
|
12
|
+
cancel: () => void;
|
|
13
|
+
editAsset: (asset: FileAsset, file: File) => Promise<FileAsset>;
|
|
14
|
+
progress: number;
|
|
15
|
+
status: "error" | "success" | "idle" | "loading";
|
|
16
|
+
data: undefined;
|
|
17
|
+
error: null;
|
|
18
|
+
isError: false;
|
|
19
|
+
isIdle: true;
|
|
20
|
+
isLoading: false;
|
|
21
|
+
isSuccess: false;
|
|
22
|
+
mutate: import("react-query").UseMutateFunction<FileAsset, ErrorMutation, {
|
|
23
|
+
asset: FileAsset;
|
|
24
|
+
file: File;
|
|
25
|
+
}, unknown>;
|
|
26
|
+
reset: () => void;
|
|
27
|
+
context: unknown;
|
|
28
|
+
failureCount: number;
|
|
29
|
+
isPaused: boolean;
|
|
30
|
+
variables: {
|
|
31
|
+
asset: FileAsset;
|
|
32
|
+
file: File;
|
|
33
|
+
} | undefined;
|
|
34
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<FileAsset, ErrorMutation, {
|
|
35
|
+
asset: FileAsset;
|
|
36
|
+
file: File;
|
|
37
|
+
}, unknown>;
|
|
38
|
+
} | {
|
|
39
|
+
cancel: () => void;
|
|
40
|
+
editAsset: (asset: FileAsset, file: File) => Promise<FileAsset>;
|
|
41
|
+
progress: number;
|
|
42
|
+
status: "error" | "success" | "idle" | "loading";
|
|
43
|
+
data: undefined;
|
|
44
|
+
error: null;
|
|
45
|
+
isError: false;
|
|
46
|
+
isIdle: false;
|
|
47
|
+
isLoading: true;
|
|
48
|
+
isSuccess: false;
|
|
49
|
+
mutate: import("react-query").UseMutateFunction<FileAsset, ErrorMutation, {
|
|
50
|
+
asset: FileAsset;
|
|
51
|
+
file: File;
|
|
52
|
+
}, unknown>;
|
|
53
|
+
reset: () => void;
|
|
54
|
+
context: unknown;
|
|
55
|
+
failureCount: number;
|
|
56
|
+
isPaused: boolean;
|
|
57
|
+
variables: {
|
|
58
|
+
asset: FileAsset;
|
|
59
|
+
file: File;
|
|
60
|
+
} | undefined;
|
|
61
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<FileAsset, ErrorMutation, {
|
|
62
|
+
asset: FileAsset;
|
|
63
|
+
file: File;
|
|
64
|
+
}, unknown>;
|
|
65
|
+
} | {
|
|
66
|
+
cancel: () => void;
|
|
67
|
+
editAsset: (asset: FileAsset, file: File) => Promise<FileAsset>;
|
|
68
|
+
progress: number;
|
|
69
|
+
status: "error" | "success" | "idle" | "loading";
|
|
70
|
+
data: undefined;
|
|
71
|
+
error: ErrorMutation;
|
|
72
|
+
isError: true;
|
|
73
|
+
isIdle: false;
|
|
74
|
+
isLoading: false;
|
|
75
|
+
isSuccess: false;
|
|
76
|
+
mutate: import("react-query").UseMutateFunction<FileAsset, ErrorMutation, {
|
|
77
|
+
asset: FileAsset;
|
|
78
|
+
file: File;
|
|
79
|
+
}, unknown>;
|
|
80
|
+
reset: () => void;
|
|
81
|
+
context: unknown;
|
|
82
|
+
failureCount: number;
|
|
83
|
+
isPaused: boolean;
|
|
84
|
+
variables: {
|
|
85
|
+
asset: FileAsset;
|
|
86
|
+
file: File;
|
|
87
|
+
} | undefined;
|
|
88
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<FileAsset, ErrorMutation, {
|
|
89
|
+
asset: FileAsset;
|
|
90
|
+
file: File;
|
|
91
|
+
}, unknown>;
|
|
92
|
+
} | {
|
|
93
|
+
cancel: () => void;
|
|
94
|
+
editAsset: (asset: FileAsset, file: File) => Promise<FileAsset>;
|
|
95
|
+
progress: number;
|
|
96
|
+
status: "error" | "success" | "idle" | "loading";
|
|
97
|
+
data: FileAsset;
|
|
98
|
+
error: null;
|
|
99
|
+
isError: false;
|
|
100
|
+
isIdle: false;
|
|
101
|
+
isLoading: false;
|
|
102
|
+
isSuccess: true;
|
|
103
|
+
mutate: import("react-query").UseMutateFunction<FileAsset, ErrorMutation, {
|
|
104
|
+
asset: FileAsset;
|
|
105
|
+
file: File;
|
|
106
|
+
}, unknown>;
|
|
107
|
+
reset: () => void;
|
|
108
|
+
context: unknown;
|
|
109
|
+
failureCount: number;
|
|
110
|
+
isPaused: boolean;
|
|
111
|
+
variables: {
|
|
112
|
+
asset: FileAsset;
|
|
113
|
+
file: File;
|
|
114
|
+
} | undefined;
|
|
115
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<FileAsset, ErrorMutation, {
|
|
116
|
+
asset: FileAsset;
|
|
117
|
+
file: File;
|
|
118
|
+
}, unknown>;
|
|
119
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { CreateFolders, UpdateFolder } from '../../../shared/contracts/folders';
|
|
2
|
+
interface EditFolderRequestParams {
|
|
3
|
+
attrs: CreateFolders.Request['body'] | UpdateFolder.Request['body'];
|
|
4
|
+
id?: UpdateFolder.Request['params']['id'];
|
|
5
|
+
}
|
|
6
|
+
export declare const useEditFolder: () => {
|
|
7
|
+
editFolder: (attrs: EditFolderRequestParams['attrs'], id?: EditFolderRequestParams['id']) => Promise<import("../../../shared/contracts/folders").Folder>;
|
|
8
|
+
status: "error" | "success" | "idle" | "loading";
|
|
9
|
+
data: undefined;
|
|
10
|
+
error: null;
|
|
11
|
+
isError: false;
|
|
12
|
+
isIdle: true;
|
|
13
|
+
isLoading: false;
|
|
14
|
+
isSuccess: false;
|
|
15
|
+
mutate: import("react-query").UseMutateFunction<import("../../../shared/contracts/folders").Folder, import("@strapi/utils/dist/errors").ApplicationError<"ApplicationError", string, unknown> | import("@strapi/utils/dist/errors").NotFoundError<string, unknown> | import("@strapi/utils/dist/errors").ValidationError<string, unknown> | undefined, EditFolderRequestParams, unknown>;
|
|
16
|
+
reset: () => void;
|
|
17
|
+
context: unknown;
|
|
18
|
+
failureCount: number;
|
|
19
|
+
isPaused: boolean;
|
|
20
|
+
variables: EditFolderRequestParams | undefined;
|
|
21
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<import("../../../shared/contracts/folders").Folder, import("@strapi/utils/dist/errors").ApplicationError<"ApplicationError", string, unknown> | import("@strapi/utils/dist/errors").NotFoundError<string, unknown> | import("@strapi/utils/dist/errors").ValidationError<string, unknown> | undefined, EditFolderRequestParams, unknown>;
|
|
22
|
+
} | {
|
|
23
|
+
editFolder: (attrs: EditFolderRequestParams['attrs'], id?: EditFolderRequestParams['id']) => Promise<import("../../../shared/contracts/folders").Folder>;
|
|
24
|
+
status: "error" | "success" | "idle" | "loading";
|
|
25
|
+
data: undefined;
|
|
26
|
+
error: null;
|
|
27
|
+
isError: false;
|
|
28
|
+
isIdle: false;
|
|
29
|
+
isLoading: true;
|
|
30
|
+
isSuccess: false;
|
|
31
|
+
mutate: import("react-query").UseMutateFunction<import("../../../shared/contracts/folders").Folder, import("@strapi/utils/dist/errors").ApplicationError<"ApplicationError", string, unknown> | import("@strapi/utils/dist/errors").NotFoundError<string, unknown> | import("@strapi/utils/dist/errors").ValidationError<string, unknown> | undefined, EditFolderRequestParams, unknown>;
|
|
32
|
+
reset: () => void;
|
|
33
|
+
context: unknown;
|
|
34
|
+
failureCount: number;
|
|
35
|
+
isPaused: boolean;
|
|
36
|
+
variables: EditFolderRequestParams | undefined;
|
|
37
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<import("../../../shared/contracts/folders").Folder, import("@strapi/utils/dist/errors").ApplicationError<"ApplicationError", string, unknown> | import("@strapi/utils/dist/errors").NotFoundError<string, unknown> | import("@strapi/utils/dist/errors").ValidationError<string, unknown> | undefined, EditFolderRequestParams, unknown>;
|
|
38
|
+
} | {
|
|
39
|
+
editFolder: (attrs: EditFolderRequestParams['attrs'], id?: EditFolderRequestParams['id']) => Promise<import("../../../shared/contracts/folders").Folder>;
|
|
40
|
+
status: "error" | "success" | "idle" | "loading";
|
|
41
|
+
data: undefined;
|
|
42
|
+
error: import("@strapi/utils/dist/errors").ApplicationError<"ApplicationError", string, unknown> | import("@strapi/utils/dist/errors").NotFoundError<string, unknown> | import("@strapi/utils/dist/errors").ValidationError<string, unknown> | undefined;
|
|
43
|
+
isError: true;
|
|
44
|
+
isIdle: false;
|
|
45
|
+
isLoading: false;
|
|
46
|
+
isSuccess: false;
|
|
47
|
+
mutate: import("react-query").UseMutateFunction<import("../../../shared/contracts/folders").Folder, import("@strapi/utils/dist/errors").ApplicationError<"ApplicationError", string, unknown> | import("@strapi/utils/dist/errors").NotFoundError<string, unknown> | import("@strapi/utils/dist/errors").ValidationError<string, unknown> | undefined, EditFolderRequestParams, unknown>;
|
|
48
|
+
reset: () => void;
|
|
49
|
+
context: unknown;
|
|
50
|
+
failureCount: number;
|
|
51
|
+
isPaused: boolean;
|
|
52
|
+
variables: EditFolderRequestParams | undefined;
|
|
53
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<import("../../../shared/contracts/folders").Folder, import("@strapi/utils/dist/errors").ApplicationError<"ApplicationError", string, unknown> | import("@strapi/utils/dist/errors").NotFoundError<string, unknown> | import("@strapi/utils/dist/errors").ValidationError<string, unknown> | undefined, EditFolderRequestParams, unknown>;
|
|
54
|
+
} | {
|
|
55
|
+
editFolder: (attrs: EditFolderRequestParams['attrs'], id?: EditFolderRequestParams['id']) => Promise<import("../../../shared/contracts/folders").Folder>;
|
|
56
|
+
status: "error" | "success" | "idle" | "loading";
|
|
57
|
+
data: import("../../../shared/contracts/folders").Folder;
|
|
58
|
+
error: null;
|
|
59
|
+
isError: false;
|
|
60
|
+
isIdle: false;
|
|
61
|
+
isLoading: false;
|
|
62
|
+
isSuccess: true;
|
|
63
|
+
mutate: import("react-query").UseMutateFunction<import("../../../shared/contracts/folders").Folder, import("@strapi/utils/dist/errors").ApplicationError<"ApplicationError", string, unknown> | import("@strapi/utils/dist/errors").NotFoundError<string, unknown> | import("@strapi/utils/dist/errors").ValidationError<string, unknown> | undefined, EditFolderRequestParams, unknown>;
|
|
64
|
+
reset: () => void;
|
|
65
|
+
context: unknown;
|
|
66
|
+
failureCount: number;
|
|
67
|
+
isPaused: boolean;
|
|
68
|
+
variables: EditFolderRequestParams | undefined;
|
|
69
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<import("../../../shared/contracts/folders").Folder, import("@strapi/utils/dist/errors").ApplicationError<"ApplicationError", string, unknown> | import("@strapi/utils/dist/errors").NotFoundError<string, unknown> | import("@strapi/utils/dist/errors").ValidationError<string, unknown> | undefined, EditFolderRequestParams, unknown>;
|
|
70
|
+
};
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const useFolder: (id: number, { enabled }?: {
|
|
2
|
+
enabled?: boolean | undefined;
|
|
3
|
+
}) => {
|
|
4
|
+
data: import("../../../shared/contracts/folders").Folder | undefined;
|
|
5
|
+
error: import("@strapi/utils/dist/errors").ApplicationError<"ApplicationError", string, unknown> | import("@strapi/utils/dist/errors").NotFoundError<string, unknown> | null | undefined;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FolderNode } from '../../../shared/contracts/folders';
|
|
2
|
+
export declare const useFolderStructure: ({ enabled }?: {
|
|
3
|
+
enabled?: boolean | undefined;
|
|
4
|
+
}) => {
|
|
5
|
+
data: {
|
|
6
|
+
value: null;
|
|
7
|
+
label: string;
|
|
8
|
+
children: import("./utils/rename-keys").DeepRecord<FolderNode>[];
|
|
9
|
+
}[] | undefined;
|
|
10
|
+
error: unknown;
|
|
11
|
+
isLoading: boolean;
|
|
12
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Query } from '../../../shared/contracts/files';
|
|
2
|
+
interface UseFoldersOptions {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
query?: Query;
|
|
5
|
+
}
|
|
6
|
+
export declare const useFolders: ({ enabled, query }?: UseFoldersOptions) => {
|
|
7
|
+
data: import("../../../shared/contracts/folders").Folder[] | undefined;
|
|
8
|
+
error: import("@strapi/utils/dist/errors").ApplicationError<"ApplicationError", string, unknown> | import("@strapi/utils/dist/errors").NotFoundError<string, unknown> | null | undefined;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Query, FilterCondition } from '../../../shared/contracts/files';
|
|
2
|
+
declare const useModalQueryParams: (initialState?: Partial<Query>) => ({
|
|
3
|
+
queryObject: Query;
|
|
4
|
+
rawQuery: string;
|
|
5
|
+
onChangeFilters?: undefined;
|
|
6
|
+
onChangeFolder?: undefined;
|
|
7
|
+
onChangePage?: undefined;
|
|
8
|
+
onChangePageSize?: undefined;
|
|
9
|
+
onChangeSort?: undefined;
|
|
10
|
+
onChangeSearch?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
onChangeFilters: (nextFilters: FilterCondition<string>[]) => void;
|
|
13
|
+
onChangeFolder: (folder: Query['folder'], folderPath: Query['folderPath']) => void;
|
|
14
|
+
onChangePage: (page: Query['page']) => void;
|
|
15
|
+
onChangePageSize: (pageSize: Query['pageSize']) => void;
|
|
16
|
+
onChangeSort: (sort: Query['sort']) => void;
|
|
17
|
+
onChangeSearch: (_q: Query['_q']) => void;
|
|
18
|
+
queryObject?: undefined;
|
|
19
|
+
rawQuery?: undefined;
|
|
20
|
+
})[];
|
|
21
|
+
export default useModalQueryParams;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { DeleteFile } from '../../../shared/contracts/files';
|
|
2
|
+
export declare const useRemoveAsset: (onSuccess: () => void) => {
|
|
3
|
+
removeAsset: (assetId: number) => Promise<void>;
|
|
4
|
+
data: undefined;
|
|
5
|
+
error: null;
|
|
6
|
+
isError: false;
|
|
7
|
+
isIdle: true;
|
|
8
|
+
isLoading: false;
|
|
9
|
+
isSuccess: false;
|
|
10
|
+
status: "idle";
|
|
11
|
+
mutate: import("react-query").UseMutateFunction<import("@strapi/admin/strapi-admin").FetchResponse<DeleteFile.Response>, Error, number, unknown>;
|
|
12
|
+
reset: () => void;
|
|
13
|
+
context: unknown;
|
|
14
|
+
failureCount: number;
|
|
15
|
+
isPaused: boolean;
|
|
16
|
+
variables: number | undefined;
|
|
17
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<import("@strapi/admin/strapi-admin").FetchResponse<DeleteFile.Response>, Error, number, unknown>;
|
|
18
|
+
} | {
|
|
19
|
+
removeAsset: (assetId: number) => Promise<void>;
|
|
20
|
+
data: undefined;
|
|
21
|
+
error: null;
|
|
22
|
+
isError: false;
|
|
23
|
+
isIdle: false;
|
|
24
|
+
isLoading: true;
|
|
25
|
+
isSuccess: false;
|
|
26
|
+
status: "loading";
|
|
27
|
+
mutate: import("react-query").UseMutateFunction<import("@strapi/admin/strapi-admin").FetchResponse<DeleteFile.Response>, Error, number, unknown>;
|
|
28
|
+
reset: () => void;
|
|
29
|
+
context: unknown;
|
|
30
|
+
failureCount: number;
|
|
31
|
+
isPaused: boolean;
|
|
32
|
+
variables: number | undefined;
|
|
33
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<import("@strapi/admin/strapi-admin").FetchResponse<DeleteFile.Response>, Error, number, unknown>;
|
|
34
|
+
} | {
|
|
35
|
+
removeAsset: (assetId: number) => Promise<void>;
|
|
36
|
+
data: undefined;
|
|
37
|
+
error: Error;
|
|
38
|
+
isError: true;
|
|
39
|
+
isIdle: false;
|
|
40
|
+
isLoading: false;
|
|
41
|
+
isSuccess: false;
|
|
42
|
+
status: "error";
|
|
43
|
+
mutate: import("react-query").UseMutateFunction<import("@strapi/admin/strapi-admin").FetchResponse<DeleteFile.Response>, Error, number, unknown>;
|
|
44
|
+
reset: () => void;
|
|
45
|
+
context: unknown;
|
|
46
|
+
failureCount: number;
|
|
47
|
+
isPaused: boolean;
|
|
48
|
+
variables: number | undefined;
|
|
49
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<import("@strapi/admin/strapi-admin").FetchResponse<DeleteFile.Response>, Error, number, unknown>;
|
|
50
|
+
} | {
|
|
51
|
+
removeAsset: (assetId: number) => Promise<void>;
|
|
52
|
+
data: import("@strapi/admin/strapi-admin").FetchResponse<DeleteFile.Response>;
|
|
53
|
+
error: null;
|
|
54
|
+
isError: false;
|
|
55
|
+
isIdle: false;
|
|
56
|
+
isLoading: false;
|
|
57
|
+
isSuccess: true;
|
|
58
|
+
status: "success";
|
|
59
|
+
mutate: import("react-query").UseMutateFunction<import("@strapi/admin/strapi-admin").FetchResponse<DeleteFile.Response>, Error, number, unknown>;
|
|
60
|
+
reset: () => void;
|
|
61
|
+
context: unknown;
|
|
62
|
+
failureCount: number;
|
|
63
|
+
isPaused: boolean;
|
|
64
|
+
variables: number | undefined;
|
|
65
|
+
mutateAsync: import("react-query").UseMutateAsyncFunction<import("@strapi/admin/strapi-admin").FetchResponse<DeleteFile.Response>, Error, number, unknown>;
|
|
66
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { File, RawFile } from '../../../shared/contracts/files';
|
|
2
|
+
interface Asset extends File {
|
|
3
|
+
rawFile: RawFile;
|
|
4
|
+
}
|
|
5
|
+
export declare const useUpload: () => {
|
|
6
|
+
upload: (asset: Asset, folderId: number) => Promise<File[]>;
|
|
7
|
+
cancel: () => void;
|
|
8
|
+
error: import("@strapi/utils/dist/errors").ApplicationError<"ApplicationError", string, unknown> | import("@strapi/utils/dist/errors").ValidationError<string, unknown> | null | undefined;
|
|
9
|
+
progress: number;
|
|
10
|
+
status: "error" | "success" | "idle" | "loading";
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type Primitive = string | number | boolean | null | undefined;
|
|
2
|
+
export type DeepRecord<T> = {
|
|
3
|
+
[K in keyof T]: T[K] extends Primitive ? T[K] : DeepRecord<T[K]>;
|
|
4
|
+
};
|
|
5
|
+
export declare const recursiveRenameKeys: <T extends object>(obj: T, fn: (key: string) => string) => DeepRecord<T>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export declare enum AssetType {
|
|
2
|
+
Video = "video",
|
|
3
|
+
Image = "image",
|
|
4
|
+
Document = "doc",
|
|
5
|
+
Audio = "audio"
|
|
6
|
+
}
|
|
7
|
+
export declare enum AssetSource {
|
|
8
|
+
Url = "url",
|
|
9
|
+
Computer = "computer"
|
|
10
|
+
}
|
|
11
|
+
export declare const PERMISSIONS: {
|
|
12
|
+
main: {
|
|
13
|
+
action: string;
|
|
14
|
+
subject: null;
|
|
15
|
+
}[];
|
|
16
|
+
copyLink: {
|
|
17
|
+
action: string;
|
|
18
|
+
subject: null;
|
|
19
|
+
}[];
|
|
20
|
+
create: {
|
|
21
|
+
action: string;
|
|
22
|
+
subject: null;
|
|
23
|
+
}[];
|
|
24
|
+
download: {
|
|
25
|
+
action: string;
|
|
26
|
+
subject: null;
|
|
27
|
+
}[];
|
|
28
|
+
read: {
|
|
29
|
+
action: string;
|
|
30
|
+
subject: null;
|
|
31
|
+
}[];
|
|
32
|
+
configureView: {
|
|
33
|
+
action: string;
|
|
34
|
+
subject: null;
|
|
35
|
+
}[];
|
|
36
|
+
settings: {
|
|
37
|
+
action: string;
|
|
38
|
+
subject: null;
|
|
39
|
+
}[];
|
|
40
|
+
update: {
|
|
41
|
+
action: string;
|
|
42
|
+
subject: null;
|
|
43
|
+
fields: null;
|
|
44
|
+
}[];
|
|
45
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
interface AppendSearchParamsToUrlProps {
|
|
2
|
+
url?: string;
|
|
3
|
+
params?: Record<string, string | null | undefined> | string;
|
|
4
|
+
}
|
|
5
|
+
declare const appendSearchParamsToUrl: ({ url, params }: AppendSearchParamsToUrlProps) => string | undefined;
|
|
6
|
+
export { appendSearchParamsToUrl };
|
|
@@ -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 @@
|
|
|
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,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
|
+
};
|