@thetechfossil/upfiles 1.0.7 → 1.0.11

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/README.md CHANGED
@@ -12,6 +12,14 @@ For detailed API reference, guides, examples, and more information, visit the do
12
12
  - React `<Uploader />`: drag/drop, progress, single/multiple, accepts/types, size limits
13
13
  - React `<ProjectFilesWidget />`: list all files for a project (Plugin API), pick one, and optionally auto-save to your app
14
14
 
15
+ ## API Key Permissions (Scopes)
16
+
17
+ API keys can have granular scopes. When using an API key with this SDK, ensure it has the necessary scopes:
18
+
19
+ - **`read`**: access `getProjectFiles`, `getThumbnails`, `download`
20
+ - **`write`**: access `upload`, `generateThumbnails`
21
+ - **`delete`**: access file deletion
22
+
15
23
  ## Installation
16
24
 
17
25
  ```bash
package/dist/index.d.mts CHANGED
@@ -26,6 +26,14 @@ type Thumbnail = {
26
26
  sizeType?: string;
27
27
  createdAt?: string;
28
28
  };
29
+ type Folder = {
30
+ id: string;
31
+ name: string;
32
+ parentId: string | null;
33
+ projectId: string;
34
+ createdAt: string;
35
+ updatedAt: string;
36
+ };
29
37
  type FileListItem = {
30
38
  key: string;
31
39
  originalName: string;
@@ -56,6 +64,9 @@ type UpfilesClientOptions = {
56
64
  apiKey?: string;
57
65
  apiKeyHeader?: 'authorization' | 'x-api-key' | 'x-up-api-key';
58
66
  thumbnailsPath?: string;
67
+ completionPath?: string;
68
+ foldersPath?: string;
69
+ callCompletionEndpoint?: boolean;
59
70
  };
60
71
  /**
61
72
  * UpfilesClient - Main client class for interacting with Upfiles Plugin API
@@ -81,6 +92,9 @@ declare class UpfilesClient {
81
92
  private apiKey?;
82
93
  private apiKeyHeader;
83
94
  private thumbnailsPath;
95
+ private completionPath;
96
+ private foldersPath;
97
+ private callCompletionEndpoint;
84
98
  constructor(opts: UpfilesClientOptions);
85
99
  getPresignedUrl(params: {
86
100
  fileName: string;
@@ -94,7 +108,31 @@ declare class UpfilesClient {
94
108
  projectId?: string;
95
109
  folderPath?: string;
96
110
  fetchThumbnails?: boolean;
111
+ callCompletionEndpoint?: boolean;
97
112
  }): Promise<UploadedFileResult>;
113
+ completeUpload(params: {
114
+ fileKey: string;
115
+ originalName: string;
116
+ size: number;
117
+ contentType: string;
118
+ projectId?: string;
119
+ }): Promise<{
120
+ success: boolean;
121
+ file: {
122
+ id: string;
123
+ key: string;
124
+ originalName: string;
125
+ size: number;
126
+ contentType: string;
127
+ url: string;
128
+ uploadedAt: string;
129
+ };
130
+ thumbnails?: Thumbnail[];
131
+ masterWebp?: {
132
+ key: string;
133
+ url: string;
134
+ };
135
+ }>;
98
136
  getThumbnails(fileKey: string): Promise<Thumbnail[]>;
99
137
  generateThumbnails(fileKey: string): Promise<{
100
138
  masterWebp?: {
@@ -103,9 +141,15 @@ declare class UpfilesClient {
103
141
  };
104
142
  thumbnails: Thumbnail[];
105
143
  }>;
144
+ getFolders(parentId?: string): Promise<Folder[]>;
145
+ createFolder(name: string, parentId?: string): Promise<Folder>;
106
146
  getProjectFiles(params?: {
107
147
  folderPath?: string;
108
- }): Promise<FileListItem[]>;
148
+ }): Promise<{
149
+ files: FileListItem[];
150
+ updatedAt: string | null;
151
+ }>;
152
+ getEventsUrl(projectId?: string): string;
109
153
  }
110
154
 
111
155
  type UploaderFile = {
@@ -171,6 +215,7 @@ type ProjectFilesWidgetProps = {
171
215
  onDelete?: (key: string) => Promise<void>;
172
216
  deleteUrl?: string;
173
217
  showDelete?: boolean;
218
+ refreshInterval?: number;
174
219
  };
175
220
  declare const ProjectFilesWidget: React.FC<ProjectFilesWidgetProps>;
176
221
 
@@ -225,7 +270,10 @@ declare function connectUsingApiKey(opts: {
225
270
  client: UpfilesClient;
226
271
  };
227
272
 
228
- declare function fetchProjectFiles(clientOptions: UpfilesClientOptions, folderPath?: string): Promise<FileListItem[]>;
273
+ declare function fetchProjectFiles(clientOptions: UpfilesClientOptions, folderPath?: string): Promise<{
274
+ files: FileListItem[];
275
+ updatedAt: string | null;
276
+ }>;
229
277
  declare function fetchFileThumbnails(clientOptions: UpfilesClientOptions, fileKey: string): Promise<Thumbnail[]>;
230
278
  type ImageWithThumbs = FileListItem & {
231
279
  thumbnails?: Thumbnail[];
@@ -233,7 +281,10 @@ type ImageWithThumbs = FileListItem & {
233
281
  declare function fetchProjectImagesWithThumbs(clientOptions: UpfilesClientOptions, opts?: {
234
282
  folderPath?: string;
235
283
  limitConcurrent?: number;
236
- }): Promise<ImageWithThumbs[]>;
284
+ }): Promise<{
285
+ items: ImageWithThumbs[];
286
+ updatedAt: string | null;
287
+ }>;
237
288
 
238
289
  type ImageManagerProps = {
239
290
  open: boolean;
@@ -267,7 +318,8 @@ type ImageManagerProps = {
267
318
  maxFiles?: number;
268
319
  mode?: 'full' | 'browse' | 'upload';
269
320
  showDelete?: boolean;
321
+ refreshInterval?: number;
270
322
  };
271
323
  declare function ImageManager(props: ImageManagerProps): react_jsx_runtime.JSX.Element;
272
324
 
273
- export { type ConnectOptions, ConnectProjectDialog, type ConnectProjectDialogProps, type FileListItem, ImageManager, type ImageManagerProps, type ImageWithThumbs, type PresignResponse, type Project, ProjectFilesWidget, type ProjectFilesWidgetProps, type Thumbnail, UpfilesClient, type UpfilesClientOptions, type UploadedFileResult, Uploader, type UploaderFile, type UploaderProps, addApiKeyManually, connectProject, connectUsingApiKey, createClientWithKey, createProject, fetchFileThumbnails, fetchProjectFiles, fetchProjectImagesWithThumbs, listProjects };
325
+ export { type ConnectOptions, ConnectProjectDialog, type ConnectProjectDialogProps, type FileListItem, type Folder, ImageManager, type ImageManagerProps, type ImageWithThumbs, type PresignResponse, type Project, ProjectFilesWidget, type ProjectFilesWidgetProps, type Thumbnail, UpfilesClient, type UpfilesClientOptions, type UploadedFileResult, Uploader, type UploaderFile, type UploaderProps, addApiKeyManually, connectProject, connectUsingApiKey, createClientWithKey, createProject, fetchFileThumbnails, fetchProjectFiles, fetchProjectImagesWithThumbs, listProjects };
package/dist/index.d.ts CHANGED
@@ -26,6 +26,14 @@ type Thumbnail = {
26
26
  sizeType?: string;
27
27
  createdAt?: string;
28
28
  };
29
+ type Folder = {
30
+ id: string;
31
+ name: string;
32
+ parentId: string | null;
33
+ projectId: string;
34
+ createdAt: string;
35
+ updatedAt: string;
36
+ };
29
37
  type FileListItem = {
30
38
  key: string;
31
39
  originalName: string;
@@ -56,6 +64,9 @@ type UpfilesClientOptions = {
56
64
  apiKey?: string;
57
65
  apiKeyHeader?: 'authorization' | 'x-api-key' | 'x-up-api-key';
58
66
  thumbnailsPath?: string;
67
+ completionPath?: string;
68
+ foldersPath?: string;
69
+ callCompletionEndpoint?: boolean;
59
70
  };
60
71
  /**
61
72
  * UpfilesClient - Main client class for interacting with Upfiles Plugin API
@@ -81,6 +92,9 @@ declare class UpfilesClient {
81
92
  private apiKey?;
82
93
  private apiKeyHeader;
83
94
  private thumbnailsPath;
95
+ private completionPath;
96
+ private foldersPath;
97
+ private callCompletionEndpoint;
84
98
  constructor(opts: UpfilesClientOptions);
85
99
  getPresignedUrl(params: {
86
100
  fileName: string;
@@ -94,7 +108,31 @@ declare class UpfilesClient {
94
108
  projectId?: string;
95
109
  folderPath?: string;
96
110
  fetchThumbnails?: boolean;
111
+ callCompletionEndpoint?: boolean;
97
112
  }): Promise<UploadedFileResult>;
113
+ completeUpload(params: {
114
+ fileKey: string;
115
+ originalName: string;
116
+ size: number;
117
+ contentType: string;
118
+ projectId?: string;
119
+ }): Promise<{
120
+ success: boolean;
121
+ file: {
122
+ id: string;
123
+ key: string;
124
+ originalName: string;
125
+ size: number;
126
+ contentType: string;
127
+ url: string;
128
+ uploadedAt: string;
129
+ };
130
+ thumbnails?: Thumbnail[];
131
+ masterWebp?: {
132
+ key: string;
133
+ url: string;
134
+ };
135
+ }>;
98
136
  getThumbnails(fileKey: string): Promise<Thumbnail[]>;
99
137
  generateThumbnails(fileKey: string): Promise<{
100
138
  masterWebp?: {
@@ -103,9 +141,15 @@ declare class UpfilesClient {
103
141
  };
104
142
  thumbnails: Thumbnail[];
105
143
  }>;
144
+ getFolders(parentId?: string): Promise<Folder[]>;
145
+ createFolder(name: string, parentId?: string): Promise<Folder>;
106
146
  getProjectFiles(params?: {
107
147
  folderPath?: string;
108
- }): Promise<FileListItem[]>;
148
+ }): Promise<{
149
+ files: FileListItem[];
150
+ updatedAt: string | null;
151
+ }>;
152
+ getEventsUrl(projectId?: string): string;
109
153
  }
110
154
 
111
155
  type UploaderFile = {
@@ -171,6 +215,7 @@ type ProjectFilesWidgetProps = {
171
215
  onDelete?: (key: string) => Promise<void>;
172
216
  deleteUrl?: string;
173
217
  showDelete?: boolean;
218
+ refreshInterval?: number;
174
219
  };
175
220
  declare const ProjectFilesWidget: React.FC<ProjectFilesWidgetProps>;
176
221
 
@@ -225,7 +270,10 @@ declare function connectUsingApiKey(opts: {
225
270
  client: UpfilesClient;
226
271
  };
227
272
 
228
- declare function fetchProjectFiles(clientOptions: UpfilesClientOptions, folderPath?: string): Promise<FileListItem[]>;
273
+ declare function fetchProjectFiles(clientOptions: UpfilesClientOptions, folderPath?: string): Promise<{
274
+ files: FileListItem[];
275
+ updatedAt: string | null;
276
+ }>;
229
277
  declare function fetchFileThumbnails(clientOptions: UpfilesClientOptions, fileKey: string): Promise<Thumbnail[]>;
230
278
  type ImageWithThumbs = FileListItem & {
231
279
  thumbnails?: Thumbnail[];
@@ -233,7 +281,10 @@ type ImageWithThumbs = FileListItem & {
233
281
  declare function fetchProjectImagesWithThumbs(clientOptions: UpfilesClientOptions, opts?: {
234
282
  folderPath?: string;
235
283
  limitConcurrent?: number;
236
- }): Promise<ImageWithThumbs[]>;
284
+ }): Promise<{
285
+ items: ImageWithThumbs[];
286
+ updatedAt: string | null;
287
+ }>;
237
288
 
238
289
  type ImageManagerProps = {
239
290
  open: boolean;
@@ -267,7 +318,8 @@ type ImageManagerProps = {
267
318
  maxFiles?: number;
268
319
  mode?: 'full' | 'browse' | 'upload';
269
320
  showDelete?: boolean;
321
+ refreshInterval?: number;
270
322
  };
271
323
  declare function ImageManager(props: ImageManagerProps): react_jsx_runtime.JSX.Element;
272
324
 
273
- export { type ConnectOptions, ConnectProjectDialog, type ConnectProjectDialogProps, type FileListItem, ImageManager, type ImageManagerProps, type ImageWithThumbs, type PresignResponse, type Project, ProjectFilesWidget, type ProjectFilesWidgetProps, type Thumbnail, UpfilesClient, type UpfilesClientOptions, type UploadedFileResult, Uploader, type UploaderFile, type UploaderProps, addApiKeyManually, connectProject, connectUsingApiKey, createClientWithKey, createProject, fetchFileThumbnails, fetchProjectFiles, fetchProjectImagesWithThumbs, listProjects };
325
+ export { type ConnectOptions, ConnectProjectDialog, type ConnectProjectDialogProps, type FileListItem, type Folder, ImageManager, type ImageManagerProps, type ImageWithThumbs, type PresignResponse, type Project, ProjectFilesWidget, type ProjectFilesWidgetProps, type Thumbnail, UpfilesClient, type UpfilesClientOptions, type UploadedFileResult, Uploader, type UploaderFile, type UploaderProps, addApiKeyManually, connectProject, connectUsingApiKey, createClientWithKey, createProject, fetchFileThumbnails, fetchProjectFiles, fetchProjectImagesWithThumbs, listProjects };