calmlens 0.27.6 → 0.28.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 (82) hide show
  1. package/bin/calmlens.js +24 -13
  2. package/cjs/{BrowserUpload-CdOfuIcV.d.ts → BrowserUpload-CRbCsX7a.d.ts} +2 -2
  3. package/cjs/{BrowserUpload-GQtZti-D.js → BrowserUpload-DLoi5qVj.js} +1 -1
  4. package/cjs/{CalmLensAppClient-Btp8f-34.d.ts → CalmLensAppClient-B3u6BlP5.d.ts} +1 -1
  5. package/cjs/{CalmLensAppClient-Bwt3gP0C.js → CalmLensAppClient-C--UAnoz.js} +2 -2
  6. package/cjs/{CalmLensOptionKeys--gTpTkwt.js → CalmLensOptionKeys-BxrJ47zd.js} +2 -2
  7. package/cjs/{CalmLensServerClient-C3kaPLUZ.d.ts → CalmLensServerClient-B8ntjNL3.d.ts} +6 -6
  8. package/cjs/{CalmLensServerClient-BYMzGkQK.js → CalmLensServerClient-CPbCEJMK.js} +9 -9
  9. package/cjs/{CalmLensTypes-DxxyZt2L.d.ts → CalmLensTypes-CtO4Dieu.d.ts} +6 -3
  10. package/cjs/{Core-Dhijt6JU.d.ts → Core-BJaLU71Q.d.ts} +2 -2
  11. package/cjs/{Core-52DVaX7d.js → Core-CB0-p-ro.js} +7 -4
  12. package/cjs/{ModerationContextLimits-DJyIjzIn.js → ModerationContextLimits-CuL1TOuf.js} +43 -6
  13. package/cjs/{ReactUpload-DHuhGYsr.js → ReactUpload-3QgzpdMu.js} +1 -1
  14. package/cjs/{ReactUpload-BuqLPgNr.d.ts → ReactUpload-BGUkcMpg.d.ts} +1 -1
  15. package/{esm/TestTriggers-Dnukm-jm-DoEB7jJc.d.ts → cjs/TestTriggers-dognME9k-PWyIfHMI.d.ts} +1 -2
  16. package/cjs/{TestTriggers-DP4m92jg-C0HD-A4r.js → TestTriggers-uL2Ec8Vt-cPmmKvYd.js} +1 -2
  17. package/cjs/{UploadController-ChzDPMmm.js → UploadController-BSZnq84V.js} +2 -2
  18. package/{esm/WebhookPayload-D_yWJA9M.d.ts → cjs/WebhookPayload-DZadhbAJ.d.ts} +1 -1
  19. package/cjs/app.d.ts +4 -4
  20. package/cjs/app.js +2 -2
  21. package/cjs/elements.d.ts +4 -4
  22. package/cjs/elements.js +4 -4
  23. package/cjs/{index-CUA-HDNu.d.ts → index-DQUZYLVY.d.ts} +2 -2
  24. package/cjs/index.d.ts +3 -3
  25. package/cjs/index.js +1 -1
  26. package/cjs/react-native.d.ts +2 -2
  27. package/cjs/react-native.js +5 -5
  28. package/cjs/react.d.ts +4 -4
  29. package/cjs/react.js +5 -5
  30. package/cjs/server.d.ts +4 -4
  31. package/cjs/server.js +2 -2
  32. package/cjs/test-inputs.d.ts +1 -1
  33. package/cjs/test-inputs.js +13 -13
  34. package/cjs/testing.d.ts +61 -13
  35. package/cjs/testing.js +170 -35
  36. package/cjs/{ui-BSm_qphN.d.ts → ui-BGywTQ2M.d.ts} +2 -2
  37. package/cjs/{ui-C1_SDSiq.js → ui-CkQQm3Qw.js} +2 -2
  38. package/cjs/ui.d.ts +2 -2
  39. package/cjs/ui.js +3 -3
  40. package/cjs/vue.d.ts +5 -5
  41. package/cjs/vue.js +4 -4
  42. package/esm/{BrowserUpload-BaKFKEBz.js → BrowserUpload-BKrrHzoh.js} +1 -1
  43. package/esm/{BrowserUpload-CdOfuIcV.d.ts → BrowserUpload-CRbCsX7a.d.ts} +2 -2
  44. package/esm/{CalmLensAppClient-Btp8f-34.d.ts → CalmLensAppClient-B3u6BlP5.d.ts} +1 -1
  45. package/esm/{CalmLensAppClient-DM6c3pGC.js → CalmLensAppClient-D_SprSKl.js} +2 -2
  46. package/esm/{CalmLensOptionKeys-CKZs8i3_.js → CalmLensOptionKeys-B6an7neE.js} +2 -2
  47. package/esm/{CalmLensServerClient-C3kaPLUZ.d.ts → CalmLensServerClient-B8ntjNL3.d.ts} +6 -6
  48. package/esm/{CalmLensServerClient-Da2UfUo4.js → CalmLensServerClient-BY45aX5Q.js} +9 -9
  49. package/esm/{CalmLensTypes-DxxyZt2L.d.ts → CalmLensTypes-CtO4Dieu.d.ts} +6 -3
  50. package/esm/{Core-Dhijt6JU.d.ts → Core-BJaLU71Q.d.ts} +2 -2
  51. package/esm/{Core-kYMRW5C1.js → Core-dzPyrg_G.js} +7 -4
  52. package/esm/{ModerationContextLimits-ZIlK9n2X.js → ModerationContextLimits-IH2zX1wg.js} +26 -7
  53. package/esm/{ReactUpload-CipY3cmO.js → ReactUpload-4DeUbua_.js} +1 -1
  54. package/esm/{ReactUpload-BuqLPgNr.d.ts → ReactUpload-BGUkcMpg.d.ts} +1 -1
  55. package/{cjs/TestTriggers-Dnukm-jm-DoEB7jJc.d.ts → esm/TestTriggers-dognME9k-PWyIfHMI.d.ts} +1 -2
  56. package/esm/{TestTriggers-DP4m92jg-DhOI4S1V.js → TestTriggers-uL2Ec8Vt-DYbTEJWm.js} +1 -2
  57. package/esm/{UploadController-D-14HWII.js → UploadController-DKjI8S2K.js} +2 -2
  58. package/{cjs/WebhookPayload-D_yWJA9M.d.ts → esm/WebhookPayload-DZadhbAJ.d.ts} +1 -1
  59. package/esm/app.d.ts +4 -4
  60. package/esm/app.js +2 -2
  61. package/esm/elements.d.ts +4 -4
  62. package/esm/elements.js +4 -4
  63. package/esm/{index-CUA-HDNu.d.ts → index-DQUZYLVY.d.ts} +2 -2
  64. package/esm/index.d.ts +3 -3
  65. package/esm/index.js +1 -1
  66. package/esm/react-native.d.ts +2 -2
  67. package/esm/react-native.js +5 -5
  68. package/esm/react.d.ts +4 -4
  69. package/esm/react.js +5 -5
  70. package/esm/server.d.ts +4 -4
  71. package/esm/server.js +2 -2
  72. package/esm/test-inputs.d.ts +1 -1
  73. package/esm/test-inputs.js +1 -1
  74. package/esm/testing.d.ts +61 -13
  75. package/esm/testing.js +161 -26
  76. package/esm/{ui-BSm_qphN.d.ts → ui-BGywTQ2M.d.ts} +2 -2
  77. package/esm/{ui-CgIG3knW.js → ui-BovDqg9n.js} +2 -2
  78. package/esm/ui.d.ts +2 -2
  79. package/esm/ui.js +3 -3
  80. package/esm/vue.d.ts +5 -5
  81. package/esm/vue.js +4 -4
  82. package/package.json +1 -1
