@masters-union/union-stack 0.3.16 → 0.3.18

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 (39) hide show
  1. package/dist/cdn/loader.v1.global.js +45 -3
  2. package/dist/cdn/loader.v1.global.js.map +1 -1
  3. package/dist/{chunk-EBE7EIOZ.cjs → chunk-4DBTQE3U.cjs} +14 -14
  4. package/dist/{chunk-EBE7EIOZ.cjs.map → chunk-4DBTQE3U.cjs.map} +1 -1
  5. package/dist/{chunk-3FCZBKNN.cjs → chunk-7LKSR4EY.cjs} +8 -8
  6. package/dist/{chunk-3FCZBKNN.cjs.map → chunk-7LKSR4EY.cjs.map} +1 -1
  7. package/dist/{chunk-XBQENFBZ.js → chunk-G2H5WZDV.js} +14 -12
  8. package/dist/chunk-G2H5WZDV.js.map +1 -0
  9. package/dist/{chunk-OZGVTEMZ.js → chunk-KFGLJY75.js} +4 -4
  10. package/dist/{chunk-OZGVTEMZ.js.map → chunk-KFGLJY75.js.map} +1 -1
  11. package/dist/{chunk-GTE65IAM.cjs → chunk-TQDC5KIC.cjs} +14 -12
  12. package/dist/chunk-TQDC5KIC.cjs.map +1 -0
  13. package/dist/{chunk-7NJTA5ZD.js → chunk-VDOTBC6Y.js} +4 -4
  14. package/dist/{chunk-7NJTA5ZD.js.map → chunk-VDOTBC6Y.js.map} +1 -1
  15. package/dist/{client-BCLIIiX2.d.ts → client-BofkorBV.d.ts} +1 -1
  16. package/dist/{client-CSZ-4GVl.d.cts → client-C_pEvbZS.d.cts} +1 -1
  17. package/dist/index.cjs +5 -5
  18. package/dist/index.d.cts +3 -3
  19. package/dist/index.d.ts +3 -3
  20. package/dist/index.js +4 -4
  21. package/dist/node.cjs +8 -8
  22. package/dist/node.d.cts +2 -2
  23. package/dist/node.d.ts +2 -2
  24. package/dist/node.js +2 -2
  25. package/dist/picker.cjs +110 -5
  26. package/dist/picker.cjs.map +1 -1
  27. package/dist/picker.d.cts +4 -3
  28. package/dist/picker.d.ts +4 -3
  29. package/dist/picker.js +108 -3
  30. package/dist/picker.js.map +1 -1
  31. package/dist/react.cjs +4 -4
  32. package/dist/react.d.cts +4 -4
  33. package/dist/react.d.ts +4 -4
  34. package/dist/react.js +3 -3
  35. package/dist/{types-BWs1slkL.d.cts → types-BsGu9Oi3.d.cts} +2 -0
  36. package/dist/{types-BWs1slkL.d.ts → types-BsGu9Oi3.d.ts} +2 -0
  37. package/package.json +1 -1
  38. package/dist/chunk-GTE65IAM.cjs.map +0 -1
  39. package/dist/chunk-XBQENFBZ.js.map +0 -1
package/dist/react.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk3FCZBKNN_cjs = require('./chunk-3FCZBKNN.cjs');
4
- require('./chunk-EBE7EIOZ.cjs');
5
- require('./chunk-GTE65IAM.cjs');
3
+ var chunk7LKSR4EY_cjs = require('./chunk-7LKSR4EY.cjs');
4
+ require('./chunk-4DBTQE3U.cjs');
5
+ require('./chunk-TQDC5KIC.cjs');
6
6
  var React3 = require('react');
7
7
 
