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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as validateBatchAssetsOptions, F as isReactNativeRuntime, L as copyLastResponse, P as isBrowserRuntime, R as listPages, Y as CalmLensError, a as appendAssetLocation, b as toTextAssetOptions, ct as invalidConfig, d as checkOptionKeys, g as pollForDecision, l as validateSignAssetUrlOptions, o as buildAssetUrl, ot as SDK_ERROR_CODES, p as encodePathSegment, s as getAssetInfo, st as invalidArgument, u as DEFAULT_CDN_BASE_URL, w as validateServerClientOptions, y as stringifyQuery, z as readEnv } from "./ModerationContextLimits-
|
|
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 { C as validateBatchAssetsOptions, F as isReactNativeRuntime, L as copyLastResponse, P as isBrowserRuntime, R as listPages, Y as CalmLensError, a as appendAssetLocation, b as toTextAssetOptions, ct as invalidConfig, d as checkOptionKeys, g as pollForDecision, l as validateSignAssetUrlOptions, o as buildAssetUrl, ot as SDK_ERROR_CODES, p as encodePathSegment, s as getAssetInfo, st as invalidArgument, u as DEFAULT_CDN_BASE_URL, w as validateServerClientOptions, y as stringifyQuery, z as readEnv } from "./ModerationContextLimits-BqRzr-pg.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-B0IEIQdg.js";
|
|
3
3
|
import { n as sha256Hex, r as timingSafeEqual, t as hmacSha256Hex } from "./CryptoUtils-B_x8lMIx-DhuWGzqn.js";
|
|
4
4
|
// src/contract/JsonUtils.js
|
|
5
5
|
const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
|
|
@@ -591,20 +591,6 @@ sign: async (options) => {
|
|
|
591
591
|
return this.#send("assets.decide", requestOptions, "POST", `/assets/${requireId(assetId, "Asset ID")}/decision`, { body });
|
|
592
592
|
},
|
|
593
593
|
/**
|
|
594
|
-
* Completes the policy evidence behind a decided asset's moderation decision: its
|
|
595
|
-
* `classification.moderation.explanationComplete` becomes `true` and every action stays as
|
|
596
|
-
* decided. With `rerun: true` the asset is moderated again with the project's current policy
|
|
597
|
-
* and an `asset.rerun-requested` event is recorded; use it when the policy has changed since
|
|
598
|
-
* the decision (`asset/policy-changed`). The asset returns unchanged: it keeps its decision
|
|
599
|
-
* until the re-run's is stored, reported by `asset.classified` and `asset.<status>` events,
|
|
600
|
-
* and a failed re-run keeps it. A reviewed asset fails with `asset/reviewed`, and one whose
|
|
601
|
-
* content is gone with `asset/content-unavailable`.
|
|
602
|
-
*/
|
|
603
|
-
explain: async (options, requestOptions) => {
|
|
604
|
-
const { assetId, rerun } = checked("assets.explain", options);
|
|
605
|
-
return this.#send("assets.explain", requestOptions, "POST", `/assets/${requireId(assetId, "Asset ID")}/explain`, { body: rerun ? { rerun } : {} });
|
|
606
|
-
},
|
|
607
|
-
/**
|
|
608
594
|
* Waits until an asset is settled, its `classification.status` `completed` (with its
|
|
609
595
|
* decision in `classification.moderation.decision`) or `failed`, and returns that asset,
|
|
610
596
|
* checking every few seconds. A `queued` or `processing` asset is still waiting, even when a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as HashListEntry, f as ModerationContext, t as AssetModerationDecision$1, u as HashList } from "./Classification-
|
|
1
|
+
import { d as HashListEntry, f as ModerationContext, t as AssetModerationDecision$1, u as HashList } from "./Classification-CMM2tZpJ-IdIh63n0.js";
|
|
2
2
|
import * as zod from "zod";
|
|
3
3
|
/**
|
|
4
4
|
* Where the asset is in the pipeline: waiting for its content or its turn (`queued`), being
|
|
@@ -36713,87 +36713,6 @@ declare const EVENT_TYPE_INFO: {
|
|
|
36713
36713
|
}>>>;
|
|
36714
36714
|
}, zod.core.$strip>;
|
|
36715
36715
|
};
|
|
36716
|
-
readonly "asset.rerun-requested": {
|
|
36717
|
-
id: "asset.rerun-requested";
|
|
36718
|
-
name: string;
|
|
36719
|
-
description: string;
|
|
36720
|
-
category: EventCategory;
|
|
36721
|
-
severity: EventSeverity;
|
|
36722
|
-
/** Whether the in-app connector (notification bell) subscribes to the type by default. */
|
|
36723
|
-
notify: boolean;
|
|
36724
|
-
/**
|
|
36725
|
-
* The project-wide permission needed to see events of this type (portal feed, public events
|
|
36726
|
-
* feed) and to subscribe a connector to it.
|
|
36727
|
-
*/
|
|
36728
|
-
permission: PermissionAction;
|
|
36729
|
-
/** Types of unreleased features are left out of the published contract until enabled. */
|
|
36730
|
-
enabled?: boolean;
|
|
36731
|
-
fields: {
|
|
36732
|
-
assetName: EventFieldDefinition<zod.ZodOptional<zod.ZodNullable<zod.ZodString>>>;
|
|
36733
|
-
assetType: EventFieldDefinition<zod.ZodOptional<zod.ZodNullable<zod.ZodEnum<{
|
|
36734
|
-
audio: "audio";
|
|
36735
|
-
file: "file";
|
|
36736
|
-
image: "image";
|
|
36737
|
-
"multimedia-document": "multimedia-document";
|
|
36738
|
-
"plaintext-document": "plaintext-document";
|
|
36739
|
-
video: "video";
|
|
36740
|
-
website: "website";
|
|
36741
|
-
}>>>>;
|
|
36742
|
-
moderationStatus: EventFieldDefinition<zod.ZodEnum<{
|
|
36743
|
-
"age-restricted": "age-restricted";
|
|
36744
|
-
allowed: "allowed";
|
|
36745
|
-
blocked: "blocked";
|
|
36746
|
-
limited: "limited";
|
|
36747
|
-
purged: "purged";
|
|
36748
|
-
}>>;
|
|
36749
|
-
};
|
|
36750
|
-
/** Example data, used for synthetic test sends (`createSampleEvent`). */
|
|
36751
|
-
example: NoInfer<{
|
|
36752
|
-
assetName?: string | null | undefined;
|
|
36753
|
-
assetType?: "audio" | "file" | "image" | "multimedia-document" | "plaintext-document" | "video" | "website" | null | undefined;
|
|
36754
|
-
moderationStatus: "age-restricted" | "allowed" | "blocked" | "limited" | "purged";
|
|
36755
|
-
}>;
|
|
36756
|
-
factInfo: {
|
|
36757
|
-
label: string;
|
|
36758
|
-
description: string;
|
|
36759
|
-
display: EventFieldDisplay;
|
|
36760
|
-
/** Kept in the data but left out of rendered messages (usually an ID shown by another field). */
|
|
36761
|
-
hidden?: boolean;
|
|
36762
|
-
/**
|
|
36763
|
-
* Personal or account-level data that stays in the portal. Webhook, Slack and email deliveries,
|
|
36764
|
-
* and the public events feed, leave the fact out and word the title and description without it.
|
|
36765
|
-
*/
|
|
36766
|
-
inAppOnly?: boolean;
|
|
36767
|
-
/**
|
|
36768
|
-
* A person's name: `actor` names the event's `actor`, `member` the member in the `member-user-id`
|
|
36769
|
-
* fact. Deleting their account removes it from the events that name them.
|
|
36770
|
-
*/
|
|
36771
|
-
names?: "actor" | "member";
|
|
36772
|
-
/** Display names for `enum` and `list` values that don't read well humanized. */
|
|
36773
|
-
valueLabels?: Readonly<Record<string, string>>;
|
|
36774
|
-
schema: zod.ZodType<unknown, unknown, zod.core.$ZodTypeInternals<unknown, unknown>>;
|
|
36775
|
-
key: string;
|
|
36776
|
-
}[];
|
|
36777
|
-
values: zod.ZodObject<{
|
|
36778
|
-
assetName: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
36779
|
-
assetType: zod.ZodOptional<zod.ZodNullable<zod.ZodEnum<{
|
|
36780
|
-
audio: "audio";
|
|
36781
|
-
file: "file";
|
|
36782
|
-
image: "image";
|
|
36783
|
-
"multimedia-document": "multimedia-document";
|
|
36784
|
-
"plaintext-document": "plaintext-document";
|
|
36785
|
-
video: "video";
|
|
36786
|
-
website: "website";
|
|
36787
|
-
}>>>;
|
|
36788
|
-
moderationStatus: zod.ZodEnum<{
|
|
36789
|
-
"age-restricted": "age-restricted";
|
|
36790
|
-
allowed: "allowed";
|
|
36791
|
-
blocked: "blocked";
|
|
36792
|
-
limited: "limited";
|
|
36793
|
-
purged: "purged";
|
|
36794
|
-
}>;
|
|
36795
|
-
}, zod.core.$strip>;
|
|
36796
|
-
};
|
|
36797
36716
|
readonly "asset.review-requested": {
|
|
36798
36717
|
id: "asset.review-requested";
|
|
36799
36718
|
name: string;
|
|
@@ -38258,7 +38177,6 @@ declare const PUBLIC_EVENT_SCHEMA: zod.ZodObject<{
|
|
|
38258
38177
|
"asset.progress-updated": "asset.progress-updated";
|
|
38259
38178
|
"asset.purged": "asset.purged";
|
|
38260
38179
|
"asset.region-restricted": "asset.region-restricted";
|
|
38261
|
-
"asset.rerun-requested": "asset.rerun-requested";
|
|
38262
38180
|
"asset.retried": "asset.retried";
|
|
38263
38181
|
"asset.review-completed": "asset.review-completed";
|
|
38264
38182
|
"asset.review-requested": "asset.review-requested";
|
|
@@ -42459,7 +42377,6 @@ declare const GET_EVENTS_QUERY_SCHEMA: zod.ZodObject<{
|
|
|
42459
42377
|
"asset.progress-updated": "asset.progress-updated";
|
|
42460
42378
|
"asset.purged": "asset.purged";
|
|
42461
42379
|
"asset.region-restricted": "asset.region-restricted";
|
|
42462
|
-
"asset.rerun-requested": "asset.rerun-requested";
|
|
42463
42380
|
"asset.retried": "asset.retried";
|
|
42464
42381
|
"asset.review-completed": "asset.review-completed";
|
|
42465
42382
|
"asset.review-requested": "asset.review-requested";
|
|
@@ -42884,10 +42801,11 @@ interface SignedUploadToken {
|
|
|
42884
42801
|
}
|
|
42885
42802
|
/** What an upload through a preset can set: everything else comes from the preset or token. */
|
|
42886
42803
|
type UploadPresetSubmitAssetOptions = IdempotencyOptions & {
|
|
42887
|
-
name
|
|
42804
|
+
/** Required, except with a `File`, whose name it defaults to. */
|
|
42805
|
+
name?: string;
|
|
42888
42806
|
description?: string;
|
|
42889
42807
|
} & ({
|
|
42890
|
-
content:
|
|
42808
|
+
content: AssetContentInput;
|
|
42891
42809
|
} | {
|
|
42892
42810
|
part: CreateMultipartUploadPartOptions;
|
|
42893
42811
|
/** The size of the whole file, when known. */
|
|
@@ -43032,15 +42950,6 @@ interface RetryAssetOptions {
|
|
|
43032
42950
|
type DecideAssetOptions = {
|
|
43033
42951
|
assetId: string;
|
|
43034
42952
|
} & PostAssetDecisionBody;
|
|
43035
|
-
interface ExplainAssetOptions {
|
|
43036
|
-
assetId: string;
|
|
43037
|
-
/**
|
|
43038
|
-
* Moderates the asset again with the project's current policy, answering every question,
|
|
43039
|
-
* instead of explaining the decision as made. The asset returns to `processing` and gets a new
|
|
43040
|
-
* decision, which can differ from the old one.
|
|
43041
|
-
*/
|
|
43042
|
-
rerun?: boolean;
|
|
43043
|
-
}
|
|
43044
42953
|
interface WaitForAssetDecisionOptions {
|
|
43045
42954
|
assetId: string;
|
|
43046
42955
|
/** How long to wait for a decision, in milliseconds. Defaults to 60000. */
|
|
@@ -43199,7 +43108,13 @@ interface SubmitAssetCommonOptions extends IdempotencyOptions {
|
|
|
43199
43108
|
uploadPresetId?: string;
|
|
43200
43109
|
isFinal?: never;
|
|
43201
43110
|
}
|
|
43202
|
-
|
|
43111
|
+
/**
|
|
43112
|
+
* An asset's content: a `Blob` or `File`, whose own type is the content type (and a `File`'s
|
|
43113
|
+
* name the asset's name when you give none), or bytes, base64 or plain text with their `type`.
|
|
43114
|
+
*/
|
|
43115
|
+
type AssetContentInput = AssetContentOptions | Blob;
|
|
43116
|
+
/** Options as the client sends them, once a `Blob` or `File` is read as `{ data, type }`. */
|
|
43117
|
+
type PreparedSubmitAssetOptions = (SubmitAssetCommonOptions & {
|
|
43203
43118
|
content: AssetContentOptions;
|
|
43204
43119
|
}) | (SubmitAssetCommonOptions & {
|
|
43205
43120
|
url: string;
|
|
@@ -43213,6 +43128,10 @@ type SubmitAssetOptions = (SubmitAssetCommonOptions & {
|
|
|
43213
43128
|
*/
|
|
43214
43129
|
totalSizeInBytes?: number;
|
|
43215
43130
|
});
|
|
43131
|
+
/** What `assets.create` and `assets.classify` take: content, a URL or a multipart part. */
|
|
43132
|
+
type SubmitAssetOptions = PreparedSubmitAssetOptions | (SubmitAssetCommonOptions & {
|
|
43133
|
+
content: Blob;
|
|
43134
|
+
});
|
|
43216
43135
|
interface MultipartUploadOptions extends SubmitAssetCommonOptions {
|
|
43217
43136
|
part: CreateMultipartUploadPartOptions;
|
|
43218
43137
|
totalSizeInBytes?: number;
|
|
@@ -43251,4 +43170,4 @@ interface ClassifyTextOptions extends Omit<SubmitAssetCommonOptions, "name" | "i
|
|
|
43251
43170
|
/** `folders.list` options. `sort` is `name` (the default) or `createdAt`, descending when prefixed with `-`. */
|
|
43252
43171
|
type ListFoldersOptions = GetFoldersQuery;
|
|
43253
43172
|
type FolderPage = GetFoldersResponse;
|
|
43254
|
-
export {
|
|
43173
|
+
export { FolderPage as $, VerifyWebhookSignatureOptions as $t, CdnAssetLocation as A, Policy as An, RetrieveAssetOptions as At, CreateHashListOptions as B, AssetRendered as Bn, UpdateAssetOptions as Bt, AssetUploadStatus as C, BoundingBox as Cn, MultipartUploadPartOptions as Ct, BatchAssetsResponse as D, ProcessingFeatureResults as Dn, RequestAttempt as Dt, BatchAssetsOptions as E, ProcessingFeatureId as En, RemoveAssetContentOptions as Et, CdnTransform as F, AssetBinaryPayloadInput as Fn, SignUploadTokenOptions as Ft, DeleteAssetOptions as G, FileMetadata as Gn, UpdateProjectSettingsOptions as Gt, CreateMultipartUploadPartOptions as H, AssetSafetyHold as Hn, UpdateHashListOptions as Ht, ClassifyTextOptions as I, AssetInfo as In, SignedAssetUrl as It, EnsureLensesOptions as J, UploadPresetDefinition as Jt, DeleteMetadataFieldOptions as K, MetadataItem as Kn, UpgradePolicyOptions as Kt, ClientRequestDefaults as L, AssetHls as Ln, SignedUploadToken as Lt, CdnAssetUrlOptions as M, LensType as Mn, SearchAssetsOptions as Mt, CdnResource as N, AssetSearchMatchField as Nn, SetPolicyAutomaticUpdatesOptions as Nt, CalmLensAppClientOptions as O, ProcessingFeatureStage as On, RequestOptions as Ot, CdnServeOptions as P, AssetSearchQuery as Pn, SignAssetUrlOptions as Pt, FolderIdOptions as Q, UploadedAsset as Qt, ConnectionOptions as R, AssetHlsRendition as Rn, StreamingFeatureOptions as Rt, AssetUpload as S, AgeRange as Sn, MultipartUploadOptions as St, AssignPolicyOptions as T, DetectedPerson as Tn, PolicyPage as Tt, CreatePolicyOptions as U, AssetSafetyHoldReason as Un, UpdateLensOptions as Ut, CreateLensOptions as V, AssetRenderedKind as Vn, UpdateFolderOptions as Vt, DecideAssetOptions as W, ExtractedText as Wn, UpdatePolicyOptions as Wt, EnsureUploadPresetsOptions as X, UploadPresetPage as Xt, EnsureMetadataFieldsOptions as Y, UploadPresetIdOptions as Yt, EnsureUploadPresetsResponse as Z, UploadPresetSubmitAssetOptions as Zt, AssetPage as _, Folder as _n, ListLensesOptions as _t, AssetChecksums as a, AssetTimelineSegment as an, IdempotencyOptions as at, AssetTimelinePage as b, PublicProjectSettings as bn, MoveAssetOptions as bt, AssetClassificationFailureReason as c, EventAsset as cn, LensIdOptions as ct, AssetContentOptions as d, EventFact as dn, ListAssetTimelineOptions as dt, ViewerClaims as en, GetAssetInfoOptions as et, AssetContentRemovalReason as f, EventFactValues as fn, ListAssetsOptions as ft, AssetModerationStatus as g, PermissionGrant as gn, ListHashListsOptions as gt, AssetModerationDecision as h, EventType as hn, ListHashListEntriesOptions as ht, AssetAvailability as i, AssetBatchOperation as in, HashListPage as it, CdnAssetReference as j, CursorPage as jn, RetryAssetOptions as jt, CalmLensServerClientOptions as k, ProcessingFeatures as kn, ResetPolicyOptions as kt, AssetClassificationStatus as l, TypedEvent as ln, LensPage as lt, AssetModeration as m, EventSeverity as mn, ListFoldersOptions as mt, AppInfo as n, WebhookHeadersInput as nn, HashListEntryPage as nt, AssetChildrenPage as o, GetEventsResponse as on, ImageTransformOptions as ot, AssetContentStatus as p, EventFacts as pn, ListEventsOptions as pt, EnsureLensOptions as q, ProcessingOptions as qn, UploadAssetPartOptions as qt, Asset as r, WebhookPayloadInput as rn, HashListIdOptions as rt, AssetClassification as s, Actor as sn, Lens as st, AddHashListEntryOptions as t, WaitForAssetDecisionOptions as tn, HashListEntryIdOptions as tt, AssetContent as u, EventCategory as un, ListAssetChildrenOptions as ut, AssetSearchResponse as v, MetadataFieldsResource as vn, ListPoliciesOptions as vt, AssetVisibility as w, DetectedFace as wn, PolicyIdOptions as wt, AssetType as x, UploadPreset as xn, MoveFolderOptions as xt, AssetSearchResult as y, ProjectSettingsResource as yn, ListUploadPresetsOptions as yt, CreateFolderOptions as z, AssetPreview as zn, SubmitAssetOptions as zt };
|
|
@@ -1109,7 +1109,12 @@ declare const CLASSIFICATION_NOT_EVALUATED_REASON_SCHEMA: zod.ZodEnum<{
|
|
|
1109
1109
|
unavailable: "unavailable";
|
|
1110
1110
|
}>;
|
|
1111
1111
|
type ClassificationNotEvaluatedReason = zod.infer<typeof CLASSIFICATION_NOT_EVALUATED_REASON_SCHEMA>;
|
|
1112
|
-
|
|
1112
|
+
/**
|
|
1113
|
+
* Qualifier results keyed by qualifier. Keys from removed or renamed qualifiers are dropped rather
|
|
1114
|
+
* than failing the report; known keys are still validated. Typed as the strict schema: the filter
|
|
1115
|
+
* changes neither the accepted shape of known keys nor the JSON schema.
|
|
1116
|
+
*/
|
|
1117
|
+
declare const CLASSIFICATION_QUALIFIER_RESULTS_SCHEMA: zod.ZodRecord<zod.ZodEnum<{
|
|
1113
1118
|
"criminal-activity-alcohol": "criminal-activity-alcohol";
|
|
1114
1119
|
"criminal-activity-coded-incitement": "criminal-activity-coded-incitement";
|
|
1115
1120
|
"criminal-activity-csam": "criminal-activity-csam";
|
|
@@ -1266,12 +1271,6 @@ declare const STRICT_QUALIFIER_RESULTS_SCHEMA: zod.ZodRecord<zod.ZodEnum<{
|
|
|
1266
1271
|
unavailable: "unavailable";
|
|
1267
1272
|
}>;
|
|
1268
1273
|
}, zod.core.$strict>], "status">>;
|
|
1269
|
-
/**
|
|
1270
|
-
* Qualifier results keyed by qualifier. Keys from removed or renamed qualifiers are dropped rather
|
|
1271
|
-
* than failing the report; known keys are still validated. Typed as the strict schema: the filter
|
|
1272
|
-
* changes neither the accepted shape of known keys nor the JSON schema.
|
|
1273
|
-
*/
|
|
1274
|
-
declare const CLASSIFICATION_QUALIFIER_RESULTS_SCHEMA: typeof STRICT_QUALIFIER_RESULTS_SCHEMA;
|
|
1275
1274
|
type ClassificationQualifierResults = zod.infer<typeof CLASSIFICATION_QUALIFIER_RESULTS_SCHEMA>;
|
|
1276
1275
|
declare const CLASSIFICATION_CATEGORY_REPORT_SCHEMA: zod.ZodDiscriminatedUnion<[zod.ZodObject<{
|
|
1277
1276
|
status: zod.ZodLiteral<"evaluated">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as CdnTransform, O as CalmLensAppClientOptions,
|
|
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-HUERg5hI.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-CCeFnKX8.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.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Y as CalmLensError, a as appendAssetLocation, c as toUrlViewerClaims, s as getAssetInfo, v as serializeTransform, x as transformSelector } from "./ModerationContextLimits-
|
|
2
|
-
import { o as placeholderHashToDataURL } from "./UploadController-
|
|
1
|
+
import { Y as CalmLensError, a as appendAssetLocation, c as toUrlViewerClaims, s as getAssetInfo, v as serializeTransform, x as transformSelector } from "./ModerationContextLimits-BqRzr-pg.js";
|
|
2
|
+
import { o as placeholderHashToDataURL } from "./UploadController-DnXRTWCY.js";
|
|
3
3
|
import { a as getFileIcon, c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
|
|
4
4
|
// src/ui/viewers/ViewerAsset.ts
|
|
5
5
|
/** Spreadsheet MIME types, as `content.format` reports them (compared lower-cased). */
|
|
@@ -126,7 +126,8 @@ const VIEWER_STYLES = `
|
|
|
126
126
|
margin: 0 auto; padding: 20px 24px; max-width: 75ch; white-space: pre-wrap; overflow-wrap: anywhere;
|
|
127
127
|
font-family: inherit; font-size: 1rem; line-height: 1.6;
|
|
128
128
|
}
|
|
129
|
-
|
|
129
|
+
/* Fit to width, the page fills the viewer edge to edge; zoomed out, it sits centred. */
|
|
130
|
+
.calmlens-viewer__pages { flex: 1; min-height: 0; overflow: auto; text-align: center; }
|
|
130
131
|
.calmlens-viewer__page { display: inline-block; position: relative; vertical-align: top; }
|
|
131
132
|
.calmlens-viewer__page canvas { display: block; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 0.2); }
|
|
132
133
|
.calmlens-viewer__page-field { width: 4.5em; min-height: 36px; padding: 4px 6px; font: inherit; border: 1px solid var(--calmlens-border); border-radius: calc(var(--calmlens-radius) / 2); background: transparent; color: inherit; }
|
|
@@ -802,6 +803,8 @@ const CALMLENS_STYLES = `
|
|
|
802
803
|
position: relative; display: block; overflow: hidden; margin: 0; border-radius: var(--calmlens-media-radius, 0);
|
|
803
804
|
background: var(--calmlens-surface);
|
|
804
805
|
}
|
|
806
|
+
/* The average colour stands in while the content loads; transparent content and notices show the surface. */
|
|
807
|
+
.calmlens-asset:not([data-state="loaded"], [data-state="error"], [data-kind="unavailable"]) { background-color: var(--calmlens-average-color, var(--calmlens-surface)); }
|
|
805
808
|
.calmlens-asset__placeholder, .calmlens-asset__content {
|
|
806
809
|
position: absolute; inset: 0; width: 100%; height: 100%; object-fit: var(--calmlens-fit, contain);
|
|
807
810
|
object-position: var(--calmlens-position, center);
|
|
@@ -816,8 +819,8 @@ const CALMLENS_STYLES = `
|
|
|
816
819
|
/* Documents, text and spreadsheets fill the box with their viewer; a document shows its first
|
|
817
820
|
page's still and an open link until the viewer loads. */
|
|
818
821
|
.calmlens-asset__viewer { position: absolute; inset: 0; }
|
|
819
|
-
|
|
820
|
-
.calmlens-asset:not([data-sized])[data-kind="spreadsheet"] { height: 480px; }
|
|
822
|
+
/* A default height only: any height the page gives the element (a class, a style) wins. */
|
|
823
|
+
:where(.calmlens-asset:not([data-sized]):is([data-kind="document"], [data-kind="text"], [data-kind="spreadsheet"])) { height: 480px; }
|
|
821
824
|
.calmlens-asset[data-kind="document"] .calmlens-asset__content { opacity: 1; }
|
|
822
825
|
.calmlens-asset__open { position: absolute; right: 8px; bottom: 8px; text-decoration: none; }
|
|
823
826
|
/* A website's screenshot scrolls beneath the link to its page. */
|
|
@@ -847,7 +850,9 @@ const CALMLENS_STYLES = `
|
|
|
847
850
|
}
|
|
848
851
|
.calmlens-asset__notice p { margin: 0; display: flex; gap: 6px; align-items: center; }
|
|
849
852
|
/* Thumbnails keep the notice's icon and leave its text to screen readers. */
|
|
850
|
-
|
|
853
|
+
/* A notice has no content of its own to size the box, so it can always measure its width. */
|
|
854
|
+
.calmlens-asset[data-sized], .calmlens-asset[data-kind="unavailable"], .calmlens-asset[data-kind="age-restricted"],
|
|
855
|
+
.calmlens-asset[data-state="error"] { container-type: inline-size; }
|
|
851
856
|
@container (max-width: 119px) {
|
|
852
857
|
.calmlens-asset__label, .calmlens-asset__notice > strong, .calmlens-asset__notice > p:not(:has(svg)) {
|
|
853
858
|
position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
|
|
@@ -66,9 +66,6 @@ const API_ERROR_CODES = {
|
|
|
66
66
|
ASSET_NOT_RETRYABLE: "asset/not-retryable",
|
|
67
67
|
ASSET_CONTENT_UNAVAILABLE: "asset/content-unavailable",
|
|
68
68
|
ASSET_CONTENT_PURGED: "asset/content-purged",
|
|
69
|
-
ASSET_NOT_DECIDED: "asset/not-decided",
|
|
70
|
-
ASSET_POLICY_CHANGED: "asset/policy-changed",
|
|
71
|
-
ASSET_REVIEWED: "asset/reviewed",
|
|
72
69
|
SUPPORT_TICKET_NOT_FOUND: "support-ticket/not-found",
|
|
73
70
|
DUPLICATE_EXTERNAL_ID: "asset/duplicate-external-id",
|
|
74
71
|
FOLDER_NOT_FOUND: "folder/not-found",
|
|
@@ -384,18 +381,6 @@ const API_ERROR_DEFINITIONS = {
|
|
|
384
381
|
status: 409,
|
|
385
382
|
message: "This asset's content was purged, so it can only be blocked. Upload it again to have it moderated afresh."
|
|
386
383
|
},
|
|
387
|
-
"asset/not-decided": {
|
|
388
|
-
status: 409,
|
|
389
|
-
message: "This asset has no automatic moderation decision to explain yet."
|
|
390
|
-
},
|
|
391
|
-
"asset/policy-changed": {
|
|
392
|
-
status: 409,
|
|
393
|
-
message: "The project's moderation policy has changed since this decision, so it can't be explained as made. Re-run moderation with the current policy instead."
|
|
394
|
-
},
|
|
395
|
-
"asset/reviewed": {
|
|
396
|
-
status: 409,
|
|
397
|
-
message: "A reviewer has decided this asset, so its moderation can't be re-run."
|
|
398
|
-
},
|
|
399
384
|
"support-ticket/not-found": {
|
|
400
385
|
status: 404,
|
|
401
386
|
message: "Support ticket not found."
|
|
@@ -1067,7 +1052,7 @@ const listPages = (fetchPage, { cursor, feed = false } = {}) => {
|
|
|
1067
1052
|
};
|
|
1068
1053
|
// src/client/CalmLensVersion.ts
|
|
1069
1054
|
/** This SDK's version, from its package.json. */
|
|
1070
|
-
const SDK_VERSION = "0.
|
|
1055
|
+
const SDK_VERSION = "0.27.2";
|
|
1071
1056
|
const runtimeName = () => {
|
|
1072
1057
|
const runtime = globalThis;
|
|
1073
1058
|
if (isReactNativeRuntime()) return "react-native";
|
|
@@ -1808,6 +1793,7 @@ const UPLOAD_MIME_SUFFIXES = ["+json", "+xml"];
|
|
|
1808
1793
|
const UPLOAD_MIME_TYPES = [
|
|
1809
1794
|
"application/pdf",
|
|
1810
1795
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
1796
|
+
"application/vnd.ms-word.document.macroenabled.12",
|
|
1811
1797
|
"application/msword",
|
|
1812
1798
|
"application/rtf",
|
|
1813
1799
|
"application/vnd.oasis.opendocument.text",
|
|
@@ -2364,7 +2350,7 @@ const getAssetInfo = async (url, options = {}) => {
|
|
|
2364
2350
|
});
|
|
2365
2351
|
return data;
|
|
2366
2352
|
};
|
|
2367
|
-
// src/contract/ModerationContextLimits-
|
|
2353
|
+
// src/contract/ModerationContextLimits-k930WU8i.js
|
|
2368
2354
|
/** The most recent earlier posts CalmLens uses. */
|
|
2369
2355
|
const MODERATION_CONTEXT_USED_ITEMS = 5;
|
|
2370
2356
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as UploadFile, L as UploadSnapshot, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions } from "./Core-
|
|
1
|
+
import { F as UploadFile, L as UploadSnapshot, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions } from "./Core-DXAs8mcx.js";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
type CalmLensProviderProps<F extends UploadFile = File> = CalmLensProvidedOptions<F> & {
|
|
4
4
|
children?: ReactNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as withProvidedOptions, n as createUploadController } from "./UploadController-
|
|
1
|
+
import { i as withProvidedOptions, n as createUploadController } from "./UploadController-DnXRTWCY.js";
|
|
2
2
|
import { createContext, createElement, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
3
|
// src/ui/ReactUpload.ts
|
|
4
4
|
const CalmLensContext = createContext(void 0);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { r as timingSafeEqual, t as hmacSha256Hex } from "./CryptoUtils-B_x8lMIx-DhuWGzqn.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
+
import { globalRegistry } from "zod";
|
|
3
4
|
// src/contract/ModerationCategories-CHFRoeWV.js
|
|
4
5
|
const CLASSIFICATION_CATEGORIES = [
|
|
5
6
|
"sexual",
|
|
@@ -11,7 +12,77 @@ const CLASSIFICATION_CATEGORIES = [
|
|
|
11
12
|
"personal-information",
|
|
12
13
|
"profanity"
|
|
13
14
|
];
|
|
14
|
-
// src/contract/
|
|
15
|
+
// src/contract/LazySchema-D_3-dV1e.js
|
|
16
|
+
const registryMap = globalRegistry._map;
|
|
17
|
+
/**
|
|
18
|
+
* A schema built the first time anything reads it, rather than when its module loads. Building
|
|
19
|
+
* Zod schemas costs a new isolate CPU before its first request, so a module whose schemas most
|
|
20
|
+
* requests never use (support tickets, compliance cases, appeals…) builds them only when one does.
|
|
21
|
+
*
|
|
22
|
+
* The returned proxy stands for the schema: reading, calling or composing it (`.parse`, `.extend`,
|
|
23
|
+
* embedding it in another schema) builds the schema and forwards to it, with the schema as the
|
|
24
|
+
* receiver, so its methods see the real instance. Its metadata (`.meta()`, `.describe()`, zod-meta's
|
|
25
|
+
* stores) is registered under the proxy too, for the code that looks schemas up by identity (JSON
|
|
26
|
+
* Schema generation, where the proxy is embedded in another schema).
|
|
27
|
+
*
|
|
28
|
+
* Calling it has no side effects (the annotation tells bundlers), so a bundle drops the lazy
|
|
29
|
+
* schemas it never uses, as it drops plain Zod schemas.
|
|
30
|
+
*/
|
|
31
|
+
const lazySchema = /* @__NO_SIDE_EFFECTS__ */ (build) => {
|
|
32
|
+
let schema;
|
|
33
|
+
const real = () => {
|
|
34
|
+
if (!schema) {
|
|
35
|
+
const built = build();
|
|
36
|
+
schema = built;
|
|
37
|
+
const meta = registryMap.get(built);
|
|
38
|
+
if (meta !== void 0) registryMap.set(proxy, meta);
|
|
39
|
+
const internals = built._zod;
|
|
40
|
+
const process = internals.processJSONSchema;
|
|
41
|
+
if (process) internals.processJSONSchema = (context, json, params) => {
|
|
42
|
+
const record = context.seen.get(proxy);
|
|
43
|
+
if (!record || context.seen.has(built)) return process(context, json, params);
|
|
44
|
+
context.seen.set(built, record);
|
|
45
|
+
try {
|
|
46
|
+
return process(context, json, params);
|
|
47
|
+
} finally {
|
|
48
|
+
if (context.seen.get(built) === record) context.seen.delete(built);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return schema;
|
|
53
|
+
};
|
|
54
|
+
const proxy = new Proxy({}, {
|
|
55
|
+
get(_, key) {
|
|
56
|
+
const target = real();
|
|
57
|
+
return Reflect.get(target, key, target);
|
|
58
|
+
},
|
|
59
|
+
set(_, key, value) {
|
|
60
|
+
const target = real();
|
|
61
|
+
return Reflect.set(target, key, value, target);
|
|
62
|
+
},
|
|
63
|
+
has(_, key) {
|
|
64
|
+
return Reflect.has(real(), key);
|
|
65
|
+
},
|
|
66
|
+
ownKeys() {
|
|
67
|
+
return Reflect.ownKeys(real());
|
|
68
|
+
},
|
|
69
|
+
getOwnPropertyDescriptor(_, key) {
|
|
70
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(real(), key);
|
|
71
|
+
return descriptor && {
|
|
72
|
+
...descriptor,
|
|
73
|
+
configurable: true
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
getPrototypeOf() {
|
|
77
|
+
return Reflect.getPrototypeOf(real());
|
|
78
|
+
},
|
|
79
|
+
defineProperty(_, key, descriptor) {
|
|
80
|
+
return Reflect.defineProperty(real(), key, descriptor);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return proxy;
|
|
84
|
+
};
|
|
85
|
+
// src/contract/Jurisdiction-CQN8qnzX.js
|
|
15
86
|
/**
|
|
16
87
|
* Jurisdictions with legal rules always apply to every project. An optional jurisdiction is a
|
|
17
88
|
* product standard rather than a legal floor: every project serves it unless it opts out.
|
|
@@ -58,19 +129,12 @@ const JURISDICTIONS = {
|
|
|
58
129
|
optional: false
|
|
59
130
|
}
|
|
60
131
|
};
|
|
61
|
-
const JURISDICTION_SCHEMA = z.enum(Object.keys(JURISDICTIONS));
|
|
132
|
+
const JURISDICTION_SCHEMA = /* @__PURE__ */ lazySchema(() => z.enum(Object.keys(JURISDICTIONS)));
|
|
62
133
|
Object.keys(JURISDICTIONS).filter((code) => !JURISDICTIONS[code].optional);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
JURISDICTION_SCHEMA.array().min(1).refine((regions) => regions.includes("global") && new Set(regions).size === regions.length, { message: "jurisdiction/global-required-or-duplicate" });
|
|
66
|
-
const COUNTRIES = new Set("AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW".split(" "));
|
|
67
|
-
const VIEWER_REGION_SCHEMA = z.enum([...COUNTRIES]).describe("Viewer's ISO 3166-1 alpha-2 country, supplied by your integration; not the proxy server's country. EU is not a viewer country.");
|
|
134
|
+
Object.keys(JURISDICTIONS).filter((code) => JURISDICTIONS[code].optional);
|
|
135
|
+
new Set("AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW".split(" "));
|
|
68
136
|
new Set("AT BE BG HR CY CZ DK EE FI FR DE GR HU IE IT LV LT LU MT NL PL PT RO SK SI ES SE".split(" "));
|
|
69
|
-
|
|
70
|
-
region: VIEWER_REGION_SCHEMA.optional().describe("Viewer country. Defaults to the country of the connection reaching CalmLens; proxies should forward the viewer country explicitly."),
|
|
71
|
-
ageConfirmed: z.boolean().optional().describe("Your platform's confirmation that the viewer passed its age check, so age-restricted content may be delivered. Defaults to false. Your platform confirms the viewer's age. Viewer claims are assertions from your application; CalmLens doesn't verify them. To restrict who can load an age-restricted asset, make it private and issue signed URLs only to viewers who passed your age check.")
|
|
72
|
-
}).strict();
|
|
73
|
-
// src/contract/TestRegionalActions-DUzwPr1a.js
|
|
137
|
+
// src/contract/TestRegionalActions-BhyWuU49.js
|
|
74
138
|
/**
|
|
75
139
|
* Marks English text in shared, backend and data modules that the portal shows, so the app's
|
|
76
140
|
* message catalog (packages/app/vite/messageCatalog.ts) extracts it and the portal can translate it
|
|
@@ -1093,15 +1157,15 @@ function getModerationQualifierInfo(qualifier) {
|
|
|
1093
1157
|
return MODERATION_QUALIFIER_INFO[qualifier];
|
|
1094
1158
|
}
|
|
1095
1159
|
/** Authenticated test inputs can add regional delivery restrictions without inventing evidence. */
|
|
1096
|
-
const TEST_REGIONAL_ACTIONS_SCHEMA = z.array(z.object({
|
|
1160
|
+
const TEST_REGIONAL_ACTIONS_SCHEMA = /* @__PURE__ */ lazySchema(() => z.array(z.object({
|
|
1097
1161
|
region: JURISDICTION_SCHEMA.exclude(["global"]),
|
|
1098
1162
|
action: z.enum([
|
|
1099
1163
|
"limit",
|
|
1100
1164
|
"age-restrict",
|
|
1101
1165
|
"block"
|
|
1102
1166
|
])
|
|
1103
|
-
}).strict()).max(7).refine((entries) => new Set(entries.map((entry) => entry.region)).size === entries.length, "Choose each region once");
|
|
1104
|
-
// src/contract/TestTriggers-
|
|
1167
|
+
}).strict()).max(7).refine((entries) => new Set(entries.map((entry) => entry.region)).size === entries.length, "Choose each region once"));
|
|
1168
|
+
// src/contract/TestTriggers-Cvi7e2KA.js
|
|
1105
1169
|
/**
|
|
1106
1170
|
* The visual encoding of test images (shared by images and video frames), independent of what the
|
|
1107
1171
|
* bytes mean. An odd N×N grid of square cells fills the image. Its outer ring alternates black and
|
|
@@ -1574,21 +1638,21 @@ const detectionShape = {
|
|
|
1574
1638
|
const fitsImage = ({ box: [left, top, width, height] }) => left + width <= 1e4 && top + height <= 1e4;
|
|
1575
1639
|
const BOX_MESSAGE = msg("A box must lie inside the image: left + width and top + height are at most 10000.");
|
|
1576
1640
|
const ageYears = z.number().int().min(0).max(120);
|
|
1577
|
-
const TEST_DETECTED_PERSON_SCHEMA = z.object(detectionShape).strict().refine(fitsImage, BOX_MESSAGE);
|
|
1578
|
-
const TEST_DETECTED_FACE_SCHEMA = z.object({
|
|
1641
|
+
const TEST_DETECTED_PERSON_SCHEMA = /* @__PURE__ */ lazySchema(() => z.object(detectionShape).strict().refine(fitsImage, BOX_MESSAGE));
|
|
1642
|
+
const TEST_DETECTED_FACE_SCHEMA = /* @__PURE__ */ lazySchema(() => z.object({
|
|
1579
1643
|
...detectionShape,
|
|
1580
1644
|
age: z.union([z.enum(["adult", "minor"]), z.object({
|
|
1581
1645
|
low: ageYears,
|
|
1582
1646
|
high: ageYears
|
|
1583
1647
|
}).strict().refine(({ low, high }) => low <= high, msg("An age range's low must not be above its high."))]).optional()
|
|
1584
|
-
}).strict().refine(fitsImage, BOX_MESSAGE);
|
|
1648
|
+
}).strict().refine(fitsImage, BOX_MESSAGE));
|
|
1585
1649
|
/** Person and face detection results a test image reports instead of running detection. */
|
|
1586
|
-
const TEST_DETECTIONS_SCHEMA = z.object({
|
|
1650
|
+
const TEST_DETECTIONS_SCHEMA = /* @__PURE__ */ lazySchema(() => z.object({
|
|
1587
1651
|
people: z.union([z.array(TEST_DETECTED_PERSON_SCHEMA).max(32), z.literal("unavailable")]).optional(),
|
|
1588
1652
|
faces: z.union([z.array(TEST_DETECTED_FACE_SCHEMA).max(32), z.literal("unavailable")]).optional()
|
|
1589
|
-
}).strict();
|
|
1653
|
+
}).strict());
|
|
1590
1654
|
/** Each row is one qualifying instance. Unselected qualifiers are explicitly absent. */
|
|
1591
|
-
const TEST_INPUT_SCHEMA = z.object({
|
|
1655
|
+
const TEST_INPUT_SCHEMA = /* @__PURE__ */ lazySchema(() => z.object({
|
|
1592
1656
|
regionalActions: TEST_REGIONAL_ACTIONS_SCHEMA.optional(),
|
|
1593
1657
|
unassessedCategories: z.array(z.enum(CLASSIFICATION_CATEGORIES)).max(CLASSIFICATION_CATEGORIES.length).optional(),
|
|
1594
1658
|
instances: z.array(z.object({
|
|
@@ -1618,7 +1682,7 @@ const TEST_INPUT_SCHEMA = z.object({
|
|
|
1618
1682
|
code: "custom",
|
|
1619
1683
|
message: msg("An unassessed category cannot also have assessed instances.")
|
|
1620
1684
|
});
|
|
1621
|
-
});
|
|
1685
|
+
}));
|
|
1622
1686
|
const TEST_INPUT_PRESETS = {
|
|
1623
1687
|
clean: { instances: [] },
|
|
1624
1688
|
limited: { instances: [{
|
|
@@ -1894,4 +1958,4 @@ async function detectTestImage(image, key, { whole = true } = {}) {
|
|
|
1894
1958
|
if (!scenario || !whole) return scenario;
|
|
1895
1959
|
return matchesTestImageGrid(image, grid, paintTestImageGrid(data.subarray(0, 18 + length), testImagePalette(scenario))) ? scenario : void 0;
|
|
1896
1960
|
}
|
|
1897
|
-
export { TEST_INPUT_KEY_PATTERN as a, detectTestTrigger as c, getTestInputTag as d, paintTestImage as f, TEST_FACE_AGE_PRESETS as i, generateTestTextCode as l,
|
|
1961
|
+
export { TEST_INPUT_KEY_PATTERN as a, detectTestTrigger as c, getTestInputTag as d, paintTestImage as f, CLASSIFICATION_CATEGORIES as h, TEST_FACE_AGE_PRESETS as i, generateTestTextCode as l, lazySchema as m, TEST_DETECTION_BOX_MAX as n, TEST_INPUT_PRESETS as o, testInputForSignal as p, TEST_FACE_AGE_MAX as r, detectTestImage as s, TEST_DETECTIONS_MAX as t, getImageTestCategories as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Y as CalmLensError, ot as SDK_ERROR_CODES } from "./ModerationContextLimits-
|
|
2
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
1
|
+
import { Y as CalmLensError, ot as SDK_ERROR_CODES } from "./ModerationContextLimits-BqRzr-pg.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-BOwCdI-Q.js";
|
|
3
3
|
// src/contract/PlaceholderHashDecode.js
|
|
4
4
|
/**
|
|
5
5
|
* Decodes a ThumbHash to an RGBA image. RGB is not be premultiplied by A.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as EventAsset, ln as TypedEvent, sn as Actor } from "./CalmLensTypes-HUERg5hI.js";
|
|
2
2
|
import * as zod from "zod";
|
|
3
3
|
/** Error codes the CalmLens API documents, by name. */
|
|
4
4
|
declare const API_ERROR_CODES: {
|
|
@@ -67,9 +67,6 @@ declare const API_ERROR_CODES: {
|
|
|
67
67
|
readonly ASSET_NOT_RETRYABLE: "asset/not-retryable";
|
|
68
68
|
readonly ASSET_CONTENT_UNAVAILABLE: "asset/content-unavailable";
|
|
69
69
|
readonly ASSET_CONTENT_PURGED: "asset/content-purged";
|
|
70
|
-
readonly ASSET_NOT_DECIDED: "asset/not-decided";
|
|
71
|
-
readonly ASSET_POLICY_CHANGED: "asset/policy-changed";
|
|
72
|
-
readonly ASSET_REVIEWED: "asset/reviewed";
|
|
73
70
|
readonly SUPPORT_TICKET_NOT_FOUND: "support-ticket/not-found";
|
|
74
71
|
readonly DUPLICATE_EXTERNAL_ID: "asset/duplicate-external-id";
|
|
75
72
|
readonly FOLDER_NOT_FOUND: "folder/not-found";
|
|
@@ -218,9 +215,6 @@ declare const CALMLENS_ERROR_CODES: {
|
|
|
218
215
|
readonly ASSET_NOT_RETRYABLE: "asset/not-retryable";
|
|
219
216
|
readonly ASSET_CONTENT_UNAVAILABLE: "asset/content-unavailable";
|
|
220
217
|
readonly ASSET_CONTENT_PURGED: "asset/content-purged";
|
|
221
|
-
readonly ASSET_NOT_DECIDED: "asset/not-decided";
|
|
222
|
-
readonly ASSET_POLICY_CHANGED: "asset/policy-changed";
|
|
223
|
-
readonly ASSET_REVIEWED: "asset/reviewed";
|
|
224
218
|
readonly SUPPORT_TICKET_NOT_FOUND: "support-ticket/not-found";
|
|
225
219
|
readonly DUPLICATE_EXTERNAL_ID: "asset/duplicate-external-id";
|
|
226
220
|
readonly FOLDER_NOT_FOUND: "folder/not-found";
|