package/esm/testing.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { Fn as AssetBinaryPayloadInput, Ft as SignUploadTokenOptions, Lt as SignedUploadToken, O as CalmLensAppClientOptions, _n as Folder, gn as PermissionGrant, k as CalmLensServerClientOptions, ln as TypedEvent, m as AssetModeration, r as Asset } from "./CalmLensTypes-DxxyZt2L.js";
2
- import { t as CalmLensAppClient } from "./CalmLensAppClient-Btp8f-34.js";
3
- import { I as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-D_yWJA9M.js";
4
- import { t as CalmLensServerClient } from "./CalmLensServerClient-C3kaPLUZ.js";
5
- import { t as ClassificationTestSignal } from "./TestTriggers-Dnukm-jm-DoEB7jJc.js";
1
+ import { Fn as AssetBinaryPayloadInput, Ft as SignUploadTokenOptions, Lt as SignedUploadToken, O as CalmLensAppClientOptions, _n as Folder, gn as PermissionGrant, k as CalmLensServerClientOptions, ln as TypedEvent, m as AssetModeration, r as Asset } from "./CalmLensTypes-CtO4Dieu.js";
2
+ import { t as CalmLensAppClient } from "./CalmLensAppClient-B3u6BlP5.js";
3
+ import { I as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-DZadhbAJ.js";
4
+ import { t as CalmLensServerClient } from "./CalmLensServerClient-B8ntjNL3.js";
5
+ import { t as ClassificationTestSignal } from "./TestTriggers-dognME9k-PWyIfHMI.js";
6
6
  import "zod";
7
7
  /**
8
8
  * Signs a single-use upload token with `apiKey`, locally. `CalmLensServerClient` and
@@ -64,6 +64,19 @@ declare const MOCK_CATEGORIES: readonly ["sexual", "violence", "self-harm", "har
64
64
  */
65
65
  type MockAssetOutcome = "pending" | "failed" | "allowed" | "limited" | "age-restricted" | "blocked" | "purged";
66
66
  type Category = (typeof MOCK_CATEGORIES)[number];
67
+ type EvaluatedFeature<K extends "ocr" | "linkDetection" | "personDetection" | "faceDetection"> = Extract<NonNullable<Asset["classification"][K]>, {
68
+ status: "evaluated";
69
+ }>;
70
+ /** A region of text OCR found, as `classification.ocr.textRegions` reports one. */
71
+ type MockTextRegion = EvaluatedFeature<"ocr">["textRegions"][number];
72
+ /** A QR code link detection decoded, as `classification.linkDetection.qrCodes` reports one. */
73
+ type MockQrCode = EvaluatedFeature<"linkDetection">["qrCodes"][number];
74
+ /** A link found in an image's text or QR codes, as `classification.linkDetection.links` reports one. */
75
+ type MockDetectedLink = EvaluatedFeature<"linkDetection">["links"][number];
76
+ /** A person that person detection found, as `classification.personDetection.people` reports one. */
77
+ type MockDetectedPerson = EvaluatedFeature<"personDetection">["people"][number];
78
+ /** A face that face detection found, as `classification.faceDetection.faces` reports one. */
79
+ type MockDetectedFace = EvaluatedFeature<"faceDetection">["faces"][number];
67
80
  /** Why a decision waits for human review: `sampled`, or `uncertain` about some categories. */
68
81
  type MockPendingReviewReason = "sampled" | "uncertain";
69
82
  /**
@@ -90,6 +103,41 @@ export declare class MockDecision {
90
103
  * decision (`decide` on the mock) clears it; `assets.decide` doesn't, as with the API.
91
104
  */
92
105
  pendingReview(reason: MockPendingReviewReason, uncertainCategories?: Category[]): this;
106
+ /**
107
+ * The text OCR finds in an image, for an upload that turns OCR on: `classification.ocr` reports
108
+ * `textRegions`, and `content.extractedText` holds `text` when the upload keeps its content.
109
+ */
110
+ withOcr(text: string | null, textRegions?: MockTextRegion[]): this;
111
+ /**
112
+ * The QR codes and links link detection finds in an image, reported as
113
+ * `classification.linkDetection` unless the upload turns link detection off.
114
+ */
115
+ withLinkDetection(qrCodes?: MockQrCode[], links?: MockDetectedLink[]): this;
116
+ /**
117
+ * The people that person detection finds in an image, reported as `classification.personDetection`
118
+ * when the upload turns person detection on. Without them, it finds nobody.
119
+ */
120
+ withPersonDetection(people: MockDetectedPerson[]): this;
121
+ /**
122
+ * The faces that face detection finds in an image, reported as `classification.faceDetection` when
123
+ * the upload turns face detection on; each face's `ageRange` only when the upload also asks for
124
+ * age estimation. Without them, it finds no faces.
125
+ */
126
+ withFaceDetection(faces: MockDetectedFace[]): this;
127
+ /** @internal What `withPersonDetection` set, if anything. */
128
+ get personFindings(): MockDetectedPerson[] | undefined;
129
+ /** @internal What `withFaceDetection` set, if anything. */
130
+ get faceFindings(): MockDetectedFace[] | undefined;
131
+ /** @internal What `withOcr` set, if anything. */
132
+ get ocrFindings(): {
133
+ text: string | null;
134
+ textRegions: MockTextRegion[];
135
+ } | undefined;
136
+ /** @internal What `withLinkDetection` set, if anything. */
137
+ get linkFindings(): {
138
+ qrCodes: MockQrCode[];
139
+ links: MockDetectedLink[];
140
+ } | undefined;
93
141
  /**
94
142
  * The report a decided asset gets, as the API sends it: every category (unflagged ones
95
143
  * evaluated with score 0), policy-adjusted results and the automated status and
@@ -196,10 +244,10 @@ declare const MOCK_OPERATIONS: readonly ["assets.list", "assets.search", "assets
196
244
  type MockCalmLensOperation = (typeof MOCK_OPERATIONS)[number];
197
245
  /**
198
246
  * One request a mock client sent, as the in-memory API received it. `operation` is the client
199
- * method that sends it; requests several methods send are recorded under the first: `text.classify`
200
- * as `assets.classify`, `ensureLens` as `ensureLenses`, `assets.waitForDecision` polls as
201
- * `assets.retrieve`, and so on. `callsTo` matches all of
202
- * them. Methods that send nothing, such as `uploadTokens.sign` or a cached `ensureLens`, are not
247
+ * method that sends it; requests several methods send are recorded under the first: `ensureLens`
248
+ * as `ensureLenses`, `assets.waitForDecision` polls as `assets.retrieve`, and so on. `callsTo`
249
+ * matches all of them. A text upload is `text.classify`'s and a file or URL upload
250
+ * `assets.classify`'s, never both. Methods that send nothing, such as `uploadTokens.sign` or a cached `ensureLens`, are not
203
251
  * recorded.
204
252
  */
205
253
  interface MockCalmLensCall {
@@ -271,7 +319,7 @@ interface MockCalmLensServerClientOptions extends Omit<CalmLensServerClientOptio
271
319
  /**
272
320
  * Returns a new ID for an object of the kind `prefix` names (`asset`, `fldr`, `hl`, `hle`,
273
321
  * `lens`, `evt` or `rev`). The default is like the API's: the prefix, `_` and 20 random
274
- * base62 characters, such as `asset_5Gm2Rk8XqT3wLp9VbN4c`.
322
+ * base62 characters, such as `asset_e5Gm2Rk8XqT3wLp9VbN4`.
275
323
  */
276
324
  createId?: (prefix: IdPrefix) => string;
277
325
  /**
@@ -313,8 +361,8 @@ export declare class MockCalmLensServerClient extends CalmLensServerClient {
313
361
  get calls(): MockCalmLensCall[];
314
362
  /**
315
363
  * Requests `operation` sends, oldest first. A request several methods send matches each of
316
- * them: `callsTo("text.classify")` also lists `assets.classify` text uploads, and
317
- * `callsTo("assets.waitForDecision")` the `assets.retrieve` requests it polls with.
364
+ * them: `callsTo("assets.waitForDecision")` lists the `assets.retrieve` requests it polls
365
+ * with. A text upload is `text.classify`'s request and a file or URL upload `assets.classify`'s.
318
366
  */
319
367
  callsTo(operation: MockCalmLensOperation): MockCalmLensCall[];
320
368
  /**
@@ -401,4 +449,4 @@ export declare const createWebhookHeaders: (options: {
401
449
  deliveryId: string;
402
450
  timestampSeconds?: number;
403
451
  }) => Promise<Record<string, string>>;
404
- export { type MockAssetOutcome, type MockCalmLensAppClientOptions, type MockCalmLensCall, type MockCalmLensOperation, type MockCalmLensServerClientOptions, type MockDatabaseStorage, type MockEventInput, type MockFailureOptions, type MockImageStorage, type MockModerate, type MockModerationInput, type MockModerationTrigger, type MockRequestFailure, type MockReviewDecision, type MockStoredContent, type MockUploadPreset, signUploadTokenWithApiKey as signUploadToken };
452
+ export { type MockAssetOutcome, type MockCalmLensAppClientOptions, type MockCalmLensCall, type MockCalmLensOperation, type MockCalmLensServerClientOptions, type MockDatabaseStorage, type MockDetectedFace, type MockDetectedLink, type MockDetectedPerson, type MockEventInput, type MockFailureOptions, type MockImageStorage, type MockModerate, type MockModerationInput, type MockModerationTrigger, type MockQrCode, type MockRequestFailure, type MockReviewDecision, type MockStoredContent, type MockTextRegion, type MockUploadPreset, signUploadTokenWithApiKey as signUploadToken };
package/esm/testing.js CHANGED
@@ -1,10 +1,10 @@
1
- import { A as normalizeUploadMimeType, D as MAX_IMAGE_UPLOAD_BYTES, M as sleep, S as validateAppClientOptions, Y as CalmLensError, _ as randomUuid, ct as invalidConfig, f as checkTransformOptions, h as parseTransformSelector, k as getRejectedUploadMimeTypeError, lt as API_ERROR_CODES, m as isAcceptedUploadMimeType, ot as SDK_ERROR_CODES, r as selectModerationContextItems, st as invalidArgument, ut as API_ERROR_DEFINITIONS, w as validateServerClientOptions } from "./ModerationContextLimits-ZIlK9n2X.js";
2
- 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-Da2UfUo4.js";
3
- import { _ as validateAssetPayload, a as MOCK_HOOKS, g as assetToData, h as assetDataToUint8Array } from "./CalmLensOptionKeys-CKZs8i3_.js";
1
+ import { A as MAX_IMAGE_UPLOAD_BYTES, D as validateServerClientOptions, F as sleep, M as getRejectedUploadMimeTypeError, N as normalizeUploadMimeType, Q as CalmLensError, T as validateAppClientOptions, _ as isAcceptedUploadMimeType, b as randomUuid, dt as invalidConfig, ft as API_ERROR_CODES, h as checkTransformOptions, i as ASSET_RESOURCE_PATHS, lt as SDK_ERROR_CODES, pt as API_ERROR_DEFINITIONS, r as selectModerationContextItems, ut as invalidArgument, v as parseTransformSelector } from "./ModerationContextLimits-IH2zX1wg.js";
2
+ 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-BY45aX5Q.js";
3
+ import { _ as validateAssetPayload, a as MOCK_HOOKS, g as assetToData, h as assetDataToUint8Array } from "./CalmLensOptionKeys-B6an7neE.js";
4
4
  import { t as hmacSha256Hex } from "./CryptoUtils-BLCa-oZe-DKr3LmN6.js";
5
- import { t as CalmLensAppClient } from "./CalmLensAppClient-DM6c3pGC.js";
6
- import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-D-14HWII.js";
7
- import { d as getTestInputTag, h as CLASSIFICATION_CATEGORIES, m as lazySchema } from "./TestTriggers-DP4m92jg-DhOI4S1V.js";
5
+ import { t as CalmLensAppClient } from "./CalmLensAppClient-D_SprSKl.js";
6
+ import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-DKjI8S2K.js";
7
+ import { d as getTestInputTag, h as CLASSIFICATION_CATEGORIES, m as lazySchema } from "./TestTriggers-uL2Ec8Vt-DYbTEJWm.js";
8
8
  import * as zod from "zod";
9
9
  // src/contract/MediaTestTriggers.js
10
10
  const MEDIA_TEST_SIGNALS = [...CLASSIFICATION_CATEGORIES, "violence.graphic"];
@@ -8337,6 +8337,10 @@ var MockDecision = class {
8337
8337
  #flags = /* @__PURE__ */ new Map();
8338
8338
  #notEvaluated = /* @__PURE__ */ new Set();
8339
8339
  #pendingReview;
8340
+ #ocr;
8341
+ #linkDetection;
8342
+ #people;
8343
+ #faces;
8340
8344
  constructor(status) {
8341
8345
  if (!OUTCOMES.includes(status)) throw invalidArgument(`status must be one of ${OUTCOMES.join(", ")}`);
8342
8346
  this.status = status;
@@ -8386,6 +8390,61 @@ var MockDecision = class {
8386
8390
  };
8387
8391
  return this;
8388
8392
  }
8393
+ /**
8394
+ * The text OCR finds in an image, for an upload that turns OCR on: `classification.ocr` reports
8395
+ * `textRegions`, and `content.extractedText` holds `text` when the upload keeps its content.
8396
+ */
8397
+ withOcr(text, textRegions = []) {
8398
+ this.#ocr = {
8399
+ text,
8400
+ textRegions: structuredClone(textRegions)
8401
+ };
8402
+ return this;
8403
+ }
8404
+ /**
8405
+ * The QR codes and links link detection finds in an image, reported as
8406
+ * `classification.linkDetection` unless the upload turns link detection off.
8407
+ */
8408
+ withLinkDetection(qrCodes = [], links = []) {
8409
+ this.#linkDetection = {
8410
+ qrCodes: structuredClone(qrCodes),
8411
+ links: structuredClone(links)
8412
+ };
8413
+ return this;
8414
+ }
8415
+ /**
8416
+ * The people that person detection finds in an image, reported as `classification.personDetection`
8417
+ * when the upload turns person detection on. Without them, it finds nobody.
8418
+ */
8419
+ withPersonDetection(people) {
8420
+ this.#people = structuredClone(people);
8421
+ return this;
8422
+ }
8423
+ /**
8424
+ * The faces that face detection finds in an image, reported as `classification.faceDetection` when
8425
+ * the upload turns face detection on; each face's `ageRange` only when the upload also asks for
8426
+ * age estimation. Without them, it finds no faces.
8427
+ */
8428
+ withFaceDetection(faces) {
8429
+ this.#faces = structuredClone(faces);
8430
+ return this;
8431
+ }
8432
+ /** @internal What `withPersonDetection` set, if anything. */
8433
+ get personFindings() {
8434
+ return this.#people && structuredClone(this.#people);
8435
+ }
8436
+ /** @internal What `withFaceDetection` set, if anything. */
8437
+ get faceFindings() {
8438
+ return this.#faces && structuredClone(this.#faces);
8439
+ }
8440
+ /** @internal What `withOcr` set, if anything. */
8441
+ get ocrFindings() {
8442
+ return this.#ocr && structuredClone(this.#ocr);
8443
+ }
8444
+ /** @internal What `withLinkDetection` set, if anything. */
8445
+ get linkFindings() {
8446
+ return this.#linkDetection && structuredClone(this.#linkDetection);
8447
+ }
8389
8448
  #checkCategory(category) {
8390
8449
  if (!MOCK_CATEGORIES.includes(category)) throw invalidArgument(`${category} is not a CalmLens category`);
8391
8450
  }