8
8
  function _interopNamespace(e) {
@@ -28,7 +28,7 @@ var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
28
28
  var UnionStackContext = React3__namespace.createContext(null);
29
29
  function UnionStackProvider({ children, ...cfg }) {
30
30
  const client = React3__namespace.useMemo(
31
- () => new chunk3FCZBKNN_cjs.UnionStackClient(cfg),
31
+ () => new chunk7LKSR4EY_cjs.UnionStackClient(cfg),
32
32
  // eslint-disable-next-line react-hooks/exhaustive-deps
33
33
  [cfg.apiKey, cfg.chunkSize]
34
34
  );
package/dist/react.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import { U as UnionStackClient, P as PickerOptions } from './client-CSZ-4GVl.cjs';
3
- export { b as PickerBranding, a as PickerHandle, c as PickerTheme } from './client-CSZ-4GVl.cjs';
4
- import { C as ClientConfig, e as UploadedFile, a as PickedFile, U as UploadError, B as BatchUploadOptions, P as PickResponse } from './types-BWs1slkL.cjs';
5
- export { b as ProgressEvent, c as UploadErrorCode, d as UploadOptions } from './types-BWs1slkL.cjs';
2
+ import { U as UnionStackClient, P as PickerOptions } from './client-C_pEvbZS.cjs';
3
+ export { b as PickerBranding, a as PickerHandle, c as PickerTheme } from './client-C_pEvbZS.cjs';
4
+ import { C as ClientConfig, e as UploadedFile, a as PickedFile, U as UploadError, B as BatchUploadOptions, P as PickResponse } from './types-BsGu9Oi3.cjs';
5
+ export { b as ProgressEvent, c as UploadErrorCode, d as UploadOptions } from './types-BsGu9Oi3.cjs';
6
6
 
7
7
  interface UnionStackProviderProps extends ClientConfig {
8
8
  children: React.ReactNode;
package/dist/react.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
- import { U as UnionStackClient, P as PickerOptions } from './client-BCLIIiX2.js';
3
- export { b as PickerBranding, a as PickerHandle, c as PickerTheme } from './client-BCLIIiX2.js';
4
- import { C as ClientConfig, e as UploadedFile, a as PickedFile, U as UploadError, B as BatchUploadOptions, P as PickResponse } from './types-BWs1slkL.js';
5
- export { b as ProgressEvent, c as UploadErrorCode, d as UploadOptions } from './types-BWs1slkL.js';
2
+ import { U as UnionStackClient, P as PickerOptions } from './client-BofkorBV.js';
3
+ export { b as PickerBranding, a as PickerHandle, c as PickerTheme } from './client-BofkorBV.js';
4
+ import { C as ClientConfig, e as UploadedFile, a as PickedFile, U as UploadError, B as BatchUploadOptions, P as PickResponse } from './types-BsGu9Oi3.js';
5
+ export { b as ProgressEvent, c as UploadErrorCode, d as UploadOptions } from './types-BsGu9Oi3.js';
6
6
 
7
7
  interface UnionStackProviderProps extends ClientConfig {
8
8
  children: React.ReactNode;
package/dist/react.js CHANGED
@@ -1,6 +1,6 @@
1
- import { UnionStackClient } from './chunk-OZGVTEMZ.js';
2
- import './chunk-7NJTA5ZD.js';
3
- import './chunk-XBQENFBZ.js';
1
+ import { UnionStackClient } from './chunk-KFGLJY75.js';
2
+ import './chunk-VDOTBC6Y.js';
3
+ import './chunk-G2H5WZDV.js';
4
4
  import * as React3 from 'react';
5
5
 
6
6
  var UnionStackContext = React3.createContext(null);
@@ -5,6 +5,8 @@ interface UploadError {
5
5
  status?: number;
6
6
  /** True if a retry has a reasonable chance of succeeding. */
7
7
  retryable: boolean;
8
+ /** Docs deep-link to the fix for this error, when the API provides one. */
9
+ docs?: string;
8
10
  /** Raw error from fetch / server (debugging only — don't display). */
9
11
  cause?: unknown;
10
12
  }
@@ -5,6 +5,8 @@ interface UploadError {
5
5
  status?: number;
6
6
  /** True if a retry has a reasonable chance of succeeding. */
7
7
  retryable: boolean;
8
+ /** Docs deep-link to the fix for this error, when the API provides one. */
9
+ docs?: string;
8
10
  /** Raw error from fetch / server (debugging only — don't display). */
9
11
  cause?: unknown;
10
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masters-union/union-stack",
3
- "version": "0.3.16",
3
+ "version": "0.3.18",
4
4
  "description": "UnionStack — file upload SDK. Direct-to-R2 multipart uploads with a small client surface.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";;;AAMO,IAAM,kBAAA,GACX;AAGK,SAAS,SAAA,CACd,IAAA,EACA,OAAA,EACA,IAAA,GAAkE,EAAC,EACtD;AACb,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAQ,IAAA,CAAK,MAAA;AAAA,IACb,WAAW,IAAA,CAAK,SAAA,IAAa,gBAAA,CAAiB,IAAA,EAAM,KAAK,MAAM,CAAA;AAAA,IAC/D,OAAO,IAAA,CAAK;AAAA,GACd;AACF;AAEA,SAAS,gBAAA,CAAiB,MAAuB,MAAA,EAA0B;AACzE,EAAA,IAAI,IAAA,KAAS,SAAA,IAAa,IAAA,KAAS,aAAA,EAAe,OAAO,IAAA;AACzD,EAAA,IAAI,IAAA,KAAS,QAAA,IAAY,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,OAAO,UAAU,QAAA,EAAU,GAAA,EAAK,EAAE,MAAA,EAAQ,SAAA,EAAW,OAAO,CAAA;AAAA,EAC9D;AACA,EAAA,IAAI,WAAW,GAAA,EAAK;AAClB,IAAA,MAAM,UAAU,IAAA,KAAS,gBAAA;AACzB,IAAA,OAAO,SAAA,CAAU,OAAA,GAAU,OAAA,GAAU,SAAA,EAAW,GAAA,EAAK,EAAE,MAAA,EAAQ,SAAA,EAAW,CAAC,OAAA,EAAS,CAAA;AAAA,EACtF;AACA,EAAA,IAAI,UAAU,GAAA,EAAK;AACjB,IAAA,OAAO,UAAU,QAAA,EAAU,GAAA,EAAK,EAAE,MAAA,EAAQ,SAAA,EAAW,MAAM,CAAA;AAAA,EAC7D;AACA,EAAA,OAAO,UAAU,QAAA,EAAU,GAAA,EAAK,EAAE,MAAA,EAAQ,SAAA,EAAW,OAAO,CAAA;AAC9D","file":"chunk-GTE65IAM.cjs","sourcesContent":["import type { UploadError, UploadErrorCode } from './types.js';\n\n// Single source of truth for the 0-byte message. Used by the client-side guard\n// (uploader), the picker UI, and the server-side reject (mapped from a 422\n// EMPTY_UPLOAD), so the end user sees the same actionable text no matter where\n// the empty file was caught.\nexport const EMPTY_FILE_MESSAGE =\n \"This file is empty (0 bytes) and can't be uploaded. If it's stored in iCloud, \" +\n 'OneDrive, or Google Drive, open it once to download it to this device, then try again.';\n\nexport function makeError(\n code: UploadErrorCode,\n message: string,\n opts: { status?: number; retryable?: boolean; cause?: unknown } = {}\n): UploadError {\n return {\n code,\n message,\n status: opts.status,\n retryable: opts.retryable ?? defaultRetryable(code, opts.status),\n cause: opts.cause,\n };\n}\n\nfunction defaultRetryable(code: UploadErrorCode, status?: number): boolean {\n if (code === 'NETWORK' || code === 'PART_FAILED') return true;\n if (code === 'SERVER' && status && status >= 500) return true;\n return false;\n}\n\n/** Map an HTTP error response from the cdn-be API to an UploadError. */\nexport function fromApiResponse(status: number, body: unknown): UploadError {\n const err = (body as { error?: { code?: string; message?: string } } | null)?.error;\n const msg = err?.message || `Request failed with status ${status}`;\n const code = (err?.code || '').toUpperCase();\n\n if (status === 401) {\n return makeError('AUTH', msg, { status, retryable: false });\n }\n if (status === 403) {\n return makeError('AUTH', msg, { status, retryable: false });\n }\n if (status === 413) {\n return makeError('VALIDATION', msg, { status, retryable: false });\n }\n if (status === 415) {\n return makeError('VALIDATION', msg, { status, retryable: false });\n }\n if (status === 422) {\n // Server rejected the assembled object. EMPTY_UPLOAD (0 bytes landed) gets\n // the dedicated code + canonical message so it reads the same as a\n // client-side empty catch; other 422s fall back to VALIDATION. Either way,\n // retrying the same source file won't help, so it's not retryable.\n if (code === 'EMPTY_UPLOAD') {\n return makeError('EMPTY_FILE', EMPTY_FILE_MESSAGE, { status, retryable: false });\n }\n return makeError('VALIDATION', msg, { status, retryable: false });\n }\n if (status === 426) {\n // Server-enforced minimum SDK version. Not retryable — the integrator\n // must upgrade the package (or reload, for script-loader users).\n return makeError('CONFIG', msg, { status, retryable: false });\n }\n if (status === 429) {\n const isQuota = code === 'QUOTA_EXCEEDED';\n return makeError(isQuota ? 'QUOTA' : 'NETWORK', msg, { status, retryable: !isQuota });\n }\n if (status >= 500) {\n return makeError('SERVER', msg, { status, retryable: true });\n }\n return makeError('SERVER', msg, { status, retryable: false });\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/errors.ts"],"names":[],"mappings":";AAMO,IAAM,kBAAA,GACX;AAGK,SAAS,SAAA,CACd,IAAA,EACA,OAAA,EACA,IAAA,GAAkE,EAAC,EACtD;AACb,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAQ,IAAA,CAAK,MAAA;AAAA,IACb,WAAW,IAAA,CAAK,SAAA,IAAa,gBAAA,CAAiB,IAAA,EAAM,KAAK,MAAM,CAAA;AAAA,IAC/D,OAAO,IAAA,CAAK;AAAA,GACd;AACF;AAEA,SAAS,gBAAA,CAAiB,MAAuB,MAAA,EAA0B;AACzE,EAAA,I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AAK,EAAE,MAAA,EAAQ,SAAA,EAAW,OAAO,CAAA;AAAA,EAClE;AACA,EAAA,IAAI,WAAW,GAAA,EAAK;AAGlB,IAAA,OAAO,UAAU,QAAA,EAAU,GAAA,EAAK,EAAE,MAAA,EAAQ,SAAA,EAAW,OAAO,CAAA;AAAA,EAC9D;AACA,EAAA,IAAI,WAAW,GAAA,EAAK;AAClB,IAAA,MAAM,UAAU,IAAA,KAAS,gBAAA;AACzB,IAAA,OAAO,SAAA,CAAU,OAAA,GAAU,OAAA,GAAU,SAAA,EAAW,GAAA,EAAK,EAAE,MAAA,EAAQ,SAAA,EAAW,CAAC,OAAA,EAAS,CAAA;AAAA,EACtF;AACA,EAAA,IAAI,UAAU,GAAA,EAAK;AACjB,IAAA,OAAO,UAAU,QAAA,EAAU,GAAA,EAAK,EAAE,MAAA,EAAQ,SAAA,EAAW,MAAM,CAAA;AAAA,EAC7D;AACA,EAAA,OAAO,UAAU,QAAA,EAAU,GAAA,EAAK,EAAE,MAAA,EAAQ,SAAA,EAAW,OAAO,CAAA;AAC9D","file":"chunk-XBQENFBZ.js","sourcesContent":["import type { UploadError, UploadErrorCode } from './types.js';\n\n// Single source of truth for the 0-byte message. Used by the client-side guard\n// (uploader), the picker UI, and the server-side reject (mapped from a 422\n// EMPTY_UPLOAD), so the end user sees the same actionable text no matter where\n// the empty file was caught.\nexport const EMPTY_FILE_MESSAGE =\n \"This file is empty (0 bytes) and can't be uploaded. If it's stored in iCloud, \" +\n 'OneDrive, or Google Drive, open it once to download it to this device, then try again.';\n\nexport function makeError(\n code: UploadErrorCode,\n message: string,\n opts: { status?: number; retryable?: boolean; cause?: unknown } = {}\n): UploadError {\n return {\n code,\n message,\n status: opts.status,\n retryable: opts.retryable ?? defaultRetryable(code, opts.status),\n cause: opts.cause,\n };\n}\n\nfunction defaultRetryable(code: UploadErrorCode, status?: number): boolean {\n if (code === 'NETWORK' || code === 'PART_FAILED') return true;\n if (code === 'SERVER' && status && status >= 500) return true;\n return false;\n}\n\n/** Map an HTTP error response from the cdn-be API to an UploadError. */\nexport function fromApiResponse(status: number, body: unknown): UploadError {\n const err = (body as { error?: { code?: string; message?: string } } | null)?.error;\n const msg = err?.message || `Request failed with status ${status}`;\n const code = (err?.code || '').toUpperCase();\n\n if (status === 401) {\n return makeError('AUTH', msg, { status, retryable: false });\n }\n if (status === 403) {\n return makeError('AUTH', msg, { status, retryable: false });\n }\n if (status === 413) {\n return makeError('VALIDATION', msg, { status, retryable: false });\n }\n if (status === 415) {\n return makeError('VALIDATION', msg, { status, retryable: false });\n }\n if (status === 422) {\n // Server rejected the assembled object. EMPTY_UPLOAD (0 bytes landed) gets\n // the dedicated code + canonical message so it reads the same as a\n // client-side empty catch; other 422s fall back to VALIDATION. Either way,\n // retrying the same source file won't help, so it's not retryable.\n if (code === 'EMPTY_UPLOAD') {\n return makeError('EMPTY_FILE', EMPTY_FILE_MESSAGE, { status, retryable: false });\n }\n return makeError('VALIDATION', msg, { status, retryable: false });\n }\n if (status === 426) {\n // Server-enforced minimum SDK version. Not retryable — the integrator\n // must upgrade the package (or reload, for script-loader users).\n return makeError('CONFIG', msg, { status, retryable: false });\n }\n if (status === 429) {\n const isQuota = code === 'QUOTA_EXCEEDED';\n return makeError(isQuota ? 'QUOTA' : 'NETWORK', msg, { status, retryable: !isQuota });\n }\n if (status >= 500) {\n return makeError('SERVER', msg, { status, retryable: true });\n }\n return makeError('SERVER', msg, { status, retryable: false });\n}\n"]}