@shipstatic/drop 0.1.10 → 0.1.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/dist/index.d.cts CHANGED
@@ -1,12 +1,10 @@
1
- import { StaticFile } from '@shipstatic/types';
2
1
  import { Ship, formatFileSize as formatFileSize$1 } from '@shipstatic/ship';
3
2
 
4
3
  /**
5
- * Core types for @shipstatic/dropzone
4
+ * Core types for @shipstatic/drop
6
5
  * Imports types from @shipstatic/types (single source of truth)
7
- * and defines dropzone-specific types
6
+ * and defines drop-specific types
8
7
  */
9
-
10
8
  declare const FILE_STATUSES: {
11
9
  readonly PENDING: "pending";
12
10
  readonly PROCESSING: "processing";
@@ -31,14 +29,20 @@ interface ClientError {
31
29
  }
32
30
  /**
33
31
  * Processed file entry ready for upload
34
- * Extends StaticFile from SDK, adding UI-specific properties
35
- * This means ProcessedFile IS a StaticFile - can be passed directly to ship.deployments.create()
32
+ * Contains both the File object and UI-specific metadata
33
+ * Use `file` property to access the underlying File for SDK operations
36
34
  */
37
- interface ProcessedFile extends StaticFile {
35
+ interface ProcessedFile {
38
36
  /** Unique identifier for React keys and tracking */
39
37
  id: string;
40
- /** Original File object (alias for 'content' from StaticFile for better DX) */
38
+ /** The File object - pass this to ship.deployments.create() */
41
39
  file: File;
40
+ /** Relative path for deployment (e.g., "images/photo.jpg") */
41
+ path: string;
42
+ /** File size in bytes */
43
+ size: number;
44
+ /** MD5 hash (optional - Ship SDK calculates during deployment if not provided) */
45
+ md5?: string;
42
46
  /** Filename without path */
43
47
  name: string;
44
48
  /** MIME type for UI icons/previews */
@@ -212,4 +216,9 @@ declare function normalizePath(path: string): string;
212
216
  */
213
217
  declare function isZipFile(file: File): boolean;
214
218
 
215
- export { type ClientError, type DropOptions, type DropReturn, type DropState, type DropStateValue, type DropStatus, FILE_STATUSES, type FileStatus, type ProcessedFile, type ZipExtractionResult, createProcessedFile, extractZipToFiles, formatFileSize, isZipFile, normalizePath, stripCommonPrefix, traverseFileTree, useDrop };
219
+ /**
220
+ * Get MIME type from file path (browser-compatible, no Node.js dependencies)
221
+ */
222
+ declare function getMimeType(path: string): string;
223
+
224
+ export { type ClientError, type DropOptions, type DropReturn, type DropState, type DropStateValue, type DropStatus, FILE_STATUSES, type FileStatus, type ProcessedFile, type ZipExtractionResult, createProcessedFile, extractZipToFiles, formatFileSize, getMimeType, isZipFile, normalizePath, stripCommonPrefix, traverseFileTree, useDrop };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,10 @@
1
- import { StaticFile } from '@shipstatic/types';
2
1
  import { Ship, formatFileSize as formatFileSize$1 } from '@shipstatic/ship';
3
2
 
4
3
  /**
5
- * Core types for @shipstatic/dropzone
4
+ * Core types for @shipstatic/drop
6
5
  * Imports types from @shipstatic/types (single source of truth)
7
- * and defines dropzone-specific types
6
+ * and defines drop-specific types
8
7
  */
9
-
10
8
  declare const FILE_STATUSES: {
11
9
  readonly PENDING: "pending";
12
10
  readonly PROCESSING: "processing";
@@ -31,14 +29,20 @@ interface ClientError {
31
29
  }
32
30
  /**
33
31
  * Processed file entry ready for upload
34
- * Extends StaticFile from SDK, adding UI-specific properties
35
- * This means ProcessedFile IS a StaticFile - can be passed directly to ship.deployments.create()
32
+ * Contains both the File object and UI-specific metadata
33
+ * Use `file` property to access the underlying File for SDK operations
36
34
  */
37
- interface ProcessedFile extends StaticFile {
35
+ interface ProcessedFile {
38
36
  /** Unique identifier for React keys and tracking */
39
37
  id: string;
40
- /** Original File object (alias for 'content' from StaticFile for better DX) */
38
+ /** The File object - pass this to ship.deployments.create() */
41
39
  file: File;
40
+ /** Relative path for deployment (e.g., "images/photo.jpg") */
41
+ path: string;
42
+ /** File size in bytes */
43
+ size: number;
44
+ /** MD5 hash (optional - Ship SDK calculates during deployment if not provided) */
45
+ md5?: string;
42
46
  /** Filename without path */
43
47
  name: string;
44
48
  /** MIME type for UI icons/previews */
@@ -212,4 +216,9 @@ declare function normalizePath(path: string): string;
212
216
  */
213
217
  declare function isZipFile(file: File): boolean;
214
218
 
215
- export { type ClientError, type DropOptions, type DropReturn, type DropState, type DropStateValue, type DropStatus, FILE_STATUSES, type FileStatus, type ProcessedFile, type ZipExtractionResult, createProcessedFile, extractZipToFiles, formatFileSize, isZipFile, normalizePath, stripCommonPrefix, traverseFileTree, useDrop };
219
+ /**
220
+ * Get MIME type from file path (browser-compatible, no Node.js dependencies)
221
+ */
222
+ declare function getMimeType(path: string): string;
223
+
224
+ export { type ClientError, type DropOptions, type DropReturn, type DropState, type DropStateValue, type DropStatus, FILE_STATUSES, type FileStatus, type ProcessedFile, type ZipExtractionResult, createProcessedFile, extractZipToFiles, formatFileSize, getMimeType, isZipFile, normalizePath, stripCommonPrefix, traverseFileTree, useDrop };
package/dist/index.js CHANGED
@@ -11796,15 +11796,12 @@ async function createProcessedFile(file, options) {
11796
11796
  const path = options?.path || (webkitPath && webkitPath.trim() ? webkitPath : file.name);
11797
11797
  const type = file.type || getMimeType(path);
11798
11798
  return {
11799
- // StaticFile properties (SDK compatibility)
11799
+ // ProcessedFile properties
11800
11800
  // Note: md5 is intentionally undefined - Ship SDK will calculate it during deployment
11801
- content: file,
11802
- path,
11803
- size: file.size,
11804
- // ProcessedFile-specific properties (UI functionality)
11805
11801
  id: crypto.randomUUID(),
11806
11802
  file,
11807
- // Keep as alias for better DX
11803
+ path,
11804
+ size: file.size,
11808
11805
  name: path.split("/").pop() || file.name,
11809
11806
  type,
11810
11807
  lastModified: file.lastModified,
@@ -12149,6 +12146,6 @@ mime-db/index.js:
12149
12146
  *)
12150
12147
  */
12151
12148
 
12152
- export { FILE_STATUSES, createProcessedFile, extractZipToFiles, formatFileSize, isZipFile, normalizePath, stripCommonPrefix, traverseFileTree, useDrop };
12149
+ export { FILE_STATUSES, createProcessedFile, extractZipToFiles, formatFileSize, getMimeType, isZipFile, normalizePath, stripCommonPrefix, traverseFileTree, useDrop };
12153
12150
  //# sourceMappingURL=index.js.map
12154
12151
  //# sourceMappingURL=index.js.map