calmlens 0.37.0 → 0.37.1

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 (40) hide show
  1. package/bin/calmlens.js +23 -7
  2. package/cjs/{BrowserUpload-BOXt-BFy.js → BrowserUpload-84KQWr1Q.js} +1 -1
  3. package/cjs/{CalmLensAppClient-Bt9GNyqS.js → CalmLensAppClient-D4tRb_P2.js} +2 -2
  4. package/cjs/{CalmLensCdn-D4I4Km4j.js → CalmLensCdn-CdYY_XtK.js} +1 -1
  5. package/cjs/{CalmLensConnection-knkk2-BW.js → CalmLensConnection-GkR2cKn5.js} +24 -11
  6. package/cjs/{CalmLensServerClient--L5qRzFd.js → CalmLensServerClient-cgPOG4Sv.js} +3 -2
  7. package/cjs/{Core-CNsji7uR.js → Core-BlnBBJKb.js} +2 -2
  8. package/cjs/{ReactUpload-DfioGW58.js → ReactUpload-D3AYIZBh.js} +1 -1
  9. package/cjs/{UploadController-B-a2r2kN.js → UploadController-BYuHuZ7K.js} +1 -1
  10. package/cjs/app.js +2 -2
  11. package/cjs/elements.js +4 -4
  12. package/cjs/index.js +1 -1
  13. package/cjs/react-native.js +4 -4
  14. package/cjs/react.js +5 -5
  15. package/cjs/server.js +2 -2
  16. package/cjs/testing.d.ts +2 -1
  17. package/cjs/testing.js +25 -7
  18. package/cjs/{ui-DOkuD90x.js → ui-Cy8MWXOw.js} +2 -2
  19. package/cjs/ui.js +3 -3
  20. package/cjs/vue.js +4 -4
  21. package/esm/{BrowserUpload-Ch67b69G.js → BrowserUpload-C429CcUi.js} +1 -1
  22. package/esm/{CalmLensAppClient-DEFSQC15.js → CalmLensAppClient-Brvc-GXt.js} +2 -2
  23. package/esm/{CalmLensCdn-xvzJyv9X.js → CalmLensCdn-cmxtF_dw.js} +1 -1
  24. package/esm/{CalmLensConnection-D6BVOMri.js → CalmLensConnection-DEfpIugc.js} +24 -11
  25. package/esm/{CalmLensServerClient-BGz_olSn.js → CalmLensServerClient-BpsCXVeO.js} +3 -2
  26. package/esm/{Core-Cj91IL4-.js → Core-C_f1o9RQ.js} +2 -2
  27. package/esm/{ReactUpload-Bg4-5rV2.js → ReactUpload-Ch5qY7PS.js} +1 -1
  28. package/esm/{UploadController-CpLvD8W-.js → UploadController-9fkYFVZM.js} +1 -1
  29. package/esm/app.js +2 -2
  30. package/esm/elements.js +4 -4
  31. package/esm/index.js +1 -1
  32. package/esm/react-native.js +4 -4
  33. package/esm/react.js +5 -5
  34. package/esm/server.js +2 -2
  35. package/esm/testing.d.ts +2 -1
  36. package/esm/testing.js +25 -7
  37. package/esm/{ui-CGrWIVKa.js → ui-HK74e42L.js} +2 -2
  38. package/esm/ui.js +3 -3
  39. package/esm/vue.js +4 -4
  40. package/package.json +1 -1
package/bin/calmlens.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import { readFile as readFile2 } from "node:fs/promises";
4
4
  import { parseArgs } from "node:util";
5
5
  // package.json
6
- var version = "0.37.0";
6
+ var version = "0.37.1";
7
7
 
8
8
  // src/contract/ModerationCategories-CHFRoeWV.js
