calmlens 0.37.0 → 0.38.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 +31 -9
- package/cjs/{BrowserUpload-BOXt-BFy.js → BrowserUpload-BO_ZukUM.js} +1 -1
- package/{esm/BrowserUpload-CuG3tWSo.d.ts → cjs/BrowserUpload-BuTS7yTy.d.ts} +2 -2
- package/cjs/{CalmLensAppClient-Bt9GNyqS.js → CalmLensAppClient-DoNMg8Dh.js} +3 -3
- package/{esm/CalmLensAppClient-QqtovWE-.d.ts → cjs/CalmLensAppClient-L5x_sMOI.d.ts} +1 -1
- package/cjs/{CalmLensCdn-D4I4Km4j.js → CalmLensCdn-B_Tbwq10.js} +2 -2
- package/cjs/{CalmLensConnection-knkk2-BW.js → CalmLensConnection-Dhg1amnb.js} +25 -12
- package/cjs/{CalmLensError-ifj5rLmk.js → CalmLensError-C9g7GXfU.js} +7 -2
- package/{esm/CalmLensServerClient-csSQqHBt.d.ts → cjs/CalmLensServerClient-2H0ZpJlr.d.ts} +5 -5
- package/cjs/{CalmLensServerClient--L5qRzFd.js → CalmLensServerClient-D0wCcQNn.js} +16 -6
- package/cjs/{CalmLensTypes-_f7QVRtO.d.ts → CalmLensTypes-CCsoVr39.d.ts} +4 -4
- package/cjs/{Core-4iFxKJnY.d.ts → Core-B110Ug8_.d.ts} +2 -2
- package/cjs/{Core-CNsji7uR.js → Core-iNgZ8Cij.js} +3 -3
- package/cjs/{ReactUpload-DfioGW58.js → ReactUpload-BS8bYIhv.js} +1 -1
- package/cjs/{ReactUpload-4qd2xACg.d.ts → ReactUpload-CbtQtN6v.d.ts} +1 -1
- package/cjs/{UploadController-B-a2r2kN.js → UploadController-CVKtUCK0.js} +2 -2
- package/{esm/WebhookPayload-BJtggTLd.d.ts → cjs/WebhookPayload-_fvY2eu8.d.ts} +5 -3
- package/cjs/app.d.ts +4 -4
- package/cjs/app.js +3 -3
- package/cjs/elements.d.ts +4 -4
- package/cjs/elements.js +4 -4
- package/cjs/{index-IEA75nev.d.ts → index-Dk3I5YXf.d.ts} +2 -2
- package/cjs/index.d.ts +3 -3
- package/cjs/index.js +2 -2
- package/cjs/react-native.d.ts +2 -2
- package/cjs/react-native.js +4 -4
- package/cjs/react.d.ts +4 -4
- package/cjs/react.js +5 -5
- package/cjs/server.d.ts +4 -4
- package/cjs/server.js +3 -3
- package/cjs/{CalmLensTestInputArguments-C6S09FVQ.js → test-inputs-BVJZjtFd.js} +156 -16
- package/cjs/{TestTriggers-CjDhhz78.d.ts → test-inputs-JaZaV9Up.d.ts} +20 -1
- package/cjs/test-inputs.d.ts +2 -18
- package/cjs/test-inputs.js +15 -126
- package/cjs/testing.d.ts +13 -15
- package/cjs/testing.js +55 -68
- package/cjs/{ui-BMQW3Hse.d.ts → ui--E_s-cDd.d.ts} +2 -2
- package/cjs/{ui-DOkuD90x.js → ui-CuO37F4u.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/{cjs/BrowserUpload-CuG3tWSo.d.ts → esm/BrowserUpload-BuTS7yTy.d.ts} +2 -2
- package/esm/{BrowserUpload-Ch67b69G.js → BrowserUpload-DxgiUXC2.js} +1 -1
- package/esm/{CalmLensAppClient-DEFSQC15.js → CalmLensAppClient-C7ScAfRx.js} +3 -3
- package/{cjs/CalmLensAppClient-QqtovWE-.d.ts → esm/CalmLensAppClient-L5x_sMOI.d.ts} +1 -1
- package/esm/{CalmLensCdn-xvzJyv9X.js → CalmLensCdn-CW5Fn3ph.js} +2 -2
- package/esm/{CalmLensConnection-D6BVOMri.js → CalmLensConnection-Blv8JyLF.js} +25 -12
- package/esm/{CalmLensError-C15tWu8W.js → CalmLensError-DjkibkdI.js} +7 -2
- package/{cjs/CalmLensServerClient-csSQqHBt.d.ts → esm/CalmLensServerClient-2H0ZpJlr.d.ts} +5 -5
- package/esm/{CalmLensServerClient-BGz_olSn.js → CalmLensServerClient-C7n6EzVd.js} +16 -6
- package/esm/{CalmLensTypes-_f7QVRtO.d.ts → CalmLensTypes-CCsoVr39.d.ts} +4 -4
- package/esm/{Core-4iFxKJnY.d.ts → Core-B110Ug8_.d.ts} +2 -2
- package/esm/{Core-Cj91IL4-.js → Core-BRrPxS4i.js} +3 -3
- package/esm/{ReactUpload-Bg4-5rV2.js → ReactUpload-BGPktblV.js} +1 -1
- package/esm/{ReactUpload-4qd2xACg.d.ts → ReactUpload-CbtQtN6v.d.ts} +1 -1
- package/esm/{UploadController-CpLvD8W-.js → UploadController-CQ4NouIU.js} +2 -2
- package/{cjs/WebhookPayload-BJtggTLd.d.ts → esm/WebhookPayload-_fvY2eu8.d.ts} +5 -3
- package/esm/app.d.ts +4 -4
- package/esm/app.js +3 -3
- package/esm/elements.d.ts +4 -4
- package/esm/elements.js +4 -4
- package/esm/{index-IEA75nev.d.ts → index-Dk3I5YXf.d.ts} +2 -2
- package/esm/index.d.ts +3 -3
- package/esm/index.js +2 -2
- package/esm/react-native.d.ts +2 -2
- package/esm/react-native.js +4 -4
- package/esm/react.d.ts +4 -4
- package/esm/react.js +5 -5
- package/esm/server.d.ts +4 -4
- package/esm/server.js +3 -3
- package/esm/{CalmLensTestInputArguments-DS_3mt1C.js → test-inputs-DizPp8_w.js} +145 -5
- package/esm/{TestTriggers-CjDhhz78.d.ts → test-inputs-JaZaV9Up.d.ts} +20 -1
- package/esm/test-inputs.d.ts +2 -18
- package/esm/test-inputs.js +1 -115
- package/esm/testing.d.ts +13 -15
- package/esm/testing.js +44 -57
- package/esm/{ui-BMQW3Hse.d.ts → ui--E_s-cDd.d.ts} +2 -2
- package/esm/{ui-CGrWIVKa.js → ui-B-QOHuVI.js} +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/test-inputs.d.ts
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
|
|
3
|
-
export declare const generateTestTextCode: (scenario: TestInput | ClassificationTestSignal, key: string) => Promise<string>;
|
|
4
|
-
/** A painted test image: its RGBA pixels, row by row, and the same image as PNG bytes. */
|
|
5
|
-
export interface TestImage {
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
rgba: Uint8Array;
|
|
9
|
-
/** The image as a PNG, to upload as it is. */
|
|
10
|
-
png: Uint8Array;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* The test image for `scenario`, signed with the project's test input key. Upload its `png` bytes
|
|
14
|
-
* (or encode `rgba` in another format: the image survives lossy formats and resizing) as the whole
|
|
15
|
-
* image, optionally on a plain single-colour border.
|
|
16
|
-
*/
|
|
17
|
-
export declare const paintTestImage: (scenario: TestInput | ClassificationTestSignal, key: string) => Promise<TestImage>;
|
|
18
|
-
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, getImageTestCategories, testInputForSignal };
|
|
1
|
+
import { _ as getImageTestCategories, a as MEDIA_TEST_SIGNALS, c as TEST_DETECTION_BOX_MAX, d as TEST_INPUT_KEY_PATTERN, f as TEST_INPUT_PRESETS, g as detectTestTrigger, h as detectTestImage, i as paintTestImage, l as TEST_FACE_AGE_MAX, m as TestInput, n as generateMediaTestCode, o as ClassificationTestSignal, p as TestDetections, r as generateTestTextCode, s as TEST_DETECTIONS_MAX, t as TestImage, u as TEST_FACE_AGE_PRESETS, v as testInputForSignal } from "./test-inputs-JaZaV9Up.js";
|
|
2
|
+
export { type ClassificationTestSignal, MEDIA_TEST_SIGNALS, TEST_DETECTIONS_MAX, TEST_DETECTION_BOX_MAX, TEST_FACE_AGE_MAX, TEST_FACE_AGE_PRESETS, TEST_INPUT_KEY_PATTERN, TEST_INPUT_PRESETS, type TestDetections, TestImage, type TestInput, detectTestImage, detectTestTrigger, generateMediaTestCode, generateTestTextCode, getImageTestCategories, paintTestImage, testInputForSignal };
|
package/esm/test-inputs.js
CHANGED
|
@@ -1,115 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// src/client/TestImagePng.ts
|
|
3
|
-
/**
|
|
4
|
-
* Encodes a painted test image as a PNG: 8-bit RGBA rows without filtering in stored deflate
|
|
5
|
-
* blocks, as every SDK writes it, so the bytes match across SDKs. Runs anywhere, with no
|
|
6
|
-
* compression library.
|
|
7
|
-
*/
|
|
8
|
-
function encodeTestImagePng(width, height, rgba) {
|
|
9
|
-
const stride = width * 4;
|
|
10
|
-
const raw = new Uint8Array((stride + 1) * height);
|
|
11
|
-
for (let row = 0; row < height; row++) raw.set(rgba.subarray(row * stride, (row + 1) * stride), row * (stride + 1) + 1);
|
|
12
|
-
const blocks = Math.max(1, Math.ceil(raw.length / 65535));
|
|
13
|
-
const stream = new Uint8Array(2 + raw.length + blocks * 5 + 4);
|
|
14
|
-
stream.set([120, 1]);
|
|
15
|
-
let position = 2;
|
|
16
|
-
for (let offset = 0; offset < raw.length || position === 2; offset += 65535) {
|
|
17
|
-
const block = raw.subarray(offset, offset + 65535);
|
|
18
|
-
const length = block.length;
|
|
19
|
-
stream.set([
|
|
20
|
-
offset + length >= raw.length ? 1 : 0,
|
|
21
|
-
length & 255,
|
|
22
|
-
length >> 8,
|
|
23
|
-
~length & 255,
|
|
24
|
-
~length >> 8 & 255
|
|
25
|
-
], position);
|
|
26
|
-
stream.set(block, position + 5);
|
|
27
|
-
position += 5 + length;
|
|
28
|
-
}
|
|
29
|
-
writeUint32(stream, position, adler32(raw));
|
|
30
|
-
const header = /* @__PURE__ */ new Uint8Array(13);
|
|
31
|
-
writeUint32(header, 0, width);
|
|
32
|
-
writeUint32(header, 4, height);
|
|
33
|
-
header.set([
|
|
34
|
-
8,
|
|
35
|
-
6,
|
|
36
|
-
0,
|
|
37
|
-
0,
|
|
38
|
-
0
|
|
39
|
-
], 8);
|
|
40
|
-
return concat([
|
|
41
|
-
Uint8Array.of(137, 80, 78, 71, 13, 10, 26, 10),
|
|
42
|
-
chunk("IHDR", header),
|
|
43
|
-
chunk("IDAT", stream),
|
|
44
|
-
chunk("IEND", /* @__PURE__ */ new Uint8Array(0))
|
|
45
|
-
]);
|
|
46
|
-
}
|
|
47
|
-
function chunk(kind, body) {
|
|
48
|
-
const typed = new Uint8Array(4 + body.length);
|
|
49
|
-
for (let i = 0; i < 4; i++) typed[i] = kind.charCodeAt(i);
|
|
50
|
-
typed.set(body, 4);
|
|
51
|
-
const out = new Uint8Array(12 + body.length);
|
|
52
|
-
writeUint32(out, 0, body.length);
|
|
53
|
-
out.set(typed, 4);
|
|
54
|
-
writeUint32(out, 8 + body.length, crc32(typed));
|
|
55
|
-
return out;
|
|
56
|
-
}
|
|
57
|
-
function writeUint32(target, offset, value) {
|
|
58
|
-
target[offset] = value >>> 24;
|
|
59
|
-
target[offset + 1] = value >>> 16 & 255;
|
|
60
|
-
target[offset + 2] = value >>> 8 & 255;
|
|
61
|
-
target[offset + 3] = value & 255;
|
|
62
|
-
}
|
|
63
|
-
function concat(parts) {
|
|
64
|
-
const out = new Uint8Array(parts.reduce((total, part) => total + part.length, 0));
|
|
65
|
-
let offset = 0;
|
|
66
|
-
for (const part of parts) {
|
|
67
|
-
out.set(part, offset);
|
|
68
|
-
offset += part.length;
|
|
69
|
-
}
|
|
70
|
-
return out;
|
|
71
|
-
}
|
|
72
|
-
let crcTable;
|
|
73
|
-
function crc32(bytes) {
|
|
74
|
-
if (!crcTable) {
|
|
75
|
-
crcTable = /* @__PURE__ */ new Uint32Array(256);
|
|
76
|
-
for (let n = 0; n < 256; n++) {
|
|
77
|
-
let c = n;
|
|
78
|
-
for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
|
|
79
|
-
crcTable[n] = c >>> 0;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
let crc = 4294967295;
|
|
83
|
-
for (const byte of bytes) crc = crcTable[(crc ^ byte) & 255] ^ crc >>> 8;
|
|
84
|
-
return (crc ^ 4294967295) >>> 0;
|
|
85
|
-
}
|
|
86
|
-
function adler32(bytes) {
|
|
87
|
-
let a = 1;
|
|
88
|
-
let b = 0;
|
|
89
|
-
for (const byte of bytes) {
|
|
90
|
-
a = (a + byte) % 65521;
|
|
91
|
-
b = (b + a) % 65521;
|
|
92
|
-
}
|
|
93
|
-
return (b << 16 | a) >>> 0;
|
|
94
|
-
}
|
|
95
|
-
// src/test-inputs.ts
|
|
96
|
-
/**
|
|
97
|
-
* Portable test inputs: presets and custom instances share one authenticated format. CalmLens
|
|
98
|
-
* recognises a code only as the whole text and a test image only as the whole
|
|
99
|
-
* upload, signed with the project's own key.
|
|
100
|
-
*/
|
|
101
|
-
/** A text code for `scenario`, signed with the project's test input key. */
|
|
102
|
-
const generateTestTextCode = (scenario, key) => withValidTestInputArguments(key, () => generateTestTextCode$1(scenario, key));
|
|
103
|
-
/**
|
|
104
|
-
* The test image for `scenario`, signed with the project's test input key. Upload its `png` bytes
|
|
105
|
-
* (or encode `rgba` in another format: the image survives lossy formats and resizing) as the whole
|
|
106
|
-
* image, optionally on a plain single-colour border.
|
|
107
|
-
*/
|
|
108
|
-
const paintTestImage = async (scenario, key) => {
|
|
109
|
-
const image = await withValidTestInputArguments(key, () => paintTestImage$1(scenario, key));
|
|
110
|
-
return {
|
|
111
|
-
...image,
|
|
112
|
-
png: encodeTestImagePng(image.width, image.height, image.rgba)
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
export { TEST_DETECTIONS_MAX, TEST_DETECTION_BOX_MAX, TEST_FACE_AGE_MAX, TEST_FACE_AGE_PRESETS, TEST_INPUT_KEY_PATTERN, TEST_INPUT_PRESETS, detectTestImage, detectTestTrigger, generateTestTextCode, getImageTestCategories, paintTestImage, testInputForSignal };
|
|
1
|
+
export { i as MEDIA_TEST_SIGNALS, a as TEST_DETECTIONS_MAX, o as TEST_DETECTION_BOX_MAX, s as TEST_FACE_AGE_MAX, c as TEST_FACE_AGE_PRESETS, l as TEST_INPUT_KEY_PATTERN, u as TEST_INPUT_PRESETS, d as detectTestImage, f as detectTestTrigger, t as generateMediaTestCode, n as generateTestTextCode, p as getImageTestCategories, r as paintTestImage, m as testInputForSignal } from "./test-inputs-DizPp8_w.js";
|
package/esm/testing.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Jt as SignedUploadToken, Kt as SignUploadTokenOptions, Ln as PermissionGrant, Nn as TypedEvent, O as CalmLensAppClientOptions, Rn as Folder, Vn as AssetBinaryPayloadInput, k as CalmLensServerClientOptions, m as AssetModeration, on as UploadPresetDefinition, 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 {
|
|
1
|
+
import { Jt as SignedUploadToken, Kt as SignUploadTokenOptions, Ln as PermissionGrant, Nn as TypedEvent, O as CalmLensAppClientOptions, Rn as Folder, Vn as AssetBinaryPayloadInput, k as CalmLensServerClientOptions, m as AssetModeration, on as UploadPresetDefinition, r as Asset } from "./CalmLensTypes-CCsoVr39.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-L5x_sMOI.js";
|
|
3
|
+
import { I as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-_fvY2eu8.js";
|
|
4
|
+
import { t as CalmLensServerClient } from "./CalmLensServerClient-2H0ZpJlr.js";
|
|
5
|
+
import { a as MEDIA_TEST_SIGNALS, n as generateMediaTestCode } from "./test-inputs-JaZaV9Up.js";
|
|
6
6
|
import "zod";
|
|
7
7
|
/**
|
|
8
8
|
* Signs a single-use upload token with `apiKey`, locally. `CalmLensServerClient` and
|
|
@@ -14,7 +14,6 @@ declare const signUploadTokenWithApiKey: (apiKey: string, options: SignUploadTok
|
|
|
14
14
|
now?: number;
|
|
15
15
|
nonce?: string;
|
|
16
16
|
}) => Promise<SignedUploadToken>;
|
|
17
|
-
export declare const MEDIA_TEST_SIGNALS: readonly ["sexual", "violence", "self-harm", "harassment", "hate", "criminal-activity", "personal-information", "profanity", "violence.graphic"];
|
|
18
17
|
export declare const MOCK_API_KEY_PREFIX = "sk_test_";
|
|
19
18
|
/**
|
|
20
19
|
* Creates a mock API key holding `grants`. Throws `sdk/invalid-argument`, naming the grant, for
|
|
@@ -188,7 +187,8 @@ interface MockModerationInput {
|
|
|
188
187
|
trigger: MockModerationTrigger;
|
|
189
188
|
/**
|
|
190
189
|
* `true` when the API would queue the work rather than answer with the decision: queued
|
|
191
|
-
* uploads,
|
|
190
|
+
* uploads, uploads of audio, video, documents, websites and plain text over 4 MiB (always
|
|
191
|
+
* moderated in the background, even when the caller waits), retries and `completeProcessing`.
|
|
192
192
|
*/
|
|
193
193
|
queued: boolean;
|
|
194
194
|
}
|
|
@@ -233,11 +233,11 @@ interface MockDatabaseStorage {
|
|
|
233
233
|
getAsset(assetId: string): Promise<Asset | undefined>;
|
|
234
234
|
listAssets(projectId: string): Promise<Asset[]>;
|
|
235
235
|
deleteAsset(assetId: string): Promise<void>;
|
|
236
|
-
createFolder
|
|
237
|
-
updateFolder
|
|
238
|
-
getFolder
|
|
239
|
-
listFolders
|
|
240
|
-
deleteFolder
|
|
236
|
+
createFolder(folder: Folder): Promise<Folder>;
|
|
237
|
+
updateFolder(folder: Folder): Promise<Folder>;
|
|
238
|
+
getFolder(folderId: string): Promise<Folder | undefined>;
|
|
239
|
+
listFolders(projectId: string): Promise<Folder[]>;
|
|
240
|
+
deleteFolder(folderId: string): Promise<void>;
|
|
241
241
|
}
|
|
242
242
|
export declare class InMemoryMockDatabaseStorage implements MockDatabaseStorage {
|
|
243
243
|
private readonly assets;
|
|
@@ -504,6 +504,4 @@ export declare const createWebhookHeaders: (options: {
|
|
|
504
504
|
deliveryId: string;
|
|
505
505
|
timestampSeconds?: number;
|
|
506
506
|
}) => Promise<Record<string, string>>;
|
|
507
|
-
|
|
508
|
-
export declare const generateMediaTestCode: (signal: ClassificationTestSignal, key: string) => Promise<string>;
|
|
509
|
-
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 MockRegionalDecision, type MockRequestFailure, type MockReviewDecision, type MockServedUrl, type MockStoredContent, type MockTextRegion, type MockUploadPreset, signUploadTokenWithApiKey as signUploadToken };
|
|
507
|
+
export { MEDIA_TEST_SIGNALS, 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 MockRegionalDecision, type MockRequestFailure, type MockReviewDecision, type MockServedUrl, type MockStoredContent, type MockTextRegion, type MockUploadPreset, generateMediaTestCode, signUploadTokenWithApiKey as signUploadToken };
|
package/esm/testing.js
CHANGED
|
@@ -1,37 +1,12 @@
|
|
|
1
|
-
import { C as invalidConfig, S as invalidArgument, T as API_ERROR_DEFINITIONS, l as CalmLensError, w as API_ERROR_CODES, x as SDK_ERROR_CODES } from "./CalmLensError-
|
|
2
|
-
import { F as sleep, M as getRejectedUploadMimeTypeError, N as normalizeUploadMimeType, O as MAX_IMAGE_UPLOAD_BYTES, S as validateAppClientOptions, _ as randomUuid, f as checkTransformOptions, h as parseTransformSelector, m as isAcceptedUploadMimeType, t as ASSET_RESOURCE_PATHS, w as validateServerClientOptions } from "./CalmLensCdn-
|
|
3
|
-
import { a as WEBHOOK_TIMESTAMP_HEADER, f as signUploadTokenWithApiKey, m as stringifyJsonCanonical, n as WEBHOOK_DELIVERY_HEADER, p as decodeUploadToken, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
4
|
-
import { _ as validateAssetPayload, g as assetToData, h as assetDataToUint8Array, n as MOCK_HOOKS } from "./CalmLensConnection-
|
|
1
|
+
import { C as invalidConfig, S as invalidArgument, T as API_ERROR_DEFINITIONS, l as CalmLensError, w as API_ERROR_CODES, x as SDK_ERROR_CODES } from "./CalmLensError-DjkibkdI.js";
|
|
2
|
+
import { F as sleep, M as getRejectedUploadMimeTypeError, N as normalizeUploadMimeType, O as MAX_IMAGE_UPLOAD_BYTES, S as validateAppClientOptions, _ as randomUuid, f as checkTransformOptions, h as parseTransformSelector, m as isAcceptedUploadMimeType, t as ASSET_RESOURCE_PATHS, w as validateServerClientOptions } from "./CalmLensCdn-CW5Fn3ph.js";
|
|
3
|
+
import { a as WEBHOOK_TIMESTAMP_HEADER, f as signUploadTokenWithApiKey, m as stringifyJsonCanonical, n as WEBHOOK_DELIVERY_HEADER, p as decodeUploadToken, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient } from "./CalmLensServerClient-C7n6EzVd.js";
|
|
4
|
+
import { _ as validateAssetPayload, g as assetToData, h as assetDataToUint8Array, n as MOCK_HOOKS } from "./CalmLensConnection-Blv8JyLF.js";
|
|
5
5
|
import { t as hmacSha256Hex } from "./CryptoUtils-BLCa-oZe-DKr3LmN6.js";
|
|
6
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
7
|
-
import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-
|
|
8
|
-
import { _ as CLASSIFICATION_CATEGORIES,
|
|
6
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-C7ScAfRx.js";
|
|
7
|
+
import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-CQ4NouIU.js";
|
|
8
|
+
import { _ as CLASSIFICATION_CATEGORIES, g as lazySchema, h as EU_COUNTRIES, i as MEDIA_TEST_SIGNALS, t as generateMediaTestCode } from "./test-inputs-DizPp8_w.js";
|
|
9
9
|
import * as zod from "zod";
|
|
10
|
-
// src/contract/MediaTestTriggers.js
|
|
11
|
-
const MEDIA_TEST_SIGNALS = [...CLASSIFICATION_CATEGORIES, "violence.graphic"];
|
|
12
|
-
const HEX_WORDS = [
|
|
13
|
-
"zero",
|
|
14
|
-
"one",
|
|
15
|
-
"two",
|
|
16
|
-
"three",
|
|
17
|
-
"four",
|
|
18
|
-
"five",
|
|
19
|
-
"six",
|
|
20
|
-
"seven",
|
|
21
|
-
"eight",
|
|
22
|
-
"nine",
|
|
23
|
-
"alpha",
|
|
24
|
-
"bravo",
|
|
25
|
-
"charlie",
|
|
26
|
-
"delta",
|
|
27
|
-
"echo",
|
|
28
|
-
"foxtrot"
|
|
29
|
-
];
|
|
30
|
-
/** Read this aloud, or render it as large, high-contrast text in a video frame. */
|
|
31
|
-
async function generateMediaTestCode$1(signal, testInputKey) {
|
|
32
|
-
if (!MEDIA_TEST_SIGNALS.includes(signal)) throw new RangeError("Unsupported media test signal");
|
|
33
|
-
return `Calm Lens test ${[...await getTestInputTag("media", signal, testInputKey)].map((character) => HEX_WORDS[Number.parseInt(character, 16)]).join(" ")} ${signal.replace(/[.-]/g, " ")} end test`;
|
|
34
|
-
}
|
|
35
10
|
/**
|
|
36
11
|
* The character an asset ID starts with (after `asset_`) to say the region it lives in: the asset
|
|
37
12
|
* table computes each row's region from it (`AssetTable`), so an ID is only ever in one region and
|
|
@@ -9857,17 +9832,14 @@ const operationsOf = (request) => {
|
|
|
9857
9832
|
return [];
|
|
9858
9833
|
};
|
|
9859
9834
|
/**
|
|
9860
|
-
*
|
|
9861
|
-
*
|
|
9835
|
+
* Like the API, every write (POST, PUT, PATCH and DELETE) runs under its `Idempotency-Key`: a retry
|
|
9836
|
+
* with the same key replays the first response. Reads ignore the header.
|
|
9862
9837
|
*/
|
|
9863
|
-
const
|
|
9864
|
-
"
|
|
9865
|
-
"
|
|
9866
|
-
"
|
|
9867
|
-
"
|
|
9868
|
-
"assets.decide",
|
|
9869
|
-
"assets.requestReview",
|
|
9870
|
-
"hashLists.addEntry"
|
|
9838
|
+
const IDEMPOTENT_METHODS = [
|
|
9839
|
+
"POST",
|
|
9840
|
+
"PUT",
|
|
9841
|
+
"PATCH",
|
|
9842
|
+
"DELETE"
|
|
9871
9843
|
];
|
|
9872
9844
|
/** A plain-text upload: the SDKs send text as a JSON body with `content.plainText`. */
|
|
9873
9845
|
const isTextUpload = (request) => {
|
|
@@ -9878,6 +9850,11 @@ const isTextUpload = (request) => {
|
|
|
9878
9850
|
return false;
|
|
9879
9851
|
}
|
|
9880
9852
|
};
|
|
9853
|
+
/**
|
|
9854
|
+
* Like the API (`classifiesInBackground`): audio, video, documents, websites and plain text over
|
|
9855
|
+
* 4 MiB are always moderated in the background, even when the caller waits.
|
|
9856
|
+
*/
|
|
9857
|
+
const classifiesInBackground = (asset) => asset.type === "audio" || asset.type === "video" || asset.type === "multimedia-document" || asset.type === "website" || asset.type === "plaintext-document" && (asset.content.sizeInBytes ?? 0) > 4194304;
|
|
9881
9858
|
/** Like the API: a new folder is 201 Created, a queued batch 202 Accepted, everything else 200. */
|
|
9882
9859
|
const SUCCESS_STATUS = {
|
|
9883
9860
|
"folders.create": 201,
|
|
@@ -10284,7 +10261,7 @@ var MockCalmLensApi = class {
|
|
|
10284
10261
|
async answer(request, operation, session) {
|
|
10285
10262
|
const { url, headers } = request;
|
|
10286
10263
|
if (!(request.segments[0] === "upload-presets") && headers.get("x-api-key") !== this.apiKey) return this.failureResponse(fail(API_ERROR_CODES.INVALID_API_KEY), url);
|
|
10287
|
-
const key =
|
|
10264
|
+
const key = IDEMPOTENT_METHODS.includes(request.method) ? headers.get("idempotency-key")?.replace(/^[\t\n\r ]+|[\t\n\r ]+$/g, "") : void 0;
|
|
10288
10265
|
const upload = headers.get("x-calmlens-upload");
|
|
10289
10266
|
const contentType = headers.get("content-type");
|
|
10290
10267
|
const isForm = !!upload && /^multipart\/form-data\b/i.test(contentType ?? "");
|
|
@@ -10298,20 +10275,32 @@ var MockCalmLensApi = class {
|
|
|
10298
10275
|
[...request.query].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0),
|
|
10299
10276
|
isForm ? "multipart/form-data" : contentType,
|
|
10300
10277
|
upload,
|
|
10301
|
-
upload ? request.bytes.byteLength : new TextDecoder().decode(request.bytes),
|
|
10278
|
+
isForm ? null : upload ? request.bytes.byteLength : new TextDecoder().decode(request.bytes),
|
|
10302
10279
|
formOptions ?? null
|
|
10303
10280
|
]);
|
|
10281
|
+
const replayOnly = headers.get("idempotency-replay-only") === "true";
|
|
10282
|
+
if (replayOnly && (key === void 0 || upload !== "part" || !isForm || request.segments.at(-1) === "part" || request.query.get("partNumber") !== "1")) return this.failureResponse(fail(API_ERROR_CODES.INVALID_REQUEST), url);
|
|
10304
10283
|
if (key !== void 0) {
|
|
10305
10284
|
if (!isValidIdempotencyKey(key)) return this.failureResponse(fail(API_ERROR_CODES.INVALID_IDEMPOTENCY_KEY), url);
|
|
10306
10285
|
const saved = this.idempotentResults.get(key);
|
|
10307
10286
|
if (saved) {
|
|
10308
10287
|
if (saved.fingerprint !== fingerprint) return this.failureResponse(fail(API_ERROR_CODES.IDEMPOTENCY_KEY_REUSED), url);
|
|
10288
|
+
if (replayOnly) {
|
|
10289
|
+
const { id } = JSON.parse(saved.body);
|
|
10290
|
+
const asset = await this.databaseStorage.getAsset(id);
|
|
10291
|
+
if (!asset) return this.response(204, null, url, {});
|
|
10292
|
+
return this.response(200, JSON.stringify(asset, this.publishAssets), url, {
|
|
10293
|
+
"Content-Type": "application/json",
|
|
10294
|
+
"Idempotent-Replayed": "true"
|
|
10295
|
+
});
|
|
10296
|
+
}
|
|
10309
10297
|
return this.response(saved.status, saved.body, url, {
|
|
10310
10298
|
"Content-Type": "application/json",
|
|
10311
10299
|
"Idempotent-Replayed": "true"
|
|
10312
10300
|
});
|
|
10313
10301
|
}
|
|
10314
10302
|
}
|
|
10303
|
+
if (replayOnly) return this.response(204, null, url, {});
|
|
10315
10304
|
let answer;
|
|
10316
10305
|
try {
|
|
10317
10306
|
answer = await this.route(request, session);
|
|
@@ -11449,11 +11438,12 @@ var MockCalmLensApi = class {
|
|
|
11449
11438
|
bytes: data,
|
|
11450
11439
|
text: data && asset.type === "plaintext-document" ? new TextDecoder().decode(data) : null
|
|
11451
11440
|
};
|
|
11441
|
+
const background = trigger === "upload" && classifiesInBackground(asset);
|
|
11452
11442
|
return toDecision(await this.options.moderate({
|
|
11453
11443
|
asset: this.toPublished(asset),
|
|
11454
11444
|
content,
|
|
11455
11445
|
trigger,
|
|
11456
|
-
queued
|
|
11446
|
+
queued: queued || background
|
|
11457
11447
|
}));
|
|
11458
11448
|
}
|
|
11459
11449
|
/**
|
|
@@ -11834,7 +11824,7 @@ var MockCalmLensApi = class {
|
|
|
11834
11824
|
* `search`, by name unless `ordering` says otherwise, with the folders above them.
|
|
11835
11825
|
*/
|
|
11836
11826
|
async listFolders(query) {
|
|
11837
|
-
const all = await this.databaseStorage.listFolders
|
|
11827
|
+
const all = await this.databaseStorage.listFolders(this.projectId);
|
|
11838
11828
|
const parentId = query.get("parentId");
|
|
11839
11829
|
const search = query.get("search")?.trim() || null;
|
|
11840
11830
|
const sort = this.sort(query, ["name", "createdAt"], 1);
|
|
@@ -11884,7 +11874,7 @@ var MockCalmLensApi = class {
|
|
|
11884
11874
|
createdAt: now,
|
|
11885
11875
|
updatedAt: now
|
|
11886
11876
|
};
|
|
11887
|
-
return this.databaseStorage.createFolder
|
|
11877
|
+
return this.databaseStorage.createFolder(folder);
|
|
11888
11878
|
}
|
|
11889
11879
|
async updateFolder(folderId, body) {
|
|
11890
11880
|
const folder = await this.findOwnFolder(folderId);
|
|
@@ -11895,17 +11885,17 @@ var MockCalmLensApi = class {
|
|
|
11895
11885
|
...name !== void 0 ? { name } : {},
|
|
11896
11886
|
updatedAt: this.now()
|
|
11897
11887
|
};
|
|
11898
|
-
return this.databaseStorage.updateFolder
|
|
11888
|
+
return this.databaseStorage.updateFolder(updated);
|
|
11899
11889
|
}
|
|
11900
11890
|
async deleteFolder(folderId) {
|
|
11901
11891
|
await this.findOwnFolder(folderId);
|
|
11902
11892
|
const hasAssets = (await this.databaseStorage.listAssets(this.projectId)).some((asset) => asset.folderId === folderId);
|
|
11903
|
-
const hasChildren = (await this.databaseStorage.listFolders
|
|
11893
|
+
const hasChildren = (await this.databaseStorage.listFolders(this.projectId)).some((folder) => folder.parentId === folderId);
|
|
11904
11894
|
if (hasAssets || hasChildren) throw fail(API_ERROR_CODES.FOLDER_NOT_EMPTY, { details: {
|
|
11905
11895
|
hasAssets,
|
|
11906
11896
|
hasChildren
|
|
11907
11897
|
} });
|
|
11908
|
-
await this.databaseStorage.deleteFolder
|
|
11898
|
+
await this.databaseStorage.deleteFolder(folderId);
|
|
11909
11899
|
}
|
|
11910
11900
|
async moveFolder(folderId, body) {
|
|
11911
11901
|
const folder = await this.findOwnFolder(folderId);
|
|
@@ -11925,10 +11915,10 @@ var MockCalmLensApi = class {
|
|
|
11925
11915
|
parentId: targetParentId,
|
|
11926
11916
|
updatedAt: this.now()
|
|
11927
11917
|
};
|
|
11928
|
-
return this.databaseStorage.updateFolder
|
|
11918
|
+
return this.databaseStorage.updateFolder(updated);
|
|
11929
11919
|
}
|
|
11930
11920
|
async resolveFolder(folderId) {
|
|
11931
|
-
const folder = await this.databaseStorage.getFolder
|
|
11921
|
+
const folder = await this.databaseStorage.getFolder(folderId);
|
|
11932
11922
|
return folder && folder.projectId === this.projectId ? folder : void 0;
|
|
11933
11923
|
}
|
|
11934
11924
|
async findOwnFolder(folderId) {
|
|
@@ -11937,7 +11927,7 @@ var MockCalmLensApi = class {
|
|
|
11937
11927
|
return folder;
|
|
11938
11928
|
}
|
|
11939
11929
|
async assertUniqueFolderName(name, parentId, excludeFolderId) {
|
|
11940
|
-
if ((await this.databaseStorage.listFolders
|
|
11930
|
+
if ((await this.databaseStorage.listFolders(this.projectId)).find((folder) => folder.id !== excludeFolderId && (folder.parentId ?? null) === parentId && folder.name === name)) throw fail(API_ERROR_CODES.DUPLICATE_FOLDER_NAME, { message: `A folder named "${name}" already exists in this location.` });
|
|
11941
11931
|
}
|
|
11942
11932
|
/** A page of the project's upload presets, oldest first unless `sort` says otherwise. */
|
|
11943
11933
|
listUploadPresets(query) {
|
|
@@ -12206,7 +12196,7 @@ var MockCalmLensApi = class {
|
|
|
12206
12196
|
}, url);
|
|
12207
12197
|
const hasApiKey = request.headers.get("x-api-key") === this.apiKey;
|
|
12208
12198
|
const grants = hasApiKey ? this.grants : [];
|
|
12209
|
-
const folders = await this.databaseStorage.listFolders
|
|
12199
|
+
const folders = await this.databaseStorage.listFolders(this.projectId);
|
|
12210
12200
|
const canDownload = () => permits(grants, "assets:download", asset.folderId ?? null, folders);
|
|
12211
12201
|
const status = asset.classification.moderation.decision;
|
|
12212
12202
|
const isHead = request.method === "HEAD";
|
|
@@ -12754,7 +12744,4 @@ const createWebhookHeaders = async (options) => {
|
|
|
12754
12744
|
[WEBHOOK_SIGNATURE_HEADER]: await createWebhookSignatureHeader(options.secret, timestamp, options.body)
|
|
12755
12745
|
};
|
|
12756
12746
|
};
|
|
12757
|
-
// src/testing.ts
|
|
12758
|
-
/** A spoken media test phrase for `signal`, signed with the project's test input key. */
|
|
12759
|
-
const generateMediaTestCode = (signal, key) => withValidTestInputArguments(key, () => generateMediaTestCode$1(signal, key));
|
|
12760
12747
|
export { InMemoryMockDatabaseStorage, InMemoryMockImageStorage, MEDIA_TEST_SIGNALS, MOCK_API_KEY_ID, MOCK_API_KEY_PREFIX, MockCalmLensAppClient, MockCalmLensServerClient, MockDecision, createMockApiKey, createWebhookHeaders, createWebhookSignatureHeader, generateMediaTestCode, mockDecision, signUploadTokenWithApiKey as signUploadToken, toWebhookEventPayload };
|
|
@@ -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-CCsoVr39.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-B110Ug8_.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 assetUrlOf, r as appendAssetLocation } from "./CalmLensCdn-
|
|
2
|
-
import "./Core-
|
|
1
|
+
import { a as assetUrlOf, r as appendAssetLocation } from "./CalmLensCdn-CW5Fn3ph.js";
|
|
2
|
+
import "./Core-BRrPxS4i.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-
|
|
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-B110Ug8_.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--E_s-cDd.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-B-QOHuVI.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-BRrPxS4i.js";
|
|
3
|
+
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-CQ4NouIU.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, fn 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, fn as ViewerClaims, g as AssetModerationStatus, i as AssetAvailability } from "./CalmLensTypes-CCsoVr39.js";
|
|
2
|
+
import "./index-Dk3I5YXf.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-B110Ug8_.js";
|
|
4
|
+
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-BuTS7yTy.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--E_s-cDd.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-B-QOHuVI.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-BRrPxS4i.js";
|
|
3
|
+
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-CQ4NouIU.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-DxgiUXC2.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.38.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",
|