calmlens 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/calmlens.js +47 -39
- package/cjs/{BrowserUpload-IiRDbL85.js → BrowserUpload-CbbFE-2v.js} +1 -1
- package/cjs/{BrowserUpload-BAH54V1q.d.ts → BrowserUpload-Dx2l9wC0.d.ts} +2 -2
- package/cjs/{CalmLensAppClient-BBcq6pJg.js → CalmLensAppClient-DOYOJ70t.js} +4 -4
- package/{esm/CalmLensAppClient-CdlcDd5l.d.ts → cjs/CalmLensAppClient-v1Ho7mJQ.d.ts} +3 -3
- package/cjs/{CalmLensCdn-2VbArrj-.js → CalmLensCdn-xQMrClXN.js} +56 -22
- package/cjs/{CalmLensConnection-CpnDGa8W.js → CalmLensConnection-DbsCA8xF.js} +7 -16
- package/cjs/{CalmLensServerClient-CtS66dCU.d.ts → CalmLensServerClient-CoiZN7Fr.d.ts} +9 -9
- package/cjs/{CalmLensServerClient-DbemlDXj.js → CalmLensServerClient-DtqFQgUn.js} +12 -15
- package/cjs/{CalmLensTypes-87kiUg0H.d.ts → CalmLensTypes-DjuOXp3b.d.ts} +8 -15
- package/cjs/{Core-xy9aV1ED.js → Core-BtFJ2xfb.js} +2 -2
- package/cjs/{Core-Ccy4-_sN.d.ts → Core-DaCkaDkb.d.ts} +2 -2
- package/cjs/{ReactUpload-BX3XOVfb.js → ReactUpload-CRtUXzMP.js} +1 -1
- package/cjs/{ReactUpload-DBhppuxM.d.ts → ReactUpload-DMtaeFN2.d.ts} +1 -1
- package/{esm/TestTriggers-Daxebd0V.d.ts → cjs/TestTriggers-CjDhhz78.d.ts} +1 -11
- package/cjs/{UploadController-CmTjpOfp.js → UploadController-tKqKphf3.js} +1 -1
- package/cjs/{WebhookPayload-B4rA_Dvm.d.ts → WebhookPayload-C3F9j4p7.d.ts} +1 -1
- package/cjs/app.d.ts +4 -4
- package/cjs/app.js +2 -2
- package/cjs/elements.d.ts +4 -4
- package/cjs/elements.js +4 -4
- package/cjs/{index-CWUnLKoF.d.ts → index-xF6Neq8A.d.ts} +2 -2
- package/cjs/index.d.ts +3 -3
- package/cjs/index.js +1 -1
- package/cjs/react-native.d.ts +2 -2
- package/cjs/react-native.js +4 -4
- package/cjs/react.d.ts +4 -4
- package/cjs/react.js +5 -5
- package/cjs/server.d.ts +4 -4
- package/cjs/server.js +2 -2
- package/cjs/test-inputs.d.ts +15 -3
- package/cjs/test-inputs.js +105 -2
- package/cjs/testing.d.ts +14 -6
- package/cjs/testing.js +122 -52
- package/cjs/{ui-BJKh49aM.js → ui-B5tgw_En.js} +8 -8
- package/cjs/{ui-sjnJhloQ.d.ts → ui-C_AhYdIA.d.ts} +2 -2
- package/cjs/ui.d.ts +2 -2
- package/cjs/ui.js +3 -3
- package/cjs/vue.d.ts +5 -5
- package/cjs/vue.js +4 -4
- package/esm/{BrowserUpload-C5aXj6QC.js → BrowserUpload-Dizcs8rx.js} +1 -1
- package/esm/{BrowserUpload-BAH54V1q.d.ts → BrowserUpload-Dx2l9wC0.d.ts} +2 -2
- package/esm/{CalmLensAppClient-gAd0C_Q_.js → CalmLensAppClient-C0Ud7eYa.js} +4 -4
- package/{cjs/CalmLensAppClient-CdlcDd5l.d.ts → esm/CalmLensAppClient-v1Ho7mJQ.d.ts} +3 -3
- package/esm/{CalmLensCdn-CcxEY6wB.js → CalmLensCdn--hZgorld.js} +39 -23
- package/esm/{CalmLensConnection-CfGVp95D.js → CalmLensConnection-dz5Kl3uC.js} +7 -16
- package/esm/{CalmLensServerClient-CPWeRVWO.js → CalmLensServerClient-BBPwU8mm.js} +12 -15
- package/esm/{CalmLensServerClient-CtS66dCU.d.ts → CalmLensServerClient-CoiZN7Fr.d.ts} +9 -9
- package/esm/{CalmLensTypes-87kiUg0H.d.ts → CalmLensTypes-DjuOXp3b.d.ts} +8 -15
- package/esm/{Core-Ccy4-_sN.d.ts → Core-DaCkaDkb.d.ts} +2 -2
- package/esm/{Core-DTcxpv3O.js → Core-Dti4LlA-.js} +2 -2
- package/esm/{ReactUpload-Dg7MtjbJ.js → ReactUpload-Cmz063Os.js} +1 -1
- package/esm/{ReactUpload-DBhppuxM.d.ts → ReactUpload-DMtaeFN2.d.ts} +1 -1
- package/{cjs/TestTriggers-Daxebd0V.d.ts → esm/TestTriggers-CjDhhz78.d.ts} +1 -11
- package/esm/{UploadController-DVsTVJVv.js → UploadController-D3um1cq9.js} +1 -1
- package/esm/{WebhookPayload-B4rA_Dvm.d.ts → WebhookPayload-C3F9j4p7.d.ts} +1 -1
- package/esm/app.d.ts +4 -4
- package/esm/app.js +2 -2
- package/esm/elements.d.ts +4 -4
- package/esm/elements.js +4 -4
- package/esm/{index-CWUnLKoF.d.ts → index-xF6Neq8A.d.ts} +2 -2
- package/esm/index.d.ts +3 -3
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +2 -2
- package/esm/react-native.js +4 -4
- package/esm/react.d.ts +4 -4
- package/esm/react.js +5 -5
- package/esm/server.d.ts +4 -4
- package/esm/server.js +2 -2
- package/esm/test-inputs.d.ts +15 -3
- package/esm/test-inputs.js +105 -2
- package/esm/testing.d.ts +14 -6
- package/esm/testing.js +122 -52
- package/esm/{ui-DUao8UY0.js → ui-B7Z6FH5F.js} +8 -8
- package/esm/{ui-sjnJhloQ.d.ts → ui-C_AhYdIA.d.ts} +2 -2
- package/esm/ui.d.ts +2 -2
- package/esm/ui.js +3 -3
- package/esm/vue.d.ts +5 -5
- package/esm/vue.js +4 -4
- package/package.json +1 -1
package/cjs/testing.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Lt as SignUploadTokenOptions, O as CalmLensAppClientOptions, Xt as UploadPresetDefinition, bn as PermissionGrant, fn as TypedEvent, k as CalmLensServerClientOptions, m as AssetModeration, r as Asset, xn as Folder, zn as AssetBinaryPayloadInput, zt as SignedUploadToken } from "./CalmLensTypes-
|
|
2
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
3
|
-
import { I as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-
|
|
4
|
-
import { t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
5
|
-
import { t as ClassificationTestSignal } from "./TestTriggers-
|
|
1
|
+
import { Lt as SignUploadTokenOptions, O as CalmLensAppClientOptions, Xt as UploadPresetDefinition, bn as PermissionGrant, fn as TypedEvent, k as CalmLensServerClientOptions, m as AssetModeration, r as Asset, xn as Folder, zn as AssetBinaryPayloadInput, zt as SignedUploadToken } from "./CalmLensTypes-DjuOXp3b.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-v1Ho7mJQ.js";
|
|
3
|
+
import { I as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-C3F9j4p7.js";
|
|
4
|
+
import { t as CalmLensServerClient } from "./CalmLensServerClient-CoiZN7Fr.js";
|
|
5
|
+
import { t as ClassificationTestSignal } from "./TestTriggers-CjDhhz78.js";
|
|
6
6
|
import "zod";
|
|
7
7
|
/**
|
|
8
8
|
* Signs a single-use upload token with `apiKey`, locally. `CalmLensServerClient` and
|
|
@@ -381,7 +381,7 @@ export declare class MockCalmLensServerClient extends CalmLensServerClient {
|
|
|
381
381
|
callsTo(operation: MockCalmLensOperation): MockCalmLensCall[];
|
|
382
382
|
/**
|
|
383
383
|
* Fetches a URL of the mock's CDN as a browser would, without the API key: a signed asset URL
|
|
384
|
-
* from `cdn.signAssetUrl
|
|
384
|
+
* from `cdn.signAssetUrl`, or a public one from `cdn.getAssetUrl`.
|
|
385
385
|
* The request is recorded like any other.
|
|
386
386
|
*/
|
|
387
387
|
fetchCdn(url: string, init?: RequestInit): Promise<Response>;
|
|
@@ -410,6 +410,14 @@ export declare class MockCalmLensServerClient extends CalmLensServerClient {
|
|
|
410
410
|
* is typed by its path's extension, and has no content.
|
|
411
411
|
*/
|
|
412
412
|
serveUrl(url: string, content: MockServedUrl): void;
|
|
413
|
+
/**
|
|
414
|
+
* Makes the mock hash an image upload of exactly `content` (bytes, or text as UTF-8) as `hash`, a
|
|
415
|
+
* PDQ hash of 64 hexadecimal characters, with `quality` (0 to 100, default 100), instead of the
|
|
416
|
+
* SHA-256 of its bytes. Hash list entries match hashes up to 31 bits away, as in CalmLens, so a
|
|
417
|
+
* test can make a resized or recompressed copy a near match of a listed image: declare the
|
|
418
|
+
* copy's hash a few bits from the entry's.
|
|
419
|
+
*/
|
|
420
|
+
setPerceptualHash(content: Uint8Array | ArrayBuffer | string, hash: string, quality?: number): void;
|
|
413
421
|
/**
|
|
414
422
|
* Changes the grants of the mock's API key, as editing the key in the portal would: later
|
|
415
423
|
* requests, such as `cdn.serve`, use them. The key itself stays the same, so idempotency keys
|
package/cjs/testing.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_CalmLensTestInputArguments = require("./CalmLensTestInputArguments-PYuRmE0j.js");
|
|
3
3
|
const require_CalmLensError = require("./CalmLensError-ifj5rLmk.js");
|
|
4
|
-
const require_CalmLensCdn = require("./CalmLensCdn-
|
|
5
|
-
const require_CalmLensServerClient = require("./CalmLensServerClient-
|
|
6
|
-
const require_CalmLensConnection = require("./CalmLensConnection-
|
|
4
|
+
const require_CalmLensCdn = require("./CalmLensCdn-xQMrClXN.js");
|
|
5
|
+
const require_CalmLensServerClient = require("./CalmLensServerClient-DtqFQgUn.js");
|
|
6
|
+
const require_CalmLensConnection = require("./CalmLensConnection-DbsCA8xF.js");
|
|
7
7
|
const require_CryptoUtils_BLCa_oZe = require("./CryptoUtils-BLCa-oZe-leCkr1ko.js");
|
|
8
|
-
const require_CalmLensAppClient = require("./CalmLensAppClient-
|
|
9
|
-
const require_UploadController = require("./UploadController-
|
|
8
|
+
const require_CalmLensAppClient = require("./CalmLensAppClient-DOYOJ70t.js");
|
|
9
|
+
const require_UploadController = require("./UploadController-tKqKphf3.js");
|
|
10
10
|
let zod = require("zod");
|
|
11
11
|
let zod$1 = require_CalmLensTestInputArguments.__toESM(zod, 1);
|
|
12
12
|
zod = require_CalmLensTestInputArguments.__toESM(zod);
|
|
@@ -8703,20 +8703,6 @@ const MOCK_ASSET_FILTER_FIELDS = {
|
|
|
8703
8703
|
"=out="
|
|
8704
8704
|
]
|
|
8705
8705
|
},
|
|
8706
|
-
description: {
|
|
8707
|
-
kind: "text",
|
|
8708
|
-
nullable: true,
|
|
8709
|
-
operators: [
|
|
8710
|
-
"==",
|
|
8711
|
-
"!=",
|
|
8712
|
-
">",
|
|
8713
|
-
">=",
|
|
8714
|
-
"<",
|
|
8715
|
-
"<=",
|
|
8716
|
-
"=in=",
|
|
8717
|
-
"=out="
|
|
8718
|
-
]
|
|
8719
|
-
},
|
|
8720
8706
|
externalId: {
|
|
8721
8707
|
kind: "text",
|
|
8722
8708
|
nullable: true,
|
|
@@ -9235,17 +9221,20 @@ const filterAssets = (items, filter) => {
|
|
|
9235
9221
|
return items.filter((item) => matchesNode(item, node));
|
|
9236
9222
|
};
|
|
9237
9223
|
const MAX_SEARCH_TOKENS = 8;
|
|
9238
|
-
/**
|
|
9239
|
-
|
|
9224
|
+
/**
|
|
9225
|
+
* The keyword fields the API searches, in the order it reports matches. `extractedText` is the
|
|
9226
|
+
* asset's retained text: empty unless its content is stored.
|
|
9227
|
+
*/
|
|
9228
|
+
const searchFieldValues = (asset, extractedText) => [
|
|
9240
9229
|
["name", asset.name],
|
|
9241
9230
|
["id", asset.id],
|
|
9242
9231
|
["externalId", asset.externalId ?? ""],
|
|
9243
|
-
["description", asset.description ?? ""],
|
|
9244
9232
|
["tags", asset.tags?.join(" ") ?? ""],
|
|
9245
9233
|
["type", asset.type],
|
|
9246
9234
|
["content.format", asset.content?.format ?? ""],
|
|
9247
9235
|
["content.extension", asset.content?.extension ?? ""],
|
|
9248
|
-
["classification.moderation.decision", asset.classification.moderation.decision ?? "pending"]
|
|
9236
|
+
["classification.moderation.decision", asset.classification.moderation.decision ?? "pending"],
|
|
9237
|
+
["content.extractedText", extractedText]
|
|
9249
9238
|
];
|
|
9250
9239
|
/** The API's keyword score for the whole lowercased query. */
|
|
9251
9240
|
const keywordScore = (values, query) => {
|
|
@@ -9264,15 +9253,15 @@ const keywordScore = (values, query) => {
|
|
|
9264
9253
|
};
|
|
9265
9254
|
/**
|
|
9266
9255
|
* Keyword search as the API runs it: every whitespace-separated token (case-insensitive, at
|
|
9267
|
-
* most 8) must appear in some searchable field
|
|
9268
|
-
* newest first.
|
|
9256
|
+
* most 8) must appear in some searchable field, including the asset's retained text, which
|
|
9257
|
+
* `extractedTexts` maps by asset ID. Results are ranked by the API's score, then newest first.
|
|
9269
9258
|
*/
|
|
9270
|
-
const searchAssets = (assets, query, limit) => {
|
|
9259
|
+
const searchAssets = (assets, extractedTexts, query, limit) => {
|
|
9271
9260
|
const normalized = query.trim().toLowerCase();
|
|
9272
9261
|
const tokens = [...new Set(normalized.split(/\s+/).filter(Boolean))].slice(0, MAX_SEARCH_TOKENS);
|
|
9273
9262
|
if (tokens.length === 0) return [];
|
|
9274
9263
|
return assets.map((asset) => {
|
|
9275
|
-
const fields = searchFieldValues(asset).map(([field, value]) => [field, value.toLowerCase()]);
|
|
9264
|
+
const fields = searchFieldValues(asset, extractedTexts.get(asset.id) ?? "").map(([field, value]) => [field, value.toLowerCase()]);
|
|
9276
9265
|
return {
|
|
9277
9266
|
asset,
|
|
9278
9267
|
matches: tokens.every((token) => fields.some(([, value]) => value.includes(token))),
|
|
@@ -9382,8 +9371,12 @@ const checkMockUploadPreset = (preset) => {
|
|
|
9382
9371
|
if (unknown.length) throw require_CalmLensError.invalidArgument(`Unknown mockOptions.preset key${unknown.length > 1 ? "s" : ""}: ${unknown.join(", ")}`, { options: unknown });
|
|
9383
9372
|
};
|
|
9384
9373
|
const MAX_PAGE_SIZE = 100;
|
|
9385
|
-
/**
|
|
9374
|
+
/** Hashes with a lower PDQ quality never match (HashList.ts, HASH_MATCH_MIN_QUALITY). */
|
|
9386
9375
|
const HASH_MATCH_MIN_QUALITY = 50;
|
|
9376
|
+
/** Hashes this many bits apart or fewer match (HashList.ts, HASH_MATCH_MAX_DISTANCE). */
|
|
9377
|
+
const HASH_MATCH_MAX_DISTANCE = 31;
|
|
9378
|
+
/** A block list blocks only matches this close; looser ones are flagged (HASH_BLOCK_MAX_DISTANCE). */
|
|
9379
|
+
const HASH_BLOCK_MAX_DISTANCE = 16;
|
|
9387
9380
|
/** The most hash matches an asset records (HashList.ts). */
|
|
9388
9381
|
const MAX_RECORDED_HASH_MATCHES = 10;
|
|
9389
9382
|
const MAX_DECISION_NOTE_LENGTH = 1499;
|
|
@@ -9628,7 +9621,6 @@ const invalidField = (code, path) => new ApiFailure(400, require_CalmLensError.A
|
|
|
9628
9621
|
/** The asset fields an upload carries in its body; the API refuses them in the query string. */
|
|
9629
9622
|
const UPLOAD_OPTION_KEYS = [
|
|
9630
9623
|
"name",
|
|
9631
|
-
"description",
|
|
9632
9624
|
"processingOptions",
|
|
9633
9625
|
"visibility",
|
|
9634
9626
|
"metadata",
|
|
@@ -9867,6 +9859,7 @@ var MockCalmLensApi = class {
|
|
|
9867
9859
|
this.idempotentResults = /* @__PURE__ */ new Map();
|
|
9868
9860
|
this.pendingFailures = [];
|
|
9869
9861
|
this.servedUrls = /* @__PURE__ */ new Map();
|
|
9862
|
+
this.perceptualHashes = [];
|
|
9870
9863
|
this.pendingReviews = /* @__PURE__ */ new Map();
|
|
9871
9864
|
this.requestCount = 0;
|
|
9872
9865
|
this.useTimers = false;
|
|
@@ -9931,6 +9924,24 @@ var MockCalmLensApi = class {
|
|
|
9931
9924
|
type: type.trim()
|
|
9932
9925
|
});
|
|
9933
9926
|
}
|
|
9927
|
+
/**
|
|
9928
|
+
* Makes an image upload of exactly `content` hash as `hash` (64 hexadecimal characters, a PDQ
|
|
9929
|
+
* hash) with `quality`, instead of the SHA-256 of its bytes.
|
|
9930
|
+
*/
|
|
9931
|
+
setPerceptualHash(content, hash, quality = 100) {
|
|
9932
|
+
const bytes = typeof content === "string" ? new TextEncoder().encode(content) : content instanceof ArrayBuffer ? new Uint8Array(content.slice(0)) : content instanceof Uint8Array ? new Uint8Array(content) : void 0;
|
|
9933
|
+
if (!bytes) throw require_CalmLensError.invalidArgument("content must be bytes or a string");
|
|
9934
|
+
if (typeof hash !== "string" || !/^[0-9a-f]{64}$/i.test(hash.trim())) throw require_CalmLensError.invalidArgument("hash must be a PDQ hash of 64 hexadecimal characters");
|
|
9935
|
+
if (typeof quality !== "number" || !Number.isInteger(quality) || quality < 0 || quality > 100) throw require_CalmLensError.invalidArgument("quality must be a whole number from 0 to 100");
|
|
9936
|
+
const declared = {
|
|
9937
|
+
bytes,
|
|
9938
|
+
hash: hash.trim().toLowerCase(),
|
|
9939
|
+
quality
|
|
9940
|
+
};
|
|
9941
|
+
const index = this.perceptualHashes.findIndex((known) => sameBytes(known.bytes, bytes));
|
|
9942
|
+
if (index === -1) this.perceptualHashes.push(declared);
|
|
9943
|
+
else this.perceptualHashes[index] = declared;
|
|
9944
|
+
}
|
|
9934
9945
|
/** A `fetch` that answers a client's requests from memory; app clients pass their session. */
|
|
9935
9946
|
createFetch(endpoints, session) {
|
|
9936
9947
|
return ((input, init) => this.handle(input, init, endpoints(), session));
|
|
@@ -10028,7 +10039,11 @@ var MockCalmLensApi = class {
|
|
|
10028
10039
|
if (asset.upload.status === "uploading" || asset.classification.status === "processing") throw fail(require_CalmLensError.API_ERROR_CODES.ASSET_PROCESSING);
|
|
10029
10040
|
const status = asset.classification.moderation.decision;
|
|
10030
10041
|
if (decision !== "purged" && decision !== "blocked" && status === null) throw fail(require_CalmLensError.API_ERROR_CODES.ASSET_DECISION_NOT_ALLOWED);
|
|
10031
|
-
if (status === decision)
|
|
10042
|
+
if (status === decision) {
|
|
10043
|
+
if (!asset.classification.moderation.pendingReview) throw fail(require_CalmLensError.API_ERROR_CODES.ASSET_DECISION_UNCHANGED);
|
|
10044
|
+
asset.classification.moderation.pendingReview = null;
|
|
10045
|
+
return this.databaseStorage.updateAsset(asset);
|
|
10046
|
+
}
|
|
10032
10047
|
if (decision !== "purged" && decision !== "blocked" && status === "purged") throw fail(require_CalmLensError.API_ERROR_CODES.ASSET_CONTENT_PURGED);
|
|
10033
10048
|
return this.recordDecision(asset, decision, { note });
|
|
10034
10049
|
}
|
|
@@ -10040,7 +10055,7 @@ var MockCalmLensApi = class {
|
|
|
10040
10055
|
async recordDecision(asset, decision, review) {
|
|
10041
10056
|
const decided = await this.applyOutcome(asset, decision, "requested");
|
|
10042
10057
|
const now = this.now();
|
|
10043
|
-
|
|
10058
|
+
decided.classification.moderation.pendingReview = null;
|
|
10044
10059
|
decided.classification.moderation.manualReviews = [...decided.classification.moderation.manualReviews ?? [], {
|
|
10045
10060
|
id: this.createId("rev"),
|
|
10046
10061
|
decision,
|
|
@@ -10732,8 +10747,9 @@ var MockCalmLensApi = class {
|
|
|
10732
10747
|
}
|
|
10733
10748
|
/**
|
|
10734
10749
|
* Keyword search like the API's: every whitespace-separated token must appear,
|
|
10735
|
-
* case-insensitively, in the asset's name, ID, external ID,
|
|
10736
|
-
*
|
|
10750
|
+
* case-insensitively, in the asset's name, ID, external ID, tags, type, content format or
|
|
10751
|
+
* extension, moderation status, or retained text while its content is stored. There is no
|
|
10752
|
+
* semantic search.
|
|
10737
10753
|
*/
|
|
10738
10754
|
async searchAssets(params) {
|
|
10739
10755
|
const query = (params.get("query") ?? "").trim();
|
|
@@ -10742,9 +10758,11 @@ var MockCalmLensApi = class {
|
|
|
10742
10758
|
const pageSize = this.integer(params, "pageSize", 10);
|
|
10743
10759
|
if (pageSize < 1) throw invalidField("validation/too-small", "pageSize");
|
|
10744
10760
|
if (pageSize > MAX_SEARCH_PAGE_SIZE) throw invalidField("validation/too-big", "pageSize");
|
|
10761
|
+
const assets = await this.databaseStorage.listAssets(this.projectId);
|
|
10762
|
+
const extractedTexts = new Map(await Promise.all(assets.map(async (asset) => [asset.id, await this.searchText(asset)])));
|
|
10745
10763
|
return {
|
|
10746
10764
|
query,
|
|
10747
|
-
items: searchAssets(
|
|
10765
|
+
items: searchAssets(assets, extractedTexts, query, pageSize),
|
|
10748
10766
|
semanticStatus: "disabled"
|
|
10749
10767
|
};
|
|
10750
10768
|
}
|
|
@@ -11087,7 +11105,6 @@ var MockCalmLensApi = class {
|
|
|
11087
11105
|
createdAt: now,
|
|
11088
11106
|
updatedAt: now,
|
|
11089
11107
|
name: fields.name,
|
|
11090
|
-
description: fields.description ?? null,
|
|
11091
11108
|
externalId: fields.externalId ?? null,
|
|
11092
11109
|
externalUrl: fields.url ?? fields.externalUrl ?? null,
|
|
11093
11110
|
type,
|
|
@@ -11269,6 +11286,9 @@ var MockCalmLensApi = class {
|
|
|
11269
11286
|
* a text asset's own text or the text found in it. Only the references CalmLens uses are kept.
|
|
11270
11287
|
*/
|
|
11271
11288
|
async selectContext(items) {
|
|
11289
|
+
items.forEach((item, index) => {
|
|
11290
|
+
if (!isId(item.assetId, "asset")) throw invalidField("validation/invalid-format", `context.items.${index}.assetId`);
|
|
11291
|
+
});
|
|
11272
11292
|
const posts = await Promise.all(items.map(async (item) => {
|
|
11273
11293
|
const asset = await this.databaseStorage.getAsset(item.assetId);
|
|
11274
11294
|
if (!asset || asset.projectId !== this.projectId) throw fail(require_CalmLensError.API_ERROR_CODES.CONTEXT_ASSET_NOT_FOUND, { details: { assetId: item.assetId } });
|
|
@@ -11281,10 +11301,19 @@ var MockCalmLensApi = class {
|
|
|
11281
11301
|
}
|
|
11282
11302
|
/** An earlier post's text, to the most CalmLens reads of one post; empty once its content is gone. */
|
|
11283
11303
|
async contextText(asset) {
|
|
11304
|
+
const text = (await this.retainedText(asset)).trim();
|
|
11305
|
+
return Array.from(text).slice(0, MODERATION_CONTEXT_MAX_ITEM_CHARACTERS).join("");
|
|
11306
|
+
}
|
|
11307
|
+
/** The text keyword search reads, like the API: the retained text, only while content is stored. */
|
|
11308
|
+
async searchText(asset) {
|
|
11309
|
+
return asset.content.status === "stored" ? this.retainedText(asset) : "";
|
|
11310
|
+
}
|
|
11311
|
+
/** A text upload's stored bytes, or the text extracted from its content (such as OCR). */
|
|
11312
|
+
async retainedText(asset) {
|
|
11284
11313
|
const extracted = asset.content.extractedText;
|
|
11285
11314
|
const bytes = asset.type === "plaintext-document" && await this.storedBytes(asset);
|
|
11286
|
-
|
|
11287
|
-
return
|
|
11315
|
+
if (bytes) return new TextDecoder().decode(bytes);
|
|
11316
|
+
return extracted?.type === "string" ? extracted.content : "";
|
|
11288
11317
|
}
|
|
11289
11318
|
async storedBytes(asset) {
|
|
11290
11319
|
if (asset.content.status === "removed") return null;
|
|
@@ -11295,28 +11324,40 @@ var MockCalmLensApi = class {
|
|
|
11295
11324
|
}
|
|
11296
11325
|
/**
|
|
11297
11326
|
* A decided image with its hash and the project's hash list matches, as the API records them
|
|
11298
|
-
* (AssetClassification.ts,
|
|
11327
|
+
* (AssetClassification.ts, HashMatching.ts and HashList.ts). The mock computes no PDQ hash: an
|
|
11299
11328
|
* image's `content.perceptualHash` is the SHA-256 of its bytes in lowercase hex, with quality
|
|
11300
|
-
* 100,
|
|
11301
|
-
*
|
|
11302
|
-
*
|
|
11303
|
-
*
|
|
11329
|
+
* 100, unless `setPerceptualHash` declared one for those bytes. An entry matches a hash up to 31
|
|
11330
|
+
* bits away, so different images' SHA-256 stand-ins never match, and an entry taken from an
|
|
11331
|
+
* image matches the same bytes at distance 0. Hashes below quality 50 never match. A match takes
|
|
11332
|
+
* its list's action, except that a block list only flags matches more than 16 bits away;
|
|
11333
|
+
* blocking matches come first, then the closest. A block raises an allowed, limited or
|
|
11334
|
+
* age-restricted decision to `blocked`, with `source: "hash-list"`, and a flag only records the
|
|
11335
|
+
* match.
|
|
11304
11336
|
*/
|
|
11305
11337
|
async withHashMatches(asset, bytes) {
|
|
11306
|
-
const hash
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11312
|
-
|
|
11313
|
-
|
|
11338
|
+
const { hash, quality } = this.perceptualHashes.find((known) => sameBytes(known.bytes, bytes)) ?? {
|
|
11339
|
+
hash: await sha256Hex(bytes),
|
|
11340
|
+
quality: 100
|
|
11341
|
+
};
|
|
11342
|
+
const matches = [...this.hashListEntries.values()].flatMap((entry) => {
|
|
11343
|
+
const list = this.hashLists.get(entry.hashListId);
|
|
11344
|
+
const distance = hashDistance(hash, entry.hash);
|
|
11345
|
+
if (!list || quality < HASH_MATCH_MIN_QUALITY || entry.quality !== null && entry.quality < HASH_MATCH_MIN_QUALITY || distance > HASH_MATCH_MAX_DISTANCE) return [];
|
|
11346
|
+
const action = list.action === "block" && distance <= HASH_BLOCK_MAX_DISTANCE ? "block" : "flag";
|
|
11347
|
+
return [{
|
|
11348
|
+
source: "hash-list",
|
|
11349
|
+
hashListId: entry.hashListId,
|
|
11350
|
+
hashListEntryId: entry.id,
|
|
11351
|
+
distance,
|
|
11352
|
+
action
|
|
11353
|
+
}];
|
|
11354
|
+
}).sort((a, b) => Number(b.action === "block") - Number(a.action === "block") || a.distance - b.distance).slice(0, MAX_RECORDED_HASH_MATCHES);
|
|
11314
11355
|
const hashed = {
|
|
11315
11356
|
...asset,
|
|
11316
11357
|
content: {
|
|
11317
11358
|
...asset.content,
|
|
11318
11359
|
perceptualHash: hash,
|
|
11319
|
-
perceptualHashQuality:
|
|
11360
|
+
perceptualHashQuality: quality
|
|
11320
11361
|
}
|
|
11321
11362
|
};
|
|
11322
11363
|
if (!matches.length) return hashed;
|
|
@@ -12239,6 +12280,25 @@ var MockCalmLensApi = class {
|
|
|
12239
12280
|
});
|
|
12240
12281
|
}
|
|
12241
12282
|
};
|
|
12283
|
+
/** The SHA-256 of `bytes` in lowercase hex. */
|
|
12284
|
+
async function sha256Hex(bytes) {
|
|
12285
|
+
return [...new Uint8Array(await crypto.subtle.digest("SHA-256", bytes))].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
12286
|
+
}
|
|
12287
|
+
/** How many bits two 64-character hex hashes differ by. */
|
|
12288
|
+
function hashDistance(a, b) {
|
|
12289
|
+
let distance = 0;
|
|
12290
|
+
for (let i = 0; i < 64; i += 8) {
|
|
12291
|
+
let bits = (Number.parseInt(a.slice(i, i + 8), 16) ^ Number.parseInt(b.slice(i, i + 8), 16)) >>> 0;
|
|
12292
|
+
while (bits) {
|
|
12293
|
+
bits &= bits - 1;
|
|
12294
|
+
distance++;
|
|
12295
|
+
}
|
|
12296
|
+
}
|
|
12297
|
+
return distance;
|
|
12298
|
+
}
|
|
12299
|
+
function sameBytes(a, b) {
|
|
12300
|
+
return a.length === b.length && a.every((byte, i) => byte === b[i]);
|
|
12301
|
+
}
|
|
12242
12302
|
// src/testing/MockStorage.ts
|
|
12243
12303
|
var InMemoryMockImageStorage = class {
|
|
12244
12304
|
constructor() {
|
|
@@ -12424,7 +12484,7 @@ var MockCalmLensServerClient = class extends require_CalmLensServerClient.CalmLe
|
|
|
12424
12484
|
}
|
|
12425
12485
|
/**
|
|
12426
12486
|
* Fetches a URL of the mock's CDN as a browser would, without the API key: a signed asset URL
|
|
12427
|
-
* from `cdn.signAssetUrl
|
|
12487
|
+
* from `cdn.signAssetUrl`, or a public one from `cdn.getAssetUrl`.
|
|
12428
12488
|
* The request is recorded like any other.
|
|
12429
12489
|
*/
|
|
12430
12490
|
fetchCdn(url, init) {
|
|
@@ -12470,6 +12530,16 @@ var MockCalmLensServerClient = class extends require_CalmLensServerClient.CalmLe
|
|
|
12470
12530
|
this.#api.serveUrl(url, content);
|
|
12471
12531
|
}
|
|
12472
12532
|
/**
|
|
12533
|
+
* Makes the mock hash an image upload of exactly `content` (bytes, or text as UTF-8) as `hash`, a
|
|
12534
|
+
* PDQ hash of 64 hexadecimal characters, with `quality` (0 to 100, default 100), instead of the
|
|
12535
|
+
* SHA-256 of its bytes. Hash list entries match hashes up to 31 bits away, as in CalmLens, so a
|
|
12536
|
+
* test can make a resized or recompressed copy a near match of a listed image: declare the
|
|
12537
|
+
* copy's hash a few bits from the entry's.
|
|
12538
|
+
*/
|
|
12539
|
+
setPerceptualHash(content, hash, quality = 100) {
|
|
12540
|
+
this.#api.setPerceptualHash(content, hash, quality);
|
|
12541
|
+
}
|
|
12542
|
+
/**
|
|
12473
12543
|
* Changes the grants of the mock's API key, as editing the key in the portal would: later
|
|
12474
12544
|
* requests, such as `cdn.serve`, use them. The key itself stays the same, so idempotency keys
|
|
12475
12545
|
* it used still replay.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_CalmLensCdn = require("./CalmLensCdn-
|
|
2
|
-
require("./Core-
|
|
1
|
+
const require_CalmLensCdn = require("./CalmLensCdn-xQMrClXN.js");
|
|
2
|
+
require("./Core-BtFJ2xfb.js");
|
|
3
3
|
// src/ui/viewers/PdfLoader.ts
|
|
4
4
|
let loading;
|
|
5
5
|
/**
|
|
@@ -81,11 +81,11 @@ const responseCode = async (response) => {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
/**
|
|
84
|
-
* The CDN URLs a viewer loads: resource paths beneath the asset URL
|
|
85
|
-
* with the viewer claims that say something. When a URL
|
|
86
|
-
* signed one does, it asks `onExpired` once for a fresh
|
|
87
|
-
* has worked (`loaded`), so a URL that keeps failing ends in the
|
|
88
|
-
* `onExpired` nothing is refreshed.
|
|
84
|
+
* The CDN URLs a viewer loads: resource paths beneath the asset URL of `src` (a public or signed
|
|
85
|
+
* asset URL, or a resource URL beneath one), with the viewer claims that say something. When a URL
|
|
86
|
+
* stops working (`refresh`), as an expired signed one does, it asks `onExpired` once for a fresh
|
|
87
|
+
* URL, and again only after that one has worked (`loaded`), so a URL that keeps failing ends in the
|
|
88
|
+
* viewer's fallback. Without `onExpired` nothing is refreshed.
|
|
89
89
|
*/
|
|
90
90
|
var ViewerUrls = class {
|
|
91
91
|
#options;
|
|
@@ -112,7 +112,7 @@ var ViewerUrls = class {
|
|
|
112
112
|
/** A resource's URL beneath the asset URL. The placeholder is never age-gated, so it needs no age claim. */
|
|
113
113
|
url(resource, transform) {
|
|
114
114
|
const { viewerClaims } = this.#options;
|
|
115
|
-
return require_CalmLensCdn.appendAssetLocation(this.#src, {
|
|
115
|
+
return require_CalmLensCdn.appendAssetLocation(require_CalmLensCdn.assetUrlOf(this.#src), {
|
|
116
116
|
resource,
|
|
117
117
|
transform,
|
|
118
118
|
viewerClaims: resource === "placeholder" && viewerClaims ? { region: viewerClaims.region } : viewerClaims
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./CalmLensTypes-
|
|
2
|
-
import { K as AssetOptions, Z as AssetView, ct as DocumentViewerOptions, dt as TextViewerOptions, lt as PdfAssetOptions, pt as ViewerOptions, q as AssetSession, ut as SpreadsheetViewerOptions } from "./Core-
|
|
1
|
+
import "./CalmLensTypes-DjuOXp3b.js";
|
|
2
|
+
import { K as AssetOptions, Z as AssetView, ct as DocumentViewerOptions, dt as TextViewerOptions, lt as PdfAssetOptions, pt as ViewerOptions, q as AssetSession, ut as SpreadsheetViewerOptions } from "./Core-DaCkaDkb.js";
|
|
3
3
|
import "pdfjs-dist";
|
|
4
4
|
/** A viewer mounted into an element, which it owns the children of. */
|
|
5
5
|
interface AssetViewer<O extends ViewerOptions = ViewerOptions> {
|
package/cjs/ui.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, I as UploadItem, J as AssetSessionState, K as AssetOptions, L as UploadSnapshot, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, h as UploaderProps, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, k as CalmLensUpload, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage, z as createUploadController } from "./Core-
|
|
2
|
-
import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui-
|
|
1
|
+
import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, I as UploadItem, J as AssetSessionState, K as AssetOptions, L as UploadSnapshot, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, h as UploaderProps, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, k as CalmLensUpload, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage, z as createUploadController } from "./Core-DaCkaDkb.js";
|
|
2
|
+
import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui-C_AhYdIA.js";
|
|
3
3
|
export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, type AssetDisplay, type AssetDisplayOptions, type AssetDocumentOptions, type AssetEventHandlers, type AssetImageOptions, type AssetImageSource, type AssetOptions, type AssetProps, AssetSession, type AssetSessionState, type AssetSpreadsheetOptions, type AssetVideoOptions, type AssetView, type AssetViewer, type AssetViewerKind, AssetViewerMount, AssetViewerName, AssetViewerOptionsByKind, CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensProvidedOptions, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, type DocumentViewerOptions, ICONS, ICON_ATTRIBUTES, INSTANT_LOAD_MS, type IconName, type MediaPlayback, MediaStreamPlayer, type MountedViewerKind, type PdfAssetOptions, type ProgressFetchOptions, type SpreadsheetCell, type SpreadsheetRow, type SpreadsheetSheet, type SpreadsheetViewerOptions, type TextViewerOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, VIEWER_STYLES, type ViewerAsset, type ViewerMessages, type ViewerOptions, type ViewerState, type ViewerTextOptions, createDocumentViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isImageReady, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, withProvidedOptions };
|
package/cjs/ui.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ui = require("./ui-
|
|
3
|
-
const require_Core = require("./Core-
|
|
4
|
-
const require_UploadController = require("./UploadController-
|
|
2
|
+
const require_ui = require("./ui-B5tgw_En.js");
|
|
3
|
+
const require_Core = require("./Core-BtFJ2xfb.js");
|
|
4
|
+
const require_UploadController = require("./UploadController-tKqKphf3.js");
|
|
5
5
|
exports.ASSET_FILE_ICON_SIZE = require_Core.ASSET_FILE_ICON_SIZE;
|
|
6
6
|
exports.ASSET_VIEWERS = require_ui.ASSET_VIEWERS;
|
|
7
7
|
exports.AssetSession = require_Core.AssetSession;
|
package/cjs/vue.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { O as CalmLensAppClientOptions, g as AssetModerationStatus, i as AssetAvailability, nn as ViewerClaims } from "./CalmLensTypes-
|
|
2
|
-
import "./index-
|
|
3
|
-
import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, J as AssetSessionState, K as AssetOptions, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage } from "./Core-
|
|
4
|
-
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-
|
|
5
|
-
import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui-
|
|
1
|
+
import { O as CalmLensAppClientOptions, g as AssetModerationStatus, i as AssetAvailability, nn as ViewerClaims } from "./CalmLensTypes-DjuOXp3b.js";
|
|
2
|
+
import "./index-xF6Neq8A.js";
|
|
3
|
+
import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, J as AssetSessionState, K as AssetOptions, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage } from "./Core-DaCkaDkb.js";
|
|
4
|
+
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-Dx2l9wC0.js";
|
|
5
|
+
import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui-C_AhYdIA.js";
|
|
6
6
|
import { App, MaybeRefOrGetter, PropType, ShallowRef } from "vue";
|
|
7
7
|
/** Shows a text asset's text, escaped, in a scrolling region. */
|
|
8
8
|
export declare const CalmLensTextViewer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
package/cjs/vue.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ui = require("./ui-
|
|
3
|
-
const require_Core = require("./Core-
|
|
4
|
-
const require_UploadController = require("./UploadController-
|
|
2
|
+
const require_ui = require("./ui-B5tgw_En.js");
|
|
3
|
+
const require_Core = require("./Core-BtFJ2xfb.js");
|
|
4
|
+
const require_UploadController = require("./UploadController-tKqKphf3.js");
|
|
5
5
|
const require_FileIcons = require("./FileIcons-Ob003MdS.js");
|
|
6
|
-
const require_BrowserUpload = require("./BrowserUpload-
|
|
6
|
+
const require_BrowserUpload = require("./BrowserUpload-CbbFE-2v.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-D3um1cq9.js";
|
|
2
2
|
// src/ui/BrowserUpload.ts
|
|
3
3
|
/** Creates an upload queue for the browser components, such as one a form starts on submit. */
|
|
4
4
|
const createUploadController = (options) => createUploadController$1(options);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as UploadFile, I as UploadItem$1, L as UploadSnapshot$1, N as UploadController, P as UploadControllerOptions$1, h as UploaderProps$1, k as CalmLensUpload$1 } from "./Core-
|
|
2
|
-
import { r as UseCalmLensUploadResult$1 } from "./ReactUpload-
|
|
1
|
+
import { F as UploadFile, I as UploadItem$1, L as UploadSnapshot$1, N as UploadController, P as UploadControllerOptions$1, h as UploaderProps$1, k as CalmLensUpload$1 } from "./Core-DaCkaDkb.js";
|
|
2
|
+
import { r as UseCalmLensUploadResult$1 } from "./ReactUpload-DMtaeFN2.js";
|
|
3
3
|
type UploadItem<F extends UploadFile = File> = UploadItem$1<F>;
|
|
4
4
|
type CalmLensUpload<F extends UploadFile = File> = CalmLensUpload$1<F>;
|
|
5
5
|
type UploadSnapshot<F extends UploadFile = File> = UploadSnapshot$1<F>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C as invalidConfig, S as invalidArgument } from "./CalmLensError-C15tWu8W.js";
|
|
2
|
-
import { S as validateAppClientOptions, d as checkOptionKeys, o as buildAssetUrl, p as encodePathSegment, u as DEFAULT_CDN_BASE_URL } from "./CalmLensCdn
|
|
3
|
-
import { c as prepareSubmitAssetOptions, f as APP_OPTION_KEYS, i as expectUploadedAsset, l as resolveConnectionOptions, t as CalmLensConnection, u as splitsIntoParts } from "./CalmLensConnection-
|
|
2
|
+
import { S as validateAppClientOptions, d as checkOptionKeys, o as buildAssetUrl, p as encodePathSegment, u as DEFAULT_CDN_BASE_URL } from "./CalmLensCdn--hZgorld.js";
|
|
3
|
+
import { c as prepareSubmitAssetOptions, f as APP_OPTION_KEYS, i as expectUploadedAsset, l as resolveConnectionOptions, t as CalmLensConnection, u as splitsIntoParts } from "./CalmLensConnection-dz5Kl3uC.js";
|
|
4
4
|
// src/client/CalmLensAppClient.ts
|
|
5
5
|
const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
6
6
|
/** `options`, once `checkOptionKeys` finds only keys `operation` takes. */
|
|
@@ -85,8 +85,8 @@ var CalmLensAppClient = class {
|
|
|
85
85
|
get cdn() {
|
|
86
86
|
return {
|
|
87
87
|
/**
|
|
88
|
-
* Builds a public asset's CDN URL: the
|
|
89
|
-
*
|
|
88
|
+
* Builds a public asset's CDN URL: the URL of `resource` (`rendered` unless one is given),
|
|
89
|
+
* with its lens or transform and the viewer claims. Private assets need a URL your
|
|
90
90
|
* server signs with `cdn.signAssetUrl`. The project is the client's `projectId` unless the
|
|
91
91
|
* call names one.
|
|
92
92
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as UploadPresetSubmitAssetOptions, M as CdnAssetUrlOptions, Mt as RetrieveAssetOptions, O as CalmLensAppClientOptions, Yt as UploadAssetPartOptions, en as UploadedAsset, kt as RequestOptions } from "./CalmLensTypes-
|
|
1
|
+
import { $t as UploadPresetSubmitAssetOptions, M as CdnAssetUrlOptions, Mt as RetrieveAssetOptions, O as CalmLensAppClientOptions, Yt as UploadAssetPartOptions, en as UploadedAsset, kt as RequestOptions } from "./CalmLensTypes-DjuOXp3b.js";
|
|
2
2
|
declare const inspectSymbol: unique symbol;
|
|
3
3
|
/**
|
|
4
4
|
* The CalmLens client for browsers and React Native apps. It uploads through an upload preset,
|
|
@@ -25,8 +25,8 @@ declare class CalmLensAppClient {
|
|
|
25
25
|
/** Public asset URLs, built without a request. */
|
|
26
26
|
get cdn(): {
|
|
27
27
|
/**
|
|
28
|
-
* Builds a public asset's CDN URL: the
|
|
29
|
-
*
|
|
28
|
+
* Builds a public asset's CDN URL: the URL of `resource` (`rendered` unless one is given),
|
|
29
|
+
* with its lens or transform and the viewer claims. Private assets need a URL your
|
|
30
30
|
* server signs with `cdn.signAssetUrl`. The project is the client's `projectId` unless the
|
|
31
31
|
* call names one.
|
|
32
32
|
*/
|