@strapi/upload 5.0.3 → 5.0.5

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 (74) hide show
  1. package/dist/_chunks/{index-Cze6kL5_.mjs → index-BJfZXhbz.mjs} +5 -2
  2. package/dist/_chunks/index-BJfZXhbz.mjs.map +1 -0
  3. package/dist/_chunks/{index-BwMdH-eI.js → index-C7Nj9ETW.js} +356 -290
  4. package/dist/_chunks/index-C7Nj9ETW.js.map +1 -0
  5. package/dist/_chunks/{index-DzHgwpS9.mjs → index-CuzWuOXx.mjs} +357 -291
  6. package/dist/_chunks/index-CuzWuOXx.mjs.map +1 -0
  7. package/dist/_chunks/{index-DK1he91f.js → index-DIjfjBzf.js} +5 -2
  8. package/dist/_chunks/index-DIjfjBzf.js.map +1 -0
  9. package/dist/_chunks/{index-C5E7jC83.js → index-Dztfplsk.js} +8 -8
  10. package/dist/_chunks/index-Dztfplsk.js.map +1 -0
  11. package/dist/_chunks/{index-ox-PAURv.js → index-boOjOtd3.js} +2 -2
  12. package/dist/_chunks/{index-ox-PAURv.js.map → index-boOjOtd3.js.map} +1 -1
  13. package/dist/_chunks/{index-Cw3NiaYP.mjs → index-moi5JZRr.mjs} +2 -2
  14. package/dist/_chunks/{index-Cw3NiaYP.mjs.map → index-moi5JZRr.mjs.map} +1 -1
  15. package/dist/_chunks/{index-CCEHGHWW.mjs → index-uOSk9F1z.mjs} +8 -8
  16. package/dist/_chunks/index-uOSk9F1z.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/files.d.ts +46 -6
  67. package/dist/shared/contracts/folders.d.ts +5 -6
  68. package/package.json +8 -7
  69. package/dist/_chunks/index-BwMdH-eI.js.map +0 -1
  70. package/dist/_chunks/index-C5E7jC83.js.map +0 -1
  71. package/dist/_chunks/index-CCEHGHWW.mjs.map +0 -1
  72. package/dist/_chunks/index-Cze6kL5_.mjs.map +0 -1
  73. package/dist/_chunks/index-DK1he91f.js.map +0 -1
  74. package/dist/_chunks/index-DzHgwpS9.mjs.map +0 -1
@@ -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;
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const usePersistentState: <T>(key: string, defaultValue: T) => readonly [T, import("react").Dispatch<import("react").SetStateAction<T>>];
2
3
  export { usePersistentState };
@@ -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,2 @@
1
+ export declare const pluginId: string;
2
+ export default pluginId;
@@ -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,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
+ }[]>;
@@ -1,6 +1,44 @@
1
1
  import { errors } from '@strapi/utils';
2
2
  type SortOrder = 'ASC' | 'DESC';
