@shipstatic/drop 0.3.5 → 0.3.7

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
@@ -56,7 +56,7 @@ function Uploader() {
56
56
  - **Prop Getters API** - Spread props on your elements (like `react-dropzone`)
57
57
  - **Built-in Drag & Drop** - Folder support with `webkitGetAsEntry` API
58
58
  - **ZIP Support** - Automatic extraction and processing
59
- - **Ship SDK Integration** - Validation via `ship.getConfig()`
59
+ - **Ship SDK Integration** - Validation via `ship.getLimits()`
60
60
  - **Headless** - No visual components, full styling control
61
61
  - **TypeScript** - Complete type definitions
62
62
 
@@ -147,7 +147,7 @@ Drop uses Ship SDK's validation automatically:
147
147
  ```tsx
148
148
  const drop = useDrop({ ship });
149
149
 
150
- // Behind the scenes: ship.getConfig() → validateFiles()
150
+ // Behind the scenes: ship.getLimits() → validateFiles()
151
151
  // Client validation matches server limits
152
152
  ```
153
153
 
package/dist/index.cjs CHANGED
@@ -31,7 +31,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
 
32
32
  // node_modules/.pnpm/mime-db@1.54.0/node_modules/mime-db/db.json
33
33
  var require_db = __commonJS({
34
- "node_modules/.pnpm/mime-db@1.54.0/node_modules/mime-db/db.json"(exports$1, module) {
34
+ "node_modules/.pnpm/mime-db@1.54.0/node_modules/mime-db/db.json"(exports, module) {
35
35
  module.exports = {
36
36
  "application/1d-interleaved-parityfec": {
37
37
  source: "iana"
@@ -9379,30 +9379,43 @@ var require_db = __commonJS({
9379
9379
 
9380
9380
  // node_modules/.pnpm/mime-db@1.54.0/node_modules/mime-db/index.js
9381
9381
  var require_mime_db = __commonJS({
9382
- "node_modules/.pnpm/mime-db@1.54.0/node_modules/mime-db/index.js"(exports$1, module) {
9382
+ "node_modules/.pnpm/mime-db@1.54.0/node_modules/mime-db/index.js"(exports, module) {
9383
9383
  module.exports = require_db();
9384
9384
  }
9385
9385
  });
9386
9386
 
9387
- // node_modules/.pnpm/@shipstatic+types@0.8.7/node_modules/@shipstatic/types/dist/index.js
9388
- var ErrorType;
9389
- (function(ErrorType2) {
9390
- ErrorType2["Validation"] = "validation_failed";
9391
- ErrorType2["NotFound"] = "not_found";
9392
- ErrorType2["RateLimit"] = "rate_limit_exceeded";
9393
- ErrorType2["Authentication"] = "authentication_failed";
9394
- ErrorType2["Business"] = "business_logic_error";
9395
- ErrorType2["Api"] = "internal_server_error";
9396
- ErrorType2["Network"] = "network_error";
9397
- ErrorType2["Cancelled"] = "operation_cancelled";
9398
- ErrorType2["File"] = "file_error";
9399
- ErrorType2["Config"] = "config_error";
9400
- })(ErrorType || (ErrorType = {}));
9401
- ({
9402
- client: /* @__PURE__ */ new Set([ErrorType.Business, ErrorType.Config, ErrorType.File, ErrorType.Validation]),
9403
- network: /* @__PURE__ */ new Set([ErrorType.Network]),
9404
- auth: /* @__PURE__ */ new Set([ErrorType.Authentication])
9405
- });
9387
+ // node_modules/.pnpm/@shipstatic+types@0.9.8/node_modules/@shipstatic/types/dist/index.js
9388
+ var ErrorType = {
9389
+ /** Validation failed (400). Input shape is wrong. */
9390
+ Validation: "validation_failed",
9391
+ /** Resource not found (404). */
9392
+ NotFound: "not_found",
9393
+ /** Authenticated but not allowed (403). User lacks permission for this action. */
9394
+ Forbidden: "forbidden",
9395
+ /** Rate limit exceeded (429). */
9396
+ RateLimit: "rate_limit_exceeded",
9397
+ /** Authentication required or failed (401). Missing/invalid credentials. */
9398
+ Authentication: "authentication_failed",
9399
+ /** Business rule violation. Catch-all for 4xx state-rule errors that aren't more specific. */
9400
+ Business: "business_logic_error",
9401
+ /** API server error (500). Generic server-side fault. */
9402
+ Api: "internal_server_error",
9403
+ /** Network/connection error. Client-side only — set by HTTP clients on fetch failure; never produced server-side. */
9404
+ Network: "network_error",
9405
+ /** Operation was cancelled. Client-side only — set on `AbortSignal` abort; never produced server-side. */
9406
+ Cancelled: "operation_cancelled",
9407
+ /** File operation error. Client-side only — set by SDK during local file processing; never produced server-side. */
9408
+ File: "file_error",
9409
+ /** Configuration error. Client-side only — set by SDK during config parsing/validation; never produced server-side. */
9410
+ Config: "config_error"
9411
+ };
9412
+ var CLIENT_ONLY_ERROR_TYPES = /* @__PURE__ */ new Set([
9413
+ ErrorType.Network,
9414
+ ErrorType.Cancelled,
9415
+ ErrorType.File,
9416
+ ErrorType.Config
9417
+ ]);
9418
+ new Set(Object.values(ErrorType).filter((t) => !CLIENT_ONLY_ERROR_TYPES.has(t)));
9406
9419
  function isShipError(error) {
9407
9420
  return error !== null && typeof error === "object" && "name" in error && error.name === "ShipError" && "status" in error;
9408
9421
  }
@@ -10180,8 +10193,8 @@ function useDrop(options) {
10180
10193
  // Use full path to match server-side validation
10181
10194
  size: f.file.size
10182
10195
  }));
10183
- const config = await ship$1.getConfig();
10184
- const validation = ship.validateFiles(validatableFiles, config);
10196
+ const limits = await ship$1.getLimits();
10197
+ const validation = ship.validateFiles(validatableFiles, limits);
10185
10198
  const filesWithStatus = finalFiles.map((processedFile, idx) => ({
10186
10199
  ...processedFile,
10187
10200
  status: validation.files[idx]?.status || processedFile.status,