@sparkstudio/storage-ui 1.0.11 → 1.0.13
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/index.cjs +437 -193
- package/dist/index.d.cts +101 -33
- package/dist/index.d.ts +101 -33
- package/dist/index.js +434 -193
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -33,6 +33,29 @@ declare class ContainerDTO implements IContainerDTO {
|
|
|
33
33
|
constructor(init: ContainerDTOInit);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Auto-generated client for the Container controller.
|
|
38
|
+
*/
|
|
39
|
+
declare class Container {
|
|
40
|
+
private baseUrl;
|
|
41
|
+
constructor(baseUrl: string);
|
|
42
|
+
ReadChildrenByContainerId(parentId: string): Promise<ContainerDTO[]>;
|
|
43
|
+
ReadRootContainers(): Promise<ContainerDTO[]>;
|
|
44
|
+
Read(id: string): Promise<ContainerDTO>;
|
|
45
|
+
Create(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
46
|
+
Update(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
47
|
+
DeleteContainer(id: string): Promise<ContainerDTO>;
|
|
48
|
+
CreateFileContainer(fileName: string, size: number, contentType: string): Promise<ContainerDTO>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Auto-generated client for the Home controller.
|
|
53
|
+
*/
|
|
54
|
+
declare class Home {
|
|
55
|
+
private baseUrl;
|
|
56
|
+
constructor(baseUrl: string);
|
|
57
|
+
}
|
|
58
|
+
|
|
36
59
|
/**
|
|
37
60
|
* Represents an Auto-generated model for AWSPresignedUrlDTO.
|
|
38
61
|
*/
|
|
@@ -50,67 +73,112 @@ declare class AWSPresignedUrlDTO implements IAWSPresignedUrlDTO {
|
|
|
50
73
|
}
|
|
51
74
|
|
|
52
75
|
/**
|
|
53
|
-
* Auto-generated client for the
|
|
76
|
+
* Auto-generated client for the S3 controller.
|
|
54
77
|
*/
|
|
55
|
-
declare class
|
|
78
|
+
declare class S3 {
|
|
56
79
|
private baseUrl;
|
|
57
80
|
constructor(baseUrl: string);
|
|
58
|
-
ReadChildrenByContainerId(parentId: string): Promise<ContainerDTO[]>;
|
|
59
|
-
ReadRootContainers(): Promise<ContainerDTO[]>;
|
|
60
|
-
Read(id: string): Promise<ContainerDTO>;
|
|
61
|
-
Create(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
62
|
-
Update(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
63
81
|
DeleteS3(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
64
|
-
DeleteContainer(id: string): Promise<ContainerDTO>;
|
|
65
|
-
CreateFileContainer(fileName: string, size: number, contentType: string): Promise<ContainerDTO>;
|
|
66
82
|
GetPreSignedUrl(containerDTO: ContainerDTO): Promise<AWSPresignedUrlDTO>;
|
|
67
83
|
}
|
|
68
84
|
|
|
69
|
-
/**
|
|
70
|
-
* Auto-generated client for the Home controller.
|
|
71
|
-
*/
|
|
72
|
-
declare class Home {
|
|
73
|
-
private baseUrl;
|
|
74
|
-
constructor(baseUrl: string);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
85
|
/**
|
|
78
86
|
* Auto-generated API client.
|
|
79
87
|
*/
|
|
80
88
|
declare class SparkStudioStorageSDK {
|
|
81
89
|
container: Container;
|
|
82
90
|
home: Home;
|
|
91
|
+
s3: S3;
|
|
83
92
|
constructor(baseUrl: string);
|
|
84
93
|
}
|
|
85
94
|
|
|
95
|
+
interface ContainerUploadPanelProps {
|
|
96
|
+
/** Base URL for the Container API (the SDK you pasted). */
|
|
97
|
+
containerApiBaseUrl: string;
|
|
98
|
+
/** Base URL for your storage / presign endpoint (used by getPresignedUrl). */
|
|
99
|
+
storageApiBaseUrl: string;
|
|
100
|
+
/** Optional parent container – if set, we query children instead of roots. */
|
|
101
|
+
parentContainerId?: string;
|
|
102
|
+
title?: string;
|
|
103
|
+
description?: string;
|
|
104
|
+
}
|
|
105
|
+
declare const ContainerUploadPanel: React.FC<ContainerUploadPanelProps>;
|
|
106
|
+
|
|
86
107
|
interface UploadContainerProps {
|
|
87
108
|
title?: string;
|
|
88
109
|
description?: string;
|
|
89
110
|
multiple?: boolean;
|
|
90
111
|
accept?: string;
|
|
91
112
|
onFilesSelected?: (files: FileList) => void;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
* using getPresignedUrl for each file.
|
|
95
|
-
*/
|
|
113
|
+
existingFiles?: ContainerDTO[];
|
|
114
|
+
onExistingFileClick?: (file: ContainerDTO) => void;
|
|
96
115
|
autoUpload?: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Your function that returns a pre-signed URL for a given file.
|
|
99
|
-
* Typically calls your backend: /api/uploads/presign
|
|
100
|
-
*/
|
|
101
116
|
getPresignedUrl?: (file: File) => Promise<AWSPresignedUrlDTO>;
|
|
102
|
-
/**
|
|
103
|
-
* Called when a file has successfully finished uploading.
|
|
104
|
-
* s3Url is usually the final S3 object URL or key (depends on your backend).
|
|
105
|
-
*/
|
|
106
117
|
onUploadComplete?: (file: File, s3Url: string) => void;
|
|
107
|
-
/**
|
|
108
|
-
* Called when a file upload fails.
|
|
109
|
-
*/
|
|
110
118
|
onUploadError?: (file: File, error: Error) => void;
|
|
111
119
|
}
|
|
112
120
|
declare const UploadContainer: React.FC<UploadContainerProps>;
|
|
113
121
|
|
|
122
|
+
interface UploadDropzoneProps {
|
|
123
|
+
isDragging: boolean;
|
|
124
|
+
onDragOver: (e: React.DragEvent<HTMLDivElement>) => void;
|
|
125
|
+
onDragLeave: (e: React.DragEvent<HTMLDivElement>) => void;
|
|
126
|
+
onDrop: (e: React.DragEvent<HTMLDivElement>) => void;
|
|
127
|
+
}
|
|
128
|
+
declare const UploadDropzone: React.FC<UploadDropzoneProps>;
|
|
129
|
+
|
|
130
|
+
interface UploadFilePickerProps {
|
|
131
|
+
multiple: boolean;
|
|
132
|
+
accept?: string;
|
|
133
|
+
fileNames: string[];
|
|
134
|
+
onFileChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
135
|
+
}
|
|
136
|
+
declare const UploadFilePicker: React.FC<UploadFilePickerProps>;
|
|
137
|
+
|
|
138
|
+
type UploadStatus = "pending" | "uploading" | "success" | "error";
|
|
139
|
+
interface UploadState {
|
|
140
|
+
id: string;
|
|
141
|
+
file: File;
|
|
142
|
+
progress: number;
|
|
143
|
+
status: UploadStatus;
|
|
144
|
+
error?: string;
|
|
145
|
+
s3Url?: string;
|
|
146
|
+
publicUrl?: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
interface UploadProgressListProps {
|
|
150
|
+
uploads: UploadState[];
|
|
151
|
+
}
|
|
152
|
+
declare const UploadProgressList: React.FC<UploadProgressListProps>;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Helper: upload a file to a pre-signed S3 URL with progress events.
|
|
156
|
+
*/
|
|
157
|
+
declare function UploadFileToS3(file: File, presignedUrl: string, onProgress: (progress: number) => void): Promise<void>;
|
|
158
|
+
|
|
159
|
+
interface UseContainersOptions {
|
|
160
|
+
apiBaseUrl: string;
|
|
161
|
+
parentId?: string;
|
|
162
|
+
}
|
|
163
|
+
declare function UseContainers({ apiBaseUrl, parentId }: UseContainersOptions): {
|
|
164
|
+
containers: ContainerDTO[];
|
|
165
|
+
loading: boolean;
|
|
166
|
+
error: Error | null;
|
|
167
|
+
reload: () => Promise<void>;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
interface UseUploadManagerOptions {
|
|
171
|
+
autoUpload?: boolean;
|
|
172
|
+
getPresignedUrl?: (file: File) => Promise<AWSPresignedUrlDTO>;
|
|
173
|
+
onUploadComplete?: (file: File, s3Url: string) => void;
|
|
174
|
+
onUploadError?: (file: File, error: Error) => void;
|
|
175
|
+
}
|
|
176
|
+
declare function UseUploadManager({ autoUpload, getPresignedUrl, onUploadComplete, onUploadError, }: UseUploadManagerOptions): {
|
|
177
|
+
uploads: UploadState[];
|
|
178
|
+
startUploadsIfNeeded: (files: FileList) => void;
|
|
179
|
+
resetUploads: () => void;
|
|
180
|
+
};
|
|
181
|
+
|
|
114
182
|
declare function HomeView(): react_jsx_runtime.JSX.Element;
|
|
115
183
|
|
|
116
|
-
export { AWSPresignedUrlDTO, Container, ContainerDTO, ContainerType, Home, HomeView, type IAWSPresignedUrlDTO, type IContainerDTO, SparkStudioStorageSDK, UploadContainer, type UploadContainerProps };
|
|
184
|
+
export { AWSPresignedUrlDTO, Container, ContainerDTO, ContainerType, ContainerUploadPanel, Home, HomeView, type IAWSPresignedUrlDTO, type IContainerDTO, S3, SparkStudioStorageSDK, UploadContainer, type UploadContainerProps, UploadDropzone, UploadFilePicker, UploadFileToS3, UploadProgressList, type UploadState, type UploadStatus, UseContainers, UseUploadManager };
|
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,29 @@ declare class ContainerDTO implements IContainerDTO {
|
|
|
33
33
|
constructor(init: ContainerDTOInit);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Auto-generated client for the Container controller.
|
|
38
|
+
*/
|
|
39
|
+
declare class Container {
|
|
40
|
+
private baseUrl;
|
|
41
|
+
constructor(baseUrl: string);
|
|
42
|
+
ReadChildrenByContainerId(parentId: string): Promise<ContainerDTO[]>;
|
|
43
|
+
ReadRootContainers(): Promise<ContainerDTO[]>;
|
|
44
|
+
Read(id: string): Promise<ContainerDTO>;
|
|
45
|
+
Create(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
46
|
+
Update(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
47
|
+
DeleteContainer(id: string): Promise<ContainerDTO>;
|
|
48
|
+
CreateFileContainer(fileName: string, size: number, contentType: string): Promise<ContainerDTO>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Auto-generated client for the Home controller.
|
|
53
|
+
*/
|
|
54
|
+
declare class Home {
|
|
55
|
+
private baseUrl;
|
|
56
|
+
constructor(baseUrl: string);
|
|
57
|
+
}
|
|
58
|
+
|
|
36
59
|
/**
|
|
37
60
|
* Represents an Auto-generated model for AWSPresignedUrlDTO.
|
|
38
61
|
*/
|
|
@@ -50,67 +73,112 @@ declare class AWSPresignedUrlDTO implements IAWSPresignedUrlDTO {
|
|
|
50
73
|
}
|
|
51
74
|
|
|
52
75
|
/**
|
|
53
|
-
* Auto-generated client for the
|
|
76
|
+
* Auto-generated client for the S3 controller.
|
|
54
77
|
*/
|
|
55
|
-
declare class
|
|
78
|
+
declare class S3 {
|
|
56
79
|
private baseUrl;
|
|
57
80
|
constructor(baseUrl: string);
|
|
58
|
-
ReadChildrenByContainerId(parentId: string): Promise<ContainerDTO[]>;
|
|
59
|
-
ReadRootContainers(): Promise<ContainerDTO[]>;
|
|
60
|
-
Read(id: string): Promise<ContainerDTO>;
|
|
61
|
-
Create(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
62
|
-
Update(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
63
81
|
DeleteS3(containerDTO: ContainerDTO): Promise<ContainerDTO>;
|
|
64
|
-
DeleteContainer(id: string): Promise<ContainerDTO>;
|
|
65
|
-
CreateFileContainer(fileName: string, size: number, contentType: string): Promise<ContainerDTO>;
|
|
66
82
|
GetPreSignedUrl(containerDTO: ContainerDTO): Promise<AWSPresignedUrlDTO>;
|
|
67
83
|
}
|
|
68
84
|
|
|
69
|
-
/**
|
|
70
|
-
* Auto-generated client for the Home controller.
|
|
71
|
-
*/
|
|
72
|
-
declare class Home {
|
|
73
|
-
private baseUrl;
|
|
74
|
-
constructor(baseUrl: string);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
85
|
/**
|
|
78
86
|
* Auto-generated API client.
|
|
79
87
|
*/
|
|
80
88
|
declare class SparkStudioStorageSDK {
|
|
81
89
|
container: Container;
|
|
82
90
|
home: Home;
|
|
91
|
+
s3: S3;
|
|
83
92
|
constructor(baseUrl: string);
|
|
84
93
|
}
|
|
85
94
|
|
|
95
|
+
interface ContainerUploadPanelProps {
|
|
96
|
+
/** Base URL for the Container API (the SDK you pasted). */
|
|
97
|
+
containerApiBaseUrl: string;
|
|
98
|
+
/** Base URL for your storage / presign endpoint (used by getPresignedUrl). */
|
|
99
|
+
storageApiBaseUrl: string;
|
|
100
|
+
/** Optional parent container – if set, we query children instead of roots. */
|
|
101
|
+
parentContainerId?: string;
|
|
102
|
+
title?: string;
|
|
103
|
+
description?: string;
|
|
104
|
+
}
|
|
105
|
+
declare const ContainerUploadPanel: React.FC<ContainerUploadPanelProps>;
|
|
106
|
+
|
|
86
107
|
interface UploadContainerProps {
|
|
87
108
|
title?: string;
|
|
88
109
|
description?: string;
|
|
89
110
|
multiple?: boolean;
|
|
90
111
|
accept?: string;
|
|
91
112
|
onFilesSelected?: (files: FileList) => void;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
* using getPresignedUrl for each file.
|
|
95
|
-
*/
|
|
113
|
+
existingFiles?: ContainerDTO[];
|
|
114
|
+
onExistingFileClick?: (file: ContainerDTO) => void;
|
|
96
115
|
autoUpload?: boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Your function that returns a pre-signed URL for a given file.
|
|
99
|
-
* Typically calls your backend: /api/uploads/presign
|
|
100
|
-
*/
|
|
101
116
|
getPresignedUrl?: (file: File) => Promise<AWSPresignedUrlDTO>;
|
|
102
|
-
/**
|
|
103
|
-
* Called when a file has successfully finished uploading.
|
|
104
|
-
* s3Url is usually the final S3 object URL or key (depends on your backend).
|
|
105
|
-
*/
|
|
106
117
|
onUploadComplete?: (file: File, s3Url: string) => void;
|
|
107
|
-
/**
|
|
108
|
-
* Called when a file upload fails.
|
|
109
|
-
*/
|
|
110
118
|
onUploadError?: (file: File, error: Error) => void;
|
|
111
119
|
}
|
|
112
120
|
declare const UploadContainer: React.FC<UploadContainerProps>;
|
|
113
121
|
|
|
122
|
+
interface UploadDropzoneProps {
|
|
123
|
+
isDragging: boolean;
|
|
124
|
+
onDragOver: (e: React.DragEvent<HTMLDivElement>) => void;
|
|
125
|
+
onDragLeave: (e: React.DragEvent<HTMLDivElement>) => void;
|
|
126
|
+
onDrop: (e: React.DragEvent<HTMLDivElement>) => void;
|
|
127
|
+
}
|
|
128
|
+
declare const UploadDropzone: React.FC<UploadDropzoneProps>;
|
|
129
|
+
|
|
130
|
+
interface UploadFilePickerProps {
|
|
131
|
+
multiple: boolean;
|
|
132
|
+
accept?: string;
|
|
133
|
+
fileNames: string[];
|
|
134
|
+
onFileChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
135
|
+
}
|
|
136
|
+
declare const UploadFilePicker: React.FC<UploadFilePickerProps>;
|
|
137
|
+
|
|
138
|
+
type UploadStatus = "pending" | "uploading" | "success" | "error";
|
|
139
|
+
interface UploadState {
|
|
140
|
+
id: string;
|
|
141
|
+
file: File;
|
|
142
|
+
progress: number;
|
|
143
|
+
status: UploadStatus;
|
|
144
|
+
error?: string;
|
|
145
|
+
s3Url?: string;
|
|
146
|
+
publicUrl?: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
interface UploadProgressListProps {
|
|
150
|
+
uploads: UploadState[];
|
|
151
|
+
}
|
|
152
|
+
declare const UploadProgressList: React.FC<UploadProgressListProps>;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Helper: upload a file to a pre-signed S3 URL with progress events.
|
|
156
|
+
*/
|
|
157
|
+
declare function UploadFileToS3(file: File, presignedUrl: string, onProgress: (progress: number) => void): Promise<void>;
|
|
158
|
+
|
|
159
|
+
interface UseContainersOptions {
|
|
160
|
+
apiBaseUrl: string;
|
|
161
|
+
parentId?: string;
|
|
162
|
+
}
|
|
163
|
+
declare function UseContainers({ apiBaseUrl, parentId }: UseContainersOptions): {
|
|
164
|
+
containers: ContainerDTO[];
|
|
165
|
+
loading: boolean;
|
|
166
|
+
error: Error | null;
|
|
167
|
+
reload: () => Promise<void>;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
interface UseUploadManagerOptions {
|
|
171
|
+
autoUpload?: boolean;
|
|
172
|
+
getPresignedUrl?: (file: File) => Promise<AWSPresignedUrlDTO>;
|
|
173
|
+
onUploadComplete?: (file: File, s3Url: string) => void;
|
|
174
|
+
onUploadError?: (file: File, error: Error) => void;
|
|
175
|
+
}
|
|
176
|
+
declare function UseUploadManager({ autoUpload, getPresignedUrl, onUploadComplete, onUploadError, }: UseUploadManagerOptions): {
|
|
177
|
+
uploads: UploadState[];
|
|
178
|
+
startUploadsIfNeeded: (files: FileList) => void;
|
|
179
|
+
resetUploads: () => void;
|
|
180
|
+
};
|
|
181
|
+
|
|
114
182
|
declare function HomeView(): react_jsx_runtime.JSX.Element;
|
|
115
183
|
|
|
116
|
-
export { AWSPresignedUrlDTO, Container, ContainerDTO, ContainerType, Home, HomeView, type IAWSPresignedUrlDTO, type IContainerDTO, SparkStudioStorageSDK, UploadContainer, type UploadContainerProps };
|
|
184
|
+
export { AWSPresignedUrlDTO, Container, ContainerDTO, ContainerType, ContainerUploadPanel, Home, HomeView, type IAWSPresignedUrlDTO, type IContainerDTO, S3, SparkStudioStorageSDK, UploadContainer, type UploadContainerProps, UploadDropzone, UploadFilePicker, UploadFileToS3, UploadProgressList, type UploadState, type UploadStatus, UseContainers, UseUploadManager };
|