calmlens 0.27.6 → 0.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/calmlens.js +24 -13
- package/cjs/{BrowserUpload-CdOfuIcV.d.ts → BrowserUpload-CRbCsX7a.d.ts} +2 -2
- package/cjs/{BrowserUpload-GQtZti-D.js → BrowserUpload-Dz4UwTTJ.js} +1 -1
- package/cjs/{CalmLensAppClient-Bwt3gP0C.js → CalmLensAppClient-B0QZ1oJV.js} +2 -2
- package/cjs/{CalmLensAppClient-Btp8f-34.d.ts → CalmLensAppClient-B3u6BlP5.d.ts} +1 -1
- package/cjs/{CalmLensOptionKeys--gTpTkwt.js → CalmLensOptionKeys-Cat8CgOn.js} +2 -2
- package/cjs/{CalmLensServerClient-C3kaPLUZ.d.ts → CalmLensServerClient-B8ntjNL3.d.ts} +6 -6
- package/cjs/{CalmLensServerClient-BYMzGkQK.js → CalmLensServerClient-CQdvhCGg.js} +9 -9
- package/cjs/{CalmLensTypes-DxxyZt2L.d.ts → CalmLensTypes-CtO4Dieu.d.ts} +6 -3
- package/cjs/{Core-Dhijt6JU.d.ts → Core-BJaLU71Q.d.ts} +2 -2
- package/cjs/{Core-52DVaX7d.js → Core-DCnnUsgF.js} +7 -4
- package/cjs/{ModerationContextLimits-DJyIjzIn.js → ModerationContextLimits-_knOVCH0.js} +43 -6
- package/cjs/{ReactUpload-BuqLPgNr.d.ts → ReactUpload-BGUkcMpg.d.ts} +1 -1
- package/cjs/{ReactUpload-DHuhGYsr.js → ReactUpload-BtmIrdky.js} +1 -1
- package/{esm/TestTriggers-Dnukm-jm-DoEB7jJc.d.ts → cjs/TestTriggers-dognME9k-PWyIfHMI.d.ts} +1 -2
- package/cjs/{TestTriggers-DP4m92jg-C0HD-A4r.js → TestTriggers-uL2Ec8Vt-cPmmKvYd.js} +1 -2
- package/cjs/{UploadController-ChzDPMmm.js → UploadController-CEL3N4Ae.js} +2 -2
- package/{esm/WebhookPayload-D_yWJA9M.d.ts → cjs/WebhookPayload-DZadhbAJ.d.ts} +1 -1
- package/cjs/app.d.ts +4 -4
- package/cjs/app.js +2 -2
- package/cjs/elements.d.ts +4 -4
- package/cjs/elements.js +4 -4
- package/cjs/{index-CUA-HDNu.d.ts → index-DQUZYLVY.d.ts} +2 -2
- package/cjs/index.d.ts +3 -3
- package/cjs/index.js +1 -1
- package/cjs/react-native.d.ts +2 -2
- package/cjs/react-native.js +5 -5
- package/cjs/react.d.ts +4 -4
- package/cjs/react.js +5 -5
- package/cjs/server.d.ts +4 -4
- package/cjs/server.js +2 -2
- package/cjs/test-inputs.d.ts +1 -1
- package/cjs/test-inputs.js +13 -13
- package/cjs/testing.d.ts +36 -7
- package/cjs/testing.js +73 -26
- package/cjs/{ui-BSm_qphN.d.ts → ui-BGywTQ2M.d.ts} +2 -2
- package/cjs/{ui-C1_SDSiq.js → ui-DVQm0TFJ.js} +2 -2
- package/cjs/ui.d.ts +2 -2
- package/cjs/ui.js +3 -3
- package/cjs/vue.d.ts +5 -5
- package/cjs/vue.js +4 -4
- package/esm/{BrowserUpload-CdOfuIcV.d.ts → BrowserUpload-CRbCsX7a.d.ts} +2 -2
- package/esm/{BrowserUpload-BaKFKEBz.js → BrowserUpload-DSq5Ezo1.js} +1 -1
- package/esm/{CalmLensAppClient-DM6c3pGC.js → CalmLensAppClient-B1QpSXYm.js} +2 -2
- package/esm/{CalmLensAppClient-Btp8f-34.d.ts → CalmLensAppClient-B3u6BlP5.d.ts} +1 -1
- package/esm/{CalmLensOptionKeys-CKZs8i3_.js → CalmLensOptionKeys-BYqFZ0FP.js} +2 -2
- package/esm/{CalmLensServerClient-C3kaPLUZ.d.ts → CalmLensServerClient-B8ntjNL3.d.ts} +6 -6
- package/esm/{CalmLensServerClient-Da2UfUo4.js → CalmLensServerClient-D2Vr_jTR.js} +9 -9
- package/esm/{CalmLensTypes-DxxyZt2L.d.ts → CalmLensTypes-CtO4Dieu.d.ts} +6 -3
- package/esm/{Core-Dhijt6JU.d.ts → Core-BJaLU71Q.d.ts} +2 -2
- package/esm/{Core-kYMRW5C1.js → Core-Dz7BAias.js} +7 -4
- package/esm/{ModerationContextLimits-ZIlK9n2X.js → ModerationContextLimits-DaFaXt45.js} +26 -7
- package/esm/{ReactUpload-BuqLPgNr.d.ts → ReactUpload-BGUkcMpg.d.ts} +1 -1
- package/esm/{ReactUpload-CipY3cmO.js → ReactUpload-kSzn3SOj.js} +1 -1
- package/{cjs/TestTriggers-Dnukm-jm-DoEB7jJc.d.ts → esm/TestTriggers-dognME9k-PWyIfHMI.d.ts} +1 -2
- package/esm/{TestTriggers-DP4m92jg-DhOI4S1V.js → TestTriggers-uL2Ec8Vt-DYbTEJWm.js} +1 -2
- package/esm/{UploadController-D-14HWII.js → UploadController--Qz3DP2W.js} +2 -2
- package/{cjs/WebhookPayload-D_yWJA9M.d.ts → esm/WebhookPayload-DZadhbAJ.d.ts} +1 -1
- package/esm/app.d.ts +4 -4
- package/esm/app.js +2 -2
- package/esm/elements.d.ts +4 -4
- package/esm/elements.js +4 -4
- package/esm/{index-CUA-HDNu.d.ts → index-DQUZYLVY.d.ts} +2 -2
- package/esm/index.d.ts +3 -3
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +2 -2
- package/esm/react-native.js +5 -5
- package/esm/react.d.ts +4 -4
- package/esm/react.js +5 -5
- package/esm/server.d.ts +4 -4
- package/esm/server.js +2 -2
- package/esm/test-inputs.d.ts +1 -1
- package/esm/test-inputs.js +1 -1
- package/esm/testing.d.ts +36 -7
- package/esm/testing.js +64 -17
- package/esm/{ui-CgIG3knW.js → ui-B951EpwC.js} +2 -2
- package/esm/{ui-BSm_qphN.d.ts → ui-BGywTQ2M.d.ts} +2 -2
- package/esm/ui.d.ts +2 -2
- package/esm/ui.js +3 -3
- package/esm/vue.d.ts +5 -5
- package/esm/vue.js +4 -4
- package/package.json +1 -1
package/esm/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as CalmLensInvalidArgumentError, G as CalmLensApiError, I as SDK_VERSION, J as CalmLensCancelledError, K as CalmLensAuthenticationError, Q as CalmLensError, W as CALMLENS_ERROR_CODES, X as CalmLensConflictError, Y as CalmLensConfigurationError, Z as CalmLensConnectionError, a as CDN_RESOURCES, at as CalmLensServerError, ct as CalmLensWebhookVerificationError, et as CalmLensInvalidResponseError, it as CalmLensRateLimitError, n as MODERATION_CONTEXT_USED_ITEMS, nt as CalmLensPayloadTooLargeError, ot as CalmLensTimeoutError, p as DEFAULT_CDN_BASE_URL, q as CalmLensBadRequestError, r as selectModerationContextItems, rt as CalmLensPermissionDeniedError, st as CalmLensUnprocessableEntityError, t as MODERATION_CONTEXT_USED_CHARACTERS, tt as CalmLensNotFoundError, u as getAssetInfo, z as AUTO_PAGING_TO_ARRAY_MAX } from "./ModerationContextLimits-DaFaXt45.js";
|
|
2
2
|
import "./index.js";
|
|
3
|
-
import { a as WEBHOOK_TIMESTAMP_HEADER, c as isNewerAssetEvent, 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-
|
|
3
|
+
import { a as WEBHOOK_TIMESTAMP_HEADER, c as isNewerAssetEvent, 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-D2Vr_jTR.js";
|
|
4
4
|
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, MODERATION_CONTEXT_USED_CHARACTERS, MODERATION_CONTEXT_USED_ITEMS, SDK_VERSION, WEBHOOK_DELIVERY_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, WEBHOOK_TIMESTAMP_HEADER, getAssetInfo, getEventFact, getEventFacts, isNewerAssetEvent, isTestWebhookEvent, parseWebhookEvent, selectModerationContextItems, verifyWebhookSignature };
|
package/esm/test-inputs.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TEST_FACE_AGE_PRESETS, c as TestDetections, d as detectTestTrigger, f as generateTestTextCode, h as testInputForSignal, i as TEST_FACE_AGE_MAX, l as TestInput, m as paintTestImage, n as TEST_DETECTIONS_MAX, o as TEST_INPUT_KEY_PATTERN, p as getImageTestCategories, r as TEST_DETECTION_BOX_MAX, s as TEST_INPUT_PRESETS, t as ClassificationTestSignal, u as detectTestImage } from "./TestTriggers-
|
|
1
|
+
import { a as TEST_FACE_AGE_PRESETS, c as TestDetections, d as detectTestTrigger, f as generateTestTextCode, h as testInputForSignal, i as TEST_FACE_AGE_MAX, l as TestInput, m as paintTestImage, n as TEST_DETECTIONS_MAX, o as TEST_INPUT_KEY_PATTERN, p as getImageTestCategories, r as TEST_DETECTION_BOX_MAX, s as TEST_INPUT_PRESETS, t as ClassificationTestSignal, u as detectTestImage } from "./TestTriggers-dognME9k-PWyIfHMI.js";
|
|
2
2
|
export { type ClassificationTestSignal, TEST_DETECTIONS_MAX, TEST_DETECTION_BOX_MAX, TEST_FACE_AGE_MAX, TEST_FACE_AGE_PRESETS, TEST_INPUT_KEY_PATTERN, TEST_INPUT_PRESETS, type TestDetections, type TestInput, detectTestImage, detectTestTrigger, generateTestTextCode, getImageTestCategories, paintTestImage, testInputForSignal };
|
package/esm/test-inputs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as TEST_DETECTIONS_MAX, n as TEST_DETECTION_BOX_MAX, r as TEST_FACE_AGE_MAX, i as TEST_FACE_AGE_PRESETS, a as TEST_INPUT_KEY_PATTERN, o as TEST_INPUT_PRESETS, s as detectTestImage, c as detectTestTrigger, l as generateTestTextCode, u as getImageTestCategories, f as paintTestImage, p as testInputForSignal } from "./TestTriggers-
|
|
1
|
+
export { t as TEST_DETECTIONS_MAX, n as TEST_DETECTION_BOX_MAX, r as TEST_FACE_AGE_MAX, i as TEST_FACE_AGE_PRESETS, a as TEST_INPUT_KEY_PATTERN, o as TEST_INPUT_PRESETS, s as detectTestImage, c as detectTestTrigger, l as generateTestTextCode, u as getImageTestCategories, f as paintTestImage, p as testInputForSignal } from "./TestTriggers-uL2Ec8Vt-DYbTEJWm.js";
|
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-
|
|
2
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
3
|
-
import { I as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-
|
|
4
|
-
import { t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
5
|
-
import { t as ClassificationTestSignal } from "./TestTriggers-
|
|
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,15 @@ 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"> = 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];
|
|
67
76
|
/** Why a decision waits for human review: `sampled`, or `uncertain` about some categories. */
|
|
68
77
|
type MockPendingReviewReason = "sampled" | "uncertain";
|
|
69
78
|
/**
|
|
@@ -90,6 +99,26 @@ export declare class MockDecision {
|
|
|
90
99
|
* decision (`decide` on the mock) clears it; `assets.decide` doesn't, as with the API.
|
|
91
100
|
*/
|
|
92
101
|
pendingReview(reason: MockPendingReviewReason, uncertainCategories?: Category[]): this;
|
|
102
|
+
/**
|
|
103
|
+
* The text OCR finds in an image, for an upload that turns OCR on: `classification.ocr` reports
|
|
104
|
+
* `textRegions`, and `content.extractedText` holds `text` when the upload keeps its content.
|
|
105
|
+
*/
|
|
106
|
+
withOcr(text: string | null, textRegions?: MockTextRegion[]): this;
|
|
107
|
+
/**
|
|
108
|
+
* The QR codes and links link detection finds in an image, reported as
|
|
109
|
+
* `classification.linkDetection` unless the upload turns link detection off.
|
|
110
|
+
*/
|
|
111
|
+
withLinkDetection(qrCodes?: MockQrCode[], links?: MockDetectedLink[]): this;
|
|
112
|
+
/** @internal What `withOcr` set, if anything. */
|
|
113
|
+
get ocrFindings(): {
|
|
114
|
+
text: string | null;
|
|
115
|
+
textRegions: MockTextRegion[];
|
|
116
|
+
} | undefined;
|
|
117
|
+
/** @internal What `withLinkDetection` set, if anything. */
|
|
118
|
+
get linkFindings(): {
|
|
119
|
+
qrCodes: MockQrCode[];
|
|
120
|
+
links: MockDetectedLink[];
|
|
121
|
+
} | undefined;
|
|
93
122
|
/**
|
|
94
123
|
* The report a decided asset gets, as the API sends it: every category (unflagged ones
|
|
95
124
|
* evaluated with score 0), policy-adjusted results and the automated status and
|
|
@@ -271,7 +300,7 @@ interface MockCalmLensServerClientOptions extends Omit<CalmLensServerClientOptio
|
|
|
271
300
|
/**
|
|
272
301
|
* Returns a new ID for an object of the kind `prefix` names (`asset`, `fldr`, `hl`, `hle`,
|
|
273
302
|
* `lens`, `evt` or `rev`). The default is like the API's: the prefix, `_` and 20 random
|
|
274
|
-
* base62 characters, such as `
|
|
303
|
+
* base62 characters, such as `asset_e5Gm2Rk8XqT3wLp9VbN4`.
|
|
275
304
|
*/
|
|
276
305
|
createId?: (prefix: IdPrefix) => string;
|
|
277
306
|
/**
|
|
@@ -401,4 +430,4 @@ export declare const createWebhookHeaders: (options: {
|
|
|
401
430
|
deliveryId: string;
|
|
402
431
|
timestampSeconds?: number;
|
|
403
432
|
}) => 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 };
|
|
433
|
+
export { type MockAssetOutcome, type MockCalmLensAppClientOptions, type MockCalmLensCall, type MockCalmLensOperation, type MockCalmLensServerClientOptions, type MockDatabaseStorage, type MockDetectedLink, 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
|
|
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-
|
|
3
|
-
import { _ as validateAssetPayload, a as MOCK_HOOKS, g as assetToData, h as assetDataToUint8Array } from "./CalmLensOptionKeys-
|
|
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-DaFaXt45.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-D2Vr_jTR.js";
|
|
3
|
+
import { _ as validateAssetPayload, a as MOCK_HOOKS, g as assetToData, h as assetDataToUint8Array } from "./CalmLensOptionKeys-BYqFZ0FP.js";
|
|
4
4
|
import { t as hmacSha256Hex } from "./CryptoUtils-BLCa-oZe-DKr3LmN6.js";
|
|
5
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
6
|
-
import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController
|
|
7
|
-
import { d as getTestInputTag, h as CLASSIFICATION_CATEGORIES, m as lazySchema } from "./TestTriggers-
|
|
5
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-B1QpSXYm.js";
|
|
6
|
+
import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController--Qz3DP2W.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,8 @@ var MockDecision = class {
|
|
|
8337
8337
|
#flags = /* @__PURE__ */ new Map();
|
|
8338
8338
|
#notEvaluated = /* @__PURE__ */ new Set();
|
|
8339
8339
|
#pendingReview;
|
|
8340
|
+
#ocr;
|
|
8341
|
+
#linkDetection;
|
|
8340
8342
|
constructor(status) {
|
|
8341
8343
|
if (!OUTCOMES.includes(status)) throw invalidArgument(`status must be one of ${OUTCOMES.join(", ")}`);
|
|
8342
8344
|
this.status = status;
|
|
@@ -8386,6 +8388,36 @@ var MockDecision = class {
|
|
|
8386
8388
|
};
|
|
8387
8389
|
return this;
|
|
8388
8390
|
}
|
|
8391
|
+
/**
|
|
8392
|
+
* The text OCR finds in an image, for an upload that turns OCR on: `classification.ocr` reports
|
|
8393
|
+
* `textRegions`, and `content.extractedText` holds `text` when the upload keeps its content.
|
|
8394
|
+
*/
|
|
8395
|
+
withOcr(text, textRegions = []) {
|
|
8396
|
+
this.#ocr = {
|
|
8397
|
+
text,
|
|
8398
|
+
textRegions: structuredClone(textRegions)
|
|
8399
|
+
};
|
|
8400
|
+
return this;
|
|
8401
|
+
}
|
|
8402
|
+
/**
|
|
8403
|
+
* The QR codes and links link detection finds in an image, reported as
|
|
8404
|
+
* `classification.linkDetection` unless the upload turns link detection off.
|
|
8405
|
+
*/
|
|
8406
|
+
withLinkDetection(qrCodes = [], links = []) {
|
|
8407
|
+
this.#linkDetection = {
|
|
8408
|
+
qrCodes: structuredClone(qrCodes),
|
|
8409
|
+
links: structuredClone(links)
|
|
8410
|
+
};
|
|
8411
|
+
return this;
|
|
8412
|
+
}
|
|
8413
|
+
/** @internal What `withOcr` set, if anything. */
|
|
8414
|
+
get ocrFindings() {
|
|
8415
|
+
return this.#ocr && structuredClone(this.#ocr);
|
|
8416
|
+
}
|
|
8417
|
+
/** @internal What `withLinkDetection` set, if anything. */
|
|
8418
|
+
get linkFindings() {
|
|
8419
|
+
return this.#linkDetection && structuredClone(this.#linkDetection);
|
|
8420
|
+
}
|
|
8389
8421
|
#checkCategory(category) {
|
|
8390
8422
|
if (!MOCK_CATEGORIES.includes(category)) throw invalidArgument(`${category} is not a CalmLens category`);
|
|
8391
8423
|
}
|
|
@@ -10469,17 +10501,21 @@ var MockCalmLensApi = class {
|
|
|
10469
10501
|
}
|
|
10470
10502
|
/**
|
|
10471
10503
|
* 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,
|
|
10504
|
+
* asset, by ID or external ID, until it expires, ending in the resource it was signed for and
|
|
10505
|
+
* serving the original only when signed for it. The mock's
|
|
10473
10506
|
* grant is readable (its asset, original access and expiry), unlike the CDN's, and only the
|
|
10474
10507
|
* mock's CDN accepts it.
|
|
10475
10508
|
*/
|
|
10476
10509
|
async signAssetUrl(body) {
|
|
10477
|
-
|
|
10510
|
+
const fields = [
|
|
10478
10511
|
"assetId",
|
|
10479
10512
|
"externalId",
|
|
10480
10513
|
"expiresIn",
|
|
10481
|
-
"
|
|
10482
|
-
]
|
|
10514
|
+
"resource"
|
|
10515
|
+
];
|
|
10516
|
+
const unknown = Object.keys(body).find((key) => !fields.includes(key));
|
|
10517
|
+
if (unknown !== void 0) throw invalidField("validation/unknown-field", unknown);
|
|
10518
|
+
for (const key of fields) if (body[key] === null) throw invalidField("validation/invalid-type", key);
|
|
10483
10519
|
const { assetId, externalId } = body;
|
|
10484
10520
|
if (assetId === void 0 === (externalId === void 0)) throw new ApiFailure(400, API_ERROR_CODES.INVALID_REQUEST, "Send either assetId or externalId", { issues: [{
|
|
10485
10521
|
path: "",
|
|
@@ -10490,8 +10526,8 @@ var MockCalmLensApi = class {
|
|
|
10490
10526
|
if (typeof expiresIn !== "number" || !Number.isInteger(expiresIn)) throw invalidField("validation/invalid-type", "expiresIn");
|
|
10491
10527
|
if (expiresIn < 1) throw invalidField("validation/too-small", "expiresIn");
|
|
10492
10528
|
if (expiresIn > 86400) throw invalidField("validation/too-big", "expiresIn");
|
|
10493
|
-
const
|
|
10494
|
-
if (typeof
|
|
10529
|
+
const { resource } = body;
|
|
10530
|
+
if (resource !== void 0 && (typeof resource !== "string" || !Object.hasOwn(ASSET_RESOURCE_PATHS, resource))) throw invalidField("validation/invalid-value", "resource");
|
|
10495
10531
|
let asset;
|
|
10496
10532
|
if (externalId !== void 0) {
|
|
10497
10533
|
asset = (await this.databaseStorage.listAssets(this.projectId)).find((candidate) => candidate.externalId === externalId);
|
|
@@ -10501,11 +10537,12 @@ var MockCalmLensApi = class {
|
|
|
10501
10537
|
const expiresAt = this.now() + expiresIn * 1e3;
|
|
10502
10538
|
const grant = encodeMockGrant({
|
|
10503
10539
|
assetId: asset.id,
|
|
10504
|
-
original,
|
|
10540
|
+
original: resource === "original",
|
|
10505
10541
|
expiresAt
|
|
10506
10542
|
});
|
|
10543
|
+
const path = resource === void 0 ? "" : `/${ASSET_RESOURCE_PATHS[resource]}`;
|
|
10507
10544
|
return {
|
|
10508
|
-
url: `${this.cdnBaseUrl}/assets/${encodeURIComponent(this.projectId)}/${grant}`,
|
|
10545
|
+
url: `${this.cdnBaseUrl}/assets/${encodeURIComponent(this.projectId)}/${grant}${path}`,
|
|
10509
10546
|
expiresAt
|
|
10510
10547
|
};
|
|
10511
10548
|
}
|
|
@@ -10927,18 +10964,28 @@ var MockCalmLensApi = class {
|
|
|
10927
10964
|
const next = await this.applyOutcome(asset, decision.status, "policy", decision.report(this.now()));
|
|
10928
10965
|
const features = this.processingOptions.get(asset.id)?.features;
|
|
10929
10966
|
if (next.classification.status !== "completed" || asset.type !== "image") return next;
|
|
10967
|
+
const ocr = features?.ocr?.enabled === true ? decision.ocrFindings : void 0;
|
|
10930
10968
|
return {
|
|
10931
10969
|
...next,
|
|
10970
|
+
...ocr?.text != null && next.content.status === "stored" && { content: {
|
|
10971
|
+
...next.content,
|
|
10972
|
+
extractedText: {
|
|
10973
|
+
type: "string",
|
|
10974
|
+
content: ocr.text
|
|
10975
|
+
}
|
|
10976
|
+
} },
|
|
10932
10977
|
classification: {
|
|
10933
10978
|
...next.classification,
|
|
10934
10979
|
...features?.ocr?.enabled === true && { ocr: {
|
|
10935
10980
|
status: "evaluated",
|
|
10936
|
-
textRegions: []
|
|
10981
|
+
textRegions: ocr?.textRegions ?? []
|
|
10937
10982
|
} },
|
|
10938
10983
|
...features?.linkDetection?.enabled !== false && { linkDetection: {
|
|
10939
10984
|
status: "evaluated",
|
|
10940
|
-
|
|
10941
|
-
|
|
10985
|
+
...decision.linkFindings ?? {
|
|
10986
|
+
qrCodes: [],
|
|
10987
|
+
links: []
|
|
10988
|
+
}
|
|
10942
10989
|
} },
|
|
10943
10990
|
...features?.personDetection?.enabled === true && { personDetection: {
|
|
10944
10991
|
status: "evaluated",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./Core-
|
|
1
|
+
import { o as appendAssetLocation } from "./ModerationContextLimits-DaFaXt45.js";
|
|
2
|
+
import "./Core-Dz7BAias.js";
|
|
3
3
|
// src/ui/viewers/PdfLoader.ts
|
|
4
4
|
let loading;
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./CalmLensTypes-
|
|
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-
|
|
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> {
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
3
|
-
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController
|
|
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-B951EpwC.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-Dz7BAias.js";
|
|
3
|
+
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController--Qz3DP2W.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-
|
|
2
|
-
import "./index-
|
|
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-
|
|
4
|
-
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-
|
|
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-
|
|
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-
|
|
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-
|
|
3
|
-
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController
|
|
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-B951EpwC.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-Dz7BAias.js";
|
|
3
|
+
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController--Qz3DP2W.js";
|
|
4
4
|
import { c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
|
|
5
|
-
import { t as createUploadController } from "./BrowserUpload-
|
|
5
|
+
import { t as createUploadController } from "./BrowserUpload-DSq5Ezo1.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.
|
|
3
|
+
"version": "0.28.0",
|
|
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",
|