calmlens 0.25.0 → 0.26.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/README.md +14 -14
- package/bin/calmlens.js +2202 -521
- package/cjs/{BrowserUpload-AO2-2U5Z.js → BrowserUpload-DdkcoZLH.js} +1 -1
- package/{esm/BrowserUpload-D2lemMIU.d.ts → cjs/BrowserUpload-zYWKtFSs.d.ts} +2 -2
- package/cjs/{CalmLensAppClient-nv6qwja0.js → CalmLensAppClient-Gu9mU_66.js} +22 -15
- package/{esm/CalmLensAppClient-Dt0t9Bk6.d.ts → cjs/CalmLensAppClient-mTTjqpRc.d.ts} +5 -11
- package/cjs/{CalmLensOptionKeys-BvCac9NO.js → CalmLensOptionKeys-BCITGsr9.js} +138 -90
- package/cjs/CalmLensServerClient-D5-njsNk.d.ts +357 -0
- package/cjs/{CalmLensServerClient-B60kCBCR.js → CalmLensServerClient-DHmAPT1u.js} +283 -303
- package/cjs/{CalmLensTypes-BhR7LFDu.d.ts → CalmLensTypes-Df8eBgWB.d.ts} +127 -59
- package/cjs/{Core-DSMxC2GL.d.ts → Core-CREGGR0L.d.ts} +10 -3
- package/cjs/{Core-Cw4IxFUq.js → Core-DAf9lqe2.js} +30 -12
- package/{esm/ModerationContextLimits-Bqr0duav.js → cjs/ModerationContextLimits-D4iwqoN_.js} +858 -28
- package/cjs/{ReactUpload--oDFltw2.js → ReactUpload-BNIbpxIH.js} +38 -2
- package/cjs/ReactUpload-D4htIz8X.d.ts +27 -0
- package/cjs/{UploadController-ObdgTaBl.js → UploadController-B_lKxvpM.js} +16 -3
- package/cjs/{WebhookPayload-DLGGOGW6.d.ts → WebhookPayload-DMa6ihHr.d.ts} +152 -3
- package/cjs/app.d.ts +5 -5
- package/cjs/app.js +20 -2
- package/cjs/elements.d.ts +5 -5
- package/cjs/elements.js +102 -67
- package/cjs/{index-AAWuerkU.d.ts → index-CtpQldn_.d.ts} +2 -2
- package/cjs/index.d.ts +4 -4
- package/cjs/index.js +19 -1
- package/cjs/react-native.d.ts +3 -3
- package/cjs/react-native.js +6 -4
- package/cjs/react.d.ts +5 -4
- package/cjs/react.js +10 -14
- package/cjs/server.d.ts +5 -5
- package/cjs/server.js +20 -2
- package/cjs/testing.d.ts +11 -9
- package/cjs/testing.js +72 -41
- package/cjs/{ui-CcuGKTcL.d.ts → ui-BwFPFrno.d.ts} +2 -2
- package/cjs/{ui-CA16jyfZ.js → ui-CvlJmRYM.js} +6 -4
- package/cjs/ui.d.ts +3 -3
- package/cjs/ui.js +4 -3
- package/cjs/vue.d.ts +15 -8
- package/cjs/vue.js +29 -16
- package/esm/{BrowserUpload-Co4T6uGk.js → BrowserUpload-BAWYEBd7.js} +1 -1
- package/{cjs/BrowserUpload-D2lemMIU.d.ts → esm/BrowserUpload-zYWKtFSs.d.ts} +2 -2
- package/esm/{CalmLensAppClient-BRzy4dwn.js → CalmLensAppClient-DNkIZb6x.js} +22 -15
- package/{cjs/CalmLensAppClient-Dt0t9Bk6.d.ts → esm/CalmLensAppClient-mTTjqpRc.d.ts} +5 -11
- package/esm/{CalmLensOptionKeys-bE3rb5PN.js → CalmLensOptionKeys-CYHJo3nV.js} +133 -91
- package/esm/{CalmLensServerClient-_PRi90wI.js → CalmLensServerClient-B1AiR4nv.js} +283 -303
- package/esm/CalmLensServerClient-D5-njsNk.d.ts +357 -0
- package/esm/{CalmLensTypes-BhR7LFDu.d.ts → CalmLensTypes-Df8eBgWB.d.ts} +127 -59
- package/esm/{Core-DSMxC2GL.d.ts → Core-CREGGR0L.d.ts} +10 -3
- package/esm/{Core-CtbYmeXG.js → Core-xNBQxZWH.js} +30 -12
- package/{cjs/ModerationContextLimits-Cn9RvnZH.js → esm/ModerationContextLimits-DxuPP4uM.js} +475 -285
- package/esm/{ReactUpload-B5itHBSF.js → ReactUpload-BWifQdLv.js} +34 -4
- package/esm/ReactUpload-D4htIz8X.d.ts +27 -0
- package/esm/{UploadController-C7fL3Iz9.js → UploadController-jlJdddyI.js} +11 -4
- package/esm/{WebhookPayload-DLGGOGW6.d.ts → WebhookPayload-DMa6ihHr.d.ts} +152 -3
- package/esm/app.d.ts +5 -5
- package/esm/app.js +3 -3
- package/esm/elements.d.ts +5 -5
- package/esm/elements.js +102 -68
- package/esm/{index-AAWuerkU.d.ts → index-CtpQldn_.d.ts} +2 -2
- package/esm/index.d.ts +4 -4
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +3 -3
- package/esm/react-native.js +5 -5
- package/esm/react.d.ts +5 -4
- package/esm/react.js +9 -15
- package/esm/server.d.ts +5 -5
- package/esm/server.js +3 -3
- package/esm/styles.css +28 -10
- package/esm/svelte/CalmLensUploader.svelte +17 -17
- package/esm/svelte/context.js +21 -0
- package/esm/svelte/index.d.ts +12 -0
- package/esm/svelte/index.js +1 -0
- package/esm/testing.d.ts +11 -9
- package/esm/testing.js +72 -41
- package/esm/{ui-B98AucZA.js → ui-BXzzqh7M.js} +6 -4
- package/esm/{ui-CcuGKTcL.d.ts → ui-BwFPFrno.d.ts} +2 -2
- package/esm/ui.d.ts +3 -3
- package/esm/ui.js +4 -4
- package/esm/vue.d.ts +15 -8
- package/esm/vue.js +29 -18
- package/package.json +16 -6
- package/cjs/CalmLensServerClient-7XjQaeKu.d.ts +0 -353
- package/cjs/ReactUpload-CW4NzAsh.d.ts +0 -17
- package/esm/CalmLensServerClient-7XjQaeKu.d.ts +0 -353
- package/esm/ReactUpload-CW4NzAsh.d.ts +0 -17
package/cjs/testing.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
3
|
-
import {
|
|
4
|
-
import { t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
1
|
+
import { In as AssetBinaryPayloadInput, It as SignUploadTokenOptions, O as CalmLensAppClientOptions, Rt as SignedUploadToken, _n as PermissionGrant, k as CalmLensServerClientOptions, m as AssetModeration, r as Asset, un as TypedEvent, vn as Folder } from "./CalmLensTypes-Df8eBgWB.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-mTTjqpRc.js";
|
|
3
|
+
import { I as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-DMa6ihHr.js";
|
|
4
|
+
import { t as CalmLensServerClient } from "./CalmLensServerClient-D5-njsNk.js";
|
|
5
5
|
import { t as ClassificationTestSignal } from "./TestTriggers-BJ4B-MXR-D1tGifPU.js";
|
|
6
6
|
import "zod";
|
|
7
7
|
/**
|
|
@@ -96,7 +96,7 @@ export declare class MockDecision {
|
|
|
96
96
|
* `flaggedCategories`. `requestedAt` is when a pending review joined the queue. `undefined` for
|
|
97
97
|
* `pending` and `failed`.
|
|
98
98
|
*/
|
|
99
|
-
report(requestedAt?: number): Omit<AssetModeration, "
|
|
99
|
+
report(requestedAt?: number): Omit<AssetModeration, "decision" | "manualReviews"> | undefined;
|
|
100
100
|
}
|
|
101
101
|
/** Starts a moderation decision with this status; see `MockDecision`. */
|
|
102
102
|
export declare const mockDecision: (status: MockAssetOutcome) => MockDecision;
|
|
@@ -194,13 +194,13 @@ type MockReviewDecision = "allowed" | "limited" | "age-restricted" | "blocked" |
|
|
|
194
194
|
* method that sends it; `callsTo` and `failNextRequest` also match the others (see
|
|
195
195
|
* `MockCalmLensCall`).
|
|
196
196
|
*/
|
|
197
|
-
declare const MOCK_OPERATIONS: readonly ["assets.list", "assets.
|
|
197
|
+
declare const MOCK_OPERATIONS: readonly ["assets.list", "assets.search", "assets.retrieve", "assets.waitForDecision", "assets.update", "assets.listChildren", "assets.listTimeline", "assets.create", "assets.classify", "assets.uploadPart", "assets.move", "assets.retry", "assets.explain", "assets.decide", "assets.removeContent", "assets.delete", "assets.batch", "text.classify", "cdn.serve", "cdn.getAssetInfo", "cdn.signAssetUrl", "events.list", "folders.list", "folders.retrieve", "folders.create", "folders.update", "folders.delete", "folders.move", "hashLists.list", "hashLists.retrieve", "hashLists.create", "hashLists.update", "hashLists.delete", "hashLists.listEntries", "hashLists.addEntry", "hashLists.removeEntry", "policies.list", "policies.retrieve", "policies.create", "policies.update", "policies.reset", "policies.upgrade", "policies.setAutomaticUpdates", "policies.delete", "policies.retrieveAssigned", "policies.assign", "lenses.list", "lenses.create", "lenses.retrieve", "lenses.update", "lenses.delete", "ensureLens", "ensureLenses", "uploadPresets.list", "uploadPresets.ensure", "uploadPresets.delete", "projectSettings.get", "projectSettings.update", "metadataFields.list", "metadataFields.ensure", "metadataFields.delete"];
|
|
198
198
|
type MockCalmLensOperation = (typeof MOCK_OPERATIONS)[number];
|
|
199
199
|
/**
|
|
200
200
|
* One request a mock client sent, as the in-memory API received it. `operation` is the client
|
|
201
201
|
* method that sends it; requests several methods send are recorded under the first: `text.classify`
|
|
202
202
|
* as `assets.classify`, `ensureLens` as `ensureLenses`, `assets.waitForDecision` polls as
|
|
203
|
-
* `assets.retrieve`,
|
|
203
|
+
* `assets.retrieve`, and so on. `callsTo` matches all of
|
|
204
204
|
* them. Methods that send nothing, such as `uploadTokens.sign` or a cached `ensureLens`, are not
|
|
205
205
|
* recorded.
|
|
206
206
|
*/
|
|
@@ -252,7 +252,7 @@ interface MockUploadPreset {
|
|
|
252
252
|
/** Accepted content types, such as `["image/*"]`. Defaults to any type. */
|
|
253
253
|
allowedContentTypes?: string[];
|
|
254
254
|
maxFileSizeInBytes?: number;
|
|
255
|
-
/** Return `classification.moderation.
|
|
255
|
+
/** Return `classification.moderation.decision` to the uploader. Defaults to `true`. */
|
|
256
256
|
showDecisions?: boolean;
|
|
257
257
|
/** Defaults to `public`. */
|
|
258
258
|
visibility?: "public" | "private";
|
|
@@ -260,7 +260,9 @@ interface MockUploadPreset {
|
|
|
260
260
|
retainContent?: boolean;
|
|
261
261
|
folderId?: string | null;
|
|
262
262
|
}
|
|
263
|
-
interface MockCalmLensServerClientOptions extends Omit<CalmLensServerClientOptions, "projectId"> {
|
|
263
|
+
interface MockCalmLensServerClientOptions extends Omit<CalmLensServerClientOptions, "apiKey" | "projectId"> {
|
|
264
|
+
/** A key from `createMockApiKey`, whose grants the mock API enforces. Never read from the environment. */
|
|
265
|
+
apiKey: string;
|
|
264
266
|
/** Defaults to `project-1`. */
|
|
265
267
|
projectId?: string;
|
|
266
268
|
mockOptions?: {
|
package/cjs/testing.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_TestTriggers_CiFcTHX3 = require("./TestTriggers-CiFcTHX3-BmfH4J3f.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-D4iwqoN_.js");
|
|
4
|
+
const require_CalmLensServerClient = require("./CalmLensServerClient-DHmAPT1u.js");
|
|
5
|
+
const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-BCITGsr9.js");
|
|
6
6
|
const require_CryptoUtils_B_x8lMIx = require("./CryptoUtils-B_x8lMIx-YBW1-bvL.js");
|
|
7
|
-
const require_CalmLensAppClient = require("./CalmLensAppClient-
|
|
8
|
-
const require_UploadController = require("./UploadController-
|
|
7
|
+
const require_CalmLensAppClient = require("./CalmLensAppClient-Gu9mU_66.js");
|
|
8
|
+
const require_UploadController = require("./UploadController-B_lKxvpM.js");
|
|
9
9
|
let zod = require("zod");
|
|
10
10
|
zod = require_TestTriggers_CiFcTHX3.__toESM(zod, 1);
|
|
11
11
|
// src/contract/MediaTestTriggers.js
|
|
@@ -33,7 +33,7 @@ async function generateMediaTestCode(signal, testInputKey) {
|
|
|
33
33
|
if (!MEDIA_TEST_SIGNALS.includes(signal)) throw new RangeError("Unsupported media test signal");
|
|
34
34
|
return `Calm Lens test ${[...await require_TestTriggers_CiFcTHX3.getTestInputTag("media", signal, testInputKey)].map((character) => HEX_WORDS[Number.parseInt(character, 16)]).join(" ")} ${signal.replace(/[.-]/g, " ")} end test`;
|
|
35
35
|
}
|
|
36
|
-
// src/contract/Ids-
|
|
36
|
+
// src/contract/Ids-l0is4BI5.js
|
|
37
37
|
var __defProp = Object.defineProperty;
|
|
38
38
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
39
39
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -7830,6 +7830,14 @@ ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
|
7830
7830
|
...schemas_exports,
|
|
7831
7831
|
...checks_exports
|
|
7832
7832
|
});
|
|
7833
|
+
const createMetaType = (type) => {
|
|
7834
|
+
return Object.assign((value) => {
|
|
7835
|
+
return {
|
|
7836
|
+
type,
|
|
7837
|
+
data: value ?? {}
|
|
7838
|
+
};
|
|
7839
|
+
}, type);
|
|
7840
|
+
};
|
|
7833
7841
|
(/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7834
7842
|
const CHARS_GLOBAL_BACKSLASH_SUPPORTED_RX = /[\0\b\t\n\r\x1a"'\\]/g;
|
|
7835
7843
|
const CHARS_ESCAPE_BACKSLASH_SUPPORTED_MAP = {
|
|
@@ -7886,6 +7894,39 @@ ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
|
7886
7894
|
}
|
|
7887
7895
|
module.exports = escapeString;
|
|
7888
7896
|
})))();
|
|
7897
|
+
const isZodTypeExtends = (type, zodType) => {
|
|
7898
|
+
if (type instanceof zodType) return type;
|
|
7899
|
+
if (type.def.type === "union") {
|
|
7900
|
+
for (const option of type.def.options) if (isZodTypeExtends(option, zodType)) return option;
|
|
7901
|
+
return false;
|
|
7902
|
+
}
|
|
7903
|
+
const rootType = type.def.innerType ?? type.def.in;
|
|
7904
|
+
if (rootType) return isZodTypeExtends(rootType, zodType);
|
|
7905
|
+
return false;
|
|
7906
|
+
};
|
|
7907
|
+
createMetaType({
|
|
7908
|
+
id: "foreignKey",
|
|
7909
|
+
check: (type) => {
|
|
7910
|
+
if (isZodTypeExtends(type, zod.ZodString) || isZodTypeExtends(type, zod.ZodNumber)) return { success: true };
|
|
7911
|
+
return {
|
|
7912
|
+
success: false,
|
|
7913
|
+
message: "Foreign key must be a string or number"
|
|
7914
|
+
};
|
|
7915
|
+
}
|
|
7916
|
+
});
|
|
7917
|
+
createMetaType({
|
|
7918
|
+
id: "primaryKey",
|
|
7919
|
+
check: (type) => {
|
|
7920
|
+
if (isZodTypeExtends(type, zod.ZodString) || isZodTypeExtends(type, zod.ZodNumber)) return { success: true };
|
|
7921
|
+
return {
|
|
7922
|
+
success: false,
|
|
7923
|
+
message: "Primary key must be a string or number"
|
|
7924
|
+
};
|
|
7925
|
+
}
|
|
7926
|
+
});
|
|
7927
|
+
createMetaType({ id: "updatedAt" });
|
|
7928
|
+
createMetaType({ id: "monotonicTimestamp" });
|
|
7929
|
+
createMetaType({ id: "backfill" });
|
|
7889
7930
|
/**
|
|
7890
7931
|
* The prefix of every kind of object customers can see, so an ID says what it identifies:
|
|
7891
7932
|
* `proj_8fK2mQx7Lp4NvB3tRz9Y` is a project. Rows that never leave the backend (usage meters, upload
|
|
@@ -7989,7 +8030,7 @@ const EXAMPLE_IDS = {
|
|
|
7989
8030
|
* across the packages that build records from plain strings).
|
|
7990
8031
|
*/
|
|
7991
8032
|
const idField = (prefix) => zod.string().regex(idPattern(prefix), { message: `Must be a valid ID: "${prefix}_" followed by 20 letters or digits` }).meta({ examples: [EXAMPLE_IDS[prefix]] });
|
|
7992
|
-
// src/contract/Permissions-
|
|
8033
|
+
// src/contract/Permissions-CJ9upU6w.js
|
|
7993
8034
|
const ACTION_SCHEMA = zod.enum([
|
|
7994
8035
|
"assets:read",
|
|
7995
8036
|
"assets:download",
|
|
@@ -8666,9 +8707,9 @@ const MOCK_ASSET_FILTER_FIELDS = {
|
|
|
8666
8707
|
"=out="
|
|
8667
8708
|
]
|
|
8668
8709
|
},
|
|
8669
|
-
"classification.moderation.
|
|
8710
|
+
"classification.moderation.decision": {
|
|
8670
8711
|
kind: "text",
|
|
8671
|
-
nullable:
|
|
8712
|
+
nullable: true,
|
|
8672
8713
|
operators: [
|
|
8673
8714
|
"==",
|
|
8674
8715
|
"!=",
|
|
@@ -9063,7 +9104,7 @@ const searchFieldValues = (asset) => [
|
|
|
9063
9104
|
["type", asset.type],
|
|
9064
9105
|
["content.format", asset.content?.format ?? ""],
|
|
9065
9106
|
["content.extension", asset.content?.extension ?? ""],
|
|
9066
|
-
["classification.moderation.
|
|
9107
|
+
["classification.moderation.decision", asset.classification.moderation.decision ?? "pending"]
|
|
9067
9108
|
];
|
|
9068
9109
|
/** The API's keyword score for the whole lowercased query. */
|
|
9069
9110
|
const keywordScore = (values, query) => {
|
|
@@ -9118,15 +9159,12 @@ const REVIEW_DECISIONS = [
|
|
|
9118
9159
|
*/
|
|
9119
9160
|
const MOCK_OPERATIONS = [
|
|
9120
9161
|
"assets.list",
|
|
9121
|
-
"assets.iterate",
|
|
9122
9162
|
"assets.search",
|
|
9123
9163
|
"assets.retrieve",
|
|
9124
9164
|
"assets.waitForDecision",
|
|
9125
9165
|
"assets.update",
|
|
9126
9166
|
"assets.listChildren",
|
|
9127
|
-
"assets.iterateChildren",
|
|
9128
9167
|
"assets.listTimeline",
|
|
9129
|
-
"assets.iterateTimeline",
|
|
9130
9168
|
"assets.create",
|
|
9131
9169
|
"assets.classify",
|
|
9132
9170
|
"assets.uploadPart",
|
|
@@ -9142,26 +9180,21 @@ const MOCK_OPERATIONS = [
|
|
|
9142
9180
|
"cdn.getAssetInfo",
|
|
9143
9181
|
"cdn.signAssetUrl",
|
|
9144
9182
|
"events.list",
|
|
9145
|
-
"events.pages",
|
|
9146
9183
|
"folders.list",
|
|
9147
|
-
"folders.iterate",
|
|
9148
9184
|
"folders.retrieve",
|
|
9149
9185
|
"folders.create",
|
|
9150
9186
|
"folders.update",
|
|
9151
9187
|
"folders.delete",
|
|
9152
9188
|
"folders.move",
|
|
9153
9189
|
"hashLists.list",
|
|
9154
|
-
"hashLists.iterate",
|
|
9155
9190
|
"hashLists.retrieve",
|
|
9156
9191
|
"hashLists.create",
|
|
9157
9192
|
"hashLists.update",
|
|
9158
9193
|
"hashLists.delete",
|
|
9159
9194
|
"hashLists.listEntries",
|
|
9160
|
-
"hashLists.iterateEntries",
|
|
9161
9195
|
"hashLists.addEntry",
|
|
9162
9196
|
"hashLists.removeEntry",
|
|
9163
9197
|
"policies.list",
|
|
9164
|
-
"policies.iterate",
|
|
9165
9198
|
"policies.retrieve",
|
|
9166
9199
|
"policies.create",
|
|
9167
9200
|
"policies.update",
|
|
@@ -9172,7 +9205,6 @@ const MOCK_OPERATIONS = [
|
|
|
9172
9205
|
"policies.retrieveAssigned",
|
|
9173
9206
|
"policies.assign",
|
|
9174
9207
|
"lenses.list",
|
|
9175
|
-
"lenses.iterate",
|
|
9176
9208
|
"lenses.create",
|
|
9177
9209
|
"lenses.retrieve",
|
|
9178
9210
|
"lenses.update",
|
|
@@ -9180,7 +9212,6 @@ const MOCK_OPERATIONS = [
|
|
|
9180
9212
|
"ensureLens",
|
|
9181
9213
|
"ensureLenses",
|
|
9182
9214
|
"uploadPresets.list",
|
|
9183
|
-
"uploadPresets.iterate",
|
|
9184
9215
|
"uploadPresets.ensure",
|
|
9185
9216
|
"uploadPresets.delete",
|
|
9186
9217
|
"projectSettings.get",
|
|
@@ -9238,7 +9269,7 @@ const toEventAsset = (asset) => ({
|
|
|
9238
9269
|
classification: {
|
|
9239
9270
|
status: asset.classification.status,
|
|
9240
9271
|
testInput: asset.classification.testInput,
|
|
9241
|
-
moderation: {
|
|
9272
|
+
moderation: { decision: asset.classification.moderation.decision }
|
|
9242
9273
|
},
|
|
9243
9274
|
content: { status: asset.content.status }
|
|
9244
9275
|
});
|
|
@@ -9546,29 +9577,29 @@ const operationsOf = (request) => {
|
|
|
9546
9577
|
const [root] = segments;
|
|
9547
9578
|
if (root === "projects") {
|
|
9548
9579
|
switch (segments.slice(2).join("/")) {
|
|
9549
|
-
case "events": return ["events.list"
|
|
9550
|
-
case "lenses": return method === "GET" ? ["lenses.list"
|
|
9551
|
-
case "folders": return method === "GET" ? ["folders.list"
|
|
9552
|
-
case "hash-lists": return method === "GET" ? ["hashLists.list"
|
|
9580
|
+
case "events": return ["events.list"];
|
|
9581
|
+
case "lenses": return method === "GET" ? ["lenses.list"] : method === "POST" ? ["lenses.create"] : ["ensureLenses", "ensureLens"];
|
|
9582
|
+
case "folders": return method === "GET" ? ["folders.list"] : ["folders.create"];
|
|
9583
|
+
case "hash-lists": return method === "GET" ? ["hashLists.list"] : ["hashLists.create"];
|
|
9553
9584
|
case "policy": return method === "GET" ? ["policies.retrieveAssigned"] : ["policies.assign"];
|
|
9554
|
-
case "upload-presets": return method === "GET" ? ["uploadPresets.list"
|
|
9585
|
+
case "upload-presets": return method === "GET" ? ["uploadPresets.list"] : ["uploadPresets.ensure"];
|
|
9555
9586
|
case "settings": return method === "GET" ? ["projectSettings.get"] : ["projectSettings.update"];
|
|
9556
9587
|
case "metadata-fields": return method === "GET" ? ["metadataFields.list"] : ["metadataFields.ensure"];
|
|
9557
9588
|
case "assets/search": return ["assets.search"];
|
|
9558
9589
|
case "assets/batch": return ["assets.batch"];
|
|
9559
9590
|
case "signed-asset-urls": return ["cdn.signAssetUrl"];
|
|
9560
9591
|
case "assets":
|
|
9561
|
-
if (method === "GET") return ["assets.list"
|
|
9592
|
+
if (method === "GET") return ["assets.list"];
|
|
9562
9593
|
if (query.get("wait") === "false") return ["assets.create"];
|
|
9563
9594
|
return isTextUpload(request) ? ["assets.classify", "text.classify"] : ["assets.classify"];
|
|
9564
9595
|
}
|
|
9565
|
-
if (segments[2] === "assets" && segments[4] === "timeline" && segments.length === 5) return ["assets.listTimeline"
|
|
9596
|
+
if (segments[2] === "assets" && segments[4] === "timeline" && segments.length === 5) return ["assets.listTimeline"];
|
|
9566
9597
|
if (segments[2] === "metadata-fields" && segments.length === 4) return ["metadataFields.delete"];
|
|
9567
9598
|
return [];
|
|
9568
9599
|
}
|
|
9569
9600
|
if (root === "policies") {
|
|
9570
9601
|
const [, policyId, policyAction] = segments;
|
|
9571
|
-
if (policyId === void 0) return method === "GET" ? ["policies.list"
|
|
9602
|
+
if (policyId === void 0) return method === "GET" ? ["policies.list"] : ["policies.create"];
|
|
9572
9603
|
if (policyAction === "reset") return ["policies.reset"];
|
|
9573
9604
|
if (policyAction === "upgrade") return ["policies.upgrade"];
|
|
9574
9605
|
if (policyAction === "automatic-updates") return ["policies.setAutomaticUpdates"];
|
|
@@ -9587,7 +9618,7 @@ const operationsOf = (request) => {
|
|
|
9587
9618
|
return method === "GET" ? ["folders.retrieve"] : method === "PATCH" ? ["folders.update"] : ["folders.delete"];
|
|
9588
9619
|
}
|
|
9589
9620
|
if (root === "hash-lists" && id !== void 0) {
|
|
9590
|
-
if (action === "entries") return method === "GET" ? ["hashLists.listEntries"
|
|
9621
|
+
if (action === "entries") return method === "GET" ? ["hashLists.listEntries"] : ["hashLists.addEntry"];
|
|
9591
9622
|
return method === "GET" ? ["hashLists.retrieve"] : method === "PATCH" ? ["hashLists.update"] : ["hashLists.delete"];
|
|
9592
9623
|
}
|
|
9593
9624
|
if (root === "hash-list-entries" && id !== void 0) return ["hashLists.removeEntry"];
|
|
@@ -9595,7 +9626,7 @@ const operationsOf = (request) => {
|
|
|
9595
9626
|
switch (action) {
|
|
9596
9627
|
case void 0: return method === "GET" ? ["assets.retrieve", "assets.waitForDecision"] : method === "PATCH" ? ["assets.update"] : ["assets.delete"];
|
|
9597
9628
|
case "content": return ["assets.removeContent"];
|
|
9598
|
-
case "children": return ["assets.listChildren"
|
|
9629
|
+
case "children": return ["assets.listChildren"];
|
|
9599
9630
|
case "part": return ["assets.uploadPart"];
|
|
9600
9631
|
case "move": return ["assets.move"];
|
|
9601
9632
|
case "retry": return ["assets.retry"];
|
|
@@ -9693,7 +9724,7 @@ var MockCalmLensApi = class {
|
|
|
9693
9724
|
if (!asset) return this.pushEvent(input);
|
|
9694
9725
|
const snapshot = toEventAsset(asset);
|
|
9695
9726
|
const announced = ANNOUNCED_STATUS[input.type];
|
|
9696
|
-
if (announced) snapshot.classification.moderation.
|
|
9727
|
+
if (announced) snapshot.classification.moderation.decision = announced;
|
|
9697
9728
|
return this.pushEvent({
|
|
9698
9729
|
...input,
|
|
9699
9730
|
asset: snapshot
|
|
@@ -9767,8 +9798,8 @@ var MockCalmLensApi = class {
|
|
|
9767
9798
|
if (note.length > MAX_DECISION_NOTE_LENGTH) throw invalidField("validation/too-big", "note");
|
|
9768
9799
|
const asset = await this.findOwnAsset(assetId);
|
|
9769
9800
|
if (asset.upload.status === "uploading" || asset.classification.status === "processing") throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_PROCESSING);
|
|
9770
|
-
const status = asset.classification.moderation.
|
|
9771
|
-
if (decision !== "purged" && decision !== "blocked" && status ===
|
|
9801
|
+
const status = asset.classification.moderation.decision;
|
|
9802
|
+
if (decision !== "purged" && decision !== "blocked" && status === null) throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_DECISION_NOT_ALLOWED);
|
|
9772
9803
|
if (status === decision) throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_DECISION_UNCHANGED);
|
|
9773
9804
|
if (decision !== "purged" && decision !== "blocked" && status === "purged") throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_CONTENT_PURGED);
|
|
9774
9805
|
return this.recordDecision(asset, decision, { note });
|
|
@@ -10481,7 +10512,7 @@ var MockCalmLensApi = class {
|
|
|
10481
10512
|
}
|
|
10482
10513
|
async retryAsset(assetId) {
|
|
10483
10514
|
const asset = await this.findOwnAsset(assetId);
|
|
10484
|
-
if (asset.classification.status !== "failed" || asset.classification.moderation.
|
|
10515
|
+
if (asset.classification.status !== "failed" || asset.classification.moderation.decision !== null) throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_NOT_RETRYABLE);
|
|
10485
10516
|
if (asset.content.status === "removed") throw fail(require_ModerationContextLimits.API_ERROR_CODES.ASSET_CONTENT_UNAVAILABLE);
|
|
10486
10517
|
const retried = await this.databaseStorage.updateAsset(await this.applyOutcome(asset, "pending"));
|
|
10487
10518
|
this.recordLifecycleEvent("asset.retried", retried);
|
|
@@ -10520,7 +10551,7 @@ var MockCalmLensApi = class {
|
|
|
10520
10551
|
},
|
|
10521
10552
|
{
|
|
10522
10553
|
key: "moderation-status",
|
|
10523
|
-
value: asset.classification.moderation.
|
|
10554
|
+
value: asset.classification.moderation.decision
|
|
10524
10555
|
}
|
|
10525
10556
|
]
|
|
10526
10557
|
});
|
|
@@ -10793,7 +10824,7 @@ var MockCalmLensApi = class {
|
|
|
10793
10824
|
progress: null,
|
|
10794
10825
|
testInput: false,
|
|
10795
10826
|
moderation: {
|
|
10796
|
-
|
|
10827
|
+
decision: null,
|
|
10797
10828
|
manualReviews: [],
|
|
10798
10829
|
automatedStatus: null,
|
|
10799
10830
|
policy: null,
|
|
@@ -11126,7 +11157,7 @@ var MockCalmLensApi = class {
|
|
|
11126
11157
|
completedAt: decided ? now : null,
|
|
11127
11158
|
moderation: {
|
|
11128
11159
|
...asset.classification.moderation,
|
|
11129
|
-
|
|
11160
|
+
decision: decided ? outcome : null,
|
|
11130
11161
|
...report
|
|
11131
11162
|
}
|
|
11132
11163
|
}
|
|
@@ -11177,7 +11208,7 @@ var MockCalmLensApi = class {
|
|
|
11177
11208
|
classification: {
|
|
11178
11209
|
status: asset.classification.status,
|
|
11179
11210
|
failureReason: asset.classification.failureReason,
|
|
11180
|
-
...preset.showDecisions !== false && { moderation: {
|
|
11211
|
+
...preset.showDecisions !== false && { moderation: { decision: asset.classification.moderation.decision } }
|
|
11181
11212
|
}
|
|
11182
11213
|
});
|
|
11183
11214
|
const [assetId, action] = rest;
|
|
@@ -11645,7 +11676,7 @@ var MockCalmLensApi = class {
|
|
|
11645
11676
|
const grants = hasApiKey ? this.grants : [];
|
|
11646
11677
|
const folders = await this.databaseStorage.listFolders?.(this.projectId) ?? [];
|
|
11647
11678
|
const canDownload = () => permits(grants, "assets:download", asset.folderId ?? null, folders);
|
|
11648
|
-
const status = asset.classification.moderation.
|
|
11679
|
+
const status = asset.classification.moderation.decision;
|
|
11649
11680
|
const isHead = request.method === "HEAD";
|
|
11650
11681
|
const { rendered, preview } = asset.content;
|
|
11651
11682
|
if (asset.visibility !== "public" && !grant && !hasApiKey && resource !== "info") return notFound();
|
|
@@ -11743,7 +11774,7 @@ var MockCalmLensApi = class {
|
|
|
11743
11774
|
} catch {
|
|
11744
11775
|
return this.jsonResponse(400, { code: "viewer-claims/invalid" }, url);
|
|
11745
11776
|
}
|
|
11746
|
-
const status = asset.classification.moderation.
|
|
11777
|
+
const status = asset.classification.moderation.decision;
|
|
11747
11778
|
const restrictedInfo = isPrivate || status === "blocked" || status === "purged";
|
|
11748
11779
|
if (restrictedInfo && !authorised) return this.jsonResponse(403, { code: "asset/not-available" }, url);
|
|
11749
11780
|
const availability = asset.content.safetyHold || asset.upload.status === "uploading" || status === "blocked" || status === "purged" || asset.classification.status === "failed" || asset.content.status === "removed" ? "unavailable" : status === "age-restricted" && claims.ageConfirmed !== true ? "age-restricted" : "available";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./CalmLensTypes-
|
|
2
|
-
import {
|
|
1
|
+
import "./CalmLensTypes-Df8eBgWB.js";
|
|
2
|
+
import { K as AssetOptions, Z as AssetView, ct as PdfAssetOptions, ft as ViewerOptions, lt as SpreadsheetViewerOptions, mt as WebsiteViewerOptions, ot as DocumentViewerOptions, q as AssetSession, st as ImageViewerOptions, ut as TextViewerOptions } from "./Core-CREGGR0L.js";
|
|
3
3
|
import "pdfjs-dist";
|
|
4
4
|
/** A viewer mounted into an element, which it owns the children of. */
|
|
5
5
|
interface AssetViewer<O extends ViewerOptions = ViewerOptions> {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
-
const require_UploadController = require("./UploadController-
|
|
3
|
-
require("./Core-
|
|
1
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-D4iwqoN_.js");
|
|
2
|
+
const require_UploadController = require("./UploadController-B_lKxvpM.js");
|
|
3
|
+
require("./Core-DAf9lqe2.js");
|
|
4
4
|
// src/ui/viewers/PdfLoader.ts
|
|
5
5
|
let loading;
|
|
6
6
|
/**
|
|
@@ -398,7 +398,9 @@ var DocumentViewer = class extends ViewerBase {
|
|
|
398
398
|
toolbar.insertBefore(next, count.nextSibling);
|
|
399
399
|
page.addEventListener("change", () => this.#go(Number(page.value)));
|
|
400
400
|
page.addEventListener("keydown", (event) => {
|
|
401
|
-
if (event.key
|
|
401
|
+
if (event.key !== "Enter") return;
|
|
402
|
+
event.preventDefault();
|
|
403
|
+
if (!event.isComposing && event.keyCode !== 229) this.#go(Number(page.value));
|
|
402
404
|
});
|
|
403
405
|
zoomOut.addEventListener("click", () => this.#setZoom(this.#scale / ZOOM_STEP));
|
|
404
406
|
zoomIn.addEventListener("click", () => this.#setZoom(this.#scale * ZOOM_STEP));
|
package/cjs/ui.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { C as ViewerState, S as AssetViewer, _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as createWebsiteViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as createDocumentViewer, y as createImageViewer } from "./ui-
|
|
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 CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, type DocumentViewerOptions, ICONS, ICON_ATTRIBUTES, type IconName, type ImageViewerOptions, type MediaPlayback, MediaStreamPlayer, type MountedViewerKind, type PdfAssetOptions, type ProgressFetchOptions, type SpreadsheetCell, type SpreadsheetRow, type SpreadsheetSheet, type SpreadsheetViewerOptions, type TextViewerOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, VIEWER_STYLES, type ViewerAsset, type ViewerMessages, type ViewerOptions, type ViewerState, type ViewerTextOptions, type WebsiteViewerOptions, createDocumentViewer, createImageViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, createWebsiteViewer, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex };
|
|
1
|
+
import { $ as getAssetAspectRatio, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, I as UploadItem, J as AssetSessionState, K as AssetOptions, L as UploadSnapshot, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions, Q as MediaPlayback, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as AssetViewerKind, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as PdfAssetOptions, d as AssetDisplayOptions, dt as ViewerAsset, et as getAssetView, f as AssetEventHandlers, ft as ViewerOptions, g as CalmLensMessages, gt as isSpreadsheetFormat, h as UploaderProps, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as pickAssetSource, j as CustomUploadResult, k as CalmLensUpload, l as IconName, lt as SpreadsheetViewerOptions, m as UploaderDisplayOptions, mt as WebsiteViewerOptions, n as CalmLensTheme, nt as getPeakHeights, o as createProgressFetch, ot as DocumentViewerOptions, p as AssetProps, pt as ViewerTextOptions, q as AssetSession, r as resolveTheme, rt as getPlayedPercent, s as ICONS, st as ImageViewerOptions, t as CALMLENS_THEME, tt as getAssetViewKey, u as ASSET_FILE_ICON_SIZE, ut as TextViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage, z as createUploadController } from "./Core-CREGGR0L.js";
|
|
2
|
+
import { C as ViewerState, S as AssetViewer, _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as createWebsiteViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as createDocumentViewer, y as createImageViewer } from "./ui-BwFPFrno.js";
|
|
3
|
+
export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, type AssetDisplay, type AssetDisplayOptions, type AssetDocumentOptions, type AssetEventHandlers, type AssetImageOptions, type AssetImageSource, type AssetOptions, type AssetProps, AssetSession, type AssetSessionState, type AssetSpreadsheetOptions, type AssetVideoOptions, type AssetView, type AssetViewer, type AssetViewerKind, AssetViewerMount, AssetViewerName, AssetViewerOptionsByKind, CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensProvidedOptions, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, type DocumentViewerOptions, ICONS, ICON_ATTRIBUTES, type IconName, type ImageViewerOptions, type MediaPlayback, MediaStreamPlayer, type MountedViewerKind, type PdfAssetOptions, type ProgressFetchOptions, type SpreadsheetCell, type SpreadsheetRow, type SpreadsheetSheet, type SpreadsheetViewerOptions, type TextViewerOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, VIEWER_STYLES, type ViewerAsset, type ViewerMessages, type ViewerOptions, type ViewerState, type ViewerTextOptions, type WebsiteViewerOptions, createDocumentViewer, createImageViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, createWebsiteViewer, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, withProvidedOptions };
|
package/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_UploadController = require("./UploadController-
|
|
4
|
-
const require_Core = require("./Core-
|
|
2
|
+
const require_ui = require("./ui-CvlJmRYM.js");
|
|
3
|
+
const require_UploadController = require("./UploadController-B_lKxvpM.js");
|
|
4
|
+
const require_Core = require("./Core-DAf9lqe2.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;
|
|
@@ -48,3 +48,4 @@ exports.resolveMessages = require_Core.resolveMessages;
|
|
|
48
48
|
exports.resolveTheme = require_Core.resolveTheme;
|
|
49
49
|
exports.resolveViewerMessages = require_ui.resolveViewerMessages;
|
|
50
50
|
exports.spreadsheetColumnIndex = require_ui.spreadsheetColumnIndex;
|
|
51
|
+
exports.withProvidedOptions = require_UploadController.withProvidedOptions;
|
package/cjs/vue.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./index-
|
|
3
|
-
import { $ as
|
|
4
|
-
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-
|
|
5
|
-
import { C as ViewerState, S as AssetViewer, _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as createWebsiteViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as createDocumentViewer, y as createImageViewer } from "./ui-
|
|
6
|
-
import { MaybeRefOrGetter, PropType, ShallowRef } from "vue";
|
|
1
|
+
import { O as CalmLensAppClientOptions, g as AssetModerationStatus, i as AssetAvailability, tn as ViewerClaims } from "./CalmLensTypes-Df8eBgWB.js";
|
|
2
|
+
import "./index-CtpQldn_.js";
|
|
3
|
+
import { $ as getAssetAspectRatio, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, J as AssetSessionState, K as AssetOptions, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, Q as MediaPlayback, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as AssetViewerKind, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as PdfAssetOptions, d as AssetDisplayOptions, dt as ViewerAsset, et as getAssetView, f as AssetEventHandlers, ft as ViewerOptions, g as CalmLensMessages, gt as isSpreadsheetFormat, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as pickAssetSource, j as CustomUploadResult, l as IconName, lt as SpreadsheetViewerOptions, m as UploaderDisplayOptions, mt as WebsiteViewerOptions, n as CalmLensTheme, nt as getPeakHeights, o as createProgressFetch, ot as DocumentViewerOptions, p as AssetProps, pt as ViewerTextOptions, q as AssetSession, r as resolveTheme, rt as getPlayedPercent, s as ICONS, st as ImageViewerOptions, t as CALMLENS_THEME, tt as getAssetViewKey, u as ASSET_FILE_ICON_SIZE, ut as TextViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage } from "./Core-CREGGR0L.js";
|
|
4
|
+
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-zYWKtFSs.js";
|
|
5
|
+
import { C as ViewerState, S as AssetViewer, _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as createWebsiteViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as createDocumentViewer, y as createImageViewer } from "./ui-BwFPFrno.js";
|
|
6
|
+
import { App, MaybeRefOrGetter, PropType, ShallowRef } from "vue";
|
|
7
7
|
/** Shows an image asset's rendered file, fitted to the element, over its placeholder. */
|
|
8
8
|
export declare const CalmLensImageViewer: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
9
9
|
/** The asset URL, public or signed. */
|
|
@@ -714,12 +714,19 @@ export interface UseCalmLensUploadResult<F extends UploadFile = File> {
|
|
|
714
714
|
clear: UploadController<F>["clear"];
|
|
715
715
|
start: UploadController<F>["start"];
|
|
716
716
|
}
|
|
717
|
+
/**
|
|
718
|
+
* Gives every `CalmLensUploader` and `useCalmLensUpload` in this component's descendants these
|
|
719
|
+
* upload options, such as `uploadPresetId` and `tokenUrl`, so they needn't be passed to each one.
|
|
720
|
+
* Call it in `setup`, or pass the app to provide them app-wide. An option a component sets itself
|
|
721
|
+
* wins, and a nested call adds to the outer one's options.
|
|
722
|
+
*/
|
|
723
|
+
export declare const provideCalmLens: <F extends UploadFile = File>(options: CalmLensProvidedOptions<F>, app?: App) => void;
|
|
717
724
|
/**
|
|
718
725
|
* Uploads files through an upload preset and keeps `snapshot` up to date as each one uploads and
|
|
719
726
|
* is checked. Use it to build your own upload UI; `CalmLensUploader` is built on it. Uploads
|
|
720
727
|
* still running when the component unmounts are cancelled.
|
|
721
728
|
*/
|
|
722
|
-
export declare const useCalmLensUpload: <F extends UploadFile = File>(
|
|
729
|
+
export declare const useCalmLensUpload: <F extends UploadFile = File>(own: MaybeRefOrGetter<UploadControllerOptions<F>>) => UseCalmLensUploadResult<F>;
|
|
723
730
|
/**
|
|
724
731
|
* A drop zone and file list that uploads through an upload preset, shows each file's progress
|
|
725
732
|
* and moderation decision, and emits `uploaded` for finished uploads.
|
|
@@ -1090,4 +1097,4 @@ export declare const CalmLensAsset: import("vue").DefineComponent<import("vue").
|
|
|
1090
1097
|
messages: Partial<CalmLensMessages>;
|
|
1091
1098
|
onAgeConfirmRequest: () => void;
|
|
1092
1099
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
1093
|
-
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 CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, type DocumentViewerOptions, ICONS, ICON_ATTRIBUTES, type IconName, type ImageViewerOptions, type MediaPlayback, MediaStreamPlayer, type MountedViewerKind, type PdfAssetOptions, type ProgressFetchOptions, type SpreadsheetCell, type SpreadsheetRow, type SpreadsheetSheet, type SpreadsheetViewerOptions, type TextViewerOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, VIEWER_STYLES, type ViewerAsset, type ViewerMessages, type ViewerOptions, type ViewerState, type ViewerTextOptions, type WebsiteViewerOptions, createDocumentViewer, createImageViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, createWebsiteViewer, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex };
|
|
1100
|
+
export { ASSET_FILE_ICON_SIZE, ASSET_VIEWERS, type AssetDisplay, type AssetDisplayOptions, type AssetDocumentOptions, type AssetEventHandlers, type AssetImageOptions, type AssetImageSource, type AssetOptions, type AssetProps, AssetSession, type AssetSessionState, type AssetSpreadsheetOptions, type AssetVideoOptions, type AssetView, type AssetViewer, type AssetViewerKind, AssetViewerMount, AssetViewerName, AssetViewerOptionsByKind, CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensProvidedOptions, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, DEFAULT_VIEWER_MESSAGES, type DocumentViewerOptions, ICONS, ICON_ATTRIBUTES, type IconName, type ImageViewerOptions, type MediaPlayback, MediaStreamPlayer, type MountedViewerKind, type PdfAssetOptions, type ProgressFetchOptions, type SpreadsheetCell, type SpreadsheetRow, type SpreadsheetSheet, type SpreadsheetViewerOptions, type TextViewerOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, VIEWER_STYLES, type ViewerAsset, type ViewerMessages, type ViewerOptions, type ViewerState, type ViewerTextOptions, type WebsiteViewerOptions, createDocumentViewer, createImageViewer, createProgressFetch, createSpreadsheetViewer, createTextViewer, createUploadController, createWebsiteViewer, describeUploadItem, describeUploader, formatBytes, formatMessage, formatViewerMessage, getAssetAspectRatio, getAssetView, getAssetViewKey, getAssetViewerKind, getDropzoneHint, getMountedViewerOptions, getPeakHeights, getPlayedPercent, getSpreadsheetPage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, isMountedViewerKind, isSpreadsheetFormat, loadPdfJs, parseSpreadsheetText, pickAssetSource, resolveMessages, resolveTheme, resolveViewerMessages, spreadsheetColumnIndex, withProvidedOptions };
|
package/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_UploadController = require("./UploadController-
|
|
4
|
-
const require_Core = require("./Core-
|
|
2
|
+
const require_ui = require("./ui-CvlJmRYM.js");
|
|
3
|
+
const require_UploadController = require("./UploadController-B_lKxvpM.js");
|
|
4
|
+
const require_Core = require("./Core-DAf9lqe2.js");
|
|
5
5
|
const require_FileIcons = require("./FileIcons-Ob003MdS.js");
|
|
6
|
-
const require_BrowserUpload = require("./BrowserUpload-
|
|
6
|
+
const require_BrowserUpload = require("./BrowserUpload-DdkcoZLH.js");
|
|
7
7
|
let vue = require("vue");
|
|
8
8
|
// src/viewers/Vue.ts
|
|
9
9
|
const optional$1 = (type) => ({
|
|
@@ -83,14 +83,30 @@ const subscribeSnapshot = (controller) => {
|
|
|
83
83
|
}, { immediate: true });
|
|
84
84
|
return snapshot;
|
|
85
85
|
};
|
|
86
|
+
const CALMLENS_PROVIDED_KEY = Symbol("calmlens");
|
|
87
|
+
/**
|
|
88
|
+
* Gives every `CalmLensUploader` and `useCalmLensUpload` in this component's descendants these
|
|
89
|
+
* upload options, such as `uploadPresetId` and `tokenUrl`, so they needn't be passed to each one.
|
|
90
|
+
* Call it in `setup`, or pass the app to provide them app-wide. An option a component sets itself
|
|
91
|
+
* wins, and a nested call adds to the outer one's options.
|
|
92
|
+
*/
|
|
93
|
+
const provideCalmLens = (options, app) => {
|
|
94
|
+
if (app) {
|
|
95
|
+
app.provide(CALMLENS_PROVIDED_KEY, options);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
(0, vue.provide)(CALMLENS_PROVIDED_KEY, require_UploadController.withProvidedOptions((0, vue.inject)(CALMLENS_PROVIDED_KEY, void 0), options));
|
|
99
|
+
};
|
|
86
100
|
/**
|
|
87
101
|
* Uploads files through an upload preset and keeps `snapshot` up to date as each one uploads and
|
|
88
102
|
* is checked. Use it to build your own upload UI; `CalmLensUploader` is built on it. Uploads
|
|
89
103
|
* still running when the component unmounts are cancelled.
|
|
90
104
|
*/
|
|
91
|
-
const useCalmLensUpload = (
|
|
92
|
-
const
|
|
93
|
-
|
|
105
|
+
const useCalmLensUpload = (own) => {
|
|
106
|
+
const provided = (0, vue.inject)(CALMLENS_PROVIDED_KEY, void 0);
|
|
107
|
+
const options = () => require_UploadController.withProvidedOptions(provided, (0, vue.toValue)(own));
|
|
108
|
+
const controller = require_UploadController.createUploadController(options());
|
|
109
|
+
(0, vue.watchEffect)(() => controller.setOptions(options()));
|
|
94
110
|
const snapshot = subscribeSnapshot(controller);
|
|
95
111
|
(0, vue.onScopeDispose)(() => controller.clear());
|
|
96
112
|
return {
|
|
@@ -258,17 +274,12 @@ const CalmLensUploader = (0, vue.defineComponent)({
|
|
|
258
274
|
(0, vue.h)("div", { class: "calmlens-upload__body" }, [
|
|
259
275
|
(0, vue.h)("span", { class: "calmlens-upload__name" }, item.file.name),
|
|
260
276
|
(0, vue.h)("span", { class: "calmlens-upload__size" }, itemView.size),
|
|
261
|
-
itemView.busy && (0, vue.h)("
|
|
277
|
+
itemView.busy && (0, vue.h)("progress", {
|
|
262
278
|
class: "calmlens-progress",
|
|
263
|
-
role: "progressbar",
|
|
264
279
|
"aria-label": itemView.message,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}, [(0, vue.h)("div", {
|
|
269
|
-
class: "calmlens-progress__bar",
|
|
270
|
-
style: itemView.progressPercent === void 0 ? void 0 : { width: `${itemView.progressPercent}%` }
|
|
271
|
-
})]),
|
|
280
|
+
max: 100,
|
|
281
|
+
value: itemView.progressPercent
|
|
282
|
+
}),
|
|
272
283
|
itemView.message && (0, vue.h)("p", {
|
|
273
284
|
class: "calmlens-upload__message",
|
|
274
285
|
role: "status"
|
|
@@ -644,8 +655,10 @@ exports.isSpreadsheetFormat = require_Core.isSpreadsheetFormat;
|
|
|
644
655
|
exports.loadPdfJs = require_ui.loadPdfJs;
|
|
645
656
|
exports.parseSpreadsheetText = require_ui.parseSpreadsheetText;
|
|
646
657
|
exports.pickAssetSource = require_Core.pickAssetSource;
|
|
658
|
+
exports.provideCalmLens = provideCalmLens;
|
|
647
659
|
exports.resolveMessages = require_Core.resolveMessages;
|
|
648
660
|
exports.resolveTheme = require_Core.resolveTheme;
|
|
649
661
|
exports.resolveViewerMessages = require_ui.resolveViewerMessages;
|
|
650
662
|
exports.spreadsheetColumnIndex = require_ui.spreadsheetColumnIndex;
|
|
651
663
|
exports.useCalmLensUpload = useCalmLensUpload;
|
|
664
|
+
exports.withProvidedOptions = require_UploadController.withProvidedOptions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createUploadController$1 } from "./UploadController-
|
|
1
|
+
import { n as createUploadController$1 } from "./UploadController-jlJdddyI.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 UploadItem$1,
|
|
2
|
-
import {
|
|
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-CREGGR0L.js";
|
|
2
|
+
import { r as UseCalmLensUploadResult$1 } from "./ReactUpload-D4htIz8X.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>;
|