calmlens 0.27.6 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-DLoi5qVj.js} +1 -1
- package/cjs/{CalmLensAppClient-Btp8f-34.d.ts → CalmLensAppClient-B3u6BlP5.d.ts} +1 -1
- package/cjs/{CalmLensAppClient-Bwt3gP0C.js → CalmLensAppClient-C--UAnoz.js} +2 -2
- package/cjs/{CalmLensOptionKeys--gTpTkwt.js → CalmLensOptionKeys-BxrJ47zd.js} +2 -2
- package/cjs/{CalmLensServerClient-C3kaPLUZ.d.ts → CalmLensServerClient-B8ntjNL3.d.ts} +6 -6
- package/cjs/{CalmLensServerClient-BYMzGkQK.js → CalmLensServerClient-CPbCEJMK.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-CB0-p-ro.js} +7 -4
- package/cjs/{ModerationContextLimits-DJyIjzIn.js → ModerationContextLimits-CuL1TOuf.js} +43 -6
- package/cjs/{ReactUpload-DHuhGYsr.js → ReactUpload-3QgzpdMu.js} +1 -1
- package/cjs/{ReactUpload-BuqLPgNr.d.ts → ReactUpload-BGUkcMpg.d.ts} +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-BSZnq84V.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 +61 -13
- package/cjs/testing.js +170 -35
- package/cjs/{ui-BSm_qphN.d.ts → ui-BGywTQ2M.d.ts} +2 -2
- package/cjs/{ui-C1_SDSiq.js → ui-CkQQm3Qw.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-BaKFKEBz.js → BrowserUpload-BKrrHzoh.js} +1 -1
- package/esm/{BrowserUpload-CdOfuIcV.d.ts → BrowserUpload-CRbCsX7a.d.ts} +2 -2
- package/esm/{CalmLensAppClient-Btp8f-34.d.ts → CalmLensAppClient-B3u6BlP5.d.ts} +1 -1
- package/esm/{CalmLensAppClient-DM6c3pGC.js → CalmLensAppClient-D_SprSKl.js} +2 -2
- package/esm/{CalmLensOptionKeys-CKZs8i3_.js → CalmLensOptionKeys-B6an7neE.js} +2 -2
- package/esm/{CalmLensServerClient-C3kaPLUZ.d.ts → CalmLensServerClient-B8ntjNL3.d.ts} +6 -6
- package/esm/{CalmLensServerClient-Da2UfUo4.js → CalmLensServerClient-BY45aX5Q.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-dzPyrg_G.js} +7 -4
- package/esm/{ModerationContextLimits-ZIlK9n2X.js → ModerationContextLimits-IH2zX1wg.js} +26 -7
- package/esm/{ReactUpload-CipY3cmO.js → ReactUpload-4DeUbua_.js} +1 -1
- package/esm/{ReactUpload-BuqLPgNr.d.ts → ReactUpload-BGUkcMpg.d.ts} +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-DKjI8S2K.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 +61 -13
- package/esm/testing.js +161 -26
- package/esm/{ui-BSm_qphN.d.ts → ui-BGywTQ2M.d.ts} +2 -2
- package/esm/{ui-CgIG3knW.js → ui-BovDqg9n.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/cjs/testing.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
4
|
-
const require_CalmLensServerClient = require("./CalmLensServerClient-
|
|
5
|
-
const require_CalmLensOptionKeys = require("./CalmLensOptionKeys
|
|
2
|
+
const require_TestTriggers_uL2Ec8Vt = require("./TestTriggers-uL2Ec8Vt-cPmmKvYd.js");
|
|
3
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-CuL1TOuf.js");
|
|
4
|
+
const require_CalmLensServerClient = require("./CalmLensServerClient-CPbCEJMK.js");
|
|
5
|
+
const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-BxrJ47zd.js");
|
|
6
6
|
const require_CryptoUtils_BLCa_oZe = require("./CryptoUtils-BLCa-oZe-leCkr1ko.js");
|
|
7
|
-
const require_CalmLensAppClient = require("./CalmLensAppClient-
|
|
8
|
-
const require_UploadController = require("./UploadController-
|
|
7
|
+
const require_CalmLensAppClient = require("./CalmLensAppClient-C--UAnoz.js");
|
|
8
|
+
const require_UploadController = require("./UploadController-BSZnq84V.js");
|
|
9
9
|
let zod = require("zod");
|
|
10
|
-
zod =
|
|
10
|
+
zod = require_TestTriggers_uL2Ec8Vt.__toESM(zod, 1);
|
|
11
11
|
// src/contract/MediaTestTriggers.js
|
|
12
|
-
const MEDIA_TEST_SIGNALS = [...
|
|
12
|
+
const MEDIA_TEST_SIGNALS = [...require_TestTriggers_uL2Ec8Vt.CLASSIFICATION_CATEGORIES, "violence.graphic"];
|
|
13
13
|
const HEX_WORDS = [
|
|
14
14
|
"zero",
|
|
15
15
|
"one",
|
|
@@ -31,7 +31,7 @@ const HEX_WORDS = [
|
|
|
31
31
|
/** Read this aloud, or render it as large, high-contrast text in a video frame. */
|
|
32
32
|
async function generateMediaTestCode(signal, testInputKey) {
|
|
33
33
|
if (!MEDIA_TEST_SIGNALS.includes(signal)) throw new RangeError("Unsupported media test signal");
|
|
34
|
-
return `Calm Lens test ${[...await
|
|
34
|
+
return `Calm Lens test ${[...await require_TestTriggers_uL2Ec8Vt.getTestInputTag("media", signal, testInputKey)].map((character) => HEX_WORDS[Number.parseInt(character, 16)]).join(" ")} ${signal.replace(/[.-]/g, " ")} end test`;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* The character an asset ID starts with (after `asset_`) to say the region it lives in: the asset
|
|
@@ -8086,7 +8086,7 @@ const PERMISSION_ACTIONS = [
|
|
|
8086
8086
|
"reviews:write",
|
|
8087
8087
|
"project:manage"
|
|
8088
8088
|
];
|
|
8089
|
-
const ACTION_SCHEMA = /* @__PURE__ */
|
|
8089
|
+
const ACTION_SCHEMA = /* @__PURE__ */ require_TestTriggers_uL2Ec8Vt.lazySchema(() => zod.enum(PERMISSION_ACTIONS));
|
|
8090
8090
|
const PROJECT_ACTIONS = [...[
|
|
8091
8091
|
"settings",
|
|
8092
8092
|
"members",
|
|
@@ -8102,12 +8102,12 @@ const PROJECT_ACTIONS = [...[
|
|
|
8102
8102
|
const isProjectAction = (action) => PROJECT_ACTIONS.includes(action);
|
|
8103
8103
|
/** The actions that include `action`: its feature's write action and project:manage. */
|
|
8104
8104
|
const actionsImplying = (action) => !isProjectAction(action) || action === "project:manage" ? [] : action.endsWith(":read") ? [action.replace(/:read$/, ":write"), "project:manage"] : ["project:manage"];
|
|
8105
|
-
const GRANT_SCHEMA = /* @__PURE__ */
|
|
8105
|
+
const GRANT_SCHEMA = /* @__PURE__ */ require_TestTriggers_uL2Ec8Vt.lazySchema(() => zod.object({
|
|
8106
8106
|
actions: zod.array(ACTION_SCHEMA),
|
|
8107
8107
|
folderId: idField("fldr").nullable(),
|
|
8108
8108
|
includeSubfolders: zod.boolean()
|
|
8109
8109
|
}).strict().refine((g) => g.folderId === null || !g.actions.some(isProjectAction), "Project configuration permissions require project scope"));
|
|
8110
|
-
const GRANTS_SCHEMA = /* @__PURE__ */
|
|
8110
|
+
const GRANTS_SCHEMA = /* @__PURE__ */ require_TestTriggers_uL2Ec8Vt.lazySchema(() => zod.array(GRANT_SCHEMA).max(100));
|
|
8111
8111
|
[...PERMISSION_ACTIONS.filter((a) => !isProjectAction(a))];
|
|
8112
8112
|
[...PERMISSION_ACTIONS.filter((a) => !isProjectAction(a))];
|
|
8113
8113
|
const permits = (grants, action, folderId, folders) => grants.some((grant) => {
|
|
@@ -8339,6 +8339,10 @@ var MockDecision = class {
|
|
|
8339
8339
|
#flags = /* @__PURE__ */ new Map();
|
|
8340
8340
|
#notEvaluated = /* @__PURE__ */ new Set();
|
|
8341
8341
|
#pendingReview;
|
|
8342
|
+
#ocr;
|
|
8343
|
+
#linkDetection;
|
|
8344
|
+
#people;
|
|
8345
|
+
#faces;
|
|
8342
8346
|
constructor(status) {
|
|
8343
8347
|
if (!OUTCOMES.includes(status)) throw require_ModerationContextLimits.invalidArgument(`status must be one of ${OUTCOMES.join(", ")}`);
|
|
8344
8348
|
this.status = status;
|
|
@@ -8388,6 +8392,61 @@ var MockDecision = class {
|
|
|
8388
8392
|
};
|
|
8389
8393
|
return this;
|
|
8390
8394
|
}
|
|
8395
|
+
/**
|
|
8396
|
+
* The text OCR finds in an image, for an upload that turns OCR on: `classification.ocr` reports
|
|
8397
|
+
* `textRegions`, and `content.extractedText` holds `text` when the upload keeps its content.
|
|
8398
|
+
*/
|
|
8399
|
+
withOcr(text, textRegions = []) {
|
|
8400
|
+
this.#ocr = {
|
|
8401
|
+
text,
|
|
8402
|
+
textRegions: structuredClone(textRegions)
|
|
8403
|
+
};
|
|
8404
|
+
return this;
|
|
8405
|
+
}
|
|
8406
|
+
/**
|
|
8407
|
+
* The QR codes and links link detection finds in an image, reported as
|
|
8408
|
+
* `classification.linkDetection` unless the upload turns link detection off.
|
|
8409
|
+
*/
|
|
8410
|
+
withLinkDetection(qrCodes = [], links = []) {
|
|
8411
|
+
this.#linkDetection = {
|
|
8412
|
+
qrCodes: structuredClone(qrCodes),
|
|
8413
|
+
links: structuredClone(links)
|
|
8414
|
+
};
|
|
8415
|
+
return this;
|
|
8416
|
+
}
|
|
8417
|
+
/**
|
|
8418
|
+
* The people that person detection finds in an image, reported as `classification.personDetection`
|
|
8419
|
+
* when the upload turns person detection on. Without them, it finds nobody.
|
|
8420
|
+
*/
|
|
8421
|
+
withPersonDetection(people) {
|
|
8422
|
+
this.#people = structuredClone(people);
|
|
8423
|
+
return this;
|
|
8424
|
+
}
|
|
8425
|
+
/**
|
|
8426
|
+
* The faces that face detection finds in an image, reported as `classification.faceDetection` when
|
|
8427
|
+
* the upload turns face detection on; each face's `ageRange` only when the upload also asks for
|
|
8428
|
+
* age estimation. Without them, it finds no faces.
|
|
8429
|
+
*/
|
|
8430
|
+
withFaceDetection(faces) {
|
|
8431
|
+
this.#faces = structuredClone(faces);
|
|
8432
|
+
return this;
|
|
8433
|
+
}
|
|
8434
|
+
/** @internal What `withPersonDetection` set, if anything. */
|
|
8435
|
+
get personFindings() {
|
|
8436
|
+
return this.#people && structuredClone(this.#people);
|
|
8437
|
+
}
|
|
8438
|
+
/** @internal What `withFaceDetection` set, if anything. */
|
|
8439
|
+
get faceFindings() {
|
|
8440
|
+
return this.#faces && structuredClone(this.#faces);
|
|
8441
|
+
}
|
|
8442
|
+
/** @internal What `withOcr` set, if anything. */
|
|
8443
|
+
get ocrFindings() {
|
|
8444
|
+
return this.#ocr && structuredClone(this.#ocr);
|
|
8445
|
+
}
|
|
8446
|
+
/** @internal What `withLinkDetection` set, if anything. */
|
|
8447
|
+
get linkFindings() {
|
|
8448
|
+
return this.#linkDetection && structuredClone(this.#linkDetection);
|
|
8449
|
+
}
|
|
8391
8450
|
#checkCategory(category) {
|
|
8392
8451
|
if (!MOCK_CATEGORIES.includes(category)) throw require_ModerationContextLimits.invalidArgument(`${category} is not a CalmLens category`);
|
|
8393
8452
|
}
|
|
@@ -8455,6 +8514,45 @@ var MockDecision = class {
|
|
|
8455
8514
|
const mockDecision = (status) => new MockDecision(status);
|
|
8456
8515
|
/** The default `moderate`: queued work stays pending until `completeProcessing`, which allows it. */
|
|
8457
8516
|
const defaultModerate = ({ trigger, queued }) => queued && trigger !== "complete" ? "pending" : "allowed";
|
|
8517
|
+
// src/testing/MockUrlAssetTypes.ts
|
|
8518
|
+
const MOCK_URL_EXTENSION_TYPES = {
|
|
8519
|
+
jpg: "image",
|
|
8520
|
+
jpeg: "image",
|
|
8521
|
+
png: "image",
|
|
8522
|
+
gif: "image",
|
|
8523
|
+
webp: "image",
|
|
8524
|
+
avif: "image",
|
|
8525
|
+
heic: "image",
|
|
8526
|
+
heif: "image",
|
|
8527
|
+
bmp: "image",
|
|
8528
|
+
tif: "image",
|
|
8529
|
+
tiff: "image",
|
|
8530
|
+
svg: "image",
|
|
8531
|
+
mp4: "video",
|
|
8532
|
+
m4v: "video",
|
|
8533
|
+
mov: "video",
|
|
8534
|
+
webm: "video",
|
|
8535
|
+
mkv: "video",
|
|
8536
|
+
avi: "video",
|
|
8537
|
+
mp3: "audio",
|
|
8538
|
+
m4a: "audio",
|
|
8539
|
+
aac: "audio",
|
|
8540
|
+
wav: "audio",
|
|
8541
|
+
ogg: "audio",
|
|
8542
|
+
oga: "audio",
|
|
8543
|
+
opus: "audio",
|
|
8544
|
+
flac: "audio",
|
|
8545
|
+
pdf: "multimedia-document",
|
|
8546
|
+
doc: "multimedia-document",
|
|
8547
|
+
docx: "multimedia-document",
|
|
8548
|
+
odt: "multimedia-document",
|
|
8549
|
+
ppt: "multimedia-document",
|
|
8550
|
+
pptx: "multimedia-document",
|
|
8551
|
+
odp: "multimedia-document",
|
|
8552
|
+
rtf: "multimedia-document",
|
|
8553
|
+
txt: "plaintext-document",
|
|
8554
|
+
md: "plaintext-document"
|
|
8555
|
+
};
|
|
8458
8556
|
// src/testing/MockAssetFilters.ts
|
|
8459
8557
|
/** The asset fields a list filter may name, each with the operators it accepts. */
|
|
8460
8558
|
const MOCK_ASSET_FILTER_FIELDS = {
|
|
@@ -9410,9 +9508,25 @@ const mockRendering = (asset, processed) => {
|
|
|
9410
9508
|
default: return NO_RENDERING;
|
|
9411
9509
|
}
|
|
9412
9510
|
};
|
|
9413
|
-
/**
|
|
9511
|
+
/**
|
|
9512
|
+
* A URL upload's type: the type of its path's file extension (`MOCK_URL_EXTENSION_TYPES`),
|
|
9513
|
+
* compared lower-case without the query or fragment, or `website` for any other extension or none.
|
|
9514
|
+
* The mock fetches nothing, so the extension stands in for the fetched content's type.
|
|
9515
|
+
*/
|
|
9516
|
+
const urlAssetType = (url) => {
|
|
9517
|
+
let path;
|
|
9518
|
+
try {
|
|
9519
|
+
path = new URL(url).pathname;
|
|
9520
|
+
} catch {
|
|
9521
|
+
path = url.split(/[?#]/, 1)[0];
|
|
9522
|
+
}
|
|
9523
|
+
const segment = path.slice(path.lastIndexOf("/") + 1);
|
|
9524
|
+
const dot = segment.lastIndexOf(".");
|
|
9525
|
+
if (dot === -1) return "website";
|
|
9526
|
+
return MOCK_URL_EXTENSION_TYPES[segment.slice(dot + 1).toLowerCase()] ?? "website";
|
|
9527
|
+
};
|
|
9528
|
+
/** An asset's type from its content type. */
|
|
9414
9529
|
const inferAssetType = (contentType) => {
|
|
9415
|
-
if (contentType === void 0) return "website";
|
|
9416
9530
|
const type = contentType.toLowerCase();
|
|
9417
9531
|
if (type.startsWith("image/")) return "image";
|
|
9418
9532
|
if (type.startsWith("video/")) return "video";
|
|
@@ -9557,7 +9671,7 @@ const MOCK_PRESET_NAMES = {
|
|
|
9557
9671
|
* personal information and profanity, `block` otherwise) and no rules. The mock holds no built-in
|
|
9558
9672
|
* preset settings, and uploads are never decided by a policy.
|
|
9559
9673
|
*/
|
|
9560
|
-
const mockPresetSettings = () => ({ categorySettings: Object.fromEntries(
|
|
9674
|
+
const mockPresetSettings = () => ({ categorySettings: Object.fromEntries(require_TestTriggers_uL2Ec8Vt.CLASSIFICATION_CATEGORIES.map((category) => [category, {
|
|
9561
9675
|
action: category === "personal-information" || category === "profanity" ? "allow" : "block",
|
|
9562
9676
|
allowances: [],
|
|
9563
9677
|
restrictions: []
|
|
@@ -9569,13 +9683,13 @@ const mockPresetSettings = () => ({ categorySettings: Object.fromEntries(require
|
|
|
9569
9683
|
const checkPolicySettings = (settings) => {
|
|
9570
9684
|
const categories = settings?.categorySettings;
|
|
9571
9685
|
if (!categories || typeof categories !== "object") throw invalidField("validation/invalid-type", "settings.categorySettings");
|
|
9572
|
-
for (const category of
|
|
9686
|
+
for (const category of require_TestTriggers_uL2Ec8Vt.CLASSIFICATION_CATEGORIES) {
|
|
9573
9687
|
const value = categories[category];
|
|
9574
9688
|
if (!value || typeof value !== "object") throw invalidField("validation/invalid-type", `settings.categorySettings.${category}`);
|
|
9575
9689
|
for (const key of ["allowances", "restrictions"]) if (!Array.isArray(value[key])) throw invalidField("validation/invalid-type", `settings.categorySettings.${category}.${key}`);
|
|
9576
9690
|
if (typeof value.action !== "string") throw invalidField("validation/invalid-value", `settings.categorySettings.${category}.action`);
|
|
9577
9691
|
}
|
|
9578
|
-
for (const key of Object.keys(categories)) if (!
|
|
9692
|
+
for (const key of Object.keys(categories)) if (!require_TestTriggers_uL2Ec8Vt.CLASSIFICATION_CATEGORIES.includes(key)) throw invalidField("validation/unknown-field", `settings.categorySettings.${key}`);
|
|
9579
9693
|
};
|
|
9580
9694
|
/** The client methods that send a request, the one it is recorded under first. */
|
|
9581
9695
|
const operationsOf = (request) => {
|
|
@@ -9598,7 +9712,7 @@ const operationsOf = (request) => {
|
|
|
9598
9712
|
case "assets":
|
|
9599
9713
|
if (method === "GET") return ["assets.list"];
|
|
9600
9714
|
if (query.get("wait") === "false") return ["assets.create"];
|
|
9601
|
-
return isTextUpload(request) ? ["
|
|
9715
|
+
return isTextUpload(request) ? ["text.classify"] : ["assets.classify"];
|
|
9602
9716
|
}
|
|
9603
9717
|
if (segments[2] === "assets" && segments[4] === "timeline" && segments.length === 5) return ["assets.listTimeline"];
|
|
9604
9718
|
if (segments[2] === "metadata-fields" && segments.length === 4) return ["metadataFields.delete"];
|
|
@@ -10471,17 +10585,21 @@ var MockCalmLensApi = class {
|
|
|
10471
10585
|
}
|
|
10472
10586
|
/**
|
|
10473
10587
|
* Signs an asset URL like the API (`POST /projects/:projectId/signed-asset-urls`): a grant to one
|
|
10474
|
-
* asset, by ID or external ID, until it expires,
|
|
10588
|
+
* asset, by ID or external ID, until it expires, ending in the resource it was signed for and
|
|
10589
|
+
* serving the original only when signed for it. The mock's
|
|
10475
10590
|
* grant is readable (its asset, original access and expiry), unlike the CDN's, and only the
|
|
10476
10591
|
* mock's CDN accepts it.
|
|
10477
10592
|
*/
|
|
10478
10593
|
async signAssetUrl(body) {
|
|
10479
|
-
|
|
10594
|
+
const fields = [
|
|
10480
10595
|
"assetId",
|
|
10481
10596
|
"externalId",
|
|
10482
10597
|
"expiresIn",
|
|
10483
|
-
"
|
|
10484
|
-
]
|
|
10598
|
+
"resource"
|
|
10599
|
+
];
|
|
10600
|
+
const unknown = Object.keys(body).find((key) => !fields.includes(key));
|
|
10601
|
+
if (unknown !== void 0) throw invalidField("validation/unknown-field", unknown);
|
|
10602
|
+
for (const key of fields) if (body[key] === null) throw invalidField("validation/invalid-type", key);
|
|
10485
10603
|
const { assetId, externalId } = body;
|
|
10486
10604
|
if (assetId === void 0 === (externalId === void 0)) throw new ApiFailure(400, require_ModerationContextLimits.API_ERROR_CODES.INVALID_REQUEST, "Send either assetId or externalId", { issues: [{
|
|
10487
10605
|
path: "",
|
|
@@ -10492,8 +10610,8 @@ var MockCalmLensApi = class {
|
|
|
10492
10610
|
if (typeof expiresIn !== "number" || !Number.isInteger(expiresIn)) throw invalidField("validation/invalid-type", "expiresIn");
|
|
10493
10611
|
if (expiresIn < 1) throw invalidField("validation/too-small", "expiresIn");
|
|
10494
10612
|
if (expiresIn > 86400) throw invalidField("validation/too-big", "expiresIn");
|
|
10495
|
-
const
|
|
10496
|
-
if (typeof
|
|
10613
|
+
const { resource } = body;
|
|
10614
|
+
if (resource !== void 0 && (typeof resource !== "string" || !Object.hasOwn(require_ModerationContextLimits.ASSET_RESOURCE_PATHS, resource))) throw invalidField("validation/invalid-value", "resource");
|
|
10497
10615
|
let asset;
|
|
10498
10616
|
if (externalId !== void 0) {
|
|
10499
10617
|
asset = (await this.databaseStorage.listAssets(this.projectId)).find((candidate) => candidate.externalId === externalId);
|
|
@@ -10503,11 +10621,12 @@ var MockCalmLensApi = class {
|
|
|
10503
10621
|
const expiresAt = this.now() + expiresIn * 1e3;
|
|
10504
10622
|
const grant = encodeMockGrant({
|
|
10505
10623
|
assetId: asset.id,
|
|
10506
|
-
original,
|
|
10624
|
+
original: resource === "original",
|
|
10507
10625
|
expiresAt
|
|
10508
10626
|
});
|
|
10627
|
+
const path = resource === void 0 ? "" : `/${require_ModerationContextLimits.ASSET_RESOURCE_PATHS[resource]}`;
|
|
10509
10628
|
return {
|
|
10510
|
-
url: `${this.cdnBaseUrl}/assets/${encodeURIComponent(this.projectId)}/${grant}`,
|
|
10629
|
+
url: `${this.cdnBaseUrl}/assets/${encodeURIComponent(this.projectId)}/${grant}${path}`,
|
|
10511
10630
|
expiresAt
|
|
10512
10631
|
};
|
|
10513
10632
|
}
|
|
@@ -10702,7 +10821,7 @@ var MockCalmLensApi = class {
|
|
|
10702
10821
|
source: "calmlens"
|
|
10703
10822
|
}
|
|
10704
10823
|
});
|
|
10705
|
-
const type =
|
|
10824
|
+
const type = fields.url === void 0 ? inferAssetType(contentType ?? "") : urlAssetType(fields.url);
|
|
10706
10825
|
if (part) {
|
|
10707
10826
|
if (part.partNumber > 1) throw fail(require_ModerationContextLimits.API_ERROR_CODES.USE_UPLOAD_PART);
|
|
10708
10827
|
const partSize = bytes.byteLength;
|
|
@@ -10799,7 +10918,9 @@ var MockCalmLensApi = class {
|
|
|
10799
10918
|
timeline: null
|
|
10800
10919
|
},
|
|
10801
10920
|
ocr: null,
|
|
10802
|
-
linkDetection: null
|
|
10921
|
+
linkDetection: null,
|
|
10922
|
+
personDetection: null,
|
|
10923
|
+
faceDetection: null
|
|
10803
10924
|
}
|
|
10804
10925
|
};
|
|
10805
10926
|
if (part) {
|
|
@@ -10929,26 +11050,40 @@ var MockCalmLensApi = class {
|
|
|
10929
11050
|
const next = await this.applyOutcome(asset, decision.status, "policy", decision.report(this.now()));
|
|
10930
11051
|
const features = this.processingOptions.get(asset.id)?.features;
|
|
10931
11052
|
if (next.classification.status !== "completed" || asset.type !== "image") return next;
|
|
11053
|
+
const ocr = features?.ocr?.enabled === true ? decision.ocrFindings : void 0;
|
|
11054
|
+
const ages = features?.faceDetection?.ageEstimation === true;
|
|
10932
11055
|
return {
|
|
10933
11056
|
...next,
|
|
11057
|
+
...ocr?.text != null && next.content.status === "stored" && { content: {
|
|
11058
|
+
...next.content,
|
|
11059
|
+
extractedText: {
|
|
11060
|
+
type: "string",
|
|
11061
|
+
content: ocr.text
|
|
11062
|
+
}
|
|
11063
|
+
} },
|
|
10934
11064
|
classification: {
|
|
10935
11065
|
...next.classification,
|
|
10936
11066
|
...features?.ocr?.enabled === true && { ocr: {
|
|
10937
11067
|
status: "evaluated",
|
|
10938
|
-
textRegions: []
|
|
11068
|
+
textRegions: ocr?.textRegions ?? []
|
|
10939
11069
|
} },
|
|
10940
11070
|
...features?.linkDetection?.enabled !== false && { linkDetection: {
|
|
10941
11071
|
status: "evaluated",
|
|
10942
|
-
|
|
10943
|
-
|
|
11072
|
+
...decision.linkFindings ?? {
|
|
11073
|
+
qrCodes: [],
|
|
11074
|
+
links: []
|
|
11075
|
+
}
|
|
10944
11076
|
} },
|
|
10945
11077
|
...features?.personDetection?.enabled === true && { personDetection: {
|
|
10946
11078
|
status: "evaluated",
|
|
10947
|
-
people: []
|
|
11079
|
+
people: decision.personFindings ?? []
|
|
10948
11080
|
} },
|
|
10949
11081
|
...features?.faceDetection?.enabled === true && { faceDetection: {
|
|
10950
11082
|
status: "evaluated",
|
|
10951
|
-
faces: []
|
|
11083
|
+
faces: (decision.faceFindings ?? []).map(({ ageRange, ...face }) => ages && ageRange ? {
|
|
11084
|
+
...face,
|
|
11085
|
+
ageRange
|
|
11086
|
+
} : face)
|
|
10952
11087
|
} }
|
|
10953
11088
|
}
|
|
10954
11089
|
};
|
|
@@ -11933,8 +12068,8 @@ var MockCalmLensServerClient = class extends require_CalmLensServerClient.CalmLe
|
|
|
11933
12068
|
}
|
|
11934
12069
|
/**
|
|
11935
12070
|
* Requests `operation` sends, oldest first. A request several methods send matches each of
|
|
11936
|
-
* them: `callsTo("
|
|
11937
|
-
*
|
|
12071
|
+
* them: `callsTo("assets.waitForDecision")` lists the `assets.retrieve` requests it polls
|
|
12072
|
+
* with. A text upload is `text.classify`'s request and a file or URL upload `assets.classify`'s.
|
|
11938
12073
|
*/
|
|
11939
12074
|
callsTo(operation) {
|
|
11940
12075
|
return this.#api.calls.filter(({ operations }) => operations.includes(operation)).map(({ call }) => call);
|
|
@@ -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> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
-
require("./Core-
|
|
1
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-CuL1TOuf.js");
|
|
2
|
+
require("./Core-CB0-p-ro.js");
|
|
3
3
|
// src/ui/viewers/PdfLoader.ts
|
|
4
4
|
let loading;
|
|
5
5
|
/**
|
package/cjs/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/cjs/ui.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ui = require("./ui-
|
|
3
|
-
const require_Core = require("./Core-
|
|
4
|
-
const require_UploadController = require("./UploadController-
|
|
2
|
+
const require_ui = require("./ui-CkQQm3Qw.js");
|
|
3
|
+
const require_Core = require("./Core-CB0-p-ro.js");
|
|
4
|
+
const require_UploadController = require("./UploadController-BSZnq84V.js");
|
|
5
5
|
exports.ASSET_FILE_ICON_SIZE = require_Core.ASSET_FILE_ICON_SIZE;
|
|
6
6
|
exports.ASSET_VIEWERS = require_ui.ASSET_VIEWERS;
|
|
7
7
|
exports.AssetSession = require_Core.AssetSession;
|
package/cjs/vue.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/cjs/vue.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ui = require("./ui-
|
|
3
|
-
const require_Core = require("./Core-
|
|
4
|
-
const require_UploadController = require("./UploadController-
|
|
2
|
+
const require_ui = require("./ui-CkQQm3Qw.js");
|
|
3
|
+
const require_Core = require("./Core-CB0-p-ro.js");
|
|
4
|
+
const require_UploadController = require("./UploadController-BSZnq84V.js");
|
|
5
5
|
const require_FileIcons = require("./FileIcons-Ob003MdS.js");
|
|
6
|
-
const require_BrowserUpload = require("./BrowserUpload-
|
|
6
|
+
const require_BrowserUpload = require("./BrowserUpload-DLoi5qVj.js");
|
|
7
7
|
let vue = require("vue");
|
|
8
8
|
// src/viewers/Vue.ts
|
|
9
9
|
const optional$1 = (type) => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createUploadController$1 } from "./UploadController-
|
|
1
|
+
import { n as createUploadController$1 } from "./UploadController-DKjI8S2K.js";
|
|
2
2
|
// src/ui/BrowserUpload.ts
|
|
3
3
|
/** Creates an upload queue for the browser components, such as one a form starts on submit. */
|
|
4
4
|
const createUploadController = (options) => createUploadController$1(options);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as UploadFile, I as UploadItem$1, L as UploadSnapshot$1, N as UploadController, P as UploadControllerOptions$1, h as UploaderProps$1, k as CalmLensUpload$1 } from "./Core-
|
|
2
|
-
import { r as UseCalmLensUploadResult$1 } from "./ReactUpload-
|
|
1
|
+
import { F as UploadFile, I as UploadItem$1, L as UploadSnapshot$1, N as UploadController, P as UploadControllerOptions$1, h as UploaderProps$1, k as CalmLensUpload$1 } from "./Core-BJaLU71Q.js";
|
|
2
|
+
import { r as UseCalmLensUploadResult$1 } from "./ReactUpload-BGUkcMpg.js";
|
|
3
3
|
type UploadItem<F extends UploadFile = File> = UploadItem$1<F>;
|
|
4
4
|
type CalmLensUpload<F extends UploadFile = File> = CalmLensUpload$1<F>;
|
|
5
5
|
type UploadSnapshot<F extends UploadFile = File> = UploadSnapshot$1<F>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as RetrieveAssetOptions, M as CdnAssetUrlOptions, O as CalmLensAppClientOptions, Ot as RequestOptions, Qt as UploadedAsset, Zt as UploadPresetSubmitAssetOptions, qt as UploadAssetPartOptions } from "./CalmLensTypes-
|
|
1
|
+
import { At as RetrieveAssetOptions, M as CdnAssetUrlOptions, O as CalmLensAppClientOptions, Ot as RequestOptions, Qt as UploadedAsset, Zt as UploadPresetSubmitAssetOptions, qt as UploadAssetPartOptions } from "./CalmLensTypes-CtO4Dieu.js";
|
|
2
2
|
declare const inspectSymbol: unique symbol;
|
|
3
3
|
declare class CalmLensAppClient {
|
|
4
4
|
#private;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as prepareSubmitAssetOptions, f as resolveConnectionOptions, i as CalmLensConnection, p as splitsIntoParts, s as expectUploadedAsset, t as APP_OPTION_KEYS } from "./CalmLensOptionKeys-
|
|
1
|
+
import { T as validateAppClientOptions, dt as invalidConfig, g as encodePathSegment, l as buildAssetUrl, m as checkOptionKeys, p as DEFAULT_CDN_BASE_URL, ut as invalidArgument } from "./ModerationContextLimits-IH2zX1wg.js";
|
|
2
|
+
import { d as prepareSubmitAssetOptions, f as resolveConnectionOptions, i as CalmLensConnection, p as splitsIntoParts, s as expectUploadedAsset, t as APP_OPTION_KEYS } from "./CalmLensOptionKeys-B6an7neE.js";
|
|
3
3
|
// src/client/CalmLensAppClient.ts
|
|
4
4
|
const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
5
5
|
/** `options`, once `checkOptionKeys` finds only keys `operation` takes. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as MAX_IMAGE_UPLOAD_BYTES, F as sleep, M as getRejectedUploadMimeTypeError, P as CalmLensTransport, Q as CalmLensError, S as stringifyQuery, U as resolveLogLevel, _ as isAcceptedUploadMimeType, b as randomUuid, ft as API_ERROR_CODES, j as MAX_NON_IMAGE_UPLOAD_BYTES, k as MAX_DIRECT_IMAGE_UPLOAD_BYTES, lt as SDK_ERROR_CODES, r as selectModerationContextItems, ut as invalidArgument } from "./ModerationContextLimits-IH2zX1wg.js";
|
|
2
2
|
// src/contract/AssetPayload.js
|
|
3
3
|
const bufferInputToBytes = (value) => {
|
|
4
4
|
if (value instanceof ArrayBuffer) return new Uint8Array(value);
|
|
@@ -746,9 +746,9 @@ const SERVER_OPTION_KEYS = {
|
|
|
746
746
|
"expiresIn",
|
|
747
747
|
"externalId",
|
|
748
748
|
"lens",
|
|
749
|
-
"original",
|
|
750
749
|
"projectId",
|
|
751
750
|
"resource",
|
|
751
|
+
"resource",
|
|
752
752
|
"transform",
|
|
753
753
|
"viewerClaims"
|
|
754
754
|
],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as HashListEntry, u as HashList } from "./Classification-CMM2tZpJ-IdIh63n0.js";
|
|
2
|
-
import { $ as FolderPage, $t as VerifyWebhookSignatureOptions, An as Policy, At as RetrieveAssetOptions, B as CreateHashListOptions, Bt as UpdateAssetOptions, D as BatchAssetsResponse, E as BatchAssetsOptions, Et as RemoveAssetContentOptions, Ft as SignUploadTokenOptions, G as DeleteAssetOptions, Gt as UpdateProjectSettingsOptions, Ht as UpdateHashListOptions, I as ClassifyTextOptions, In as AssetInfo, It as SignedAssetUrl, J as EnsureLensesOptions, K as DeleteMetadataFieldOptions, Kt as UpgradePolicyOptions, Lt as SignedUploadToken, M as CdnAssetUrlOptions, Nt as SetPolicyAutomaticUpdatesOptions, Ot as RequestOptions, P as CdnServeOptions, Pn as AssetSearchQuery, Pt as SignAssetUrlOptions, Q as FolderIdOptions, T as AssignPolicyOptions, Tt as PolicyPage, U as CreatePolicyOptions, Ut as UpdateLensOptions, V as CreateLensOptions, Vt as UpdateFolderOptions, W as DecideAssetOptions, Wt as UpdatePolicyOptions, X as EnsureUploadPresetsOptions, Xt as UploadPresetPage, Y as EnsureMetadataFieldsOptions, Yt as UploadPresetIdOptions, Z as EnsureUploadPresetsResponse, _ as AssetPage, _n as Folder, _t as ListLensesOptions, b as AssetTimelinePage, bt as MoveAssetOptions, ct as LensIdOptions, dt as ListAssetTimelineOptions, et as GetAssetInfoOptions, ft as ListAssetsOptions, gt as ListHashListsOptions, ht as ListHashListEntriesOptions, it as HashListPage, jt as RetryAssetOptions, k as CalmLensServerClientOptions, kt as ResetPolicyOptions, lt as LensPage, mt as ListFoldersOptions, nt as HashListEntryPage, o as AssetChildrenPage, on as GetEventsResponse, pt as ListEventsOptions, q as EnsureLensOptions, qt as UploadAssetPartOptions, r as Asset, rt as HashListIdOptions, st as Lens, t as AddHashListEntryOptions, tn as WaitForAssetDecisionOptions, tt as HashListEntryIdOptions, ut as ListAssetChildrenOptions, v as AssetSearchResponse, vn as MetadataFieldsResource, vt as ListPoliciesOptions, wt as PolicyIdOptions, xt as MoveFolderOptions, yn as ProjectSettingsResource, yt as ListUploadPresetsOptions, z as CreateFolderOptions, zt as SubmitAssetOptions } from "./CalmLensTypes-
|
|
3
|
-
import { d as ListPromise, l as CalmLensResponse, r as CdnResponse } from "./WebhookPayload-
|
|
2
|
+
import { $ as FolderPage, $t as VerifyWebhookSignatureOptions, An as Policy, At as RetrieveAssetOptions, B as CreateHashListOptions, Bt as UpdateAssetOptions, D as BatchAssetsResponse, E as BatchAssetsOptions, Et as RemoveAssetContentOptions, Ft as SignUploadTokenOptions, G as DeleteAssetOptions, Gt as UpdateProjectSettingsOptions, Ht as UpdateHashListOptions, I as ClassifyTextOptions, In as AssetInfo, It as SignedAssetUrl, J as EnsureLensesOptions, K as DeleteMetadataFieldOptions, Kt as UpgradePolicyOptions, Lt as SignedUploadToken, M as CdnAssetUrlOptions, Nt as SetPolicyAutomaticUpdatesOptions, Ot as RequestOptions, P as CdnServeOptions, Pn as AssetSearchQuery, Pt as SignAssetUrlOptions, Q as FolderIdOptions, T as AssignPolicyOptions, Tt as PolicyPage, U as CreatePolicyOptions, Ut as UpdateLensOptions, V as CreateLensOptions, Vt as UpdateFolderOptions, W as DecideAssetOptions, Wt as UpdatePolicyOptions, X as EnsureUploadPresetsOptions, Xt as UploadPresetPage, Y as EnsureMetadataFieldsOptions, Yt as UploadPresetIdOptions, Z as EnsureUploadPresetsResponse, _ as AssetPage, _n as Folder, _t as ListLensesOptions, b as AssetTimelinePage, bt as MoveAssetOptions, ct as LensIdOptions, dt as ListAssetTimelineOptions, et as GetAssetInfoOptions, ft as ListAssetsOptions, gt as ListHashListsOptions, ht as ListHashListEntriesOptions, it as HashListPage, jt as RetryAssetOptions, k as CalmLensServerClientOptions, kt as ResetPolicyOptions, lt as LensPage, mt as ListFoldersOptions, nt as HashListEntryPage, o as AssetChildrenPage, on as GetEventsResponse, pt as ListEventsOptions, q as EnsureLensOptions, qt as UploadAssetPartOptions, r as Asset, rt as HashListIdOptions, st as Lens, t as AddHashListEntryOptions, tn as WaitForAssetDecisionOptions, tt as HashListEntryIdOptions, ut as ListAssetChildrenOptions, v as AssetSearchResponse, vn as MetadataFieldsResource, vt as ListPoliciesOptions, wt as PolicyIdOptions, xt as MoveFolderOptions, yn as ProjectSettingsResource, yt as ListUploadPresetsOptions, z as CreateFolderOptions, zt as SubmitAssetOptions } from "./CalmLensTypes-CtO4Dieu.js";
|
|
3
|
+
import { d as ListPromise, l as CalmLensResponse, r as CdnResponse } from "./WebhookPayload-DZadhbAJ.js";
|
|
4
4
|
interface TransportRequest {
|
|
5
5
|
/** The client method sending the request, such as `assets.retrieve`, for hooks and logs. */
|
|
6
6
|
operation?: string;
|
|
@@ -83,10 +83,10 @@ declare class CalmLensServerClient {
|
|
|
83
83
|
getAssetUrl: (urlOptions: CdnAssetUrlOptions) => string;
|
|
84
84
|
/**
|
|
85
85
|
* Signs a private asset's URL on your server, so browsers and apps can load it without an API
|
|
86
|
-
* key until it expires.
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* appends them and aren't part of the signature.
|
|
86
|
+
* key until it expires. With `resource`, it is signed for that resource and ends in it; only a
|
|
87
|
+
* URL signed for `original` serves the exact uploaded file, and any other serves every other
|
|
88
|
+
* resource beneath its grant. Lenses, transforms and viewer claims are appended as
|
|
89
|
+
* `getAssetUrl` appends them and aren't part of the signature.
|
|
90
90
|
*/
|
|
91
91
|
signAssetUrl: (signOptions: SignAssetUrlOptions, requestOptions?: RequestOptions) => Promise<CalmLensResponse<SignedAssetUrl>>;
|
|
92
92
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { c as getMockHooks, d as prepareSubmitAssetOptions, f as resolveConnectionOptions, i as CalmLensConnection, l as invalidPayload, m as validateCallOptions, n as NULLABLE_OPTION_KEYS, o as expectAsset, p as splitsIntoParts, r as SERVER_OPTION_KEYS, u as newIdempotencyKey } from "./CalmLensOptionKeys-
|
|
1
|
+
import { B as copyLastResponse, C as toTextAssetOptions, D as validateServerClientOptions, E as validateBatchAssetsOptions, H as readEnv, L as isBrowserRuntime, Q as CalmLensError, R as isReactNativeRuntime, S as stringifyQuery, V as listPages, dt as invalidConfig, f as validateSignAssetUrlOptions, g as encodePathSegment, l as buildAssetUrl, lt as SDK_ERROR_CODES, m as checkOptionKeys, p as DEFAULT_CDN_BASE_URL, s as appendSignedLocation, u as getAssetInfo, ut as invalidArgument, y as pollForDecision } from "./ModerationContextLimits-IH2zX1wg.js";
|
|
2
|
+
import { c as getMockHooks, d as prepareSubmitAssetOptions, f as resolveConnectionOptions, i as CalmLensConnection, l as invalidPayload, m as validateCallOptions, n as NULLABLE_OPTION_KEYS, o as expectAsset, p as splitsIntoParts, r as SERVER_OPTION_KEYS, u as newIdempotencyKey } from "./CalmLensOptionKeys-B6an7neE.js";
|
|
3
3
|
import { n as sha256Hex, r as timingSafeEqual, t as hmacSha256Hex } from "./CryptoUtils-BLCa-oZe-DKr3LmN6.js";
|
|
4
4
|
// src/contract/JsonUtils.js
|
|
5
5
|
const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
|
|
@@ -426,24 +426,24 @@ var CalmLensServerClient = class {
|
|
|
426
426
|
},
|
|
427
427
|
/**
|
|
428
428
|
* Signs a private asset's URL on your server, so browsers and apps can load it without an API
|
|
429
|
-
* key until it expires.
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
* appends them and aren't part of the signature.
|
|
429
|
+
* key until it expires. With `resource`, it is signed for that resource and ends in it; only a
|
|
430
|
+
* URL signed for `original` serves the exact uploaded file, and any other serves every other
|
|
431
|
+
* resource beneath its grant. Lenses, transforms and viewer claims are appended as
|
|
432
|
+
* `getAssetUrl` appends them and aren't part of the signature.
|
|
433
433
|
*/
|
|
434
434
|
signAssetUrl: async (signOptions, requestOptions) => {
|
|
435
435
|
const options = checked("cdn.signAssetUrl", signOptions);
|
|
436
436
|
validateSignAssetUrlOptions(options);
|
|
437
|
-
const { projectId, assetId, externalId, expiresIn,
|
|
437
|
+
const { projectId, assetId, externalId, expiresIn, ...location } = options;
|
|
438
438
|
const project = requireId(projectId ?? this.#settings.projectId, "Project ID");
|
|
439
439
|
const signed = await this.#send("cdn.signAssetUrl", requestOptions, "POST", `/projects/${project}/signed-asset-urls`, { body: {
|
|
440
440
|
...assetId !== void 0 ? { assetId } : { externalId },
|
|
441
441
|
expiresIn: expiresIn ?? 900,
|
|
442
|
-
|
|
442
|
+
...location.resource !== void 0 ? { resource: location.resource } : {}
|
|
443
443
|
} });
|
|
444
444
|
if (!signed || typeof signed.url !== "string" || !signed.url || typeof signed.expiresAt !== "number") throw new CalmLensError(SDK_ERROR_CODES.INVALID_RESPONSE, { message: "The API returned no signed asset URL" });
|
|
445
445
|
return copyLastResponse({
|
|
446
|
-
url:
|
|
446
|
+
url: appendSignedLocation(signed.url, location),
|
|
447
447
|
expiresAt: signed.expiresAt
|
|
448
448
|
}, signed);
|
|
449
449
|
},
|
|
@@ -42912,7 +42912,7 @@ interface IdempotencyOptions {
|
|
|
42912
42912
|
}
|
|
42913
42913
|
/**
|
|
42914
42914
|
* What a resource URL beneath an asset URL serves: the `original` file exactly as uploaded (with a
|
|
42915
|
-
* signed URL, only
|
|
42915
|
+
* signed URL, only one signed for `original`); the `rendered` file for display (an image in the
|
|
42916
42916
|
* best format the client accepts, a PDF, or browser-safe video or audio); the `preview` still;
|
|
42917
42917
|
* the blurred `placeholder` PNG (private or blocked assets require a signed URL or download permission); the `hls` stream of audio or video (its
|
|
42918
42918
|
* master playlist); the `embed` page, which shows the asset in an iframe; or the `info` JSON that
|
|
@@ -42973,11 +42973,14 @@ type CdnServeOptions = CdnAssetUrlOptions & {
|
|
|
42973
42973
|
resource?: CdnResource;
|
|
42974
42974
|
init?: RequestInit;
|
|
42975
42975
|
};
|
|
42976
|
+
/**
|
|
42977
|
+
* `resource` is the resource the URL is signed for, and it ends in it. Only a URL signed for
|
|
42978
|
+
* `original` serves the exact uploaded file; any other, or one without a resource, serves every
|
|
42979
|
+
* other resource beneath its grant.
|
|
42980
|
+
*/
|
|
42976
42981
|
type SignAssetUrlOptions = CdnAssetUrlOptions & {
|
|
42977
42982
|
/** How long the URL works, in seconds, from 1 to 86400 (24 hours). Defaults to 900. */
|
|
42978
42983
|
expiresIn?: number;
|
|
42979
|
-
/** Whether the URL also serves `/original`, the exact uploaded file. Defaults to `false`. */
|
|
42980
|
-
original?: boolean;
|
|
42981
42984
|
};
|
|
42982
42985
|
/** Options for `getAssetInfo`. */
|
|
42983
42986
|
interface GetAssetInfoOptions {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as CdnTransform, O as CalmLensAppClientOptions, en as ViewerClaims, g as AssetModerationStatus, i as AssetAvailability } from "./CalmLensTypes-
|
|
2
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
1
|
+
import { F as CdnTransform, O as CalmLensAppClientOptions, en as ViewerClaims, g as AssetModerationStatus, i as AssetAvailability } from "./CalmLensTypes-CtO4Dieu.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-B3u6BlP5.js";
|
|
3
3
|
import { o as UploadFileIconFamily } from "./FileIcons-4qSX7DW2.js";
|
|
4
4
|
/**
|
|
5
5
|
* The text the asset viewers show, keyed by name. `{name}` placeholders are filled in when shown.
|