3
- type SortKey = 'createdAt' | 'name';
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
+ };
4
42
  export interface File {
5
43
  id: number;
6
44
  name: string;
@@ -8,7 +46,7 @@ export interface File {
8
46
  caption?: string | null;
9
47
  width?: number;
10
48
  height?: number;
11
- formats?: Record<string, unknown>;
49
+ formats?: Record<string, FileFormat>;
12
50
  hash: string;
13
51
  ext?: string;
14
52
  mime?: string;
@@ -20,7 +58,7 @@ export interface File {
20
58
  provider?: string;
21
59
  provider_metadata?: Record<string, unknown>;
22
60
  isUrlSigned?: boolean;
23
- folder?: number;
61
+ folder?: number | null;
24
62
  folderPath?: string;
25
63
  related?: {
26
64
  id: string | number;
@@ -32,11 +70,10 @@ export interface File {
32
70
  createdAt?: string;
33
71
  updatedAt?: string;
34
72
  createdBy?: number;
73
+ publishedAt?: string;
35
74
  updatedBy?: number;
75
+ isLocal?: boolean;
36
76
  }
37
- /**
38
- * GET /upload/files - Get files
39
- */
40
77
  export interface RawFile extends Blob {
41
78
  size: number;
42
79
  lastModified: number;
@@ -49,6 +86,9 @@ export interface Pagination {
49
86
  pageCount: number;
50
87
  total: number;
51
88
  }
89
+ /**
90
+ * GET /upload/files - Get files
91
+ */
52
92
  export declare namespace GetFiles {
53
93
  interface Request {
54
94
  body: {};
@@ -5,19 +5,19 @@ import type { File } from './files';
5
5
  export interface Folder {
6
6
  id: number;
7
7
  name: string;
8
- pathId: number;
8
+ pathId?: number;
9
9
  /**
10
10
  * parent id
11
11
  */
12
- parent?: number;
12
+ parent?: number | null | Folder;
13
13
  /**
14
14
  * children ids
15
15
  */
16
16
  children?: number[];
17
- path: string;
17
+ path?: string;
18
18
  files?: File[];
19
19
  }
20
- type FolderNode = Partial<Folder> & {
20
+ export type FolderNode = Partial<Omit<Folder, 'children'>> & {
21
21
  children: FolderNode[];
22
22
  };
23
23
  /**
@@ -88,7 +88,7 @@ export declare namespace UpdateFolder {
88
88
  *
89
89
  * Return the structure of a folder.
90
90
  */
91
- export declare namespace FolderStructureNamespace {
91
+ export declare namespace GetFolderStructure {
92
92
  interface Request {
93
93
  query?: {};
94
94
  }
@@ -138,4 +138,3 @@ export declare namespace BulkMoveFolders {
138
138
  error?: errors.ApplicationError | errors.ValidationError;
139
139
  }
140
140
  }
141
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/upload",
3
- "version": "5.0.3",
3
+ "version": "5.0.5",
4
4
  "description": "Makes it easy to upload images and files to your Strapi Application.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": {
@@ -58,8 +58,8 @@
58
58
  "dependencies": {
59
59
  "@strapi/design-system": "2.0.0-rc.11",
60
60
  "@strapi/icons": "2.0.0-rc.11",
61
- "@strapi/provider-upload-local": "5.0.3",
62
- "@strapi/utils": "5.0.3",
61
+ "@strapi/provider-upload-local": "5.0.5",
62
+ "@strapi/utils": "5.0.5",
63
63
  "byte-size": "8.1.1",
64
64
  "cropperjs": "1.6.1",
65
65
  "date-fns": "2.30.0",
@@ -81,12 +81,13 @@
81
81
  "yup": "0.32.9"
82
82
  },
83
83
  "devDependencies": {
84
- "@strapi/admin": "5.0.3",
84
+ "@strapi/admin": "5.0.5",
85
85
  "@strapi/pack-up": "5.0.0",
86
- "@strapi/types": "5.0.3",
86
+ "@strapi/types": "5.0.5",
87
87
  "@testing-library/dom": "10.1.0",
88
88
  "@testing-library/react": "15.0.7",
89
89
  "@testing-library/user-event": "14.5.2",
90
+ "@types/byte-size": "8.1.2",
90
91
  "@types/fs-extra": "11.0.4",
91
92
  "@types/koa": "2.13.4",
92
93
  "@types/koa-range": "0.3.5",
@@ -108,7 +109,7 @@
108
109
  "styled-components": "^6.0.0"
109
110
  },
110
111
  "engines": {
111
- "node": ">=18.0.0 <=20.x.x",
112
+ "node": ">=18.0.0 <=22.x.x",
112
113
  "npm": ">=6.0.0"
113
114
  },
114
115
  "strapi": {
@@ -118,5 +119,5 @@
118
119
  "required": true,
119
120
  "kind": "plugin"
120
121
  },
121
- "gitHead": "3e37ea0306e6faf2c214a654ab00a2323d7e3ab7"
122
+ "gitHead": "9cbf0e65dc4979f0db4355c05a03917f21448367"
122
123
  }