@@ -8453,6 +8512,45 @@ var MockDecision = class {
8453
8512
  const mockDecision = (status) => new MockDecision(status);
8454
8513
  /** The default `moderate`: queued work stays pending until `completeProcessing`, which allows it. */
8455
8514
  const defaultModerate = ({ trigger, queued }) => queued && trigger !== "complete" ? "pending" : "allowed";
8515
+ // src/testing/MockUrlAssetTypes.ts
8516
+ const MOCK_URL_EXTENSION_TYPES = {
8517
+ jpg: "image",
8518
+ jpeg: "image",
8519
+ png: "image",
8520
+ gif: "image",
8521
+ webp: "image",
8522
+ avif: "image",
8523
+ heic: "image",
8524
+ heif: "image",
8525
+ bmp: "image",
8526
+ tif: "image",
8527
+ tiff: "image",
8528
+ svg: "image",
8529
+ mp4: "video",
8530
+ m4v: "video",
8531
+ mov: "video",
8532
+ webm: "video",
8533
+ mkv: "video",
8534
+ avi: "video",
8535
+ mp3: "audio",
8536
+ m4a: "audio",
8537
+ aac: "audio",
8538
+ wav: "audio",
8539
+ ogg: "audio",
8540
+ oga: "audio",
8541
+ opus: "audio",
8542
+ flac: "audio",
8543
+ pdf: "multimedia-document",
8544
+ doc: "multimedia-document",
8545
+ docx: "multimedia-document",
8546
+ odt: "multimedia-document",
8547
+ ppt: "multimedia-document",
8548
+ pptx: "multimedia-document",
8549
+ odp: "multimedia-document",
8550
+ rtf: "multimedia-document",
8551
+ txt: "plaintext-document",
8552
+ md: "plaintext-document"
8553
+ };
8456
8554
  // src/testing/MockAssetFilters.ts
8457
8555
  /** The asset fields a list filter may name, each with the operators it accepts. */
8458
8556
  const MOCK_ASSET_FILTER_FIELDS = {
@@ -9408,9 +9506,25 @@ const mockRendering = (asset, processed) => {
9408
9506
  default: return NO_RENDERING;
9409
9507
  }
9410
9508
  };
9411
- /** An asset's type from its content type, or `website` for a URL. */
9509
+ /**
9510
+ * A URL upload's type: the type of its path's file extension (`MOCK_URL_EXTENSION_TYPES`),
9511
+ * compared lower-case without the query or fragment, or `website` for any other extension or none.
9512
+ * The mock fetches nothing, so the extension stands in for the fetched content's type.
9513
+ */
9514
+ const urlAssetType = (url) => {
9515
+ let path;
9516
+ try {
9517
+ path = new URL(url).pathname;
9518
+ } catch {
9519
+ path = url.split(/[?#]/, 1)[0];
9520
+ }
9521
+ const segment = path.slice(path.lastIndexOf("/") + 1);
9522
+ const dot = segment.lastIndexOf(".");
9523
+ if (dot === -1) return "website";
9524
+ return MOCK_URL_EXTENSION_TYPES[segment.slice(dot + 1).toLowerCase()] ?? "website";
9525
+ };
9526
+ /** An asset's type from its content type. */
9412
9527
  const inferAssetType = (contentType) => {
9413
- if (contentType === void 0) return "website";
9414
9528
  const type = contentType.toLowerCase();
9415
9529
  if (type.startsWith("image/")) return "image";
9416
9530
  if (type.startsWith("video/")) return "video";
@@ -9596,7 +9710,7 @@ const operationsOf = (request) => {
9596
9710
  case "assets":
9597
9711
  if (method === "GET") return ["assets.list"];
9598
9712
  if (query.get("wait") === "false") return ["assets.create"];
9599
- return isTextUpload(request) ? ["assets.classify", "text.classify"] : ["assets.classify"];
9713
+ return isTextUpload(request) ? ["text.classify"] : ["assets.classify"];
9600
9714
  }
9601
9715
  if (segments[2] === "assets" && segments[4] === "timeline" && segments.length === 5) return ["assets.listTimeline"];
9602
9716
  if (segments[2] === "metadata-fields" && segments.length === 4) return ["metadataFields.delete"];
@@ -10469,17 +10583,21 @@ var MockCalmLensApi = class {
10469
10583
  }
10470
10584
  /**
10471
10585
  * Signs an asset URL like the API (`POST /projects/:projectId/signed-asset-urls`): a grant to one
10472
- * asset, by ID or external ID, until it expires, serving the original only when asked. The mock's
10586
+ * asset, by ID or external ID, until it expires, ending in the resource it was signed for and
10587
+ * serving the original only when signed for it. The mock's
10473
10588
  * grant is readable (its asset, original access and expiry), unlike the CDN's, and only the
10474
10589
  * mock's CDN accepts it.
10475
10590
  */
10476
10591
  async signAssetUrl(body) {
10477
- for (const key of [
10592
+ const fields = [
10478
10593
  "assetId",
10479
10594
  "externalId",
10480
10595
  "expiresIn",
10481
- "original"
10482
- ]) if (body[key] === null) throw invalidField("validation/invalid-type", key);
10596
+ "resource"
10597
+ ];
10598
+ const unknown = Object.keys(body).find((key) => !fields.includes(key));
10599
+ if (unknown !== void 0) throw invalidField("validation/unknown-field", unknown);
10600
+ for (const key of fields) if (body[key] === null) throw invalidField("validation/invalid-type", key);
10483
10601
  const { assetId, externalId } = body;
10484
10602
  if (assetId === void 0 === (externalId === void 0)) throw new ApiFailure(400, API_ERROR_CODES.INVALID_REQUEST, "Send either assetId or externalId", { issues: [{
10485
10603
  path: "",
@@ -10490,8 +10608,8 @@ var MockCalmLensApi = class {
10490
10608
  if (typeof expiresIn !== "number" || !Number.isInteger(expiresIn)) throw invalidField("validation/invalid-type", "expiresIn");
10491
10609
  if (expiresIn < 1) throw invalidField("validation/too-small", "expiresIn");
10492
10610
  if (expiresIn > 86400) throw invalidField("validation/too-big", "expiresIn");
10493
- const original = body.original ?? false;
10494
- if (typeof original !== "boolean") throw invalidField("validation/invalid-type", "original");
10611
+ const { resource } = body;
10612
+ if (resource !== void 0 && (typeof resource !== "string" || !Object.hasOwn(ASSET_RESOURCE_PATHS, resource))) throw invalidField("validation/invalid-value", "resource");
10495
10613
  let asset;
10496
10614
  if (externalId !== void 0) {
10497
10615
  asset = (await this.databaseStorage.listAssets(this.projectId)).find((candidate) => candidate.externalId === externalId);
@@ -10501,11 +10619,12 @@ var MockCalmLensApi = class {
10501
10619
  const expiresAt = this.now() + expiresIn * 1e3;
10502
10620
  const grant = encodeMockGrant({
10503
10621
  assetId: asset.id,
10504
- original,
10622
+ original: resource === "original",
10505
10623
  expiresAt
10506
10624
  });
10625
+ const path = resource === void 0 ? "" : `/${ASSET_RESOURCE_PATHS[resource]}`;
10507
10626
  return {
10508
- url: `${this.cdnBaseUrl}/assets/${encodeURIComponent(this.projectId)}/${grant}`,
10627
+ url: `${this.cdnBaseUrl}/assets/${encodeURIComponent(this.projectId)}/${grant}${path}`,
10509
10628
  expiresAt
10510
10629
  };
10511
10630
  }
@@ -10700,7 +10819,7 @@ var MockCalmLensApi = class {
10700
10819
  source: "calmlens"
10701
10820
  }
10702
10821
  });
10703
- const type = inferAssetType(fields.url === void 0 ? contentType ?? "" : void 0);
10822
+ const type = fields.url === void 0 ? inferAssetType(contentType ?? "") : urlAssetType(fields.url);
10704
10823
  if (part) {
10705
10824
  if (part.partNumber > 1) throw fail(API_ERROR_CODES.USE_UPLOAD_PART);
10706
10825
  const partSize = bytes.byteLength;
@@ -10797,7 +10916,9 @@ var MockCalmLensApi = class {
10797
10916
  timeline: null
10798
10917
  },
10799
10918
  ocr: null,
10800
- linkDetection: null
10919
+ linkDetection: null,
10920
+ personDetection: null,
10921
+ faceDetection: null
10801
10922
  }
10802
10923
  };
10803
10924
  if (part) {
@@ -10927,26 +11048,40 @@ var MockCalmLensApi = class {
10927
11048
  const next = await this.applyOutcome(asset, decision.status, "policy", decision.report(this.now()));
10928
11049
  const features = this.processingOptions.get(asset.id)?.features;
10929
11050
  if (next.classification.status !== "completed" || asset.type !== "image") return next;
11051
+ const ocr = features?.ocr?.enabled === true ? decision.ocrFindings : void 0;
11052
+ const ages = features?.faceDetection?.ageEstimation === true;
10930
11053
  return {
10931
11054
  ...next,
11055
+ ...ocr?.text != null && next.content.status === "stored" && { content: {
11056
+ ...next.content,
11057
+ extractedText: {
11058
+ type: "string",
11059
+ content: ocr.text
11060
+ }
11061
+ } },
10932
11062
  classification: {
10933
11063
  ...next.classification,
10934
11064
  ...features?.ocr?.enabled === true && { ocr: {
10935
11065
  status: "evaluated",
10936
- textRegions: []
11066
+ textRegions: ocr?.textRegions ?? []
10937
11067
  } },
10938
11068
  ...features?.linkDetection?.enabled !== false && { linkDetection: {
10939
11069
  status: "evaluated",
10940
- qrCodes: [],
10941
- links: []
11070
+ ...decision.linkFindings ?? {
11071
+ qrCodes: [],
11072
+ links: []
11073
+ }
10942
11074
  } },
10943
11075
  ...features?.personDetection?.enabled === true && { personDetection: {
10944
11076
  status: "evaluated",
10945
- people: []
11077
+ people: decision.personFindings ?? []
10946
11078
  } },
10947
11079
  ...features?.faceDetection?.enabled === true && { faceDetection: {
10948
11080
  status: "evaluated",
10949
- faces: []
11081
+ faces: (decision.faceFindings ?? []).map(({ ageRange, ...face }) => ages && ageRange ? {
11082
+ ...face,
11083
+ ageRange
11084
+ } : face)
10950
11085
  } }
10951
11086
  }
10952
11087
  };
@@ -11931,8 +12066,8 @@ var MockCalmLensServerClient = class extends CalmLensServerClient {
11931
12066
  }
11932
12067
  /**
11933
12068
  * Requests `operation` sends, oldest first. A request several methods send matches each of
11934
- * them: `callsTo("text.classify")` also lists `assets.classify` text uploads, and
11935
- * `callsTo("assets.waitForDecision")` the `assets.retrieve` requests it polls with.
12069
+ * them: `callsTo("assets.waitForDecision")` lists the `assets.retrieve` requests it polls
12070
+ * with. A text upload is `text.classify`'s request and a file or URL upload `assets.classify`'s.
11936
12071
  */
11937
12072
  callsTo(operation) {
11938
12073
  return this.#api.calls.filter(({ operations }) => operations.includes(operation)).map(({ call }) => call);
@@ -1,5 +1,5 @@
1
- import "./CalmLensTypes-DxxyZt2L.js";
2
- import { K as AssetOptions, Z as AssetView, ct as DocumentViewerOptions, dt as TextViewerOptions, lt as PdfAssetOptions, pt as ViewerOptions, q as AssetSession, ut as SpreadsheetViewerOptions } from "./Core-Dhijt6JU.js";
1
+ import "./CalmLensTypes-CtO4Dieu.js";
2
+ import { K as AssetOptions, Z as AssetView, ct as DocumentViewerOptions, dt as TextViewerOptions, lt as PdfAssetOptions, pt as ViewerOptions, q as AssetSession, ut as SpreadsheetViewerOptions } from "./Core-BJaLU71Q.js";
3
3
  import "pdfjs-dist";
4
4
  /** A viewer mounted into an element, which it owns the children of. */
5
5
  interface AssetViewer<O extends ViewerOptions = ViewerOptions> {
@@ -1,5 +1,5 @@
1
- import { a as appendAssetLocation } from "./ModerationContextLimits-ZIlK9n2X.js";
2
- import "./Core-kYMRW5C1.js";
1
+ import { o as appendAssetLocation } from "./ModerationContextLimits-IH2zX1wg.js";
2
+ import "./Core-dzPyrg_G.js";
3
3
  // src/ui/viewers/PdfLoader.ts
4
4
  let loading;
5
5
  /**
package/esm/ui.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, I as UploadItem, J as AssetSessionState, K as AssetOptions, L as UploadSnapshot, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, h as UploaderProps, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, k as CalmLensUpload, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage, z as createUploadController } from "./Core-Dhijt6JU.js";
2
- import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui-BSm_qphN.js";
1
+ import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, I as UploadItem, J as AssetSessionState, K as AssetOptions, L as UploadSnapshot, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, h as UploaderProps, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, k as CalmLensUpload, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage, z as createUploadController } from "./Core-BJaLU71Q.js";
2
+ import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui-BGywTQ2M.js";
3
3
  export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, type AssetDisplay, type AssetDisplayOptions, type AssetDocumentOptions, type AssetEventHandlers, type AssetImageOptions, type AssetImageSource, type AssetOptions, type AssetProps, AssetSession, type AssetSessionState, type AssetSpreadsheetOptions, type AssetVideoOptions, type AssetView, type AssetViewer, type AssetViewerKind, AssetViewerMount, AssetViewerName, AssetViewerOptionsByKind, CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensProvidedOptions, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, type DocumentViewerOptions, ICONS, ICON_ATTRIBUTES, INSTANT_LOAD_MS, type IconName, type MediaPlayback, MediaStreamPlayer, type MountedViewerKind, type PdfAssetOptions, type ProgressFetchOptions, type SpreadsheetCell, type SpreadsheetRow, type SpreadsheetSheet, type SpreadsheetViewerOptions, type TextViewerOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, VIEWER_STYLES, type ViewerAsset, type ViewerMessages, type ViewerOptions, type ViewerState, type ViewerTextOptions, 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/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-CgIG3knW.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-kYMRW5C1.js";
3
- import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-D-14HWII.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-BovDqg9n.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-dzPyrg_G.js";
3
+ import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-DKjI8S2K.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.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { O as CalmLensAppClientOptions, en as ViewerClaims, g as AssetModerationStatus, i as AssetAvailability } from "./CalmLensTypes-DxxyZt2L.js";
2
- import "./index-CUA-HDNu.js";
3
- import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, J as AssetSessionState, K as AssetOptions, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage } from "./Core-Dhijt6JU.js";
4
- import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-CdOfuIcV.js";
5
- import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui-BSm_qphN.js";
1
+ import { O as CalmLensAppClientOptions, en as ViewerClaims, g as AssetModerationStatus, i as AssetAvailability } from "./CalmLensTypes-CtO4Dieu.js";
2
+ import "./index-DQUZYLVY.js";
3
+ import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, J as AssetSessionState, K as AssetOptions, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage } from "./Core-BJaLU71Q.js";
4
+ import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-CRbCsX7a.js";
5
+ import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui-BGywTQ2M.js";
6
6
  import { App, MaybeRefOrGetter, PropType, ShallowRef } from "vue";
7
7
  /** Shows a text asset's text, escaped, in a scrolling region. */
8
8
  export declare const CalmLensTextViewer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
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-CgIG3knW.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-kYMRW5C1.js";
3
- import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-D-14HWII.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-BovDqg9n.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-dzPyrg_G.js";
3
+ import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-DKjI8S2K.js";
4
4
  import { c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
5
- import { t as createUploadController } from "./BrowserUpload-BaKFKEBz.js";
5
+ import { t as createUploadController } from "./BrowserUpload-BKrrHzoh.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.27.6",
3
+ "version": "0.28.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",