calmlens 0.28.0 → 0.28.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/calmlens.js +1 -1
- package/cjs/{BrowserUpload-Dz4UwTTJ.js → BrowserUpload-DLoi5qVj.js} +1 -1
- package/cjs/{CalmLensAppClient-B0QZ1oJV.js → CalmLensAppClient-C--UAnoz.js} +2 -2
- package/cjs/{CalmLensOptionKeys-Cat8CgOn.js → CalmLensOptionKeys-BxrJ47zd.js} +1 -1
- package/cjs/{CalmLensServerClient-CQdvhCGg.js → CalmLensServerClient-CPbCEJMK.js} +2 -2
- package/cjs/{Core-DCnnUsgF.js → Core-CB0-p-ro.js} +2 -2
- package/cjs/{ModerationContextLimits-_knOVCH0.js → ModerationContextLimits-CuL1TOuf.js} +1 -1
- package/cjs/{ReactUpload-BtmIrdky.js → ReactUpload-3QgzpdMu.js} +1 -1
- package/cjs/{UploadController-CEL3N4Ae.js → UploadController-BSZnq84V.js} +2 -2
- package/cjs/app.js +2 -2
- package/cjs/elements.js +4 -4
- package/cjs/index.js +1 -1
- package/cjs/react-native.js +4 -4
- package/cjs/react.js +5 -5
- package/cjs/server.js +2 -2
- package/cjs/testing.d.ts +27 -8
- package/cjs/testing.js +102 -14
- package/cjs/{ui-DVQm0TFJ.js → ui-CkQQm3Qw.js} +2 -2
- package/cjs/ui.js +3 -3
- package/cjs/vue.js +4 -4
- package/esm/{BrowserUpload-DSq5Ezo1.js → BrowserUpload-BKrrHzoh.js} +1 -1
- package/esm/{CalmLensAppClient-B1QpSXYm.js → CalmLensAppClient-D_SprSKl.js} +2 -2
- package/esm/{CalmLensOptionKeys-BYqFZ0FP.js → CalmLensOptionKeys-B6an7neE.js} +1 -1
- package/esm/{CalmLensServerClient-D2Vr_jTR.js → CalmLensServerClient-BY45aX5Q.js} +2 -2
- package/esm/{Core-Dz7BAias.js → Core-dzPyrg_G.js} +2 -2
- package/esm/{ModerationContextLimits-DaFaXt45.js → ModerationContextLimits-IH2zX1wg.js} +1 -1
- package/esm/{ReactUpload-kSzn3SOj.js → ReactUpload-4DeUbua_.js} +1 -1
- package/esm/{UploadController--Qz3DP2W.js → UploadController-DKjI8S2K.js} +2 -2
- package/esm/app.js +2 -2
- package/esm/elements.js +4 -4
- package/esm/index.js +1 -1
- package/esm/react-native.js +4 -4
- package/esm/react.js +5 -5
- package/esm/server.js +2 -2
- package/esm/testing.d.ts +27 -8
- package/esm/testing.js +102 -14
- package/esm/{ui-B951EpwC.js → ui-BovDqg9n.js} +2 -2
- package/esm/ui.js +3 -3
- package/esm/vue.js +4 -4
- package/package.json +1 -1
package/bin/calmlens.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_UploadController = require("./UploadController-
|
|
1
|
+
const require_UploadController = require("./UploadController-BSZnq84V.js");
|
|
2
2
|
// src/ui/BrowserUpload.ts
|
|
3
3
|
/** Creates an upload queue for the browser components, such as one a form starts on submit. */
|
|
4
4
|
const createUploadController = (options) => require_UploadController.createUploadController(options);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
-
const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-
|
|
1
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-CuL1TOuf.js");
|
|
2
|
+
const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-BxrJ47zd.js");
|
|
3
3
|
// src/client/CalmLensAppClient.ts
|
|
4
4
|
const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
5
5
|
/** `options`, once `checkOptionKeys` finds only keys `operation` takes. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
1
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-CuL1TOuf.js");
|
|
2
2
|
// src/contract/AssetPayload.js
|
|
3
3
|
const bufferInputToBytes = (value) => {
|
|
4
4
|
if (value instanceof ArrayBuffer) return new Uint8Array(value);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
-
const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-
|
|
1
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-CuL1TOuf.js");
|
|
2
|
+
const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-BxrJ47zd.js");
|
|
3
3
|
const require_CryptoUtils_BLCa_oZe = require("./CryptoUtils-BLCa-oZe-leCkr1ko.js");
|
|
4
4
|
// src/contract/JsonUtils.js
|
|
5
5
|
const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
-
const require_UploadController = require("./UploadController-
|
|
1
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-CuL1TOuf.js");
|
|
2
|
+
const require_UploadController = require("./UploadController-BSZnq84V.js");
|
|
3
3
|
const require_FileIcons = require("./FileIcons-Ob003MdS.js");
|
|
4
4
|
// src/ui/viewers/ViewerAsset.ts
|
|
5
5
|
/** Spreadsheet MIME types, as `content.format` reports them (compared lower-cased). */
|
|
@@ -1062,7 +1062,7 @@ const listPages = (fetchPage, { cursor, feed = false } = {}) => {
|
|
|
1062
1062
|
};
|
|
1063
1063
|
// src/client/CalmLensVersion.ts
|
|
1064
1064
|
/** This SDK's version, from its package.json. */
|
|
1065
|
-
const SDK_VERSION = "0.28.
|
|
1065
|
+
const SDK_VERSION = "0.28.1";
|
|
1066
1066
|
const runtimeName = () => {
|
|
1067
1067
|
const runtime = globalThis;
|
|
1068
1068
|
if (isReactNativeRuntime()) return "react-native";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_UploadController = require("./UploadController-
|
|
1
|
+
const require_UploadController = require("./UploadController-BSZnq84V.js");
|
|
2
2
|
let react = require("react");
|
|
3
3
|
// src/ui/ReactUpload.ts
|
|
4
4
|
const CalmLensContext = (0, react.createContext)(void 0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
-
const require_CalmLensAppClient = require("./CalmLensAppClient-
|
|
1
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-CuL1TOuf.js");
|
|
2
|
+
const require_CalmLensAppClient = require("./CalmLensAppClient-C--UAnoz.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.
|
package/cjs/app.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-CuL1TOuf.js");
|
|
3
3
|
require("./index.js");
|
|
4
|
-
const require_CalmLensAppClient = require("./CalmLensAppClient-
|
|
4
|
+
const require_CalmLensAppClient = require("./CalmLensAppClient-C--UAnoz.js");
|
|
5
5
|
exports.AUTO_PAGING_TO_ARRAY_MAX = require_ModerationContextLimits.AUTO_PAGING_TO_ARRAY_MAX;
|
|
6
6
|
exports.CALMLENS_ERROR_CODES = require_ModerationContextLimits.CALMLENS_ERROR_CODES;
|
|
7
7
|
exports.CDN_RESOURCES = require_ModerationContextLimits.CDN_RESOURCES;
|
package/cjs/elements.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ui = require("./ui-
|
|
3
|
-
const require_Core = require("./Core-
|
|
4
|
-
const require_UploadController = require("./UploadController-
|
|
2
|
+
const require_ui = require("./ui-CkQQm3Qw.js");
|
|
3
|
+
const require_Core = require("./Core-CB0-p-ro.js");
|
|
4
|
+
const require_UploadController = require("./UploadController-BSZnq84V.js");
|
|
5
5
|
const require_FileIcons = require("./FileIcons-Ob003MdS.js");
|
|
6
|
-
const require_BrowserUpload = require("./BrowserUpload-
|
|
6
|
+
const require_BrowserUpload = require("./BrowserUpload-DLoi5qVj.js");
|
|
7
7
|
// src/viewers/Elements.ts
|
|
8
8
|
const BaseElement$1 = typeof HTMLElement === "undefined" ? class {} : HTMLElement;
|
|
9
9
|
const PROPERTIES = [
|
package/cjs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-CuL1TOuf.js");
|
|
3
3
|
exports.AUTO_PAGING_TO_ARRAY_MAX = require_ModerationContextLimits.AUTO_PAGING_TO_ARRAY_MAX;
|
|
4
4
|
exports.CALMLENS_ERROR_CODES = require_ModerationContextLimits.CALMLENS_ERROR_CODES;
|
|
5
5
|
exports.CDN_RESOURCES = require_ModerationContextLimits.CDN_RESOURCES;
|
package/cjs/react-native.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
3
|
-
const require_Core = require("./Core-
|
|
4
|
-
const require_UploadController = require("./UploadController-
|
|
2
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-CuL1TOuf.js");
|
|
3
|
+
const require_Core = require("./Core-CB0-p-ro.js");
|
|
4
|
+
const require_UploadController = require("./UploadController-BSZnq84V.js");
|
|
5
5
|
const require_FileIcons = require("./FileIcons-Ob003MdS.js");
|
|
6
|
-
const require_ReactUpload = require("./ReactUpload-
|
|
6
|
+
const require_ReactUpload = require("./ReactUpload-3QgzpdMu.js");
|
|
7
7
|
let react = require("react");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let react_native = require("react-native");
|
package/cjs/react.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_ui = require("./ui-
|
|
4
|
-
const require_Core = require("./Core-
|
|
5
|
-
const require_UploadController = require("./UploadController-
|
|
3
|
+
const require_ui = require("./ui-CkQQm3Qw.js");
|
|
4
|
+
const require_Core = require("./Core-CB0-p-ro.js");
|
|
5
|
+
const require_UploadController = require("./UploadController-BSZnq84V.js");
|
|
6
6
|
const require_FileIcons = require("./FileIcons-Ob003MdS.js");
|
|
7
|
-
const require_ReactUpload = require("./ReactUpload-
|
|
8
|
-
const require_BrowserUpload = require("./BrowserUpload-
|
|
7
|
+
const require_ReactUpload = require("./ReactUpload-3QgzpdMu.js");
|
|
8
|
+
const require_BrowserUpload = require("./BrowserUpload-DLoi5qVj.js");
|
|
9
9
|
let react = require("react");
|
|
10
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
11
|
const OPTION_NAMES = /* @__PURE__ */ new Set([
|
package/cjs/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-CuL1TOuf.js");
|
|
3
3
|
require("./index.js");
|
|
4
|
-
const require_CalmLensServerClient = require("./CalmLensServerClient-
|
|
4
|
+
const require_CalmLensServerClient = require("./CalmLensServerClient-CPbCEJMK.js");
|
|
5
5
|
exports.AUTO_PAGING_TO_ARRAY_MAX = require_ModerationContextLimits.AUTO_PAGING_TO_ARRAY_MAX;
|
|
6
6
|
exports.CALMLENS_ERROR_CODES = require_ModerationContextLimits.CALMLENS_ERROR_CODES;
|
|
7
7
|
exports.CDN_RESOURCES = require_ModerationContextLimits.CDN_RESOURCES;
|
package/cjs/testing.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ declare const MOCK_CATEGORIES: readonly ["sexual", "violence", "self-harm", "har
|
|
|
64
64
|
*/
|
|
65
65
|
type MockAssetOutcome = "pending" | "failed" | "allowed" | "limited" | "age-restricted" | "blocked" | "purged";
|
|
66
66
|
type Category = (typeof MOCK_CATEGORIES)[number];
|
|
67
|
-
type EvaluatedFeature<K extends "ocr" | "linkDetection"> = Extract<NonNullable<Asset["classification"][K]>, {
|
|
67
|
+
type EvaluatedFeature<K extends "ocr" | "linkDetection" | "personDetection" | "faceDetection"> = Extract<NonNullable<Asset["classification"][K]>, {
|
|
68
68
|
status: "evaluated";
|
|
69
69
|
}>;
|
|
70
70
|
/** A region of text OCR found, as `classification.ocr.textRegions` reports one. */
|
|
@@ -73,6 +73,10 @@ type MockTextRegion = EvaluatedFeature<"ocr">["textRegions"][number];
|
|
|
73
73
|
type MockQrCode = EvaluatedFeature<"linkDetection">["qrCodes"][number];
|
|
74
74
|
/** A link found in an image's text or QR codes, as `classification.linkDetection.links` reports one. */
|
|
75
75
|
type MockDetectedLink = EvaluatedFeature<"linkDetection">["links"][number];
|
|
76
|
+
/** A person that person detection found, as `classification.personDetection.people` reports one. */
|
|
77
|
+
type MockDetectedPerson = EvaluatedFeature<"personDetection">["people"][number];
|
|
78
|
+
/** A face that face detection found, as `classification.faceDetection.faces` reports one. */
|
|
79
|
+
type MockDetectedFace = EvaluatedFeature<"faceDetection">["faces"][number];
|
|
76
80
|
/** Why a decision waits for human review: `sampled`, or `uncertain` about some categories. */
|
|
77
81
|
type MockPendingReviewReason = "sampled" | "uncertain";
|
|
78
82
|
/**
|
|
@@ -109,6 +113,21 @@ export declare class MockDecision {
|
|
|
109
113
|
* `classification.linkDetection` unless the upload turns link detection off.
|
|
110
114
|
*/
|
|
111
115
|
withLinkDetection(qrCodes?: MockQrCode[], links?: MockDetectedLink[]): this;
|
|
116
|
+
/**
|
|
117
|
+
* The people that person detection finds in an image, reported as `classification.personDetection`
|
|
118
|
+
* when the upload turns person detection on. Without them, it finds nobody.
|
|
119
|
+
*/
|
|
120
|
+
withPersonDetection(people: MockDetectedPerson[]): this;
|
|
121
|
+
/**
|
|
122
|
+
* The faces that face detection finds in an image, reported as `classification.faceDetection` when
|
|
123
|
+
* the upload turns face detection on; each face's `ageRange` only when the upload also asks for
|
|
124
|
+
* age estimation. Without them, it finds no faces.
|
|
125
|
+
*/
|
|
126
|
+
withFaceDetection(faces: MockDetectedFace[]): this;
|
|
127
|
+
/** @internal What `withPersonDetection` set, if anything. */
|
|
128
|
+
get personFindings(): MockDetectedPerson[] | undefined;
|
|
129
|
+
/** @internal What `withFaceDetection` set, if anything. */
|
|
130
|
+
get faceFindings(): MockDetectedFace[] | undefined;
|
|
112
131
|
/** @internal What `withOcr` set, if anything. */
|
|
113
132
|
get ocrFindings(): {
|
|
114
133
|
text: string | null;
|
|
@@ -225,10 +244,10 @@ declare const MOCK_OPERATIONS: readonly ["assets.list", "assets.search", "assets
|
|
|
225
244
|
type MockCalmLensOperation = (typeof MOCK_OPERATIONS)[number];
|
|
226
245
|
/**
|
|
227
246
|
* One request a mock client sent, as the in-memory API received it. `operation` is the client
|
|
228
|
-
* method that sends it; requests several methods send are recorded under the first: `
|
|
229
|
-
* as `
|
|
230
|
-
*
|
|
231
|
-
*
|
|
247
|
+
* method that sends it; requests several methods send are recorded under the first: `ensureLens`
|
|
248
|
+
* as `ensureLenses`, `assets.waitForDecision` polls as `assets.retrieve`, and so on. `callsTo`
|
|
249
|
+
* matches all of them. A text upload is `text.classify`'s and a file or URL upload
|
|
250
|
+
* `assets.classify`'s, never both. Methods that send nothing, such as `uploadTokens.sign` or a cached `ensureLens`, are not
|
|
232
251
|
* recorded.
|
|
233
252
|
*/
|
|
234
253
|
interface MockCalmLensCall {
|
|
@@ -342,8 +361,8 @@ export declare class MockCalmLensServerClient extends CalmLensServerClient {
|
|
|
342
361
|
get calls(): MockCalmLensCall[];
|
|
343
362
|
/**
|
|
344
363
|
* Requests `operation` sends, oldest first. A request several methods send matches each of
|
|
345
|
-
* them: `callsTo("
|
|
346
|
-
*
|
|
364
|
+
* them: `callsTo("assets.waitForDecision")` lists the `assets.retrieve` requests it polls
|
|
365
|
+
* with. A text upload is `text.classify`'s request and a file or URL upload `assets.classify`'s.
|
|
347
366
|
*/
|
|
348
367
|
callsTo(operation: MockCalmLensOperation): MockCalmLensCall[];
|
|
349
368
|
/**
|
|
@@ -430,4 +449,4 @@ export declare const createWebhookHeaders: (options: {
|
|
|
430
449
|
deliveryId: string;
|
|
431
450
|
timestampSeconds?: number;
|
|
432
451
|
}) => Promise<Record<string, string>>;
|
|
433
|
-
export { type MockAssetOutcome, type MockCalmLensAppClientOptions, type MockCalmLensCall, type MockCalmLensOperation, type MockCalmLensServerClientOptions, type MockDatabaseStorage, type MockDetectedLink, type MockEventInput, type MockFailureOptions, type MockImageStorage, type MockModerate, type MockModerationInput, type MockModerationTrigger, type MockQrCode, type MockRequestFailure, type MockReviewDecision, type MockStoredContent, type MockTextRegion, type MockUploadPreset, signUploadTokenWithApiKey as signUploadToken };
|
|
452
|
+
export { type MockAssetOutcome, type MockCalmLensAppClientOptions, type MockCalmLensCall, type MockCalmLensOperation, type MockCalmLensServerClientOptions, type MockDatabaseStorage, type MockDetectedFace, type MockDetectedLink, type MockDetectedPerson, type MockEventInput, type MockFailureOptions, type MockImageStorage, type MockModerate, type MockModerationInput, type MockModerationTrigger, type MockQrCode, type MockRequestFailure, type MockReviewDecision, type MockStoredContent, type MockTextRegion, type MockUploadPreset, signUploadTokenWithApiKey as signUploadToken };
|
package/cjs/testing.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_TestTriggers_uL2Ec8Vt = require("./TestTriggers-uL2Ec8Vt-cPmmKvYd.js");
|
|
3
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
4
|
-
const require_CalmLensServerClient = require("./CalmLensServerClient-
|
|
5
|
-
const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-
|
|
3
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-CuL1TOuf.js");
|
|
4
|
+
const require_CalmLensServerClient = require("./CalmLensServerClient-CPbCEJMK.js");
|
|
5
|
+
const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-BxrJ47zd.js");
|
|
6
6
|
const require_CryptoUtils_BLCa_oZe = require("./CryptoUtils-BLCa-oZe-leCkr1ko.js");
|
|
7
|
-
const require_CalmLensAppClient = require("./CalmLensAppClient-
|
|
8
|
-
const require_UploadController = require("./UploadController-
|
|
7
|
+
const require_CalmLensAppClient = require("./CalmLensAppClient-C--UAnoz.js");
|
|
8
|
+
const require_UploadController = require("./UploadController-BSZnq84V.js");
|
|
9
9
|
let zod = require("zod");
|
|
10
10
|
zod = require_TestTriggers_uL2Ec8Vt.__toESM(zod, 1);
|
|
11
11
|
// src/contract/MediaTestTriggers.js
|
|
@@ -8341,6 +8341,8 @@ var MockDecision = class {
|
|
|
8341
8341
|
#pendingReview;
|
|
8342
8342
|
#ocr;
|
|
8343
8343
|
#linkDetection;
|
|
8344
|
+
#people;
|
|
8345
|
+
#faces;
|
|
8344
8346
|
constructor(status) {
|
|
8345
8347
|
if (!OUTCOMES.includes(status)) throw require_ModerationContextLimits.invalidArgument(`status must be one of ${OUTCOMES.join(", ")}`);
|
|
8346
8348
|
this.status = status;
|
|
@@ -8412,6 +8414,31 @@ var MockDecision = class {
|
|
|
8412
8414
|
};
|
|
8413
8415
|
return this;
|
|
8414
8416
|
}
|
|
8417
|
+
/**
|
|
8418
|
+
* The people that person detection finds in an image, reported as `classification.personDetection`
|
|
8419
|
+
* when the upload turns person detection on. Without them, it finds nobody.
|
|
8420
|
+
*/
|
|
8421
|
+
withPersonDetection(people) {
|
|
8422
|
+
this.#people = structuredClone(people);
|
|
8423
|
+
return this;
|
|
8424
|
+
}
|
|
8425
|
+
/**
|
|
8426
|
+
* The faces that face detection finds in an image, reported as `classification.faceDetection` when
|
|
8427
|
+
* the upload turns face detection on; each face's `ageRange` only when the upload also asks for
|
|
8428
|
+
* age estimation. Without them, it finds no faces.
|
|
8429
|
+
*/
|
|
8430
|
+
withFaceDetection(faces) {
|
|
8431
|
+
this.#faces = structuredClone(faces);
|
|
8432
|
+
return this;
|
|
8433
|
+
}
|
|
8434
|
+
/** @internal What `withPersonDetection` set, if anything. */
|
|
8435
|
+
get personFindings() {
|
|
8436
|
+
return this.#people && structuredClone(this.#people);
|
|
8437
|
+
}
|
|
8438
|
+
/** @internal What `withFaceDetection` set, if anything. */
|
|
8439
|
+
get faceFindings() {
|
|
8440
|
+
return this.#faces && structuredClone(this.#faces);
|
|
8441
|
+
}
|
|
8415
8442
|
/** @internal What `withOcr` set, if anything. */
|
|
8416
8443
|
get ocrFindings() {
|
|
8417
8444
|
return this.#ocr && structuredClone(this.#ocr);
|
|
@@ -8487,6 +8514,45 @@ var MockDecision = class {
|
|
|
8487
8514
|
const mockDecision = (status) => new MockDecision(status);
|
|
8488
8515
|
/** The default `moderate`: queued work stays pending until `completeProcessing`, which allows it. */
|
|
8489
8516
|
const defaultModerate = ({ trigger, queued }) => queued && trigger !== "complete" ? "pending" : "allowed";
|
|
8517
|
+
// src/testing/MockUrlAssetTypes.ts
|
|
8518
|
+
const MOCK_URL_EXTENSION_TYPES = {
|
|
8519
|
+
jpg: "image",
|
|
8520
|
+
jpeg: "image",
|
|
8521
|
+
png: "image",
|
|
8522
|
+
gif: "image",
|
|
8523
|
+
webp: "image",
|
|
8524
|
+
avif: "image",
|
|
8525
|
+
heic: "image",
|
|
8526
|
+
heif: "image",
|
|
8527
|
+
bmp: "image",
|
|
8528
|
+
tif: "image",
|
|
8529
|
+
tiff: "image",
|
|
8530
|
+
svg: "image",
|
|
8531
|
+
mp4: "video",
|
|
8532
|
+
m4v: "video",
|
|
8533
|
+
mov: "video",
|
|
8534
|
+
webm: "video",
|
|
8535
|
+
mkv: "video",
|
|
8536
|
+
avi: "video",
|
|
8537
|
+
mp3: "audio",
|
|
8538
|
+
m4a: "audio",
|
|
8539
|
+
aac: "audio",
|
|
8540
|
+
wav: "audio",
|
|
8541
|
+
ogg: "audio",
|
|
8542
|
+
oga: "audio",
|
|
8543
|
+
opus: "audio",
|
|
8544
|
+
flac: "audio",
|
|
8545
|
+
pdf: "multimedia-document",
|
|
8546
|
+
doc: "multimedia-document",
|
|
8547
|
+
docx: "multimedia-document",
|
|
8548
|
+
odt: "multimedia-document",
|
|
8549
|
+
ppt: "multimedia-document",
|
|
8550
|
+
pptx: "multimedia-document",
|
|
8551
|
+
odp: "multimedia-document",
|
|
8552
|
+
rtf: "multimedia-document",
|
|
8553
|
+
txt: "plaintext-document",
|
|
8554
|
+
md: "plaintext-document"
|
|
8555
|
+
};
|
|
8490
8556
|
// src/testing/MockAssetFilters.ts
|
|
8491
8557
|
/** The asset fields a list filter may name, each with the operators it accepts. */
|
|
8492
8558
|
const MOCK_ASSET_FILTER_FIELDS = {
|
|
@@ -9442,9 +9508,25 @@ const mockRendering = (asset, processed) => {
|
|
|
9442
9508
|
default: return NO_RENDERING;
|
|
9443
9509
|
}
|
|
9444
9510
|
};
|
|
9445
|
-
/**
|
|
9511
|
+
/**
|
|
9512
|
+
* A URL upload's type: the type of its path's file extension (`MOCK_URL_EXTENSION_TYPES`),
|
|
9513
|
+
* compared lower-case without the query or fragment, or `website` for any other extension or none.
|
|
9514
|
+
* The mock fetches nothing, so the extension stands in for the fetched content's type.
|
|
9515
|
+
*/
|
|
9516
|
+
const urlAssetType = (url) => {
|
|
9517
|
+
let path;
|
|
9518
|
+
try {
|
|
9519
|
+
path = new URL(url).pathname;
|
|
9520
|
+
} catch {
|
|
9521
|
+
path = url.split(/[?#]/, 1)[0];
|
|
9522
|
+
}
|
|
9523
|
+
const segment = path.slice(path.lastIndexOf("/") + 1);
|
|
9524
|
+
const dot = segment.lastIndexOf(".");
|
|
9525
|
+
if (dot === -1) return "website";
|
|
9526
|
+
return MOCK_URL_EXTENSION_TYPES[segment.slice(dot + 1).toLowerCase()] ?? "website";
|
|
9527
|
+
};
|
|
9528
|
+
/** An asset's type from its content type. */
|
|
9446
9529
|
const inferAssetType = (contentType) => {
|
|
9447
|
-
if (contentType === void 0) return "website";
|
|
9448
9530
|
const type = contentType.toLowerCase();
|
|
9449
9531
|
if (type.startsWith("image/")) return "image";
|
|
9450
9532
|
if (type.startsWith("video/")) return "video";
|
|
@@ -9630,7 +9712,7 @@ const operationsOf = (request) => {
|
|
|
9630
9712
|
case "assets":
|
|
9631
9713
|
if (method === "GET") return ["assets.list"];
|
|
9632
9714
|
if (query.get("wait") === "false") return ["assets.create"];
|
|
9633
|
-
return isTextUpload(request) ? ["
|
|
9715
|
+
return isTextUpload(request) ? ["text.classify"] : ["assets.classify"];
|
|
9634
9716
|
}
|
|
9635
9717
|
if (segments[2] === "assets" && segments[4] === "timeline" && segments.length === 5) return ["assets.listTimeline"];
|
|
9636
9718
|
if (segments[2] === "metadata-fields" && segments.length === 4) return ["metadataFields.delete"];
|
|
@@ -10739,7 +10821,7 @@ var MockCalmLensApi = class {
|
|
|
10739
10821
|
source: "calmlens"
|
|
10740
10822
|
}
|
|
10741
10823
|
});
|
|
10742
|
-
const type =
|
|
10824
|
+
const type = fields.url === void 0 ? inferAssetType(contentType ?? "") : urlAssetType(fields.url);
|
|
10743
10825
|
if (part) {
|
|
10744
10826
|
if (part.partNumber > 1) throw fail(require_ModerationContextLimits.API_ERROR_CODES.USE_UPLOAD_PART);
|
|
10745
10827
|
const partSize = bytes.byteLength;
|
|
@@ -10836,7 +10918,9 @@ var MockCalmLensApi = class {
|
|
|
10836
10918
|
timeline: null
|
|
10837
10919
|
},
|
|
10838
10920
|
ocr: null,
|
|
10839
|
-
linkDetection: null
|
|
10921
|
+
linkDetection: null,
|
|
10922
|
+
personDetection: null,
|
|
10923
|
+
faceDetection: null
|
|
10840
10924
|
}
|
|
10841
10925
|
};
|
|
10842
10926
|
if (part) {
|
|
@@ -10967,6 +11051,7 @@ var MockCalmLensApi = class {
|
|
|
10967
11051
|
const features = this.processingOptions.get(asset.id)?.features;
|
|
10968
11052
|
if (next.classification.status !== "completed" || asset.type !== "image") return next;
|
|
10969
11053
|
const ocr = features?.ocr?.enabled === true ? decision.ocrFindings : void 0;
|
|
11054
|
+
const ages = features?.faceDetection?.ageEstimation === true;
|
|
10970
11055
|
return {
|
|
10971
11056
|
...next,
|
|
10972
11057
|
...ocr?.text != null && next.content.status === "stored" && { content: {
|
|
@@ -10991,11 +11076,14 @@ var MockCalmLensApi = class {
|
|
|
10991
11076
|
} },
|
|
10992
11077
|
...features?.personDetection?.enabled === true && { personDetection: {
|
|
10993
11078
|
status: "evaluated",
|
|
10994
|
-
people: []
|
|
11079
|
+
people: decision.personFindings ?? []
|
|
10995
11080
|
} },
|
|
10996
11081
|
...features?.faceDetection?.enabled === true && { faceDetection: {
|
|
10997
11082
|
status: "evaluated",
|
|
10998
|
-
faces: []
|
|
11083
|
+
faces: (decision.faceFindings ?? []).map(({ ageRange, ...face }) => ages && ageRange ? {
|
|
11084
|
+
...face,
|
|
11085
|
+
ageRange
|
|
11086
|
+
} : face)
|
|
10999
11087
|
} }
|
|
11000
11088
|
}
|
|
11001
11089
|
};
|
|
@@ -11980,8 +12068,8 @@ var MockCalmLensServerClient = class extends require_CalmLensServerClient.CalmLe
|
|
|
11980
12068
|
}
|
|
11981
12069
|
/**
|
|
11982
12070
|
* Requests `operation` sends, oldest first. A request several methods send matches each of
|
|
11983
|
-
* them: `callsTo("
|
|
11984
|
-
*
|
|
12071
|
+
* them: `callsTo("assets.waitForDecision")` lists the `assets.retrieve` requests it polls
|
|
12072
|
+
* with. A text upload is `text.classify`'s request and a file or URL upload `assets.classify`'s.
|
|
11985
12073
|
*/
|
|
11986
12074
|
callsTo(operation) {
|
|
11987
12075
|
return this.#api.calls.filter(({ operations }) => operations.includes(operation)).map(({ call }) => call);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
-
require("./Core-
|
|
1
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-CuL1TOuf.js");
|
|
2
|
+
require("./Core-CB0-p-ro.js");
|
|
3
3
|
// src/ui/viewers/PdfLoader.ts
|
|
4
4
|
let loading;
|
|
5
5
|
/**
|
package/cjs/ui.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ui = require("./ui-
|
|
3
|
-
const require_Core = require("./Core-
|
|
4
|
-
const require_UploadController = require("./UploadController-
|
|
2
|
+
const require_ui = require("./ui-CkQQm3Qw.js");
|
|
3
|
+
const require_Core = require("./Core-CB0-p-ro.js");
|
|
4
|
+
const require_UploadController = require("./UploadController-BSZnq84V.js");
|
|
5
5
|
exports.ASSET_FILE_ICON_SIZE = require_Core.ASSET_FILE_ICON_SIZE;
|
|
6
6
|
exports.ASSET_VIEWERS = require_ui.ASSET_VIEWERS;
|
|
7
7
|
exports.AssetSession = require_Core.AssetSession;
|
package/cjs/vue.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ui = require("./ui-
|
|
3
|
-
const require_Core = require("./Core-
|
|
4
|
-
const require_UploadController = require("./UploadController-
|
|
2
|
+
const require_ui = require("./ui-CkQQm3Qw.js");
|
|
3
|
+
const require_Core = require("./Core-CB0-p-ro.js");
|
|
4
|
+
const require_UploadController = require("./UploadController-BSZnq84V.js");
|
|
5
5
|
const require_FileIcons = require("./FileIcons-Ob003MdS.js");
|
|
6
|
-
const require_BrowserUpload = require("./BrowserUpload-
|
|
6
|
+
const require_BrowserUpload = require("./BrowserUpload-DLoi5qVj.js");
|
|
7
7
|
let vue = require("vue");
|
|
8
8
|
// src/viewers/Vue.ts
|
|
9
9
|
const optional$1 = (type) => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createUploadController$1 } from "./UploadController
|
|
1
|
+
import { n as createUploadController$1 } from "./UploadController-DKjI8S2K.js";
|
|
2
2
|
// src/ui/BrowserUpload.ts
|
|
3
3
|
/** Creates an upload queue for the browser components, such as one a form starts on submit. */
|
|
4
4
|
const createUploadController = (options) => createUploadController$1(options);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as validateAppClientOptions, dt as invalidConfig, g as encodePathSegment, l as buildAssetUrl, m as checkOptionKeys, p as DEFAULT_CDN_BASE_URL, ut as invalidArgument } from "./ModerationContextLimits-
|
|
2
|
-
import { d as prepareSubmitAssetOptions, f as resolveConnectionOptions, i as CalmLensConnection, p as splitsIntoParts, s as expectUploadedAsset, t as APP_OPTION_KEYS } from "./CalmLensOptionKeys-
|
|
1
|
+
import { T as validateAppClientOptions, dt as invalidConfig, g as encodePathSegment, l as buildAssetUrl, m as checkOptionKeys, p as DEFAULT_CDN_BASE_URL, ut as invalidArgument } from "./ModerationContextLimits-IH2zX1wg.js";
|
|
2
|
+
import { d as prepareSubmitAssetOptions, f as resolveConnectionOptions, i as CalmLensConnection, p as splitsIntoParts, s as expectUploadedAsset, t as APP_OPTION_KEYS } from "./CalmLensOptionKeys-B6an7neE.js";
|
|
3
3
|
// src/client/CalmLensAppClient.ts
|
|
4
4
|
const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
5
5
|
/** `options`, once `checkOptionKeys` finds only keys `operation` takes. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as MAX_IMAGE_UPLOAD_BYTES, F as sleep, M as getRejectedUploadMimeTypeError, P as CalmLensTransport, Q as CalmLensError, S as stringifyQuery, U as resolveLogLevel, _ as isAcceptedUploadMimeType, b as randomUuid, ft as API_ERROR_CODES, j as MAX_NON_IMAGE_UPLOAD_BYTES, k as MAX_DIRECT_IMAGE_UPLOAD_BYTES, lt as SDK_ERROR_CODES, r as selectModerationContextItems, ut as invalidArgument } from "./ModerationContextLimits-
|
|
1
|
+
import { A as MAX_IMAGE_UPLOAD_BYTES, F as sleep, M as getRejectedUploadMimeTypeError, P as CalmLensTransport, Q as CalmLensError, S as stringifyQuery, U as resolveLogLevel, _ as isAcceptedUploadMimeType, b as randomUuid, ft as API_ERROR_CODES, j as MAX_NON_IMAGE_UPLOAD_BYTES, k as MAX_DIRECT_IMAGE_UPLOAD_BYTES, lt as SDK_ERROR_CODES, r as selectModerationContextItems, ut as invalidArgument } from "./ModerationContextLimits-IH2zX1wg.js";
|
|
2
2
|
// src/contract/AssetPayload.js
|
|
3
3
|
const bufferInputToBytes = (value) => {
|
|
4
4
|
if (value instanceof ArrayBuffer) return new Uint8Array(value);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as copyLastResponse, C as toTextAssetOptions, D as validateServerClientOptions, E as validateBatchAssetsOptions, H as readEnv, L as isBrowserRuntime, Q as CalmLensError, R as isReactNativeRuntime, S as stringifyQuery, V as listPages, dt as invalidConfig, f as validateSignAssetUrlOptions, g as encodePathSegment, l as buildAssetUrl, lt as SDK_ERROR_CODES, m as checkOptionKeys, p as DEFAULT_CDN_BASE_URL, s as appendSignedLocation, u as getAssetInfo, ut as invalidArgument, y as pollForDecision } from "./ModerationContextLimits-
|
|
2
|
-
import { c as getMockHooks, d as prepareSubmitAssetOptions, f as resolveConnectionOptions, i as CalmLensConnection, l as invalidPayload, m as validateCallOptions, n as NULLABLE_OPTION_KEYS, o as expectAsset, p as splitsIntoParts, r as SERVER_OPTION_KEYS, u as newIdempotencyKey } from "./CalmLensOptionKeys-
|
|
1
|
+
import { B as copyLastResponse, C as toTextAssetOptions, D as validateServerClientOptions, E as validateBatchAssetsOptions, H as readEnv, L as isBrowserRuntime, Q as CalmLensError, R as isReactNativeRuntime, S as stringifyQuery, V as listPages, dt as invalidConfig, f as validateSignAssetUrlOptions, g as encodePathSegment, l as buildAssetUrl, lt as SDK_ERROR_CODES, m as checkOptionKeys, p as DEFAULT_CDN_BASE_URL, s as appendSignedLocation, u as getAssetInfo, ut as invalidArgument, y as pollForDecision } from "./ModerationContextLimits-IH2zX1wg.js";
|
|
2
|
+
import { c as getMockHooks, d as prepareSubmitAssetOptions, f as resolveConnectionOptions, i as CalmLensConnection, l as invalidPayload, m as validateCallOptions, n as NULLABLE_OPTION_KEYS, o as expectAsset, p as splitsIntoParts, r as SERVER_OPTION_KEYS, u as newIdempotencyKey } from "./CalmLensOptionKeys-B6an7neE.js";
|
|
3
3
|
import { n as sha256Hex, r as timingSafeEqual, t as hmacSha256Hex } from "./CryptoUtils-BLCa-oZe-DKr3LmN6.js";
|
|
4
4
|
// src/contract/JsonUtils.js
|
|
5
5
|
const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Q as CalmLensError, c as assetUrlOf, d as toUrlViewerClaims, o as appendAssetLocation, u as getAssetInfo, w as transformSelector, x as serializeTransform } from "./ModerationContextLimits-
|
|
2
|
-
import { o as placeholderHashToDataURL } from "./UploadController
|
|
1
|
+
import { Q as CalmLensError, c as assetUrlOf, d as toUrlViewerClaims, o as appendAssetLocation, u as getAssetInfo, w as transformSelector, x as serializeTransform } from "./ModerationContextLimits-IH2zX1wg.js";
|
|
2
|
+
import { o as placeholderHashToDataURL } from "./UploadController-DKjI8S2K.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). */
|
|
@@ -1062,7 +1062,7 @@ const listPages = (fetchPage, { cursor, feed = false } = {}) => {
|
|
|
1062
1062
|
};
|
|
1063
1063
|
// src/client/CalmLensVersion.ts
|
|
1064
1064
|
/** This SDK's version, from its package.json. */
|
|
1065
|
-
const SDK_VERSION = "0.28.
|
|
1065
|
+
const SDK_VERSION = "0.28.1";
|
|
1066
1066
|
const runtimeName = () => {
|
|
1067
1067
|
const runtime = globalThis;
|
|
1068
1068
|
if (isReactNativeRuntime()) return "react-native";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as withProvidedOptions, n as createUploadController } from "./UploadController
|
|
1
|
+
import { i as withProvidedOptions, n as createUploadController } from "./UploadController-DKjI8S2K.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,5 @@
|
|
|
1
|
-
import { Q as CalmLensError, lt as SDK_ERROR_CODES } from "./ModerationContextLimits-
|
|
2
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
1
|
+
import { Q as CalmLensError, lt as SDK_ERROR_CODES } from "./ModerationContextLimits-IH2zX1wg.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-D_SprSKl.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.
|
package/esm/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as CalmLensInvalidArgumentError, G as CalmLensApiError, I as SDK_VERSION, J as CalmLensCancelledError, K as CalmLensAuthenticationError, Q as CalmLensError, W as CALMLENS_ERROR_CODES, X as CalmLensConflictError, Y as CalmLensConfigurationError, Z as CalmLensConnectionError, a as CDN_RESOURCES, at as CalmLensServerError, ct as CalmLensWebhookVerificationError, et as CalmLensInvalidResponseError, it as CalmLensRateLimitError, n as MODERATION_CONTEXT_USED_ITEMS, nt as CalmLensPayloadTooLargeError, ot as CalmLensTimeoutError, p as DEFAULT_CDN_BASE_URL, q as CalmLensBadRequestError, r as selectModerationContextItems, rt as CalmLensPermissionDeniedError, st as CalmLensUnprocessableEntityError, t as MODERATION_CONTEXT_USED_CHARACTERS, tt as CalmLensNotFoundError, u as getAssetInfo, z as AUTO_PAGING_TO_ARRAY_MAX } from "./ModerationContextLimits-
|
|
1
|
+
import { $ as CalmLensInvalidArgumentError, G as CalmLensApiError, I as SDK_VERSION, J as CalmLensCancelledError, K as CalmLensAuthenticationError, Q as CalmLensError, W as CALMLENS_ERROR_CODES, X as CalmLensConflictError, Y as CalmLensConfigurationError, Z as CalmLensConnectionError, a as CDN_RESOURCES, at as CalmLensServerError, ct as CalmLensWebhookVerificationError, et as CalmLensInvalidResponseError, it as CalmLensRateLimitError, n as MODERATION_CONTEXT_USED_ITEMS, nt as CalmLensPayloadTooLargeError, ot as CalmLensTimeoutError, p as DEFAULT_CDN_BASE_URL, q as CalmLensBadRequestError, r as selectModerationContextItems, rt as CalmLensPermissionDeniedError, st as CalmLensUnprocessableEntityError, t as MODERATION_CONTEXT_USED_CHARACTERS, tt as CalmLensNotFoundError, u as getAssetInfo, z as AUTO_PAGING_TO_ARRAY_MAX } from "./ModerationContextLimits-IH2zX1wg.js";
|
|
2
2
|
import "./index.js";
|
|
3
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
3
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-D_SprSKl.js";
|
|
4
4
|
export { AUTO_PAGING_TO_ARRAY_MAX, CALMLENS_ERROR_CODES, CDN_RESOURCES, CalmLensApiError, CalmLensAppClient, CalmLensAuthenticationError, CalmLensBadRequestError, CalmLensCancelledError, CalmLensConfigurationError, CalmLensConflictError, CalmLensConnectionError, CalmLensError, CalmLensInvalidArgumentError, CalmLensInvalidResponseError, CalmLensNotFoundError, CalmLensPayloadTooLargeError, CalmLensPermissionDeniedError, CalmLensRateLimitError, CalmLensServerError, CalmLensTimeoutError, CalmLensUnprocessableEntityError, CalmLensWebhookVerificationError, DEFAULT_CDN_BASE_URL, MODERATION_CONTEXT_USED_CHARACTERS, MODERATION_CONTEXT_USED_ITEMS, SDK_VERSION, getAssetInfo, selectModerationContextItems };
|
package/esm/elements.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-
|
|
2
|
-
import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-
|
|
3
|
-
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController
|
|
1
|
+
import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-BovDqg9n.js";
|
|
2
|
+
import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-dzPyrg_G.js";
|
|
3
|
+
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-DKjI8S2K.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-BKrrHzoh.js";
|
|
6
6
|
// src/viewers/Elements.ts
|
|
7
7
|
const BaseElement$1 = typeof HTMLElement === "undefined" ? class {} : HTMLElement;
|
|
8
8
|
const PROPERTIES = [
|
package/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { z as AUTO_PAGING_TO_ARRAY_MAX, W as CALMLENS_ERROR_CODES, a as CDN_RESOURCES, G as CalmLensApiError, K as CalmLensAuthenticationError, q as CalmLensBadRequestError, J as CalmLensCancelledError, Y as CalmLensConfigurationError, X as CalmLensConflictError, Z as CalmLensConnectionError, Q as CalmLensError, $ as CalmLensInvalidArgumentError, et as CalmLensInvalidResponseError, tt as CalmLensNotFoundError, nt as CalmLensPayloadTooLargeError, rt as CalmLensPermissionDeniedError, it as CalmLensRateLimitError, at as CalmLensServerError, ot as CalmLensTimeoutError, st as CalmLensUnprocessableEntityError, ct as CalmLensWebhookVerificationError, p as DEFAULT_CDN_BASE_URL, t as MODERATION_CONTEXT_USED_CHARACTERS, n as MODERATION_CONTEXT_USED_ITEMS, I as SDK_VERSION, u as getAssetInfo, r as selectModerationContextItems } from "./ModerationContextLimits-
|
|
1
|
+
export { z as AUTO_PAGING_TO_ARRAY_MAX, W as CALMLENS_ERROR_CODES, a as CDN_RESOURCES, G as CalmLensApiError, K as CalmLensAuthenticationError, q as CalmLensBadRequestError, J as CalmLensCancelledError, Y as CalmLensConfigurationError, X as CalmLensConflictError, Z as CalmLensConnectionError, Q as CalmLensError, $ as CalmLensInvalidArgumentError, et as CalmLensInvalidResponseError, tt as CalmLensNotFoundError, nt as CalmLensPayloadTooLargeError, rt as CalmLensPermissionDeniedError, it as CalmLensRateLimitError, at as CalmLensServerError, ot as CalmLensTimeoutError, st as CalmLensUnprocessableEntityError, ct as CalmLensWebhookVerificationError, p as DEFAULT_CDN_BASE_URL, t as MODERATION_CONTEXT_USED_CHARACTERS, n as MODERATION_CONTEXT_USED_ITEMS, I as SDK_VERSION, u as getAssetInfo, r as selectModerationContextItems } from "./ModerationContextLimits-IH2zX1wg.js";
|
package/esm/react-native.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as assetUrlOf, o as appendAssetLocation } from "./ModerationContextLimits-
|
|
2
|
-
import { C as pickAssetSource, E as resolveTheme, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, x as getPlayedPercent, y as getAssetViewKey } from "./Core-
|
|
3
|
-
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController
|
|
1
|
+
import { c as assetUrlOf, o as appendAssetLocation } from "./ModerationContextLimits-IH2zX1wg.js";
|
|
2
|
+
import { C as pickAssetSource, E as resolveTheme, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, x as getPlayedPercent, y as getAssetViewKey } from "./Core-dzPyrg_G.js";
|
|
3
|
+
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-DKjI8S2K.js";
|
|
4
4
|
import { a as getFileIcon, o as getFileIconLabel, t as FILE_ICON_COLORS } from "./FileIcons-M6dzjFxd.js";
|
|
5
|
-
import { i as useUploadSnapshot, n as useCalmLensUpload, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-
|
|
5
|
+
import { i as useUploadSnapshot, n as useCalmLensUpload, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-4DeUbua_.js";
|
|
6
6
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { Image, Linking, PixelRatio, Pressable, StyleSheet, Text, View } from "react-native";
|
package/esm/react.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-
|
|
3
|
-
import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, n as CALMLENS_STYLES_ID, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-
|
|
4
|
-
import { a as createProgressFetch, i as withProvidedOptions, r as isFileAccepted, t as UploadController } from "./UploadController
|
|
2
|
+
import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-BovDqg9n.js";
|
|
3
|
+
import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, n as CALMLENS_STYLES_ID, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-dzPyrg_G.js";
|
|
4
|
+
import { a as createProgressFetch, i as withProvidedOptions, r as isFileAccepted, t as UploadController } from "./UploadController-DKjI8S2K.js";
|
|
5
5
|
import { c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
|
|
6
|
-
import { i as useUploadSnapshot, n as useCalmLensUpload$1, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-
|
|
7
|
-
import { t as createUploadController } from "./BrowserUpload-
|
|
6
|
+
import { i as useUploadSnapshot, n as useCalmLensUpload$1, r as useOwnController, t as CalmLensProvider } from "./ReactUpload-4DeUbua_.js";
|
|
7
|
+
import { t as createUploadController } from "./BrowserUpload-BKrrHzoh.js";
|
|
8
8
|
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
const OPTION_NAMES = /* @__PURE__ */ new Set([
|
package/esm/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as CalmLensInvalidArgumentError, G as CalmLensApiError, I as SDK_VERSION, J as CalmLensCancelledError, K as CalmLensAuthenticationError, Q as CalmLensError, W as CALMLENS_ERROR_CODES, X as CalmLensConflictError, Y as CalmLensConfigurationError, Z as CalmLensConnectionError, a as CDN_RESOURCES, at as CalmLensServerError, ct as CalmLensWebhookVerificationError, et as CalmLensInvalidResponseError, it as CalmLensRateLimitError, n as MODERATION_CONTEXT_USED_ITEMS, nt as CalmLensPayloadTooLargeError, ot as CalmLensTimeoutError, p as DEFAULT_CDN_BASE_URL, q as CalmLensBadRequestError, r as selectModerationContextItems, rt as CalmLensPermissionDeniedError, st as CalmLensUnprocessableEntityError, t as MODERATION_CONTEXT_USED_CHARACTERS, tt as CalmLensNotFoundError, u as getAssetInfo, z as AUTO_PAGING_TO_ARRAY_MAX } from "./ModerationContextLimits-
|
|
1
|
+
import { $ as CalmLensInvalidArgumentError, G as CalmLensApiError, I as SDK_VERSION, J as CalmLensCancelledError, K as CalmLensAuthenticationError, Q as CalmLensError, W as CALMLENS_ERROR_CODES, X as CalmLensConflictError, Y as CalmLensConfigurationError, Z as CalmLensConnectionError, a as CDN_RESOURCES, at as CalmLensServerError, ct as CalmLensWebhookVerificationError, et as CalmLensInvalidResponseError, it as CalmLensRateLimitError, n as MODERATION_CONTEXT_USED_ITEMS, nt as CalmLensPayloadTooLargeError, ot as CalmLensTimeoutError, p as DEFAULT_CDN_BASE_URL, q as CalmLensBadRequestError, r as selectModerationContextItems, rt as CalmLensPermissionDeniedError, st as CalmLensUnprocessableEntityError, t as MODERATION_CONTEXT_USED_CHARACTERS, tt as CalmLensNotFoundError, u as getAssetInfo, z as AUTO_PAGING_TO_ARRAY_MAX } from "./ModerationContextLimits-IH2zX1wg.js";
|
|
2
2
|
import "./index.js";
|
|
3
|
-
import { a as WEBHOOK_TIMESTAMP_HEADER, c as isNewerAssetEvent, d as verifyWebhookSignature, i as WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, l as isTestWebhookEvent, n as WEBHOOK_DELIVERY_HEADER, o as getEventFact, r as WEBHOOK_SIGNATURE_HEADER, s as getEventFacts, t as CalmLensServerClient, u as parseWebhookEvent } from "./CalmLensServerClient-
|
|
3
|
+
import { a as WEBHOOK_TIMESTAMP_HEADER, c as isNewerAssetEvent, d as verifyWebhookSignature, i as WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, l as isTestWebhookEvent, n as WEBHOOK_DELIVERY_HEADER, o as getEventFact, r as WEBHOOK_SIGNATURE_HEADER, s as getEventFacts, t as CalmLensServerClient, u as parseWebhookEvent } from "./CalmLensServerClient-BY45aX5Q.js";
|
|
4
4
|
export { AUTO_PAGING_TO_ARRAY_MAX, CALMLENS_ERROR_CODES, CDN_RESOURCES, CalmLensApiError, CalmLensAuthenticationError, CalmLensBadRequestError, CalmLensCancelledError, CalmLensConfigurationError, CalmLensConflictError, CalmLensConnectionError, CalmLensError, CalmLensInvalidArgumentError, CalmLensInvalidResponseError, CalmLensNotFoundError, CalmLensPayloadTooLargeError, CalmLensPermissionDeniedError, CalmLensRateLimitError, CalmLensServerClient, CalmLensServerError, CalmLensTimeoutError, CalmLensUnprocessableEntityError, CalmLensWebhookVerificationError, DEFAULT_CDN_BASE_URL, MODERATION_CONTEXT_USED_CHARACTERS, MODERATION_CONTEXT_USED_ITEMS, SDK_VERSION, WEBHOOK_DELIVERY_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, WEBHOOK_TIMESTAMP_HEADER, getAssetInfo, getEventFact, getEventFacts, isNewerAssetEvent, isTestWebhookEvent, parseWebhookEvent, selectModerationContextItems, verifyWebhookSignature };
|
package/esm/testing.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ declare const MOCK_CATEGORIES: readonly ["sexual", "violence", "self-harm", "har
|
|
|
64
64
|
*/
|
|
65
65
|
type MockAssetOutcome = "pending" | "failed" | "allowed" | "limited" | "age-restricted" | "blocked" | "purged";
|
|
66
66
|
type Category = (typeof MOCK_CATEGORIES)[number];
|
|
67
|
-
type EvaluatedFeature<K extends "ocr" | "linkDetection"> = Extract<NonNullable<Asset["classification"][K]>, {
|
|
67
|
+
type EvaluatedFeature<K extends "ocr" | "linkDetection" | "personDetection" | "faceDetection"> = Extract<NonNullable<Asset["classification"][K]>, {
|
|
68
68
|
status: "evaluated";
|
|
69
69
|
}>;
|
|
70
70
|
/** A region of text OCR found, as `classification.ocr.textRegions` reports one. */
|
|
@@ -73,6 +73,10 @@ type MockTextRegion = EvaluatedFeature<"ocr">["textRegions"][number];
|
|
|
73
73
|
type MockQrCode = EvaluatedFeature<"linkDetection">["qrCodes"][number];
|
|
74
74
|
/** A link found in an image's text or QR codes, as `classification.linkDetection.links` reports one. */
|
|
75
75
|
type MockDetectedLink = EvaluatedFeature<"linkDetection">["links"][number];
|
|
76
|
+
/** A person that person detection found, as `classification.personDetection.people` reports one. */
|
|
77
|
+
type MockDetectedPerson = EvaluatedFeature<"personDetection">["people"][number];
|
|
78
|
+
/** A face that face detection found, as `classification.faceDetection.faces` reports one. */
|
|
79
|
+
type MockDetectedFace = EvaluatedFeature<"faceDetection">["faces"][number];
|
|
76
80
|
/** Why a decision waits for human review: `sampled`, or `uncertain` about some categories. */
|
|
77
81
|
type MockPendingReviewReason = "sampled" | "uncertain";
|
|
78
82
|
/**
|
|
@@ -109,6 +113,21 @@ export declare class MockDecision {
|
|
|
109
113
|
* `classification.linkDetection` unless the upload turns link detection off.
|
|
110
114
|
*/
|
|
111
115
|
withLinkDetection(qrCodes?: MockQrCode[], links?: MockDetectedLink[]): this;
|
|
116
|
+
/**
|
|
117
|
+
* The people that person detection finds in an image, reported as `classification.personDetection`
|
|
118
|
+
* when the upload turns person detection on. Without them, it finds nobody.
|
|
119
|
+
*/
|
|
120
|
+
withPersonDetection(people: MockDetectedPerson[]): this;
|
|
121
|
+
/**
|
|
122
|
+
* The faces that face detection finds in an image, reported as `classification.faceDetection` when
|
|
123
|
+
* the upload turns face detection on; each face's `ageRange` only when the upload also asks for
|
|
124
|
+
* age estimation. Without them, it finds no faces.
|
|
125
|
+
*/
|
|
126
|
+
withFaceDetection(faces: MockDetectedFace[]): this;
|
|
127
|
+
/** @internal What `withPersonDetection` set, if anything. */
|
|
128
|
+
get personFindings(): MockDetectedPerson[] | undefined;
|
|
129
|
+
/** @internal What `withFaceDetection` set, if anything. */
|
|
130
|
+
get faceFindings(): MockDetectedFace[] | undefined;
|
|
112
131
|
/** @internal What `withOcr` set, if anything. */
|
|
113
132
|
get ocrFindings(): {
|
|
114
133
|
text: string | null;
|
|
@@ -225,10 +244,10 @@ declare const MOCK_OPERATIONS: readonly ["assets.list", "assets.search", "assets
|
|
|
225
244
|
type MockCalmLensOperation = (typeof MOCK_OPERATIONS)[number];
|
|
226
245
|
/**
|
|
227
246
|
* One request a mock client sent, as the in-memory API received it. `operation` is the client
|
|
228
|
-
* method that sends it; requests several methods send are recorded under the first: `
|
|
229
|
-
* as `
|
|
230
|
-
*
|
|
231
|
-
*
|
|
247
|
+
* method that sends it; requests several methods send are recorded under the first: `ensureLens`
|
|
248
|
+
* as `ensureLenses`, `assets.waitForDecision` polls as `assets.retrieve`, and so on. `callsTo`
|
|
249
|
+
* matches all of them. A text upload is `text.classify`'s and a file or URL upload
|
|
250
|
+
* `assets.classify`'s, never both. Methods that send nothing, such as `uploadTokens.sign` or a cached `ensureLens`, are not
|
|
232
251
|
* recorded.
|
|
233
252
|
*/
|
|
234
253
|
interface MockCalmLensCall {
|
|
@@ -342,8 +361,8 @@ export declare class MockCalmLensServerClient extends CalmLensServerClient {
|
|
|
342
361
|
get calls(): MockCalmLensCall[];
|
|
343
362
|
/**
|
|
344
363
|
* Requests `operation` sends, oldest first. A request several methods send matches each of
|
|
345
|
-
* them: `callsTo("
|
|
346
|
-
*
|
|
364
|
+
* them: `callsTo("assets.waitForDecision")` lists the `assets.retrieve` requests it polls
|
|
365
|
+
* with. A text upload is `text.classify`'s request and a file or URL upload `assets.classify`'s.
|
|
347
366
|
*/
|
|
348
367
|
callsTo(operation: MockCalmLensOperation): MockCalmLensCall[];
|
|
349
368
|
/**
|
|
@@ -430,4 +449,4 @@ export declare const createWebhookHeaders: (options: {
|
|
|
430
449
|
deliveryId: string;
|
|
431
450
|
timestampSeconds?: number;
|
|
432
451
|
}) => Promise<Record<string, string>>;
|
|
433
|
-
export { type MockAssetOutcome, type MockCalmLensAppClientOptions, type MockCalmLensCall, type MockCalmLensOperation, type MockCalmLensServerClientOptions, type MockDatabaseStorage, type MockDetectedLink, type MockEventInput, type MockFailureOptions, type MockImageStorage, type MockModerate, type MockModerationInput, type MockModerationTrigger, type MockQrCode, type MockRequestFailure, type MockReviewDecision, type MockStoredContent, type MockTextRegion, type MockUploadPreset, signUploadTokenWithApiKey as signUploadToken };
|
|
452
|
+
export { type MockAssetOutcome, type MockCalmLensAppClientOptions, type MockCalmLensCall, type MockCalmLensOperation, type MockCalmLensServerClientOptions, type MockDatabaseStorage, type MockDetectedFace, type MockDetectedLink, type MockDetectedPerson, type MockEventInput, type MockFailureOptions, type MockImageStorage, type MockModerate, type MockModerationInput, type MockModerationTrigger, type MockQrCode, type MockRequestFailure, type MockReviewDecision, type MockStoredContent, type MockTextRegion, type MockUploadPreset, signUploadTokenWithApiKey as signUploadToken };
|
package/esm/testing.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as MAX_IMAGE_UPLOAD_BYTES, D as validateServerClientOptions, F as sleep, M as getRejectedUploadMimeTypeError, N as normalizeUploadMimeType, Q as CalmLensError, T as validateAppClientOptions, _ as isAcceptedUploadMimeType, b as randomUuid, dt as invalidConfig, ft as API_ERROR_CODES, h as checkTransformOptions, i as ASSET_RESOURCE_PATHS, lt as SDK_ERROR_CODES, pt as API_ERROR_DEFINITIONS, r as selectModerationContextItems, ut as invalidArgument, v as parseTransformSelector } from "./ModerationContextLimits-
|
|
2
|
-
import { a as WEBHOOK_TIMESTAMP_HEADER, f as signUploadTokenWithApiKey, m as stringifyJsonCanonical, n as WEBHOOK_DELIVERY_HEADER, p as decodeUploadToken, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
3
|
-
import { _ as validateAssetPayload, a as MOCK_HOOKS, g as assetToData, h as assetDataToUint8Array } from "./CalmLensOptionKeys-
|
|
1
|
+
import { A as MAX_IMAGE_UPLOAD_BYTES, D as validateServerClientOptions, F as sleep, M as getRejectedUploadMimeTypeError, N as normalizeUploadMimeType, Q as CalmLensError, T as validateAppClientOptions, _ as isAcceptedUploadMimeType, b as randomUuid, dt as invalidConfig, ft as API_ERROR_CODES, h as checkTransformOptions, i as ASSET_RESOURCE_PATHS, lt as SDK_ERROR_CODES, pt as API_ERROR_DEFINITIONS, r as selectModerationContextItems, ut as invalidArgument, v as parseTransformSelector } from "./ModerationContextLimits-IH2zX1wg.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-BY45aX5Q.js";
|
|
3
|
+
import { _ as validateAssetPayload, a as MOCK_HOOKS, g as assetToData, h as assetDataToUint8Array } from "./CalmLensOptionKeys-B6an7neE.js";
|
|
4
4
|
import { t as hmacSha256Hex } from "./CryptoUtils-BLCa-oZe-DKr3LmN6.js";
|
|
5
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
6
|
-
import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController
|
|
5
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-D_SprSKl.js";
|
|
6
|
+
import { o as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-DKjI8S2K.js";
|
|
7
7
|
import { d as getTestInputTag, h as CLASSIFICATION_CATEGORIES, m as lazySchema } from "./TestTriggers-uL2Ec8Vt-DYbTEJWm.js";
|
|
8
8
|
import * as zod from "zod";
|
|
9
9
|
// src/contract/MediaTestTriggers.js
|
|
@@ -8339,6 +8339,8 @@ var MockDecision = class {
|
|
|
8339
8339
|
#pendingReview;
|
|
8340
8340
|
#ocr;
|
|
8341
8341
|
#linkDetection;
|
|
8342
|
+
#people;
|
|
8343
|
+
#faces;
|
|
8342
8344
|
constructor(status) {
|
|
8343
8345
|
if (!OUTCOMES.includes(status)) throw invalidArgument(`status must be one of ${OUTCOMES.join(", ")}`);
|
|
8344
8346
|
this.status = status;
|
|
@@ -8410,6 +8412,31 @@ var MockDecision = class {
|
|
|
8410
8412
|
};
|
|
8411
8413
|
return this;
|
|
8412
8414
|
}
|
|
8415
|
+
/**
|
|
8416
|
+
* The people that person detection finds in an image, reported as `classification.personDetection`
|
|
8417
|
+
* when the upload turns person detection on. Without them, it finds nobody.
|
|
8418
|
+
*/
|
|
8419
|
+
withPersonDetection(people) {
|
|
8420
|
+
this.#people = structuredClone(people);
|
|
8421
|
+
return this;
|
|
8422
|
+
}
|
|
8423
|
+
/**
|
|
8424
|
+
* The faces that face detection finds in an image, reported as `classification.faceDetection` when
|
|
8425
|
+
* the upload turns face detection on; each face's `ageRange` only when the upload also asks for
|
|
8426
|
+
* age estimation. Without them, it finds no faces.
|
|
8427
|
+
*/
|
|
8428
|
+
withFaceDetection(faces) {
|
|
8429
|
+
this.#faces = structuredClone(faces);
|
|
8430
|
+
return this;
|
|
8431
|
+
}
|
|
8432
|
+
/** @internal What `withPersonDetection` set, if anything. */
|
|
8433
|
+
get personFindings() {
|
|
8434
|
+
return this.#people && structuredClone(this.#people);
|
|
8435
|
+
}
|
|
8436
|
+
/** @internal What `withFaceDetection` set, if anything. */
|
|
8437
|
+
get faceFindings() {
|
|
8438
|
+
return this.#faces && structuredClone(this.#faces);
|
|
8439
|
+
}
|
|
8413
8440
|
/** @internal What `withOcr` set, if anything. */
|
|
8414
8441
|
get ocrFindings() {
|
|
8415
8442
|
return this.#ocr && structuredClone(this.#ocr);
|
|
@@ -8485,6 +8512,45 @@ var MockDecision = class {
|
|
|
8485
8512
|
const mockDecision = (status) => new MockDecision(status);
|
|
8486
8513
|
/** The default `moderate`: queued work stays pending until `completeProcessing`, which allows it. */
|
|
8487
8514
|
const defaultModerate = ({ trigger, queued }) => queued && trigger !== "complete" ? "pending" : "allowed";
|
|
8515
|
+
// src/testing/MockUrlAssetTypes.ts
|
|
8516
|
+
const MOCK_URL_EXTENSION_TYPES = {
|
|
8517
|
+
jpg: "image",
|
|
8518
|
+
jpeg: "image",
|
|
8519
|
+
png: "image",
|
|
8520
|
+
gif: "image",
|
|
8521
|
+
webp: "image",
|
|
8522
|
+
avif: "image",
|
|
8523
|
+
heic: "image",
|
|
8524
|
+
heif: "image",
|
|
8525
|
+
bmp: "image",
|
|
8526
|
+
tif: "image",
|
|
8527
|
+
tiff: "image",
|
|
8528
|
+
svg: "image",
|
|
8529
|
+
mp4: "video",
|
|
8530
|
+
m4v: "video",
|
|
8531
|
+
mov: "video",
|
|
8532
|
+
webm: "video",
|
|
8533
|
+
mkv: "video",
|
|
8534
|
+
avi: "video",
|
|
8535
|
+
mp3: "audio",
|
|
8536
|
+
m4a: "audio",
|
|
8537
|
+
aac: "audio",
|
|
8538
|
+
wav: "audio",
|
|
8539
|
+
ogg: "audio",
|
|
8540
|
+
oga: "audio",
|
|
8541
|
+
opus: "audio",
|
|
8542
|
+
flac: "audio",
|
|
8543
|
+
pdf: "multimedia-document",
|
|
8544
|
+
doc: "multimedia-document",
|
|
8545
|
+
docx: "multimedia-document",
|
|
8546
|
+
odt: "multimedia-document",
|
|
8547
|
+
ppt: "multimedia-document",
|
|
8548
|
+
pptx: "multimedia-document",
|
|
8549
|
+
odp: "multimedia-document",
|
|
8550
|
+
rtf: "multimedia-document",
|
|
8551
|
+
txt: "plaintext-document",
|
|
8552
|
+
md: "plaintext-document"
|
|
8553
|
+
};
|
|
8488
8554
|
// src/testing/MockAssetFilters.ts
|
|
8489
8555
|
/** The asset fields a list filter may name, each with the operators it accepts. */
|
|
8490
8556
|
const MOCK_ASSET_FILTER_FIELDS = {
|
|
@@ -9440,9 +9506,25 @@ const mockRendering = (asset, processed) => {
|
|
|
9440
9506
|
default: return NO_RENDERING;
|
|
9441
9507
|
}
|
|
9442
9508
|
};
|
|
9443
|
-
/**
|
|
9509
|
+
/**
|
|
9510
|
+
* A URL upload's type: the type of its path's file extension (`MOCK_URL_EXTENSION_TYPES`),
|
|
9511
|
+
* compared lower-case without the query or fragment, or `website` for any other extension or none.
|
|
9512
|
+
* The mock fetches nothing, so the extension stands in for the fetched content's type.
|
|
9513
|
+
*/
|
|
9514
|
+
const urlAssetType = (url) => {
|
|
9515
|
+
let path;
|
|
9516
|
+
try {
|
|
9517
|
+
path = new URL(url).pathname;
|
|
9518
|
+
} catch {
|
|
9519
|
+
path = url.split(/[?#]/, 1)[0];
|
|
9520
|
+
}
|
|
9521
|
+
const segment = path.slice(path.lastIndexOf("/") + 1);
|
|
9522
|
+
const dot = segment.lastIndexOf(".");
|
|
9523
|
+
if (dot === -1) return "website";
|
|
9524
|
+
return MOCK_URL_EXTENSION_TYPES[segment.slice(dot + 1).toLowerCase()] ?? "website";
|
|
9525
|
+
};
|
|
9526
|
+
/** An asset's type from its content type. */
|
|
9444
9527
|
const inferAssetType = (contentType) => {
|
|
9445
|
-
if (contentType === void 0) return "website";
|
|
9446
9528
|
const type = contentType.toLowerCase();
|
|
9447
9529
|
if (type.startsWith("image/")) return "image";
|
|
9448
9530
|
if (type.startsWith("video/")) return "video";
|
|
@@ -9628,7 +9710,7 @@ const operationsOf = (request) => {
|
|
|
9628
9710
|
case "assets":
|
|
9629
9711
|
if (method === "GET") return ["assets.list"];
|
|
9630
9712
|
if (query.get("wait") === "false") return ["assets.create"];
|
|
9631
|
-
return isTextUpload(request) ? ["
|
|
9713
|
+
return isTextUpload(request) ? ["text.classify"] : ["assets.classify"];
|
|
9632
9714
|
}
|
|
9633
9715
|
if (segments[2] === "assets" && segments[4] === "timeline" && segments.length === 5) return ["assets.listTimeline"];
|
|
9634
9716
|
if (segments[2] === "metadata-fields" && segments.length === 4) return ["metadataFields.delete"];
|
|
@@ -10737,7 +10819,7 @@ var MockCalmLensApi = class {
|
|
|
10737
10819
|
source: "calmlens"
|
|
10738
10820
|
}
|
|
10739
10821
|
});
|
|
10740
|
-
const type =
|
|
10822
|
+
const type = fields.url === void 0 ? inferAssetType(contentType ?? "") : urlAssetType(fields.url);
|
|
10741
10823
|
if (part) {
|
|
10742
10824
|
if (part.partNumber > 1) throw fail(API_ERROR_CODES.USE_UPLOAD_PART);
|
|
10743
10825
|
const partSize = bytes.byteLength;
|
|
@@ -10834,7 +10916,9 @@ var MockCalmLensApi = class {
|
|
|
10834
10916
|
timeline: null
|
|
10835
10917
|
},
|
|
10836
10918
|
ocr: null,
|
|
10837
|
-
linkDetection: null
|
|
10919
|
+
linkDetection: null,
|
|
10920
|
+
personDetection: null,
|
|
10921
|
+
faceDetection: null
|
|
10838
10922
|
}
|
|
10839
10923
|
};
|
|
10840
10924
|
if (part) {
|
|
@@ -10965,6 +11049,7 @@ var MockCalmLensApi = class {
|
|
|
10965
11049
|
const features = this.processingOptions.get(asset.id)?.features;
|
|
10966
11050
|
if (next.classification.status !== "completed" || asset.type !== "image") return next;
|
|
10967
11051
|
const ocr = features?.ocr?.enabled === true ? decision.ocrFindings : void 0;
|
|
11052
|
+
const ages = features?.faceDetection?.ageEstimation === true;
|
|
10968
11053
|
return {
|
|
10969
11054
|
...next,
|
|
10970
11055
|
...ocr?.text != null && next.content.status === "stored" && { content: {
|
|
@@ -10989,11 +11074,14 @@ var MockCalmLensApi = class {
|
|
|
10989
11074
|
} },
|
|
10990
11075
|
...features?.personDetection?.enabled === true && { personDetection: {
|
|
10991
11076
|
status: "evaluated",
|
|
10992
|
-
people: []
|
|
11077
|
+
people: decision.personFindings ?? []
|
|
10993
11078
|
} },
|
|
10994
11079
|
...features?.faceDetection?.enabled === true && { faceDetection: {
|
|
10995
11080
|
status: "evaluated",
|
|
10996
|
-
faces: []
|
|
11081
|
+
faces: (decision.faceFindings ?? []).map(({ ageRange, ...face }) => ages && ageRange ? {
|
|
11082
|
+
...face,
|
|
11083
|
+
ageRange
|
|
11084
|
+
} : face)
|
|
10997
11085
|
} }
|
|
10998
11086
|
}
|
|
10999
11087
|
};
|
|
@@ -11978,8 +12066,8 @@ var MockCalmLensServerClient = class extends CalmLensServerClient {
|
|
|
11978
12066
|
}
|
|
11979
12067
|
/**
|
|
11980
12068
|
* Requests `operation` sends, oldest first. A request several methods send matches each of
|
|
11981
|
-
* them: `callsTo("
|
|
11982
|
-
*
|
|
12069
|
+
* them: `callsTo("assets.waitForDecision")` lists the `assets.retrieve` requests it polls
|
|
12070
|
+
* with. A text upload is `text.classify`'s request and a file or URL upload `assets.classify`'s.
|
|
11983
12071
|
*/
|
|
11984
12072
|
callsTo(operation) {
|
|
11985
12073
|
return this.#api.calls.filter(({ operations }) => operations.includes(operation)).map(({ call }) => call);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as appendAssetLocation } from "./ModerationContextLimits-
|
|
2
|
-
import "./Core-
|
|
1
|
+
import { o as appendAssetLocation } from "./ModerationContextLimits-IH2zX1wg.js";
|
|
2
|
+
import "./Core-dzPyrg_G.js";
|
|
3
3
|
// src/ui/viewers/PdfLoader.ts
|
|
4
4
|
let loading;
|
|
5
5
|
/**
|
package/esm/ui.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-
|
|
2
|
-
import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-
|
|
3
|
-
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController
|
|
1
|
+
import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-BovDqg9n.js";
|
|
2
|
+
import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-dzPyrg_G.js";
|
|
3
|
+
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-DKjI8S2K.js";
|
|
4
4
|
export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, AssetSession, AssetViewerMount, CALMLENS_STYLES, CALMLENS_THEME, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, ICONS, ICON_ATTRIBUTES, INSTANT_LOAD_MS, MediaStreamPlayer, UploadController, VIEWER_STYLES, createDocumentViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isImageReady, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, withProvidedOptions };
|
package/esm/vue.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-
|
|
2
|
-
import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-
|
|
3
|
-
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController
|
|
1
|
+
import { a as ASSET_VIEWERS, c as getSpreadsheetPage, d as createDocumentViewer, f as DEFAULT_VIEWER_MESSAGES, h as loadPdfJs, i as isMountedViewerKind, l as parseSpreadsheetText, m as resolveViewerMessages, n as AssetViewerMount, o as createSpreadsheetViewer, p as formatViewerMessage, r as getMountedViewerOptions, s as createTextViewer, t as MediaStreamPlayer, u as spreadsheetColumnIndex } from "./ui-BovDqg9n.js";
|
|
2
|
+
import { C as pickAssetSource, D as getAssetViewerKind, E as resolveTheme, O as isSpreadsheetFormat, S as isImageReady, T as CALMLENS_THEME, _ as getAssetAspectRatio, a as describeUploadItem, b as getPeakHeights, c as formatMessage, d as getUploadItemOutcome, f as resolveMessages, g as INSTANT_LOAD_MS, h as AssetSession, i as DEFAULT_MESSAGES, l as getDropzoneHint, m as ICON_ATTRIBUTES, o as describeUploader, p as ICONS, r as ASSET_FILE_ICON_SIZE, s as formatBytes, t as CALMLENS_STYLES, u as getUploadItemMessage, v as getAssetView, w as VIEWER_STYLES, x as getPlayedPercent, y as getAssetViewKey } from "./Core-dzPyrg_G.js";
|
|
3
|
+
import { a as createProgressFetch, i as withProvidedOptions, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-DKjI8S2K.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-BKrrHzoh.js";
|
|
6
6
|
import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, onScopeDispose, provide, ref, shallowRef, toValue, watch, watchEffect } from "vue";
|
|
7
7
|
// src/viewers/Vue.ts
|
|
8
8
|
const optional$1 = (type) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "calmlens",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.1",
|
|
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",
|