calmlens 0.26.1 → 0.27.2
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/README.md +1 -1
- package/bin/calmlens.js +118 -92
- package/{esm/BrowserUpload-zYWKtFSs.d.ts → cjs/BrowserUpload-D4sEmd0X.d.ts} +2 -2
- package/cjs/{BrowserUpload-DdkcoZLH.js → BrowserUpload-QizRFMJK.js} +1 -1
- package/{esm/CalmLensAppClient-mTTjqpRc.d.ts → cjs/CalmLensAppClient-CCeFnKX8.d.ts} +1 -1
- package/cjs/{CalmLensAppClient-Gu9mU_66.js → CalmLensAppClient-DdoxXe_7.js} +6 -6
- package/cjs/{CalmLensOptionKeys-BCITGsr9.js → CalmLensOptionKeys-C-KVONBL.js} +28 -6
- package/cjs/{CalmLensServerClient-D5-njsNk.d.ts → CalmLensServerClient-B7PfocET.d.ts} +3 -14
- package/cjs/{CalmLensServerClient-DHmAPT1u.js → CalmLensServerClient-CuZgePdv.js} +2 -16
- package/cjs/{CalmLensTypes-Df8eBgWB.d.ts → CalmLensTypes-HUERg5hI.d.ts} +16 -97
- package/cjs/{Classification-CxRedzgH-C9qlYW_J.d.ts → Classification-CMM2tZpJ-IdIh63n0.d.ts} +6 -7
- package/cjs/{Core-DAf9lqe2.js → Core-CizvXm3N.js} +11 -6
- package/{esm/Core-CREGGR0L.d.ts → cjs/Core-DXAs8mcx.d.ts} +2 -2
- package/cjs/{ModerationContextLimits-D4iwqoN_.js → ModerationContextLimits-ZbGIGHTQ.js} +3 -17
- package/{esm/ReactUpload-D4htIz8X.d.ts → cjs/ReactUpload-BTciTpwB.d.ts} +1 -1
- package/cjs/{ReactUpload-BNIbpxIH.js → ReactUpload-Swb6TIMq.js} +1 -1
- package/cjs/{TestTriggers-CiFcTHX3-BmfH4J3f.js → TestTriggers-Cvi7e2KA-DcT1pc_W.js} +91 -22
- package/{esm/TestTriggers-BJ4B-MXR-D1tGifPU.d.ts → cjs/TestTriggers-Dnukm-jm-DoEB7jJc.d.ts} +1 -1
- package/cjs/{UploadController-B_lKxvpM.js → UploadController-V6xkojIF.js} +2 -2
- package/cjs/{WebhookPayload-DMa6ihHr.d.ts → WebhookPayload-mUmOFH55.d.ts} +1 -7
- package/cjs/app.d.ts +6 -6
- package/cjs/app.js +2 -2
- package/cjs/elements.d.ts +4 -4
- package/cjs/elements.js +7 -5
- package/cjs/{index-CtpQldn_.d.ts → index-Ck7x1YjM.d.ts} +3 -3
- package/cjs/index.d.ts +5 -5
- 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 +6 -6
- package/cjs/server.d.ts +6 -6
- 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 +12 -17
- package/cjs/testing.js +35 -114
- package/cjs/{ui-BwFPFrno.d.ts → ui-BfJNO3c6.d.ts} +2 -2
- package/cjs/{ui-CvlJmRYM.js → ui-XxS-YOd3.js} +4 -4
- package/cjs/ui.d.ts +2 -2
- package/cjs/ui.js +3 -3
- package/cjs/vue.d.ts +5 -5
- package/cjs/vue.js +5 -5
- package/{cjs/BrowserUpload-zYWKtFSs.d.ts → esm/BrowserUpload-D4sEmd0X.d.ts} +2 -2
- package/esm/{BrowserUpload-BAWYEBd7.js → BrowserUpload-DhBPcU3A.js} +1 -1
- package/esm/{CalmLensAppClient-DNkIZb6x.js → CalmLensAppClient-BOwCdI-Q.js} +6 -6
- package/{cjs/CalmLensAppClient-mTTjqpRc.d.ts → esm/CalmLensAppClient-CCeFnKX8.d.ts} +1 -1
- package/esm/{CalmLensOptionKeys-CYHJo3nV.js → CalmLensOptionKeys-B0IEIQdg.js} +28 -6
- package/esm/{CalmLensServerClient-D5-njsNk.d.ts → CalmLensServerClient-B7PfocET.d.ts} +3 -14
- package/esm/{CalmLensServerClient-B1AiR4nv.js → CalmLensServerClient-DzXRfHQS.js} +2 -16
- package/esm/{CalmLensTypes-Df8eBgWB.d.ts → CalmLensTypes-HUERg5hI.d.ts} +16 -97
- package/esm/{Classification-CxRedzgH-C9qlYW_J.d.ts → Classification-CMM2tZpJ-IdIh63n0.d.ts} +6 -7
- package/{cjs/Core-CREGGR0L.d.ts → esm/Core-DXAs8mcx.d.ts} +2 -2
- package/esm/{Core-xNBQxZWH.js → Core-DxMJrvTr.js} +11 -6
- package/esm/{ModerationContextLimits-DxuPP4uM.js → ModerationContextLimits-BqRzr-pg.js} +3 -17
- package/{cjs/ReactUpload-D4htIz8X.d.ts → esm/ReactUpload-BTciTpwB.d.ts} +1 -1
- package/esm/{ReactUpload-BWifQdLv.js → ReactUpload-s0rFzCpq.js} +1 -1
- package/esm/{TestTriggers-CiFcTHX3-BK2-sgOC.js → TestTriggers-Cvi7e2KA-BA83CRJb.js} +87 -23
- package/{cjs/TestTriggers-BJ4B-MXR-D1tGifPU.d.ts → esm/TestTriggers-Dnukm-jm-DoEB7jJc.d.ts} +1 -1
- package/esm/{UploadController-jlJdddyI.js → UploadController-DnXRTWCY.js} +2 -2
- package/esm/{WebhookPayload-DMa6ihHr.d.ts → WebhookPayload-mUmOFH55.d.ts} +1 -7
- package/esm/app.d.ts +6 -6
- package/esm/app.js +2 -2
- package/esm/elements.d.ts +4 -4
- package/esm/elements.js +7 -5
- package/esm/{index-CtpQldn_.d.ts → index-Ck7x1YjM.d.ts} +3 -3
- package/esm/index.d.ts +5 -5
- 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 +6 -6
- package/esm/server.d.ts +6 -6
- package/esm/server.js +2 -2
- package/esm/styles.css +9 -4
- package/esm/svelte/CalmLensAsset.svelte +1 -1
- package/esm/test-inputs.d.ts +1 -1
- package/esm/test-inputs.js +1 -1
- package/esm/testing.d.ts +12 -17
- package/esm/testing.js +29 -108
- package/esm/{ui-BwFPFrno.d.ts → ui-BfJNO3c6.d.ts} +2 -2
- package/esm/{ui-BXzzqh7M.js → ui-DgR1wEWD.js} +4 -4
- package/esm/ui.d.ts +2 -2
- package/esm/ui.js +3 -3
- package/esm/vue.d.ts +5 -5
- package/esm/vue.js +5 -5
- package/package.json +1 -1
package/esm/testing.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { A as normalizeUploadMimeType, D as MAX_IMAGE_UPLOAD_BYTES, M as sleep, S as validateAppClientOptions, Y as CalmLensError, _ as randomUuid, ct as invalidConfig, f as checkTransformOptions, h as parseTransformSelector, k as getRejectedUploadMimeTypeError, lt as API_ERROR_CODES, m as isAcceptedUploadMimeType, ot as SDK_ERROR_CODES, r as selectModerationContextItems, st as invalidArgument, ut as API_ERROR_DEFINITIONS, w as validateServerClientOptions } from "./ModerationContextLimits-
|
|
2
|
-
import { a as WEBHOOK_TIMESTAMP_HEADER, f as signUploadTokenWithApiKey, m as stringifyJsonCanonical, n as WEBHOOK_DELIVERY_HEADER, p as decodeUploadToken, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
3
|
-
import { _ as validateAssetPayload, a as MOCK_HOOKS, g as assetToData, h as assetDataToUint8Array } from "./CalmLensOptionKeys-
|
|
1
|
+
import { A as normalizeUploadMimeType, D as MAX_IMAGE_UPLOAD_BYTES, M as sleep, S as validateAppClientOptions, Y as CalmLensError, _ as randomUuid, ct as invalidConfig, f as checkTransformOptions, h as parseTransformSelector, k as getRejectedUploadMimeTypeError, lt as API_ERROR_CODES, m as isAcceptedUploadMimeType, ot as SDK_ERROR_CODES, r as selectModerationContextItems, st as invalidArgument, ut as API_ERROR_DEFINITIONS, w as validateServerClientOptions } from "./ModerationContextLimits-BqRzr-pg.js";
|
|
2
|
+
import { a as WEBHOOK_TIMESTAMP_HEADER, f as signUploadTokenWithApiKey, m as stringifyJsonCanonical, n as WEBHOOK_DELIVERY_HEADER, p as decodeUploadToken, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient } from "./CalmLensServerClient-DzXRfHQS.js";
|
|
3
|
+
import { _ as validateAssetPayload, a as MOCK_HOOKS, g as assetToData, h as assetDataToUint8Array } from "./CalmLensOptionKeys-B0IEIQdg.js";
|
|
4
4
|
import { t as hmacSha256Hex } from "./CryptoUtils-B_x8lMIx-DhuWGzqn.js";
|
|
5
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
6
|
-
import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-
|
|
7
|
-
import { d as getTestInputTag,
|
|
5
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-BOwCdI-Q.js";
|
|
6
|
+
import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-DnXRTWCY.js";
|
|
7
|
+
import { d as getTestInputTag, h as CLASSIFICATION_CATEGORIES, m as lazySchema } from "./TestTriggers-Cvi7e2KA-BA83CRJb.js";
|
|
8
8
|
import * as zod from "zod";
|
|
9
9
|
// src/contract/MediaTestTriggers.js
|
|
10
10
|
const MEDIA_TEST_SIGNALS = [...CLASSIFICATION_CATEGORIES, "violence.graphic"];
|
|
@@ -31,7 +31,7 @@ async function generateMediaTestCode(signal, testInputKey) {
|
|
|
31
31
|
if (!MEDIA_TEST_SIGNALS.includes(signal)) throw new RangeError("Unsupported media test signal");
|
|
32
32
|
return `Calm Lens test ${[...await getTestInputTag("media", signal, testInputKey)].map((character) => HEX_WORDS[Number.parseInt(character, 16)]).join(" ")} ${signal.replace(/[.-]/g, " ")} end test`;
|
|
33
33
|
}
|
|
34
|
-
// src/contract/Ids-
|
|
34
|
+
// src/contract/Ids-C2cLdFM0.js
|
|
35
35
|
var __defProp = Object.defineProperty;
|
|
36
36
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
37
37
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -4266,7 +4266,7 @@ function registry() {
|
|
|
4266
4266
|
return new $ZodRegistry();
|
|
4267
4267
|
}
|
|
4268
4268
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
4269
|
-
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
4269
|
+
const globalRegistry$1 = globalThis.__zod_globalRegistry;
|
|
4270
4270
|
function snapshotChecks(def) {
|
|
4271
4271
|
if (def.checks) def.checks = [...def.checks];
|
|
4272
4272
|
return def;
|
|
@@ -5004,8 +5004,8 @@ function _check(fn, params) {
|
|
|
5004
5004
|
function describe$1(description) {
|
|
5005
5005
|
const ch = new $ZodCheck({ check: "describe" });
|
|
5006
5006
|
ch._zod.onattach = [(inst) => {
|
|
5007
|
-
const existing = globalRegistry.get(inst) ?? {};
|
|
5008
|
-
globalRegistry.add(inst, {
|
|
5007
|
+
const existing = globalRegistry$1.get(inst) ?? {};
|
|
5008
|
+
globalRegistry$1.add(inst, {
|
|
5009
5009
|
...existing,
|
|
5010
5010
|
description
|
|
5011
5011
|
});
|
|
@@ -5017,8 +5017,8 @@ function describe$1(description) {
|
|
|
5017
5017
|
function meta$1(metadata) {
|
|
5018
5018
|
const ch = new $ZodCheck({ check: "meta" });
|
|
5019
5019
|
ch._zod.onattach = [(inst) => {
|
|
5020
|
-
const existing = globalRegistry.get(inst) ?? {};
|
|
5021
|
-
globalRegistry.add(inst, {
|
|
5020
|
+
const existing = globalRegistry$1.get(inst) ?? {};
|
|
5021
|
+
globalRegistry$1.add(inst, {
|
|
5022
5022
|
...existing,
|
|
5023
5023
|
...metadata
|
|
5024
5024
|
});
|
|
@@ -5114,7 +5114,7 @@ function initializeContext(params) {
|
|
|
5114
5114
|
if (target === "draft-7") target = "draft-07";
|
|
5115
5115
|
return {
|
|
5116
5116
|
processors: params.processors ?? {},
|
|
5117
|
-
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
5117
|
+
metadataRegistry: params?.metadata ?? globalRegistry$1,
|
|
5118
5118
|
target,
|
|
5119
5119
|
unrepresentable: params?.unrepresentable ?? "throw",
|
|
5120
5120
|
override: params?.override ?? (() => {}),
|
|
@@ -6470,13 +6470,13 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
|
6470
6470
|
},
|
|
6471
6471
|
describe(description) {
|
|
6472
6472
|
const cl = this.clone();
|
|
6473
|
-
globalRegistry.add(cl, { description });
|
|
6473
|
+
globalRegistry$1.add(cl, { description });
|
|
6474
6474
|
return cl;
|
|
6475
6475
|
},
|
|
6476
6476
|
meta(...args) {
|
|
6477
|
-
if (args.length === 0) return globalRegistry.get(this);
|
|
6477
|
+
if (args.length === 0) return globalRegistry$1.get(this);
|
|
6478
6478
|
const cl = this.clone();
|
|
6479
|
-
globalRegistry.add(cl, args[0]);
|
|
6479
|
+
globalRegistry$1.add(cl, args[0]);
|
|
6480
6480
|
return cl;
|
|
6481
6481
|
},
|
|
6482
6482
|
isOptional() {
|
|
@@ -6552,7 +6552,7 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
|
6552
6552
|
return createToJSONSchemaMethod(this, {})(params);
|
|
6553
6553
|
},
|
|
6554
6554
|
get description() {
|
|
6555
|
-
return globalRegistry.get(this)?.description;
|
|
6555
|
+
return globalRegistry$1.get(this)?.description;
|
|
6556
6556
|
},
|
|
6557
6557
|
get _def() {
|
|
6558
6558
|
return this._zod.def;
|
|
@@ -8028,8 +8028,8 @@ const EXAMPLE_IDS = {
|
|
|
8028
8028
|
* across the packages that build records from plain strings).
|
|
8029
8029
|
*/
|
|
8030
8030
|
const idField = (prefix) => zod.string().regex(idPattern(prefix), { message: `Must be a valid ID: "${prefix}_" followed by 20 letters or digits` }).meta({ examples: [EXAMPLE_IDS[prefix]] });
|
|
8031
|
-
// src/contract/Permissions-
|
|
8032
|
-
const ACTION_SCHEMA = zod.enum([
|
|
8031
|
+
// src/contract/Permissions-CzuRcPMS.js
|
|
8032
|
+
const ACTION_SCHEMA = /* @__PURE__ */ lazySchema(() => zod.enum([
|
|
8033
8033
|
"assets:read",
|
|
8034
8034
|
"assets:download",
|
|
8035
8035
|
"assets:create",
|
|
@@ -8061,7 +8061,7 @@ const ACTION_SCHEMA = zod.enum([
|
|
|
8061
8061
|
"reviews:read",
|
|
8062
8062
|
"reviews:write",
|
|
8063
8063
|
"project:manage"
|
|
8064
|
-
]);
|
|
8064
|
+
]));
|
|
8065
8065
|
const PROJECT_ACTIONS = [...[
|
|
8066
8066
|
"settings",
|
|
8067
8067
|
"members",
|
|
@@ -8077,19 +8077,12 @@ const PROJECT_ACTIONS = [...[
|
|
|
8077
8077
|
const isProjectAction = (action) => PROJECT_ACTIONS.includes(action);
|
|
8078
8078
|
/** The actions that include `action`: its feature's write action and project:manage. */
|
|
8079
8079
|
const actionsImplying = (action) => !isProjectAction(action) || action === "project:manage" ? [] : action.endsWith(":read") ? [action.replace(/:read$/, ":write"), "project:manage"] : ["project:manage"];
|
|
8080
|
-
const GRANT_SCHEMA = zod.object({
|
|
8080
|
+
const GRANT_SCHEMA = /* @__PURE__ */ lazySchema(() => zod.object({
|
|
8081
8081
|
actions: zod.array(ACTION_SCHEMA),
|
|
8082
8082
|
folderId: idField("fldr").nullable(),
|
|
8083
8083
|
includeSubfolders: zod.boolean()
|
|
8084
|
-
}).strict().refine((g) => g.folderId === null || !g.actions.some(isProjectAction), "Project configuration permissions require project scope");
|
|
8085
|
-
const GRANTS_SCHEMA = zod.array(GRANT_SCHEMA).max(100);
|
|
8086
|
-
zod.enum([
|
|
8087
|
-
"admin",
|
|
8088
|
-
"configurator",
|
|
8089
|
-
"editor",
|
|
8090
|
-
"viewer",
|
|
8091
|
-
"custom"
|
|
8092
|
-
]);
|
|
8084
|
+
}).strict().refine((g) => g.folderId === null || !g.actions.some(isProjectAction), "Project configuration permissions require project scope"));
|
|
8085
|
+
const GRANTS_SCHEMA = /* @__PURE__ */ lazySchema(() => zod.array(GRANT_SCHEMA).max(100));
|
|
8093
8086
|
[...ACTION_SCHEMA.options.filter((a) => !isProjectAction(a))];
|
|
8094
8087
|
[...ACTION_SCHEMA.options.filter((a) => !isProjectAction(a))];
|
|
8095
8088
|
const permits = (grants, action, folderId, folders) => grants.some((grant) => {
|
|
@@ -8105,14 +8098,6 @@ const permits = (grants, action, folderId, folders) => grants.some((grant) => {
|
|
|
8105
8098
|
}
|
|
8106
8099
|
return false;
|
|
8107
8100
|
});
|
|
8108
|
-
/**
|
|
8109
|
-
* What a person can let an AI assistant or the CLI do for them. `read` looks at assets, folders,
|
|
8110
|
-
* hash lists and events; `write` also creates, changes and deletes assets, folders and hash lists.
|
|
8111
|
-
* Members, API keys, connectors, sharing, downloads and project settings are never delegated.
|
|
8112
|
-
*/
|
|
8113
|
-
const AGENT_SCOPE_SCHEMA = zod.enum(["read", "write"]);
|
|
8114
|
-
zod.array(AGENT_SCOPE_SCHEMA).min(1).max(2);
|
|
8115
|
-
zod.enum(["active", "banned"]);
|
|
8116
8101
|
// src/testing/MockApiKey.ts
|
|
8117
8102
|
const MOCK_API_KEY_PREFIX = "sk_test_";
|
|
8118
8103
|
const toBase64Url = (value) => btoa(value).replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
|
|
@@ -9168,7 +9153,6 @@ const MOCK_OPERATIONS = [
|
|
|
9168
9153
|
"assets.uploadPart",
|
|
9169
9154
|
"assets.move",
|
|
9170
9155
|
"assets.retry",
|
|
9171
|
-
"assets.explain",
|
|
9172
9156
|
"assets.decide",
|
|
9173
9157
|
"assets.removeContent",
|
|
9174
9158
|
"assets.delete",
|
|
@@ -9628,7 +9612,6 @@ const operationsOf = (request) => {
|
|
|
9628
9612
|
case "part": return ["assets.uploadPart"];
|
|
9629
9613
|
case "move": return ["assets.move"];
|
|
9630
9614
|
case "retry": return ["assets.retry"];
|
|
9631
|
-
case "explain": return ["assets.explain"];
|
|
9632
9615
|
case "decision": return ["assets.decide"];
|
|
9633
9616
|
}
|
|
9634
9617
|
return [];
|
|
@@ -9675,7 +9658,6 @@ var MockCalmLensApi = class {
|
|
|
9675
9658
|
this.eventFeed = [];
|
|
9676
9659
|
this.assetEventSequences = /* @__PURE__ */ new Map();
|
|
9677
9660
|
this.processingOptions = /* @__PURE__ */ new Map();
|
|
9678
|
-
this.pendingReruns = /* @__PURE__ */ new Set();
|
|
9679
9661
|
this.openUploads = /* @__PURE__ */ new Map();
|
|
9680
9662
|
this.idempotentResults = /* @__PURE__ */ new Map();
|
|
9681
9663
|
this.pendingFailures = [];
|
|
@@ -9773,11 +9755,9 @@ var MockCalmLensApi = class {
|
|
|
9773
9755
|
} catch (failure) {
|
|
9774
9756
|
throw this.toError(failure);
|
|
9775
9757
|
}
|
|
9776
|
-
|
|
9777
|
-
if (!rerun && asset.classification.status !== "processing") throw invalidArgument(`asset ${assetId} isn't processing`);
|
|
9758
|
+
if (asset.classification.status !== "processing") throw invalidArgument(`asset ${assetId} isn't processing`);
|
|
9778
9759
|
const settled = decision === void 0 ? void 0 : toDecision(decision);
|
|
9779
|
-
|
|
9780
|
-
return structuredClone(await this.settleRerun(asset, settled ?? await this.decisionFor(asset, "complete", true)));
|
|
9760
|
+
return structuredClone(await this.moderateStored(asset, "complete", settled));
|
|
9781
9761
|
}
|
|
9782
9762
|
/**
|
|
9783
9763
|
* `POST /assets/:assetId/decision`, like the API: an asset still uploading or processing can't
|
|
@@ -9808,7 +9788,6 @@ var MockCalmLensApi = class {
|
|
|
9808
9788
|
* the mock API key's; the test hook records no note, the API's handler records it.
|
|
9809
9789
|
*/
|
|
9810
9790
|
async recordDecision(asset, decision, review) {
|
|
9811
|
-
this.pendingReruns.delete(asset.id);
|
|
9812
9791
|
const decided = await this.applyOutcome(asset, decision, "requested");
|
|
9813
9792
|
const now = this.now();
|
|
9814
9793
|
if (!review) decided.classification.moderation.pendingReview = null;
|
|
@@ -10094,7 +10073,6 @@ var MockCalmLensApi = class {
|
|
|
10094
10073
|
case "POST part": return [200, await this.uploadPart(id, request)];
|
|
10095
10074
|
case "POST move": return [200, await this.moveAsset(id, this.json(request))];
|
|
10096
10075
|
case "POST retry": return [200, await this.retryAsset(id)];
|
|
10097
|
-
case "POST explain": return [200, await this.explainAsset(id, this.json(request))];
|
|
10098
10076
|
case "POST decision": return [200, await this.decideAsset(id, this.json(request))];
|
|
10099
10077
|
case "DELETE content": return [200, await this.removeContent(await this.findOwnAsset(id))];
|
|
10100
10078
|
}
|
|
@@ -10516,47 +10494,6 @@ var MockCalmLensApi = class {
|
|
|
10516
10494
|
this.recordLifecycleEvent("asset.retried", retried);
|
|
10517
10495
|
return this.moderateStored(retried, "retry");
|
|
10518
10496
|
}
|
|
10519
|
-
async explainAsset(assetId, body) {
|
|
10520
|
-
const asset = await this.findOwnAsset(assetId);
|
|
10521
|
-
if (asset.classification.status !== "completed") throw fail(API_ERROR_CODES.ASSET_NOT_DECIDED);
|
|
10522
|
-
if (!body.rerun) {
|
|
10523
|
-
if (asset.classification.moderation?.explanationComplete !== false) return asset;
|
|
10524
|
-
return this.databaseStorage.updateAsset({
|
|
10525
|
-
...asset,
|
|
10526
|
-
updatedAt: this.now(),
|
|
10527
|
-
classification: {
|
|
10528
|
-
...asset.classification,
|
|
10529
|
-
moderation: {
|
|
10530
|
-
...asset.classification.moderation,
|
|
10531
|
-
explanationComplete: true
|
|
10532
|
-
}
|
|
10533
|
-
}
|
|
10534
|
-
});
|
|
10535
|
-
}
|
|
10536
|
-
if (asset.classification.moderation.manualReviews.length) throw fail(API_ERROR_CODES.ASSET_REVIEWED);
|
|
10537
|
-
if (asset.content.status === "removed") throw fail(API_ERROR_CODES.ASSET_CONTENT_UNAVAILABLE);
|
|
10538
|
-
this.pushEvent({
|
|
10539
|
-
type: "asset.rerun-requested",
|
|
10540
|
-
actor: MOCK_API_KEY_ACTOR,
|
|
10541
|
-
severity: "low",
|
|
10542
|
-
assetId: asset.id,
|
|
10543
|
-
asset: toEventAsset(asset),
|
|
10544
|
-
facts: [
|
|
10545
|
-
assetNameFact(asset),
|
|
10546
|
-
{
|
|
10547
|
-
key: "asset-type",
|
|
10548
|
-
value: asset.type
|
|
10549
|
-
},
|
|
10550
|
-
{
|
|
10551
|
-
key: "moderation-status",
|
|
10552
|
-
value: asset.classification.moderation.decision
|
|
10553
|
-
}
|
|
10554
|
-
]
|
|
10555
|
-
});
|
|
10556
|
-
const response = structuredClone(asset);
|
|
10557
|
-
await this.settleRerun(asset, await this.decisionFor(asset, "rerun", true));
|
|
10558
|
-
return response;
|
|
10559
|
-
}
|
|
10560
10497
|
/**
|
|
10561
10498
|
* Checks every asset like the API (an ID that is not an asset ID is
|
|
10562
10499
|
* `validation/invalid-format`, an unknown
|
|
@@ -11001,20 +10938,6 @@ var MockCalmLensApi = class {
|
|
|
11001
10938
|
this.recordProcessingEvents(stored, decision);
|
|
11002
10939
|
return stored;
|
|
11003
10940
|
}
|
|
11004
|
-
/**
|
|
11005
|
-
* Applies a re-run's `decision` to a decided asset like the pipeline: a `pending` decision stays
|
|
11006
|
-
* queued for `completeProcessing`, a `failed` one keeps the asset's decision, and any other
|
|
11007
|
-
* replaces it with the pipeline's events.
|
|
11008
|
-
*/
|
|
11009
|
-
async settleRerun(asset, decision) {
|
|
11010
|
-
this.pendingReruns.delete(asset.id);
|
|
11011
|
-
if (decision.status === "pending") {
|
|
11012
|
-
this.pendingReruns.add(asset.id);
|
|
11013
|
-
return asset;
|
|
11014
|
-
}
|
|
11015
|
-
if (decision.status === "failed") return asset;
|
|
11016
|
-
return this.settle(asset, decision);
|
|
11017
|
-
}
|
|
11018
10941
|
/** Asks `moderate` (unless `decision` is given) and settles a processing asset. */
|
|
11019
10942
|
async moderateStored(asset, trigger, decision) {
|
|
11020
10943
|
return this.settle(asset, decision ?? await this.decisionFor(asset, trigger, true));
|
|
@@ -11677,6 +11600,7 @@ var MockCalmLensApi = class {
|
|
|
11677
11600
|
const status = asset.classification.moderation.decision;
|
|
11678
11601
|
const isHead = request.method === "HEAD";
|
|
11679
11602
|
const { rendered, preview } = asset.content;
|
|
11603
|
+
if (resource !== "info" && asset.content.status === "removed") return notFound();
|
|
11680
11604
|
if (asset.visibility !== "public" && !grant && !hasApiKey && resource !== "info") return notFound();
|
|
11681
11605
|
if (resource === "info") return this.serveInfo(request, asset, Boolean(grant) || canDownload());
|
|
11682
11606
|
if (asset.content.safetyHold) return notAvailable();
|
|
@@ -11693,7 +11617,7 @@ var MockCalmLensApi = class {
|
|
|
11693
11617
|
});
|
|
11694
11618
|
}
|
|
11695
11619
|
const storedContent = await this.imageStorage.getContent(asset.id);
|
|
11696
|
-
if (asset.upload.status === "uploading" || status === "purged" || status === "blocked" || asset.classification.status === "failed" ||
|
|
11620
|
+
if (asset.upload.status === "uploading" || status === "purged" || status === "blocked" || asset.classification.status === "failed" || resource === "original" && !storedContent) return notAvailable();
|
|
11697
11621
|
let claims = {};
|
|
11698
11622
|
try {
|
|
11699
11623
|
claims = JSON.parse(query.get("viewerClaims") ?? request.headers.get("X-CalmLens-Viewer-Claims") ?? "{}");
|
|
@@ -12043,11 +11967,8 @@ var MockCalmLensServerClient = class extends CalmLensServerClient {
|
|
|
12043
11967
|
* else what `mockOptions.moderate` returns for the `complete` trigger (`allowed` by default).
|
|
12044
11968
|
* The asset gets the decision's report, and `asset.classified` and the automated
|
|
12045
11969
|
* `asset.<status>` (or `asset.failed`) join the events feed. No review is recorded, so the
|
|
12046
|
-
* asset can still be moderated again.
|
|
12047
|
-
* `
|
|
12048
|
-
* `pending` or `failed`. Rejects with `asset/not-found` for an unknown asset and
|
|
12049
|
-
* `sdk/invalid-argument` for one that isn't processing or awaiting a pending re-run. It sends
|
|
12050
|
-
* no request.
|
|
11970
|
+
* asset can still be moderated again. Rejects with `asset/not-found` for an unknown asset and
|
|
11971
|
+
* `sdk/invalid-argument` for one that isn't processing. It sends no request.
|
|
12051
11972
|
*/
|
|
12052
11973
|
completeProcessing(assetId, decision) {
|
|
12053
11974
|
return this.#api.completeProcessing(assetId, decision);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./CalmLensTypes-
|
|
2
|
-
import { K as AssetOptions, Z as AssetView, ct as PdfAssetOptions, ft as ViewerOptions, lt as SpreadsheetViewerOptions, mt as WebsiteViewerOptions, ot as DocumentViewerOptions, q as AssetSession, st as ImageViewerOptions, ut as TextViewerOptions } from "./Core-
|
|
1
|
+
import "./CalmLensTypes-HUERg5hI.js";
|
|
2
|
+
import { K as AssetOptions, Z as AssetView, ct as PdfAssetOptions, ft as ViewerOptions, lt as SpreadsheetViewerOptions, mt as WebsiteViewerOptions, ot as DocumentViewerOptions, q as AssetSession, st as ImageViewerOptions, ut as TextViewerOptions } from "./Core-DXAs8mcx.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,6 +1,6 @@
|
|
|
1
|
-
import { a as appendAssetLocation } from "./ModerationContextLimits-
|
|
2
|
-
import { o as placeholderHashToDataURL } from "./UploadController-
|
|
3
|
-
import "./Core-
|
|
1
|
+
import { a as appendAssetLocation } from "./ModerationContextLimits-BqRzr-pg.js";
|
|
2
|
+
import { o as placeholderHashToDataURL } from "./UploadController-DnXRTWCY.js";
|
|
3
|
+
import "./Core-DxMJrvTr.js";
|
|
4
4
|
// src/ui/viewers/PdfLoader.ts
|
|
5
5
|
let loading;
|
|
6
6
|
/**
|
|
@@ -490,7 +490,7 @@ var DocumentViewer = class extends ViewerBase {
|
|
|
490
490
|
const page = await document.getPage(pageNumber);
|
|
491
491
|
if (render !== this.#renders) return;
|
|
492
492
|
const natural = page.getViewport({ scale: 1 });
|
|
493
|
-
const available = controls.pages.clientWidth
|
|
493
|
+
const available = controls.pages.clientWidth;
|
|
494
494
|
const scale = this.#zoom ?? (available > 0 ? available / natural.width : 1);
|
|
495
495
|
this.#scale = scale;
|
|
496
496
|
controls.zoomLevel.textContent = formatViewerMessage(messages.zoomLevel, { percent: Math.round(scale * 100) });
|
package/esm/ui.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as getAssetAspectRatio, 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 MediaPlayback, 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 AssetViewerKind, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as PdfAssetOptions, d as AssetDisplayOptions, dt as ViewerAsset, et as getAssetView, f as AssetEventHandlers, ft as ViewerOptions, g as CalmLensMessages, gt as isSpreadsheetFormat, h as UploaderProps, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as pickAssetSource, j as CustomUploadResult, k as CalmLensUpload, l as IconName, lt as SpreadsheetViewerOptions, m as UploaderDisplayOptions, mt as WebsiteViewerOptions, n as CalmLensTheme, nt as getPeakHeights, o as createProgressFetch, ot as DocumentViewerOptions, p as AssetProps, pt as ViewerTextOptions, q as AssetSession, r as resolveTheme, rt as getPlayedPercent, s as ICONS, st as ImageViewerOptions, t as CALMLENS_THEME, tt as getAssetViewKey, u as ASSET_FILE_ICON_SIZE, ut as TextViewerOptions, 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 { C as ViewerState, S as AssetViewer, _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as createWebsiteViewer, 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 createDocumentViewer, y as createImageViewer } from "./ui-
|
|
1
|
+
import { $ as getAssetAspectRatio, 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 MediaPlayback, 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 AssetViewerKind, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as PdfAssetOptions, d as AssetDisplayOptions, dt as ViewerAsset, et as getAssetView, f as AssetEventHandlers, ft as ViewerOptions, g as CalmLensMessages, gt as isSpreadsheetFormat, h as UploaderProps, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as pickAssetSource, j as CustomUploadResult, k as CalmLensUpload, l as IconName, lt as SpreadsheetViewerOptions, m as UploaderDisplayOptions, mt as WebsiteViewerOptions, n as CalmLensTheme, nt as getPeakHeights, o as createProgressFetch, ot as DocumentViewerOptions, p as AssetProps, pt as ViewerTextOptions, q as AssetSession, r as resolveTheme, rt as getPlayedPercent, s as ICONS, st as ImageViewerOptions, t as CALMLENS_THEME, tt as getAssetViewKey, u as ASSET_FILE_ICON_SIZE, ut as TextViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage, z as createUploadController } from "./Core-DXAs8mcx.js";
|
|
2
|
+
import { C as ViewerState, S as AssetViewer, _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as createWebsiteViewer, 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 createDocumentViewer, y as createImageViewer } from "./ui-BfJNO3c6.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, type IconName, type ImageViewerOptions, 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, type WebsiteViewerOptions, createDocumentViewer, createImageViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, createWebsiteViewer, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, withProvidedOptions };
|
package/esm/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as loadPdfJs, a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createImageViewer, f as createWebsiteViewer, g as resolveViewerMessages, h as formatViewerMessage, i as isMountedViewerKind, l as parseSpreadsheetText, m as DEFAULT_VIEWER_MESSAGES, n as AssetViewerMount, o as createSpreadsheetViewer, p as createDocumentViewer, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-
|
|
2
|
-
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-
|
|
3
|
-
import { C as CALMLENS_THEME, E as isSpreadsheetFormat, S as VIEWER_STYLES, T as getAssetViewerKind, _ as getAssetView, a as describeUploadItem, b as getPlayedPercent, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as getAssetAspectRatio, 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 getAssetViewKey, w as resolveTheme, x as pickAssetSource, y as getPeakHeights } from "./Core-
|
|
1
|
+
import { _ as loadPdfJs, a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createImageViewer, f as createWebsiteViewer, g as resolveViewerMessages, h as formatViewerMessage, i as isMountedViewerKind, l as parseSpreadsheetText, m as DEFAULT_VIEWER_MESSAGES, n as AssetViewerMount, o as createSpreadsheetViewer, p as createDocumentViewer, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-DgR1wEWD.js";
|
|
2
|
+
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-DnXRTWCY.js";
|
|
3
|
+
import { C as CALMLENS_THEME, E as isSpreadsheetFormat, S as VIEWER_STYLES, T as getAssetViewerKind, _ as getAssetView, a as describeUploadItem, b as getPlayedPercent, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as getAssetAspectRatio, 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 getAssetViewKey, w as resolveTheme, x as pickAssetSource, y as getPeakHeights } from "./Core-DxMJrvTr.js";
|
|
4
4
|
export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, AssetSession, AssetViewerMount, CALMLENS_STYLES, CALMLENS_THEME, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, ICONS, ICON_ATTRIBUTES, MediaStreamPlayer, UploadController, VIEWER_STYLES, createDocumentViewer, createImageViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, createWebsiteViewer, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, 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,
|
|
2
|
-
import "./index-
|
|
3
|
-
import { $ as getAssetAspectRatio, 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 MediaPlayback, 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 AssetViewerKind, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as PdfAssetOptions, d as AssetDisplayOptions, dt as ViewerAsset, et as getAssetView, f as AssetEventHandlers, ft as ViewerOptions, g as CalmLensMessages, gt as isSpreadsheetFormat, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as pickAssetSource, j as CustomUploadResult, l as IconName, lt as SpreadsheetViewerOptions, m as UploaderDisplayOptions, mt as WebsiteViewerOptions, n as CalmLensTheme, nt as getPeakHeights, o as createProgressFetch, ot as DocumentViewerOptions, p as AssetProps, pt as ViewerTextOptions, q as AssetSession, r as resolveTheme, rt as getPlayedPercent, s as ICONS, st as ImageViewerOptions, t as CALMLENS_THEME, tt as getAssetViewKey, u as ASSET_FILE_ICON_SIZE, ut as TextViewerOptions, 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 { C as ViewerState, S as AssetViewer, _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as createWebsiteViewer, 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 createDocumentViewer, y as createImageViewer } from "./ui-
|
|
1
|
+
import { O as CalmLensAppClientOptions, en as ViewerClaims, g as AssetModerationStatus, i as AssetAvailability } from "./CalmLensTypes-HUERg5hI.js";
|
|
2
|
+
import "./index-Ck7x1YjM.js";
|
|
3
|
+
import { $ as getAssetAspectRatio, 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 MediaPlayback, 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 AssetViewerKind, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as PdfAssetOptions, d as AssetDisplayOptions, dt as ViewerAsset, et as getAssetView, f as AssetEventHandlers, ft as ViewerOptions, g as CalmLensMessages, gt as isSpreadsheetFormat, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as pickAssetSource, j as CustomUploadResult, l as IconName, lt as SpreadsheetViewerOptions, m as UploaderDisplayOptions, mt as WebsiteViewerOptions, n as CalmLensTheme, nt as getPeakHeights, o as createProgressFetch, ot as DocumentViewerOptions, p as AssetProps, pt as ViewerTextOptions, q as AssetSession, r as resolveTheme, rt as getPlayedPercent, s as ICONS, st as ImageViewerOptions, t as CALMLENS_THEME, tt as getAssetViewKey, u as ASSET_FILE_ICON_SIZE, ut as TextViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage } from "./Core-DXAs8mcx.js";
|
|
4
|
+
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-D4sEmd0X.js";
|
|
5
|
+
import { C as ViewerState, S as AssetViewer, _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as createWebsiteViewer, 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 createDocumentViewer, y as createImageViewer } from "./ui-BfJNO3c6.js";
|
|
6
6
|
import { App, MaybeRefOrGetter, PropType, ShallowRef } from "vue";
|
|
7
7
|
/** Shows an image asset's rendered file, fitted to the element, over its placeholder. */
|
|
8
8
|
export declare const CalmLensImageViewer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
package/esm/vue.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { _ as loadPdfJs, a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createImageViewer, f as createWebsiteViewer, g as resolveViewerMessages, h as formatViewerMessage, i as isMountedViewerKind, l as parseSpreadsheetText, m as DEFAULT_VIEWER_MESSAGES, n as AssetViewerMount, o as createSpreadsheetViewer, p as createDocumentViewer, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-
|
|
2
|
-
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-
|
|
3
|
-
import { C as CALMLENS_THEME, E as isSpreadsheetFormat, S as VIEWER_STYLES, T as getAssetViewerKind, _ as getAssetView, a as describeUploadItem, b as getPlayedPercent, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as getAssetAspectRatio, 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 getAssetViewKey, w as resolveTheme, x as pickAssetSource, y as getPeakHeights } from "./Core-
|
|
1
|
+
import { _ as loadPdfJs, a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createImageViewer, f as createWebsiteViewer, g as resolveViewerMessages, h as formatViewerMessage, i as isMountedViewerKind, l as parseSpreadsheetText, m as DEFAULT_VIEWER_MESSAGES, n as AssetViewerMount, o as createSpreadsheetViewer, p as createDocumentViewer, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-DgR1wEWD.js";
|
|
2
|
+
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-DnXRTWCY.js";
|
|
3
|
+
import { C as CALMLENS_THEME, E as isSpreadsheetFormat, S as VIEWER_STYLES, T as getAssetViewerKind, _ as getAssetView, a as describeUploadItem, b as getPlayedPercent, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as getAssetAspectRatio, 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 getAssetViewKey, w as resolveTheme, x as pickAssetSource, y as getPeakHeights } from "./Core-DxMJrvTr.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-DhBPcU3A.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) => ({
|
|
@@ -512,7 +512,7 @@ const CalmLensAsset = defineComponent({
|
|
|
512
512
|
"aria-busy": current.kind === "pending" ? "true" : void 0,
|
|
513
513
|
style: {
|
|
514
514
|
aspectRatio: ratio,
|
|
515
|
-
|
|
515
|
+
"--calmlens-average-color": state.value.info?.content?.preview?.averageColor ?? void 0,
|
|
516
516
|
"--calmlens-fit": props.fit
|
|
517
517
|
}
|
|
518
518
|
}, [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "calmlens",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.2",
|
|
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",
|