9
9
  var CLASSIFICATION_CATEGORIES = [
@@ -2461,25 +2461,40 @@ class CalmLensConnection {
2461
2461
  authHeaders = {},
2462
2462
  partPath,
2463
2463
  onStarted,
2464
+ resumes = false,
2464
2465
  retrieve
2465
2466
  }) {
2466
2467
  const { content, idempotencyKey, ...fields } = options;
2467
2468
  const source = getSplittableContent(content);
2468
2469
  const partSize = this.partSizeBytes;
2469
2470
  const count = Math.ceil(source.size / partSize);
2470
- const key = idempotencyKey ?? this.call.idempotencyKey ?? newIdempotencyKey();
2471
+ const explicitKey = idempotencyKey ?? this.call.idempotencyKey;
2472
+ const key = explicitKey ?? newIdempotencyKey();
2471
2473
  const part = (partNumber) => source.slice((partNumber - 1) * partSize, Math.min(partNumber * partSize, source.size));
2472
- const first = await this.submitUpload(uploadsPath, {
2474
+ const sendFirst = (payload, headers) => this.submitUpload(uploadsPath, {
2473
2475
  ...fields,
2474
- part: { ...part(1), type: content.type, partNumber: 1, isFinal: false },
2476
+ part: {
2477
+ ...payload,
2478
+ type: content.type,
2479
+ sizeInBytes: Math.min(partSize, source.size),
2480
+ partNumber: 1,
2481
+ isFinal: false
2482
+ },
2475
2483
  totalSizeInBytes: source.size,
2476
2484
  idempotencyKey: key
2477
- }, wait, authHeaders);
2478
- const assetId = expectUploadedAsset(first).id;
2485
+ }, wait, headers);
2486
+ const existing = resumes && explicitKey ? await sendFirst({ uint8Array: new Uint8Array(0) }, { ...authHeaders, "Idempotency-Replay-Only": "true" }) : undefined;
2487
+ const first = existing ?? await sendFirst(part(1), authHeaders);
2488
+ const uploaded = expectUploadedAsset(first);
2489
+ const assetId = uploaded.id;
2479
2490
  onStarted?.(assetId);
2491
+ if (existing && uploaded.upload.status === "completed")
2492
+ return first;
2480
2493
  const laterParts = this.withCall({ extraBody: undefined });
2481
2494
  let result = first;
2482
- for (let partNumber = 2;partNumber <= count; ) {
2495
+ const received = uploaded.upload.partsReceived;
2496
+ const nextPart = typeof received === "number" && received >= 2 && received < count ? received + 1 : 2;
2497
+ for (let partNumber = nextPart;partNumber <= count; ) {
2483
2498
  const isFinal = partNumber === count;
2484
2499
  try {
2485
2500
  result = await laterParts.uploadPart(partPath(assetId), {
@@ -2811,6 +2826,7 @@ class CalmLensServerClient {
2811
2826
  if ("content" in body && splitsIntoParts(body.content, connection.partSizeBytes)) {
2812
2827
  return expectAsset(await connection.submitInParts(uploadsPath, body, wait, {
2813
2828
  partPath: (assetId) => `/assets/${encodeURIComponent(assetId)}/part`,
2829
+ resumes: true,
2814
2830
  retrieve: (assetId, read) => read.json("GET", `/assets/${requireId(assetId, "Asset ID")}`)
2815
2831
  }));
2816
2832
  }
@@ -1,4 +1,4 @@
1
- const require_UploadController = require("./UploadController-B-a2r2kN.js");
1
+ const require_UploadController = require("./UploadController-BYuHuZ7K.js");
2
2
  // src/ui/BrowserUpload.ts
3
3
  /** Creates an upload queue for the browser components, such as one a form starts on submit. */
4
4
  const createUploadController = (options) => require_UploadController.createUploadController(options);
@@ -1,6 +1,6 @@
1
1
  const require_CalmLensError = require("./CalmLensError-ifj5rLmk.js");
2
- const require_CalmLensCdn = require("./CalmLensCdn-D4I4Km4j.js");
3
- const require_CalmLensConnection = require("./CalmLensConnection-knkk2-BW.js");
2
+ const require_CalmLensCdn = require("./CalmLensCdn-CdYY_XtK.js");
3
+ const require_CalmLensConnection = require("./CalmLensConnection-GkR2cKn5.js");
4
4
  // src/client/CalmLensAppClient.ts
5
5
  const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
6
6
  /** `options`, once `checkOptionKeys` finds only keys `operation` takes. */
@@ -152,7 +152,7 @@ const listPages = (fetchPage, { cursor, feed = false } = {}) => {
152
152
  };
153
153
  // src/client/CalmLensVersion.ts
154
154
  /** This SDK's version, from its package.json. */
155
- const SDK_VERSION = "0.37.0";
155
+ const SDK_VERSION = "0.37.1";
156
156
  const runtimeName = () => {
157
157
  const runtime = globalThis;
158
158
  if (isReactNativeRuntime()) return "react-native";
@@ -1,5 +1,5 @@
1
1
  const require_CalmLensError = require("./CalmLensError-ifj5rLmk.js");
2
- const require_CalmLensCdn = require("./CalmLensCdn-D4I4Km4j.js");
2
+ const require_CalmLensCdn = require("./CalmLensCdn-CdYY_XtK.js");
3
3
  // src/contract/AssetPayload.js
4
4
  const bufferInputToBytes = (value) => {
5
5
  if (value instanceof ArrayBuffer) return new Uint8Array(value);
@@ -915,33 +915,46 @@ var CalmLensConnection = class CalmLensConnection {
915
915
  /**
916
916
  * Uploads content larger than `partSizeBytes` in parts: the first to `uploadsPath` with the
917
917
  * upload's fields, the rest to `partPath(assetId)`. Each part carries its own Idempotency-Key
918
- * (`<key>:part-<n>`), so it is retried safely and a repeated call with the same key resumes the
919
- * upload. A part the API already has is skipped, and a final part that finds the upload already
920
- * completed reads it back with `retrieve`.
918
+ * (`<key>:part-<n>`), so it is retried safely. With `resumes`, a repeated call with the same
919
+ * explicit key resumes the upload: it first asks which parts the API has, with the first part's
920
+ * options and an empty file (`Idempotency-Replay-Only`), and sends only the missing parts. A
921
+ * part the API already has is skipped, and a final part that finds the upload already completed
922
+ * reads it back with `retrieve`.
921
923
  */
922
- async submitInParts(uploadsPath, options, wait, { authHeaders = {}, partPath, onStarted, retrieve }) {
924
+ async submitInParts(uploadsPath, options, wait, { authHeaders = {}, partPath, onStarted, resumes = false, retrieve }) {
923
925
  const { content, idempotencyKey, ...fields } = options;
924
926
  const source = getSplittableContent(content);
925
927
  const partSize = this.partSizeBytes;
926
928
  const count = Math.ceil(source.size / partSize);
927
- const key = idempotencyKey ?? this.call.idempotencyKey ?? newIdempotencyKey();
929
+ const explicitKey = idempotencyKey ?? this.call.idempotencyKey;
930
+ const key = explicitKey ?? newIdempotencyKey();
928
931
  const part = (partNumber) => source.slice((partNumber - 1) * partSize, Math.min(partNumber * partSize, source.size));
929
- const first = await this.submitUpload(uploadsPath, {
932
+ const sendFirst = (payload, headers) => this.submitUpload(uploadsPath, {
930
933
  ...fields,
931
934
  part: {
932
- ...part(1),
935
+ ...payload,
933
936
  type: content.type,
937
+ sizeInBytes: Math.min(partSize, source.size),
934
938
  partNumber: 1,
935
939
  isFinal: false
936
940
  },
937
941
  totalSizeInBytes: source.size,
938
942
  idempotencyKey: key
939
- }, wait, authHeaders);
940
- const assetId = expectUploadedAsset(first).id;
943
+ }, wait, headers);
944
+ const existing = resumes && explicitKey ? await sendFirst({ uint8Array: /* @__PURE__ */ new Uint8Array(0) }, {
945
+ ...authHeaders,
946
+ "Idempotency-Replay-Only": "true"
947
+ }) : void 0;
948
+ const first = existing ?? await sendFirst(part(1), authHeaders);
949
+ const uploaded = expectUploadedAsset(first);
950
+ const assetId = uploaded.id;
941
951
  onStarted?.(assetId);
952
+ if (existing && uploaded.upload.status === "completed") return first;
942
953
  const laterParts = this.withCall({ extraBody: void 0 });
943
954
  let result = first;
944
- for (let partNumber = 2; partNumber <= count;) {
955
+ const received = uploaded.upload.partsReceived;
956
+ const nextPart = typeof received === "number" && received >= 2 && received < count ? received + 1 : 2;
957
+ for (let partNumber = nextPart; partNumber <= count;) {
945
958
  const isFinal = partNumber === count;
946
959
  try {
947
960
  result = await laterParts.uploadPart(partPath(assetId), {
@@ -1,6 +1,6 @@
1
1
  const require_CalmLensError = require("./CalmLensError-ifj5rLmk.js");
2
- const require_CalmLensCdn = require("./CalmLensCdn-D4I4Km4j.js");
3
- const require_CalmLensConnection = require("./CalmLensConnection-knkk2-BW.js");
2
+ const require_CalmLensCdn = require("./CalmLensCdn-CdYY_XtK.js");
3
+ const require_CalmLensConnection = require("./CalmLensConnection-GkR2cKn5.js");
4
4
  const require_CryptoUtils_BLCa_oZe = require("./CryptoUtils-BLCa-oZe-leCkr1ko.js");
5
5
  // src/contract/JsonUtils.js
6
6
  const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
@@ -399,6 +399,7 @@ var CalmLensServerClient = class {
399
399
  const uploadsPath = `${this.#projectPath}/assets`;
400
400
  if ("content" in body && require_CalmLensConnection.splitsIntoParts(body.content, connection.partSizeBytes)) return require_CalmLensConnection.expectAsset(await connection.submitInParts(uploadsPath, body, wait, {
401
401
  partPath: (assetId) => `/assets/${encodeURIComponent(assetId)}/part`,
402
+ resumes: true,
402
403
  retrieve: (assetId, read) => read.json("GET", `/assets/${requireId(assetId, "Asset ID")}`)
403
404
  }));
404
405
  if ("content" in body || "part" in body) return require_CalmLensConnection.expectAsset(await connection.submitUpload(uploadsPath, body, wait));
@@ -1,6 +1,6 @@
1
1
  const require_CalmLensError = require("./CalmLensError-ifj5rLmk.js");
2
- const require_CalmLensCdn = require("./CalmLensCdn-D4I4Km4j.js");
3
- const require_UploadController = require("./UploadController-B-a2r2kN.js");
2
+ const require_CalmLensCdn = require("./CalmLensCdn-CdYY_XtK.js");
3
+ const require_UploadController = require("./UploadController-BYuHuZ7K.js");
4
4
  const require_FileIcons = require("./FileIcons-Ob003MdS.js");
5
5
  // src/ui/viewers/ViewerAsset.ts
6
6
  /** Spreadsheet MIME types, as `content.format` reports them (compared lower-cased). */
@@ -1,4 +1,4 @@
1
- const require_UploadController = require("./UploadController-B-a2r2kN.js");
1
+ const require_UploadController = require("./UploadController-BYuHuZ7K.js");
2
2
  let react = require("react");
3
3
  // src/ui/ReactUpload.ts
4
4
  const CalmLensContext = (0, react.createContext)(void 0);
@@ -1,5 +1,5 @@
1
1
  const require_CalmLensError = require("./CalmLensError-ifj5rLmk.js");
2
- const require_CalmLensAppClient = require("./CalmLensAppClient-Bt9GNyqS.js");
2
+ const require_CalmLensAppClient = require("./CalmLensAppClient-D4tRb_P2.js");
3
3
  // src/contract/PlaceholderHashDecode.js
4
4
  /**
5
5
  * Decodes a ThumbHash to an RGBA image. RGB is not be premultiplied by A.
package/cjs/app.js CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_CalmLensError = require("./CalmLensError-ifj5rLmk.js");
3
- const require_CalmLensCdn = require("./CalmLensCdn-D4I4Km4j.js");
3
+ const require_CalmLensCdn = require("./CalmLensCdn-CdYY_XtK.js");
4
4
  require("./index.js");
5
- const require_CalmLensAppClient = require("./CalmLensAppClient-Bt9GNyqS.js");
5
+ const require_CalmLensAppClient = require("./CalmLensAppClient-D4tRb_P2.js");
6
6
  exports.AUTO_PAGING_TO_ARRAY_MAX = require_CalmLensCdn.AUTO_PAGING_TO_ARRAY_MAX;
7
7
  exports.CALMLENS_ERROR_CODES = require_CalmLensError.CALMLENS_ERROR_CODES;
8
8
  exports.CDN_RESOURCES = require_CalmLensCdn.CDN_RESOURCES;
package/cjs/elements.js CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_ui = require("./ui-DOkuD90x.js");
3
- const require_Core = require("./Core-CNsji7uR.js");
4
- const require_UploadController = require("./UploadController-B-a2r2kN.js");
2
+ const require_ui = require("./ui-Cy8MWXOw.js");
3
+ const require_Core = require("./Core-BlnBBJKb.js");
4
+ const require_UploadController = require("./UploadController-BYuHuZ7K.js");
5
5
  const require_FileIcons = require("./FileIcons-Ob003MdS.js");
6
- const require_BrowserUpload = require("./BrowserUpload-BOXt-BFy.js");
6
+ const require_BrowserUpload = require("./BrowserUpload-84KQWr1Q.js");
7
7
  // src/viewers/Elements.ts
8
8
  const BaseElement$1 = typeof HTMLElement === "undefined" ? class {} : HTMLElement;
9
9
  const PROPERTIES = [
package/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_CalmLensError = require("./CalmLensError-ifj5rLmk.js");
3
- const require_CalmLensCdn = require("./CalmLensCdn-D4I4Km4j.js");
3
+ const require_CalmLensCdn = require("./CalmLensCdn-CdYY_XtK.js");
4
4
  exports.AUTO_PAGING_TO_ARRAY_MAX = require_CalmLensCdn.AUTO_PAGING_TO_ARRAY_MAX;
5
5
  exports.CALMLENS_ERROR_CODES = require_CalmLensError.CALMLENS_ERROR_CODES;
6
6
  exports.CDN_RESOURCES = require_CalmLensCdn.CDN_RESOURCES;
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_CalmLensCdn = require("./CalmLensCdn-D4I4Km4j.js");
3
- const require_Core = require("./Core-CNsji7uR.js");
4
- const require_UploadController = require("./UploadController-B-a2r2kN.js");
2
+ const require_CalmLensCdn = require("./CalmLensCdn-CdYY_XtK.js");
3
+ const require_Core = require("./Core-BlnBBJKb.js");
4
+ const require_UploadController = require("./UploadController-BYuHuZ7K.js");
5
5
  const require_FileIcons = require("./FileIcons-Ob003MdS.js");
6
- const require_ReactUpload = require("./ReactUpload-DfioGW58.js");
6
+ const require_ReactUpload = require("./ReactUpload-D3AYIZBh.js");
7
7
  let react = require("react");
8
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
9
  let react_native = require("react-native");
package/cjs/react.js CHANGED
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_ui = require("./ui-DOkuD90x.js");
4
- const require_Core = require("./Core-CNsji7uR.js");
5
- const require_UploadController = require("./UploadController-B-a2r2kN.js");
3
+ const require_ui = require("./ui-Cy8MWXOw.js");
4
+ const require_Core = require("./Core-BlnBBJKb.js");
5
+ const require_UploadController = require("./UploadController-BYuHuZ7K.js");
6
6
  const require_FileIcons = require("./FileIcons-Ob003MdS.js");
7
- const require_ReactUpload = require("./ReactUpload-DfioGW58.js");
8
- const require_BrowserUpload = require("./BrowserUpload-BOXt-BFy.js");
7
+ const require_ReactUpload = require("./ReactUpload-D3AYIZBh.js");
8
+ const require_BrowserUpload = require("./BrowserUpload-84KQWr1Q.js");
9
9
  let react = require("react");
10
10
  let react_jsx_runtime = require("react/jsx-runtime");
11
11
  const OPTION_NAMES = /* @__PURE__ */ new Set([
package/cjs/server.js CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_CalmLensError = require("./CalmLensError-ifj5rLmk.js");
3
- const require_CalmLensCdn = require("./CalmLensCdn-D4I4Km4j.js");
3
+ const require_CalmLensCdn = require("./CalmLensCdn-CdYY_XtK.js");
4
4
  require("./index.js");
5
- const require_CalmLensServerClient = require("./CalmLensServerClient--L5qRzFd.js");
5
+ const require_CalmLensServerClient = require("./CalmLensServerClient-cgPOG4Sv.js");
6
6
  exports.AUTO_PAGING_TO_ARRAY_MAX = require_CalmLensCdn.AUTO_PAGING_TO_ARRAY_MAX;
7
7
  exports.CALMLENS_ERROR_CODES = require_CalmLensError.CALMLENS_ERROR_CODES;
8
8
  exports.CDN_RESOURCES = require_CalmLensCdn.CDN_RESOURCES;
package/cjs/testing.d.ts CHANGED
@@ -188,7 +188,8 @@ interface MockModerationInput {
188
188
  trigger: MockModerationTrigger;
189
189
  /**
190
190
  * `true` when the API would queue the work rather than answer with the decision: queued
191
- * uploads, retries and `completeProcessing`.
191
+ * uploads, uploads of audio, video, documents, websites and plain text over 4 MiB (always
192
+ * moderated in the background, even when the caller waits), retries and `completeProcessing`.
192
193
  */
193
194
  queued: boolean;
194
195
  }
package/cjs/testing.js CHANGED
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_CalmLensTestInputArguments = require("./CalmLensTestInputArguments-C6S09FVQ.js");
3
3
  const require_CalmLensError = require("./CalmLensError-ifj5rLmk.js");
4
- const require_CalmLensCdn = require("./CalmLensCdn-D4I4Km4j.js");
5
- const require_CalmLensServerClient = require("./CalmLensServerClient--L5qRzFd.js");
6
- const require_CalmLensConnection = require("./CalmLensConnection-knkk2-BW.js");
4
+ const require_CalmLensCdn = require("./CalmLensCdn-CdYY_XtK.js");
5
+ const require_CalmLensServerClient = require("./CalmLensServerClient-cgPOG4Sv.js");
6
+ const require_CalmLensConnection = require("./CalmLensConnection-GkR2cKn5.js");
7
7
  const require_CryptoUtils_BLCa_oZe = require("./CryptoUtils-BLCa-oZe-leCkr1ko.js");
8
- const require_CalmLensAppClient = require("./CalmLensAppClient-Bt9GNyqS.js");
9
- const require_UploadController = require("./UploadController-B-a2r2kN.js");
8
+ const require_CalmLensAppClient = require("./CalmLensAppClient-D4tRb_P2.js");
9
+ const require_UploadController = require("./UploadController-BYuHuZ7K.js");
10
10
  let zod = require("zod");
11
11
  let zod$1 = require_CalmLensTestInputArguments.__toESM(zod, 1);
12
12
  zod = require_CalmLensTestInputArguments.__toESM(zod);
@@ -9881,6 +9881,11 @@ const isTextUpload = (request) => {
9881
9881
  return false;
9882
9882
  }
9883
9883
  };
9884
+ /**
9885
+ * Like the API (`classifiesInBackground`): audio, video, documents, websites and plain text over
9886
+ * 4 MiB are always moderated in the background, even when the caller waits.
9887
+ */
9888
+ const classifiesInBackground = (asset) => asset.type === "audio" || asset.type === "video" || asset.type === "multimedia-document" || asset.type === "website" || asset.type === "plaintext-document" && (asset.content.sizeInBytes ?? 0) > 4194304;
9884
9889
  /** Like the API: a new folder is 201 Created, a queued batch 202 Accepted, everything else 200. */
9885
9890
  const SUCCESS_STATUS = {
9886
9891
  "folders.create": 201,
@@ -10301,20 +10306,32 @@ var MockCalmLensApi = class {
10301
10306
  [...request.query].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0),
10302
10307
  isForm ? "multipart/form-data" : contentType,
10303
10308
  upload,
10304
- upload ? request.bytes.byteLength : new TextDecoder().decode(request.bytes),
10309
+ isForm ? null : upload ? request.bytes.byteLength : new TextDecoder().decode(request.bytes),
10305
10310
  formOptions ?? null
10306
10311
  ]);
10312
+ const replayOnly = headers.get("idempotency-replay-only") === "true";
10313
+ if (replayOnly && (key === void 0 || upload !== "part" || !isForm || request.segments.at(-1) === "part" || request.query.get("partNumber") !== "1")) return this.failureResponse(fail(require_CalmLensError.API_ERROR_CODES.INVALID_REQUEST), url);
10307
10314
  if (key !== void 0) {
10308
10315
  if (!isValidIdempotencyKey(key)) return this.failureResponse(fail(require_CalmLensError.API_ERROR_CODES.INVALID_IDEMPOTENCY_KEY), url);
10309
10316
  const saved = this.idempotentResults.get(key);
10310
10317
  if (saved) {
10311
10318
  if (saved.fingerprint !== fingerprint) return this.failureResponse(fail(require_CalmLensError.API_ERROR_CODES.IDEMPOTENCY_KEY_REUSED), url);
10319
+ if (replayOnly) {
10320
+ const { id } = JSON.parse(saved.body);
10321
+ const asset = await this.databaseStorage.getAsset(id);
10322
+ if (!asset) return this.response(204, null, url, {});
10323
+ return this.response(200, JSON.stringify(asset, this.publishAssets), url, {
10324
+ "Content-Type": "application/json",
10325
+ "Idempotent-Replayed": "true"
10326
+ });
10327
+ }
10312
10328
  return this.response(saved.status, saved.body, url, {
10313
10329
  "Content-Type": "application/json",
10314
10330
  "Idempotent-Replayed": "true"
10315
10331
  });
10316
10332
  }
10317
10333
  }
10334
+ if (replayOnly) return this.response(204, null, url, {});
10318
10335
  let answer;
10319
10336
  try {
10320
10337
  answer = await this.route(request, session);
@@ -11452,11 +11469,12 @@ var MockCalmLensApi = class {
11452
11469
  bytes: data,
11453
11470
  text: data && asset.type === "plaintext-document" ? new TextDecoder().decode(data) : null
11454
11471
  };
11472
+ const background = trigger === "upload" && classifiesInBackground(asset);
11455
11473
  return toDecision(await this.options.moderate({
11456
11474
  asset: this.toPublished(asset),
11457
11475
  content,
11458
11476
  trigger,
11459
- queued
11477
+ queued: queued || background
11460
11478
  }));
11461
11479
  }
11462
11480
  /**
@@ -1,5 +1,5 @@
1
- const require_CalmLensCdn = require("./CalmLensCdn-D4I4Km4j.js");
2
- require("./Core-CNsji7uR.js");
1
+ const require_CalmLensCdn = require("./CalmLensCdn-CdYY_XtK.js");
2
+ require("./Core-BlnBBJKb.js");
3
3
  // src/ui/viewers/PdfLoader.ts
4
4
  let loading;
5
5
  /**
package/cjs/ui.js CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_ui = require("./ui-DOkuD90x.js");
3
- const require_Core = require("./Core-CNsji7uR.js");
4
- const require_UploadController = require("./UploadController-B-a2r2kN.js");
2
+ const require_ui = require("./ui-Cy8MWXOw.js");
3
+ const require_Core = require("./Core-BlnBBJKb.js");
4
+ const require_UploadController = require("./UploadController-BYuHuZ7K.js");
5
5
  exports.ASSET_FILE_ICON_SIZE = require_Core.ASSET_FILE_ICON_SIZE;
6
6
  exports.ASSET_VIEWERS = require_ui.ASSET_VIEWERS;
7
7
  exports.AssetSession = require_Core.AssetSession;
package/cjs/vue.js CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_ui = require("./ui-DOkuD90x.js");
3
- const require_Core = require("./Core-CNsji7uR.js");
4
- const require_UploadController = require("./UploadController-B-a2r2kN.js");
2
+ const require_ui = require("./ui-Cy8MWXOw.js");
3
+ const require_Core = require("./Core-BlnBBJKb.js");
4
+ const require_UploadController = require("./UploadController-BYuHuZ7K.js");
5
5
  const require_FileIcons = require("./FileIcons-Ob003MdS.js");
6
- const require_BrowserUpload = require("./BrowserUpload-BOXt-BFy.js");
6
+ const require_BrowserUpload = require("./BrowserUpload-84KQWr1Q.js");
7
7
  let vue = require("vue");
8
8
  // src/viewers/Vue.ts
9
9
  const optional$1 = (type) => ({
@@ -1,4 +1,4 @@
1
- import { n as createUploadController$1 } from "./UploadController-CpLvD8W-.js";
1
+ import { n as createUploadController$1 } from "./UploadController-9fkYFVZM.js";
2
2
  // src/ui/BrowserUpload.ts
3
3
  /** Creates an upload queue for the browser components, such as one a form starts on submit. */
4
4
  const createUploadController = (options) => createUploadController$1(options);
@@ -1,6 +1,6 @@
1
1
  import { C as invalidConfig, S as invalidArgument } from "./CalmLensError-C15tWu8W.js";
2
- import { S as validateAppClientOptions, d as checkOptionKeys, o as buildAssetUrl, p as encodePathSegment, u as DEFAULT_CDN_BASE_URL } from "./CalmLensCdn-xvzJyv9X.js";
3
- import { c as prepareSubmitAssetOptions, f as APP_OPTION_KEYS, i as expectUploadedAsset, l as resolveConnectionOptions, t as CalmLensConnection, u as splitsIntoParts } from "./CalmLensConnection-D6BVOMri.js";
2
+ import { S as validateAppClientOptions, d as checkOptionKeys, o as buildAssetUrl, p as encodePathSegment, u as DEFAULT_CDN_BASE_URL } from "./CalmLensCdn-cmxtF_dw.js";
3
+ import { c as prepareSubmitAssetOptions, f as APP_OPTION_KEYS, i as expectUploadedAsset, l as resolveConnectionOptions, t as CalmLensConnection, u as splitsIntoParts } from "./CalmLensConnection-DEfpIugc.js";
4
4
  // src/client/CalmLensAppClient.ts
5
5
  const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
6
6
  /** `options`, once `checkOptionKeys` finds only keys `operation` takes. */
@@ -152,7 +152,7 @@ const listPages = (fetchPage, { cursor, feed = false } = {}) => {
152
152
  };
153
153
  // src/client/CalmLensVersion.ts
154
154
  /** This SDK's version, from its package.json. */
155
- const SDK_VERSION = "0.37.0";
155
+ const SDK_VERSION = "0.37.1";
156
156
  const runtimeName = () => {
157
157
  const runtime = globalThis;
158
158
  if (isReactNativeRuntime()) return "react-native";
@@ -1,5 +1,5 @@
1
1
  import { S as invalidArgument, l as CalmLensError, w as API_ERROR_CODES, x as SDK_ERROR_CODES } from "./CalmLensError-C15tWu8W.js";
2
- import { A as MAX_OTHER_DOCUMENT_UPLOAD_BYTES, D as MAX_DIRECT_IMAGE_UPLOAD_BYTES, F as sleep, M as getRejectedUploadMimeTypeError, N as normalizeUploadMimeType, O as MAX_IMAGE_UPLOAD_BYTES, P as CalmLensTransport, T as UPLOAD_MIME_DOCUMENTS, U as resolveLogLevel, _ as randomUuid, j as MAX_PDF_UPLOAD_BYTES, k as MAX_NON_IMAGE_UPLOAD_BYTES, m as isAcceptedUploadMimeType, y as stringifyQuery } from "./CalmLensCdn-xvzJyv9X.js";
2
+ import { A as MAX_OTHER_DOCUMENT_UPLOAD_BYTES, D as MAX_DIRECT_IMAGE_UPLOAD_BYTES, F as sleep, M as getRejectedUploadMimeTypeError, N as normalizeUploadMimeType, O as MAX_IMAGE_UPLOAD_BYTES, P as CalmLensTransport, T as UPLOAD_MIME_DOCUMENTS, U as resolveLogLevel, _ as randomUuid, j as MAX_PDF_UPLOAD_BYTES, k as MAX_NON_IMAGE_UPLOAD_BYTES, m as isAcceptedUploadMimeType, y as stringifyQuery } from "./CalmLensCdn-cmxtF_dw.js";
3
3
  // src/contract/AssetPayload.js
4
4
  const bufferInputToBytes = (value) => {
5
5
  if (value instanceof ArrayBuffer) return new Uint8Array(value);
@@ -915,33 +915,46 @@ var CalmLensConnection = class CalmLensConnection {
915
915
  /**
916
916
  * Uploads content larger than `partSizeBytes` in parts: the first to `uploadsPath` with the
917
917
  * upload's fields, the rest to `partPath(assetId)`. Each part carries its own Idempotency-Key
918
- * (`<key>:part-<n>`), so it is retried safely and a repeated call with the same key resumes the
919
- * upload. A part the API already has is skipped, and a final part that finds the upload already
920
- * completed reads it back with `retrieve`.
918
+ * (`<key>:part-<n>`), so it is retried safely. With `resumes`, a repeated call with the same
919
+ * explicit key resumes the upload: it first asks which parts the API has, with the first part's
920
+ * options and an empty file (`Idempotency-Replay-Only`), and sends only the missing parts. A
921
+ * part the API already has is skipped, and a final part that finds the upload already completed
922
+ * reads it back with `retrieve`.
921
923
  */
922
- async submitInParts(uploadsPath, options, wait, { authHeaders = {}, partPath, onStarted, retrieve }) {
924
+ async submitInParts(uploadsPath, options, wait, { authHeaders = {}, partPath, onStarted, resumes = false, retrieve }) {
923
925
  const { content, idempotencyKey, ...fields } = options;
924
926
  const source = getSplittableContent(content);
925
927
  const partSize = this.partSizeBytes;
926
928
  const count = Math.ceil(source.size / partSize);
927
- const key = idempotencyKey ?? this.call.idempotencyKey ?? newIdempotencyKey();
929
+ const explicitKey = idempotencyKey ?? this.call.idempotencyKey;
930
+ const key = explicitKey ?? newIdempotencyKey();
928
931
  const part = (partNumber) => source.slice((partNumber - 1) * partSize, Math.min(partNumber * partSize, source.size));
929
- const first = await this.submitUpload(uploadsPath, {
932
+ const sendFirst = (payload, headers) => this.submitUpload(uploadsPath, {
930
933
  ...fields,
931
934
  part: {
932
- ...part(1),
935
+ ...payload,
933
936
  type: content.type,
937
+ sizeInBytes: Math.min(partSize, source.size),
934
938
  partNumber: 1,
935
939
  isFinal: false
936
940
  },
937
941
  totalSizeInBytes: source.size,
938
942
  idempotencyKey: key
939
- }, wait, authHeaders);
940
- const assetId = expectUploadedAsset(first).id;
943
+ }, wait, headers);
944
+ const existing = resumes && explicitKey ? await sendFirst({ uint8Array: /* @__PURE__ */ new Uint8Array(0) }, {
945
+ ...authHeaders,
946
+ "Idempotency-Replay-Only": "true"
947
+ }) : void 0;
948
+ const first = existing ?? await sendFirst(part(1), authHeaders);
949
+ const uploaded = expectUploadedAsset(first);
950
+ const assetId = uploaded.id;
941
951
  onStarted?.(assetId);
952
+ if (existing && uploaded.upload.status === "completed") return first;
942
953
  const laterParts = this.withCall({ extraBody: void 0 });
943
954
  let result = first;
944
- for (let partNumber = 2; partNumber <= count;) {
955
+ const received = uploaded.upload.partsReceived;
956
+ const nextPart = typeof received === "number" && received >= 2 && received < count ? received + 1 : 2;
957
+ for (let partNumber = nextPart; partNumber <= count;) {
945
958
  const isFinal = partNumber === count;
946
959
  try {
947
960
  result = await laterParts.uploadPart(partPath(assetId), {
@@ -1,6 +1,6 @@
1
1
  import { C as invalidConfig, S as invalidArgument, l as CalmLensError, x as SDK_ERROR_CODES } from "./CalmLensError-C15tWu8W.js";
2
- import { B as copyLastResponse, C as validateBatchAssetsOptions, H as readEnv, L as isBrowserRuntime, R as isReactNativeRuntime, V as listPages, b as toTextAssetOptions, d as checkOptionKeys, g as pollForDecision, i as appendSignedLocation, l as validateSignAssetUrlOptions, o as buildAssetUrl, p as encodePathSegment, s as getAssetInfo, u as DEFAULT_CDN_BASE_URL, w as validateServerClientOptions, y as stringifyQuery } from "./CalmLensCdn-xvzJyv9X.js";
3
- import { a as getMockHooks, c as prepareSubmitAssetOptions, d as validateCallOptions, l as resolveConnectionOptions, m as SERVER_OPTION_KEYS, o as invalidPayload, p as NULLABLE_OPTION_KEYS, r as expectAsset, s as newIdempotencyKey, t as CalmLensConnection, u as splitsIntoParts } from "./CalmLensConnection-D6BVOMri.js";
2
+ import { B as copyLastResponse, C as validateBatchAssetsOptions, H as readEnv, L as isBrowserRuntime, R as isReactNativeRuntime, V as listPages, b as toTextAssetOptions, d as checkOptionKeys, g as pollForDecision, i as appendSignedLocation, l as validateSignAssetUrlOptions, o as buildAssetUrl, p as encodePathSegment, s as getAssetInfo, u as DEFAULT_CDN_BASE_URL, w as validateServerClientOptions, y as stringifyQuery } from "./CalmLensCdn-cmxtF_dw.js";
3
+ import { a as getMockHooks, c as prepareSubmitAssetOptions, d as validateCallOptions, l as resolveConnectionOptions, m as SERVER_OPTION_KEYS, o as invalidPayload, p as NULLABLE_OPTION_KEYS, r as expectAsset, s as newIdempotencyKey, t as CalmLensConnection, u as splitsIntoParts } from "./CalmLensConnection-DEfpIugc.js";
4
4
  import { n as sha256Hex, r as timingSafeEqual, t as hmacSha256Hex } from "./CryptoUtils-BLCa-oZe-DKr3LmN6.js";
5
5
  // src/contract/JsonUtils.js
6
6
  const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
@@ -399,6 +399,7 @@ var CalmLensServerClient = class {
399
399
  const uploadsPath = `${this.#projectPath}/assets`;
400
400
  if ("content" in body && splitsIntoParts(body.content, connection.partSizeBytes)) return expectAsset(await connection.submitInParts(uploadsPath, body, wait, {
401
401
  partPath: (assetId) => `/assets/${encodeURIComponent(assetId)}/part`,
402
+ resumes: true,
402
403
  retrieve: (assetId, read) => read.json("GET", `/assets/${requireId(assetId, "Asset ID")}`)
403
404
  }));
404
405
  if ("content" in body || "part" in body) return expectAsset(await connection.submitUpload(uploadsPath, body, wait));
@@ -1,6 +1,6 @@
1
1
  import { l as CalmLensError } from "./CalmLensError-C15tWu8W.js";
2
- import { a as assetUrlOf, c as toUrlViewerClaims, r as appendAssetLocation, s as getAssetInfo, v as serializeTransform, x as transformSelector } from "./CalmLensCdn-xvzJyv9X.js";
3
- import { o as placeholderHashToDataURL } from "./UploadController-CpLvD8W-.js";
2
+ import { a as assetUrlOf, c as toUrlViewerClaims, r as appendAssetLocation, s as getAssetInfo, v as serializeTransform, x as transformSelector } from "./CalmLensCdn-cmxtF_dw.js";
3
+ import { o as placeholderHashToDataURL } from "./UploadController-9fkYFVZM.js";
4
4
  import { a as getFileIcon, c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
5
5
  // src/ui/viewers/ViewerAsset.ts
6
6
  /** Spreadsheet MIME types, as `content.format` reports them (compared lower-cased). */
@@ -1,4 +1,4 @@
1
- import { i as withProvidedOptions, n as createUploadController } from "./UploadController-CpLvD8W-.js";
1
+ import { i as withProvidedOptions, n as createUploadController } from "./UploadController-9fkYFVZM.js";
2
2
  import { createContext, createElement, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
3
3
  // src/ui/ReactUpload.ts
4
4
  const CalmLensContext = createContext(void 0);
@@ -1,5 +1,5 @@
1
1
  import { l as CalmLensError, x as SDK_ERROR_CODES } from "./CalmLensError-C15tWu8W.js";
2
- import { t as CalmLensAppClient } from "./CalmLensAppClient-DEFSQC15.js";
2
+ import { t as CalmLensAppClient } from "./CalmLensAppClient-Brvc-GXt.js";
3
3
  // src/contract/PlaceholderHashDecode.js
4
4
  /**
5
5
  * Decodes a ThumbHash to an RGBA image. RGB is not be premultiplied by A.
package/esm/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { _ as CalmLensTimeoutError, a as CalmLensCancelledError, c as CalmLensConnectionError, d as CalmLensInvalidResponseError, f as CalmLensNotFoundError, g as CalmLensServerError, h as CalmLensRateLimitError, i as CalmLensBadRequestError, l as CalmLensError, m as CalmLensPermissionDeniedError, n as CalmLensApiError, o as CalmLensConfigurationError, p as CalmLensPayloadTooLargeError, r as CalmLensAuthenticationError, s as CalmLensConflictError, t as CALMLENS_ERROR_CODES, u as CalmLensInvalidArgumentError, v as CalmLensUnprocessableEntityError, y as CalmLensWebhookVerificationError } from "./CalmLensError-C15tWu8W.js";
2
- import { I as SDK_VERSION, n as CDN_RESOURCES, s as getAssetInfo, u as DEFAULT_CDN_BASE_URL, z as AUTO_PAGING_TO_ARRAY_MAX } from "./CalmLensCdn-xvzJyv9X.js";
2
+ import { I as SDK_VERSION, n as CDN_RESOURCES, s as getAssetInfo, u as DEFAULT_CDN_BASE_URL, z as AUTO_PAGING_TO_ARRAY_MAX } from "./CalmLensCdn-cmxtF_dw.js";
3
3
  import "./index.js";
4
- import { t as CalmLensAppClient } from "./CalmLensAppClient-DEFSQC15.js";
4
+ import { t as CalmLensAppClient } from "./CalmLensAppClient-Brvc-GXt.js";
5
5
  export { AUTO_PAGING_TO_ARRAY_MAX, CALMLENS_ERROR_CODES, CDN_RESOURCES, CalmLensApiError, CalmLensAppClient, CalmLensAuthenticationError, CalmLensBadRequestError, CalmLensCancelledError, CalmLensConfigurationError, CalmLensConflictError, CalmLensConnectionError, CalmLensError, CalmLensInvalidArgumentError, CalmLensInvalidResponseError, CalmLensNotFoundError, CalmLensPayloadTooLargeError, CalmLensPermissionDeniedError, CalmLensRateLimitError, CalmLensServerError, CalmLensTimeoutError, CalmLensUnprocessableEntityError, CalmLensWebhookVerificationError, DEFAULT_CDN_BASE_URL, SDK_VERSION, getAssetInfo };
package/esm/elements.js CHANGED
@@ -1,8 +1,8 @@
1
- import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-CGrWIVKa.js";
2
- import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-Cj91IL4-.js";
3
- import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-CpLvD8W-.js";
1
+ import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-HK74e42L.js";
2
+ import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-C_f1o9RQ.js";
3
+ import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-9fkYFVZM.js";
4
4
  import { c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
5
- import { t as createUploadController } from "./BrowserUpload-Ch67b69G.js";
5
+ import { t as createUploadController } from "./BrowserUpload-C429CcUi.js";
6
6
  // src/viewers/Elements.ts
7
7
  const BaseElement$1 = typeof HTMLElement === "undefined" ? class {} : HTMLElement;
8
8
  const PROPERTIES = [
package/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { _ as CalmLensTimeoutError, a as CalmLensCancelledError, c as CalmLensConnectionError, d as CalmLensInvalidResponseError, f as CalmLensNotFoundError, g as CalmLensServerError, h as CalmLensRateLimitError, i as CalmLensBadRequestError, l as CalmLensError, m as CalmLensPermissionDeniedError, n as CalmLensApiError, o as CalmLensConfigurationError, p as CalmLensPayloadTooLargeError, r as CalmLensAuthenticationError, s as CalmLensConflictError, t as CALMLENS_ERROR_CODES, u as CalmLensInvalidArgumentError, v as CalmLensUnprocessableEntityError, y as CalmLensWebhookVerificationError } from "./CalmLensError-C15tWu8W.js";
2
- import { I as SDK_VERSION, n as CDN_RESOURCES, s as getAssetInfo, u as DEFAULT_CDN_BASE_URL, z as AUTO_PAGING_TO_ARRAY_MAX } from "./CalmLensCdn-xvzJyv9X.js";
2
+ import { I as SDK_VERSION, n as CDN_RESOURCES, s as getAssetInfo, u as DEFAULT_CDN_BASE_URL, z as AUTO_PAGING_TO_ARRAY_MAX } from "./CalmLensCdn-cmxtF_dw.js";
3
3
  export { AUTO_PAGING_TO_ARRAY_MAX, CALMLENS_ERROR_CODES, CDN_RESOURCES, CalmLensApiError, CalmLensAuthenticationError, CalmLensBadRequestError, CalmLensCancelledError, CalmLensConfigurationError, CalmLensConflictError, CalmLensConnectionError, CalmLensError, CalmLensInvalidArgumentError, CalmLensInvalidResponseError, CalmLensNotFoundError, CalmLensPayloadTooLargeError, CalmLensPermissionDeniedError, CalmLensRateLimitError, CalmLensServerError, CalmLensTimeoutError, CalmLensUnprocessableEntityError, CalmLensWebhookVerificationError, DEFAULT_CDN_BASE_URL, SDK_VERSION, getAssetInfo };
@@ -1,8 +1,8 @@
1
- import { a as assetUrlOf, r as appendAssetLocation } from "./CalmLensCdn-xvzJyv9X.js";
2
- import { C as pickAssetSource, E as resolveTheme, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, x as getPlayedPercent, y as getAssetViewKey } from "./Core-Cj91IL4-.js";
3
- import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-CpLvD8W-.js";
1
+ import { a as assetUrlOf, r as appendAssetLocation } from "./CalmLensCdn-cmxtF_dw.js";
2
+ import { C as pickAssetSource, E as resolveTheme, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, x as getPlayedPercent, y as getAssetViewKey } from "./Core-C_f1o9RQ.js";
3
+ import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-9fkYFVZM.js";
4
4
  import { a as getFileIcon, o as getFileIconLabel, t as FILE_ICON_COLORS } from "./FileIcons-M6dzjFxd.js";
5
- import { i as useUploadSnapshot, n as useCalmLensUpload, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-Bg4-5rV2.js";
5
+ import { i as useUploadSnapshot, n as useCalmLensUpload, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-Ch5qY7PS.js";
6
6
  import { useEffect, useMemo, useRef, useState } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { Image, Linking, PixelRatio, Pressable, StyleSheet, Text, View } from "react-native";
package/esm/react.js CHANGED
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-CGrWIVKa.js";
3
- import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, n as CALMLENS_STYLES_ID, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-Cj91IL4-.js";
4
- import { a as createProgressFetch, i as withProvidedOptions, r as isFileAccepted, t as UploadController } from "./UploadController-CpLvD8W-.js";
2
+ import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-HK74e42L.js";
3
+ import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, n as CALMLENS_STYLES_ID, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-C_f1o9RQ.js";
4
+ import { a as createProgressFetch, i as withProvidedOptions, r as isFileAccepted, t as UploadController } from "./UploadController-9fkYFVZM.js";
5
5
  import { c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
6
- import { i as useUploadSnapshot, n as useCalmLensUpload$1, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-Bg4-5rV2.js";
7
- import { t as createUploadController } from "./BrowserUpload-Ch67b69G.js";
6
+ import { i as useUploadSnapshot, n as useCalmLensUpload$1, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-Ch5qY7PS.js";
7
+ import { t as createUploadController } from "./BrowserUpload-C429CcUi.js";
8
8
  import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
9
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
10
  const OPTION_NAMES = /* @__PURE__ */ new Set([
package/esm/server.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { _ as CalmLensTimeoutError, a as CalmLensCancelledError, c as CalmLensConnectionError, d as CalmLensInvalidResponseError, f as CalmLensNotFoundError, g as CalmLensServerError, h as CalmLensRateLimitError, i as CalmLensBadRequestError, l as CalmLensError, m as CalmLensPermissionDeniedError, n as CalmLensApiError, o as CalmLensConfigurationError, p as CalmLensPayloadTooLargeError, r as CalmLensAuthenticationError, s as CalmLensConflictError, t as CALMLENS_ERROR_CODES, u as CalmLensInvalidArgumentError, v as CalmLensUnprocessableEntityError, y as CalmLensWebhookVerificationError } from "./CalmLensError-C15tWu8W.js";
2
- import { I as SDK_VERSION, n as CDN_RESOURCES, s as getAssetInfo, u as DEFAULT_CDN_BASE_URL, z as AUTO_PAGING_TO_ARRAY_MAX } from "./CalmLensCdn-xvzJyv9X.js";
2
+ import { I as SDK_VERSION, n as CDN_RESOURCES, s as getAssetInfo, u as DEFAULT_CDN_BASE_URL, z as AUTO_PAGING_TO_ARRAY_MAX } from "./CalmLensCdn-cmxtF_dw.js";
3
3
  import "./index.js";
4
- import { a as WEBHOOK_TIMESTAMP_HEADER, c as isNewerEvent, d as verifyWebhookSignature, i as WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, l as isTestWebhookEvent, n as WEBHOOK_DELIVERY_HEADER, o as getEventFact, r as WEBHOOK_SIGNATURE_HEADER, s as getEventFacts, t as CalmLensServerClient, u as parseWebhookEvent } from "./CalmLensServerClient-BGz_olSn.js";
4
+ import { a as WEBHOOK_TIMESTAMP_HEADER, c as isNewerEvent, d as verifyWebhookSignature, i as WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, l as isTestWebhookEvent, n as WEBHOOK_DELIVERY_HEADER, o as getEventFact, r as WEBHOOK_SIGNATURE_HEADER, s as getEventFacts, t as CalmLensServerClient, u as parseWebhookEvent } from "./CalmLensServerClient-BpsCXVeO.js";
5
5
  export { AUTO_PAGING_TO_ARRAY_MAX, CALMLENS_ERROR_CODES, CDN_RESOURCES, CalmLensApiError, CalmLensAuthenticationError, CalmLensBadRequestError, CalmLensCancelledError, CalmLensConfigurationError, CalmLensConflictError, CalmLensConnectionError, CalmLensError, CalmLensInvalidArgumentError, CalmLensInvalidResponseError, CalmLensNotFoundError, CalmLensPayloadTooLargeError, CalmLensPermissionDeniedError, CalmLensRateLimitError, CalmLensServerClient, CalmLensServerError, CalmLensTimeoutError, CalmLensUnprocessableEntityError, CalmLensWebhookVerificationError, DEFAULT_CDN_BASE_URL, SDK_VERSION, WEBHOOK_DELIVERY_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, WEBHOOK_TIMESTAMP_HEADER, getAssetInfo, getEventFact, getEventFacts, isNewerEvent, isTestWebhookEvent, parseWebhookEvent, verifyWebhookSignature };
package/esm/testing.d.ts CHANGED
@@ -188,7 +188,8 @@ interface MockModerationInput {
188
188
  trigger: MockModerationTrigger;
189
189
  /**
190
190
  * `true` when the API would queue the work rather than answer with the decision: queued
191
- * uploads, retries and `completeProcessing`.
191
+ * uploads, uploads of audio, video, documents, websites and plain text over 4 MiB (always
192
+ * moderated in the background, even when the caller waits), retries and `completeProcessing`.
192
193
  */
193
194
  queued: boolean;
194
195
  }
package/esm/testing.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { C as invalidConfig, S as invalidArgument, T as API_ERROR_DEFINITIONS, l as CalmLensError, w as API_ERROR_CODES, x as SDK_ERROR_CODES } from "./CalmLensError-C15tWu8W.js";
2
- import { F as sleep, M as getRejectedUploadMimeTypeError, N as normalizeUploadMimeType, O as MAX_IMAGE_UPLOAD_BYTES, S as validateAppClientOptions, _ as randomUuid, f as checkTransformOptions, h as parseTransformSelector, m as isAcceptedUploadMimeType, t as ASSET_RESOURCE_PATHS, w as validateServerClientOptions } from "./CalmLensCdn-xvzJyv9X.js";
3
- import { a as WEBHOOK_TIMESTAMP_HEADER, f as signUploadTokenWithApiKey, m as stringifyJsonCanonical, n as WEBHOOK_DELIVERY_HEADER, p as decodeUploadToken, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient } from "./CalmLensServerClient-BGz_olSn.js";
4
- import { _ as validateAssetPayload, g as assetToData, h as assetDataToUint8Array, n as MOCK_HOOKS } from "./CalmLensConnection-D6BVOMri.js";
2
+ import { F as sleep, M as getRejectedUploadMimeTypeError, N as normalizeUploadMimeType, O as MAX_IMAGE_UPLOAD_BYTES, S as validateAppClientOptions, _ as randomUuid, f as checkTransformOptions, h as parseTransformSelector, m as isAcceptedUploadMimeType, t as ASSET_RESOURCE_PATHS, w as validateServerClientOptions } from "./CalmLensCdn-cmxtF_dw.js";
3
+ import { a as WEBHOOK_TIMESTAMP_HEADER, f as signUploadTokenWithApiKey, m as stringifyJsonCanonical, n as WEBHOOK_DELIVERY_HEADER, p as decodeUploadToken, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient } from "./CalmLensServerClient-BpsCXVeO.js";
4
+ import { _ as validateAssetPayload, g as assetToData, h as assetDataToUint8Array, n as MOCK_HOOKS } from "./CalmLensConnection-DEfpIugc.js";
5
5
  import { t as hmacSha256Hex } from "./CryptoUtils-BLCa-oZe-DKr3LmN6.js";
6
- import { t as CalmLensAppClient } from "./CalmLensAppClient-DEFSQC15.js";
7
- import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-CpLvD8W-.js";
6
+ import { t as CalmLensAppClient } from "./CalmLensAppClient-Brvc-GXt.js";
7
+ import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-9fkYFVZM.js";
8
8
  import { _ as CLASSIFICATION_CATEGORIES, f as getTestInputTag, g as lazySchema, h as EU_COUNTRIES, t as withValidTestInputArguments } from "./CalmLensTestInputArguments-DS_3mt1C.js";
9
9
  import * as zod from "zod";
10
10
  // src/contract/MediaTestTriggers.js
@@ -9878,6 +9878,11 @@ const isTextUpload = (request) => {
9878
9878
  return false;
9879
9879
  }
9880
9880
  };
9881
+ /**
9882
+ * Like the API (`classifiesInBackground`): audio, video, documents, websites and plain text over
9883
+ * 4 MiB are always moderated in the background, even when the caller waits.
9884
+ */
9885
+ const classifiesInBackground = (asset) => asset.type === "audio" || asset.type === "video" || asset.type === "multimedia-document" || asset.type === "website" || asset.type === "plaintext-document" && (asset.content.sizeInBytes ?? 0) > 4194304;
9881
9886
  /** Like the API: a new folder is 201 Created, a queued batch 202 Accepted, everything else 200. */
9882
9887
  const SUCCESS_STATUS = {
9883
9888
  "folders.create": 201,
@@ -10298,20 +10303,32 @@ var MockCalmLensApi = class {
10298
10303
  [...request.query].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0),
10299
10304
  isForm ? "multipart/form-data" : contentType,
10300
10305
  upload,
10301
- upload ? request.bytes.byteLength : new TextDecoder().decode(request.bytes),
10306
+ isForm ? null : upload ? request.bytes.byteLength : new TextDecoder().decode(request.bytes),
10302
10307
  formOptions ?? null
10303
10308
  ]);
10309
+ const replayOnly = headers.get("idempotency-replay-only") === "true";
10310
+ if (replayOnly && (key === void 0 || upload !== "part" || !isForm || request.segments.at(-1) === "part" || request.query.get("partNumber") !== "1")) return this.failureResponse(fail(API_ERROR_CODES.INVALID_REQUEST), url);
10304
10311
  if (key !== void 0) {
10305
10312
  if (!isValidIdempotencyKey(key)) return this.failureResponse(fail(API_ERROR_CODES.INVALID_IDEMPOTENCY_KEY), url);
10306
10313
  const saved = this.idempotentResults.get(key);
10307
10314
  if (saved) {
10308
10315
  if (saved.fingerprint !== fingerprint) return this.failureResponse(fail(API_ERROR_CODES.IDEMPOTENCY_KEY_REUSED), url);
10316
+ if (replayOnly) {
10317
+ const { id } = JSON.parse(saved.body);
10318
+ const asset = await this.databaseStorage.getAsset(id);
10319
+ if (!asset) return this.response(204, null, url, {});
10320
+ return this.response(200, JSON.stringify(asset, this.publishAssets), url, {
10321
+ "Content-Type": "application/json",
10322
+ "Idempotent-Replayed": "true"
10323
+ });
10324
+ }
10309
10325
  return this.response(saved.status, saved.body, url, {
10310
10326
  "Content-Type": "application/json",
10311
10327
  "Idempotent-Replayed": "true"
10312
10328
  });
10313
10329
  }
10314
10330
  }
10331
+ if (replayOnly) return this.response(204, null, url, {});
10315
10332
  let answer;
10316
10333
  try {
10317
10334
  answer = await this.route(request, session);
@@ -11449,11 +11466,12 @@ var MockCalmLensApi = class {
11449
11466
  bytes: data,
11450
11467
  text: data && asset.type === "plaintext-document" ? new TextDecoder().decode(data) : null
11451
11468
  };
11469
+ const background = trigger === "upload" && classifiesInBackground(asset);
11452
11470
  return toDecision(await this.options.moderate({
11453
11471
  asset: this.toPublished(asset),
11454
11472
  content,
11455
11473
  trigger,
11456
- queued
11474
+ queued: queued || background
11457
11475
  }));
11458
11476
  }
11459
11477
  /**
@@ -1,5 +1,5 @@
1
- import { a as assetUrlOf, r as appendAssetLocation } from "./CalmLensCdn-xvzJyv9X.js";
2
- import "./Core-Cj91IL4-.js";
1
+ import { a as assetUrlOf, r as appendAssetLocation } from "./CalmLensCdn-cmxtF_dw.js";
2
+ import "./Core-C_f1o9RQ.js";
3
3
  // src/ui/viewers/PdfLoader.ts
4
4
  let loading;
5
5
  /**
package/esm/ui.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-CGrWIVKa.js";
2
- import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-Cj91IL4-.js";
3
- import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-CpLvD8W-.js";
1
+ import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-HK74e42L.js";
2
+ import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-C_f1o9RQ.js";
3
+ import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-9fkYFVZM.js";
4
4
  export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, AssetSession, AssetViewerMount, CALMLENS_STYLES, CALMLENS_THEME, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, ICONS, ICON_ATTRIBUTES, INSTANT_LOAD_MS, MediaStreamPlayer, UploadController, VIEWER_STYLES, createDocumentViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isImageReady, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, withProvidedOptions };
package/esm/vue.js CHANGED
@@ -1,8 +1,8 @@
1
- import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-CGrWIVKa.js";
2
- import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-Cj91IL4-.js";
3
- import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-CpLvD8W-.js";
1
+ import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-HK74e42L.js";
2
+ import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-C_f1o9RQ.js";
3
+ import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-9fkYFVZM.js";
4
4
  import { c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
5
- import { t as createUploadController } from "./BrowserUpload-Ch67b69G.js";
5
+ import { t as createUploadController } from "./BrowserUpload-C429CcUi.js";
6
6
  import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, onScopeDispose, provide, ref, shallowRef, toValue, watch, watchEffect } from "vue";
7
7
  // src/viewers/Vue.ts
8
8
  const optional$1 = (type) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "calmlens",
3
- "version": "0.37.0",
3
+ "version": "0.37.1",
4
4
  "description": "Official CalmLens SDK for JavaScript and TypeScript: content moderation, asset storage and CDN delivery.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://calmlens.com/docs/sdk/javascript",