calmlens 0.19.0 → 0.21.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/README.md +13 -9
- package/bin/calmlens.js +1646 -706
- package/cjs/{BrowserUpload-CJ4Xc9bR.js → BrowserUpload-CeSwiMo5.js} +1 -1
- package/{esm/BrowserUpload-RkxV_Vv7.d.ts → cjs/BrowserUpload-D-NnAN7g.d.ts} +2 -2
- package/cjs/{CalmLensAppClient-LHMEQ-UZ.js → CalmLensAppClient-0UVCuNqW.js} +30 -10
- package/cjs/{CalmLensAppClient-B5gfOB6J.d.ts → CalmLensAppClient-gG16T2py.d.ts} +13 -3
- package/cjs/{CalmLensOptionKeys-BUj7v5AG.js → CalmLensOptionKeys-CYY6elxg.js} +242 -345
- package/cjs/{CalmLensServerClient-DCSbwIBs.d.ts → CalmLensServerClient-BHx3x_nZ.d.ts} +107 -49
- package/cjs/{CalmLensServerClient-BVOEUT_v.js → CalmLensServerClient-nfu6_YEW.js} +297 -92
- package/cjs/{CalmLensTypes-DpU-hXq2.d.ts → CalmLensTypes-CUB0YYVz.d.ts} +26601 -27354
- package/cjs/{Classification-D3SkprrQ-CMnQKW13.d.ts → Classification-Q5zGpR8l-CEWjnE39.d.ts} +731 -607
- package/cjs/Core-C82YmjjX.d.ts +823 -0
- package/cjs/Core-Dc3cteU7.js +998 -0
- package/cjs/FileIcons-4qSX7DW2.d.ts +67 -0
- package/cjs/{ModerationContextLimits-FDpQmw_T.js → ModerationContextLimits-BxOmeSqq.js} +970 -278
- package/cjs/{ReactUpload-BvpW4hJi.js → ReactUpload-BK2O3dnK.js} +1 -1
- package/cjs/{ReactUpload-huIMnOJ4.d.ts → ReactUpload-DiiXfKvj.d.ts} +1 -1
- package/cjs/{TestTriggers-CMwMrbjy-K0YBzu2a.js → TestTriggers-BTyXtX0Q-ATuFDhLX.js} +343 -35
- package/{esm/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts → cjs/TestTriggers-D0pYHbkr-D5T0VdSn.d.ts} +146 -8
- package/cjs/{UploadController-D4qOZZc3.js → UploadController-DLyiLDTB.js} +34 -14
- package/cjs/{WebhookPayload-CQg8BBZQ.d.ts → WebhookPayload-BLT2y_Jy.d.ts} +93 -86
- package/cjs/app.d.ts +6 -7
- package/cjs/app.js +4 -3
- package/cjs/elements.d.ts +123 -22
- package/cjs/elements.js +553 -156
- package/cjs/file-icons.d.ts +2 -67
- package/cjs/index-CKRgjV16.d.ts +16 -0
- package/cjs/index.d.ts +5 -6
- package/cjs/index.js +3 -2
- package/cjs/react-native.d.ts +52 -11
- package/cjs/react-native.js +231 -99
- package/cjs/react.d.ts +42 -9
- package/cjs/react.js +381 -118
- package/cjs/server.d.ts +48 -7
- package/cjs/server.js +7 -3
- package/cjs/test-inputs.d.ts +2 -2
- package/cjs/test-inputs.js +13 -9
- package/cjs/testing.d.ts +29 -16
- package/cjs/testing.js +1511 -397
- package/cjs/ui-CTBUxnVp.d.ts +139 -0
- package/cjs/ui-CZ8exACq.js +1359 -0
- package/cjs/ui.d.ts +3 -2
- package/cjs/ui.js +45 -22
- package/cjs/vue.d.ts +802 -199
- package/cjs/vue.js +359 -127
- package/{cjs/BrowserUpload-RkxV_Vv7.d.ts → esm/BrowserUpload-D-NnAN7g.d.ts} +2 -2
- package/esm/{BrowserUpload-DpzS2bbj.js → BrowserUpload-i9OhCzMJ.js} +1 -1
- package/esm/{CalmLensAppClient-BjlvBweS.js → CalmLensAppClient-CK4_Py0c.js} +30 -10
- package/esm/{CalmLensAppClient-B5gfOB6J.d.ts → CalmLensAppClient-gG16T2py.d.ts} +13 -3
- package/esm/{CalmLensOptionKeys-BKez0Wiw.js → CalmLensOptionKeys-BGZlIsT2.js} +235 -338
- package/esm/{CalmLensServerClient-DCSbwIBs.d.ts → CalmLensServerClient-BHx3x_nZ.d.ts} +107 -49
- package/esm/{CalmLensServerClient-DemxbNMn.js → CalmLensServerClient-dAQUcDWb.js} +274 -93
- package/esm/{CalmLensTypes-DpU-hXq2.d.ts → CalmLensTypes-CUB0YYVz.d.ts} +26601 -27354
- package/esm/{Classification-D3SkprrQ-CMnQKW13.d.ts → Classification-Q5zGpR8l-CEWjnE39.d.ts} +731 -607
- package/esm/Core-BxeIud_S.js +843 -0
- package/esm/Core-C82YmjjX.d.ts +823 -0
- package/esm/FileIcons-4qSX7DW2.d.ts +67 -0
- package/esm/{ModerationContextLimits-lLfmyLni.js → ModerationContextLimits-B6_RalCQ.js} +911 -261
- package/esm/{ReactUpload-huIMnOJ4.d.ts → ReactUpload-DiiXfKvj.d.ts} +1 -1
- package/esm/{ReactUpload-6klucehl.js → ReactUpload-DxwVqfX1.js} +1 -1
- package/esm/{TestTriggers-CMwMrbjy-bdowBBKw.js → TestTriggers-BTyXtX0Q-GRB9jQwo.js} +320 -36
- package/{cjs/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts → esm/TestTriggers-D0pYHbkr-D5T0VdSn.d.ts} +146 -8
- package/esm/{UploadController-UxP6gj7A.js → UploadController-D9Z-h00Q.js} +34 -14
- package/esm/{WebhookPayload-CQg8BBZQ.d.ts → WebhookPayload-BLT2y_Jy.d.ts} +93 -86
- package/esm/app.d.ts +6 -7
- package/esm/app.js +3 -3
- package/esm/elements.d.ts +123 -22
- package/esm/elements.js +497 -128
- package/esm/file-icons.d.ts +2 -67
- package/esm/index-CKRgjV16.d.ts +16 -0
- package/esm/index.d.ts +5 -6
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +52 -11
- package/esm/react-native.js +205 -75
- package/esm/react.d.ts +42 -9
- package/esm/react.js +327 -91
- package/esm/server.d.ts +48 -7
- package/esm/server.js +3 -3
- package/esm/styles.css +142 -22
- package/esm/svelte/AssetViewer.svelte +25 -0
- package/esm/svelte/CalmLensAsset.svelte +318 -0
- package/esm/svelte/CalmLensDocumentViewer.svelte +7 -0
- package/esm/svelte/CalmLensImageViewer.svelte +7 -0
- package/esm/svelte/CalmLensSpreadsheetViewer.svelte +7 -0
- package/esm/svelte/CalmLensTextViewer.svelte +7 -0
- package/esm/svelte/CalmLensWebsiteViewer.svelte +7 -0
- package/esm/svelte/index.d.ts +29 -6
- package/esm/svelte/index.js +7 -2
- package/esm/test-inputs.d.ts +2 -2
- package/esm/test-inputs.js +1 -1
- package/esm/testing.d.ts +29 -16
- package/esm/testing.js +1507 -393
- package/esm/ui-CTBUxnVp.d.ts +139 -0
- package/esm/ui-Cr7s6JHm.js +1258 -0
- package/esm/ui.d.ts +3 -2
- package/esm/ui.js +4 -3
- package/esm/vue.d.ts +802 -199
- package/esm/vue.js +308 -103
- package/package.json +3 -1
- package/cjs/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +0 -67
- package/cjs/index-BcDDQJF2.d.ts +0 -253
- package/cjs/ui-B23r8BvW.d.ts +0 -539
- package/cjs/ui-Dq-cm6Rx.js +0 -586
- package/esm/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +0 -67
- package/esm/index-BcDDQJF2.d.ts +0 -253
- package/esm/svelte/CalmLensMedia.svelte +0 -134
- package/esm/ui-B23r8BvW.d.ts +0 -539
- package/esm/ui-Bn29rfAi.js +0 -461
package/esm/svelte/index.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import type { Component } from "svelte";
|
|
1
|
+
import type { Component, Snippet } from "svelte";
|
|
2
2
|
import type {
|
|
3
|
+
AssetProps,
|
|
3
4
|
CalmLensUpload as CoreCalmLensUpload,
|
|
4
5
|
UploadControllerOptions as CoreUploadControllerOptions,
|
|
5
6
|
UploaderProps as CoreUploaderProps,
|
|
6
7
|
UploadItem as CoreUploadItem,
|
|
7
8
|
UploadSnapshot as CoreUploadSnapshot,
|
|
8
|
-
|
|
9
|
+
DocumentViewerOptions,
|
|
10
|
+
ImageViewerOptions,
|
|
11
|
+
SpreadsheetViewerOptions,
|
|
12
|
+
TextViewerOptions,
|
|
9
13
|
UploadController,
|
|
10
14
|
UploadFile,
|
|
15
|
+
WebsiteViewerOptions,
|
|
11
16
|
} from "../ui.js";
|
|
12
17
|
|
|
13
18
|
// The browser's files are `File`s, so the upload types default to `File` here.
|
|
@@ -28,10 +33,28 @@ export declare const createUploadController: <F extends UploadFile = File>(
|
|
|
28
33
|
export declare const CalmLensUploader: Component<UploaderProps>;
|
|
29
34
|
|
|
30
35
|
/**
|
|
31
|
-
* Shows
|
|
32
|
-
*
|
|
33
|
-
*
|
|
36
|
+
* Shows any asset from its asset URL (public or signed), natively in the page: images, websites,
|
|
37
|
+
* video and audio with their adaptive stream, documents, text and spreadsheets, or a preview still
|
|
38
|
+
* or file icon. It reads `{src}/info` once mounted, unless `info` is given. Age-restricted content
|
|
39
|
+
* stays behind its blurred placeholder and a reveal button; content the CDN refuses shows the
|
|
40
|
+
* unavailable notice. `renderUnavailable` and `renderAgeGate` snippets replace the notices.
|
|
34
41
|
*/
|
|
35
|
-
export declare const
|
|
42
|
+
export declare const CalmLensAsset: Component<
|
|
43
|
+
AssetProps & {
|
|
44
|
+
renderUnavailable?: Snippet;
|
|
45
|
+
renderAgeGate?: Snippet<[{ placeholderUrl?: string; confirm?: () => void }]>;
|
|
46
|
+
}
|
|
47
|
+
>;
|
|
48
|
+
|
|
49
|
+
/** Shows an image asset's rendered file, fitted to the element, over its placeholder (preview). */
|
|
50
|
+
export declare const CalmLensImageViewer: Component<ImageViewerOptions>;
|
|
51
|
+
/** Shows a website asset's screenshot with a link to the original page (preview). */
|
|
52
|
+
export declare const CalmLensWebsiteViewer: Component<WebsiteViewerOptions>;
|
|
53
|
+
/** Shows a text asset's text, escaped, in a scrolling region (preview). */
|
|
54
|
+
export declare const CalmLensTextViewer: Component<TextViewerOptions>;
|
|
55
|
+
/** Shows a PDF, or a document rendered as one, a page at a time with pdf.js (preview). */
|
|
56
|
+
export declare const CalmLensDocumentViewer: Component<DocumentViewerOptions>;
|
|
57
|
+
/** Shows a spreadsheet's sheets as tabs and paged tables, from its extracted text (preview). */
|
|
58
|
+
export declare const CalmLensSpreadsheetViewer: Component<SpreadsheetViewerOptions>;
|
|
36
59
|
|
|
37
60
|
export * from "../ui.js";
|
package/esm/svelte/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
// Svelte 5 components for uploads and
|
|
1
|
+
// Svelte 5 components for uploads and assets. The upload controller is a Svelte store, so
|
|
2
2
|
// `createUploadController(...)` and `$controller.items` build your own upload UI.
|
|
3
3
|
|
|
4
4
|
export * from "../ui.js";
|
|
5
|
-
export { default as
|
|
5
|
+
export { default as CalmLensAsset } from "./CalmLensAsset.svelte";
|
|
6
|
+
export { default as CalmLensDocumentViewer } from "./CalmLensDocumentViewer.svelte";
|
|
7
|
+
export { default as CalmLensImageViewer } from "./CalmLensImageViewer.svelte";
|
|
8
|
+
export { default as CalmLensSpreadsheetViewer } from "./CalmLensSpreadsheetViewer.svelte";
|
|
9
|
+
export { default as CalmLensTextViewer } from "./CalmLensTextViewer.svelte";
|
|
6
10
|
export { default as CalmLensUploader } from "./CalmLensUploader.svelte";
|
|
11
|
+
export { default as CalmLensWebsiteViewer } from "./CalmLensWebsiteViewer.svelte";
|
package/esm/test-inputs.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { type ClassificationTestSignal, TEST_INPUT_KEY_PATTERN, TEST_INPUT_PRESETS, type TestInput, detectTestImage, detectTestTrigger, generateTestTextCode, getImageTestCategories, paintTestImage, testInputForSignal };
|
|
1
|
+
import { a as TEST_FACE_AGE_PRESETS, c as TestDetections, d as detectTestTrigger, f as generateTestTextCode, h as testInputForSignal, i as TEST_FACE_AGE_MAX, l as TestInput, m as paintTestImage, n as TEST_DETECTIONS_MAX, o as TEST_INPUT_KEY_PATTERN, p as getImageTestCategories, r as TEST_DETECTION_BOX_MAX, s as TEST_INPUT_PRESETS, t as ClassificationTestSignal, u as detectTestImage } from "./TestTriggers-D0pYHbkr-D5T0VdSn.js";
|
|
2
|
+
export { type ClassificationTestSignal, TEST_DETECTIONS_MAX, TEST_DETECTION_BOX_MAX, TEST_FACE_AGE_MAX, TEST_FACE_AGE_PRESETS, TEST_INPUT_KEY_PATTERN, TEST_INPUT_PRESETS, type TestDetections, type TestInput, detectTestImage, detectTestTrigger, generateTestTextCode, getImageTestCategories, paintTestImage, testInputForSignal };
|
package/esm/test-inputs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as
|
|
1
|
+
export { t as TEST_DETECTIONS_MAX, n as TEST_DETECTION_BOX_MAX, r as TEST_FACE_AGE_MAX, i as TEST_FACE_AGE_PRESETS, a as TEST_INPUT_KEY_PATTERN, o as TEST_INPUT_PRESETS, s as detectTestImage, c as detectTestTrigger, l as generateTestTextCode, u as getImageTestCategories, f as paintTestImage, p as testInputForSignal } from "./TestTriggers-BTyXtX0Q-GRB9jQwo.js";
|
package/esm/testing.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
3
|
-
import { l as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-
|
|
4
|
-
import { t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
5
|
-
import { t as ClassificationTestSignal } from "./TestTriggers-
|
|
1
|
+
import { D as CalmLensAppClientOptions, It as SignUploadTokenOptions, O as CalmLensServerClientOptions, On as AssetBinaryPayloadInput, Rt as SignedUploadToken, mn as Folder, n as Asset, on as TypedEvent, p as AssetModeration, pn as PermissionGrant } from "./CalmLensTypes-CUB0YYVz.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-gG16T2py.js";
|
|
3
|
+
import { l as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-BLT2y_Jy.js";
|
|
4
|
+
import { t as CalmLensServerClient } from "./CalmLensServerClient-BHx3x_nZ.js";
|
|
5
|
+
import { t as ClassificationTestSignal } from "./TestTriggers-D0pYHbkr-D5T0VdSn.js";
|
|
6
6
|
import "zod";
|
|
7
7
|
/**
|
|
8
8
|
* Signs a single-use upload token with `apiKey`, locally. `CalmLensServerClient` and
|
|
@@ -42,6 +42,7 @@ declare const ID_PREFIXES: {
|
|
|
42
42
|
readonly member: "mem";
|
|
43
43
|
readonly invitation: "inv";
|
|
44
44
|
readonly transfer: "xfer";
|
|
45
|
+
readonly assetBatch: "batch";
|
|
45
46
|
readonly supportTicket: "tkt";
|
|
46
47
|
readonly supportTicketMessage: "msg";
|
|
47
48
|
readonly humanReview: "rev";
|
|
@@ -83,7 +84,7 @@ export declare class MockDecision {
|
|
|
83
84
|
notEvaluated(category: Category): this;
|
|
84
85
|
/**
|
|
85
86
|
* The report a decided asset gets, as the API sends it: every category (unflagged ones
|
|
86
|
-
* evaluated with score 0), policy-adjusted results and the automated
|
|
87
|
+
* evaluated with score 0), policy-adjusted results and the automated status and
|
|
87
88
|
* `flaggedCategories`. `undefined` for `pending` and `failed`.
|
|
88
89
|
*/
|
|
89
90
|
report(): Omit<AssetModeration, "status" | "manualReviews"> | undefined;
|
|
@@ -184,7 +185,8 @@ type MockReviewDecision = "allowed" | "limited" | "age-restricted" | "blocked" |
|
|
|
184
185
|
* method that sends it; `callsTo` and `failNextRequest` also match the others (see
|
|
185
186
|
* `MockCalmLensCall`).
|
|
186
187
|
*/
|
|
187
|
-
|
|
188
|
+
declare const MOCK_OPERATIONS: readonly ["assets.list", "assets.iterate", "assets.search", "assets.retrieve", "assets.waitForDecision", "assets.update", "assets.listChildren", "assets.iterateChildren", "assets.listTimeline", "assets.iterateTimeline", "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", "events.pages", "folders.list", "folders.iterate", "folders.retrieve", "folders.create", "folders.update", "folders.delete", "folders.move", "hashLists.list", "hashLists.iterate", "hashLists.retrieve", "hashLists.create", "hashLists.update", "hashLists.delete", "hashLists.listEntries", "hashLists.iterateEntries", "hashLists.addEntry", "hashLists.removeEntry", "policies.list", "policies.iterate", "policies.retrieve", "policies.create", "policies.update", "policies.reset", "policies.upgrade", "policies.setAutomaticUpdates", "policies.delete", "policies.retrieveAssigned", "policies.assign", "lenses.list", "lenses.iterate", "lenses.create", "lenses.retrieve", "lenses.update", "lenses.delete", "ensureLens", "ensureLenses"];
|
|
189
|
+
type MockCalmLensOperation = (typeof MOCK_OPERATIONS)[number];
|
|
188
190
|
/**
|
|
189
191
|
* One request a mock client sent, as the in-memory API received it. `operation` is the client
|
|
190
192
|
* method that sends it; requests several methods send are recorded under the first: `text.classify`
|
|
@@ -212,7 +214,7 @@ interface MockCalmLensCall {
|
|
|
212
214
|
/**
|
|
213
215
|
* What a simulated request failure does: `"transport-error"` and `"timeout"` fail the request
|
|
214
216
|
* like a network failure (`sdk/transport-error`) or a deadline (`sdk/timeout`); an API error
|
|
215
|
-
* code, such as `"
|
|
217
|
+
* code, such as `"usage/free-uploads-exhausted"`, answers with that API error and its HTTP status; a
|
|
216
218
|
* `CalmLensError` is thrown as is and any other `Error` as the cause of `sdk/transport-error`,
|
|
217
219
|
* like an exception from `fetch`.
|
|
218
220
|
*/
|
|
@@ -226,7 +228,8 @@ interface MockFailureOptions {
|
|
|
226
228
|
retryAfter?: number;
|
|
227
229
|
}
|
|
228
230
|
/** An event to add to the mock feed; omitted fields get defaults. */
|
|
229
|
-
|
|
231
|
+
/** An event to add to the feed; its `assetSequence` is assigned like the API's. */
|
|
232
|
+
type MockEventInput = Partial<Omit<TypedEvent, "type" | "assetSequence">> & {
|
|
230
233
|
type: TypedEvent["type"];
|
|
231
234
|
};
|
|
232
235
|
/** The upload preset settings a `MockCalmLensAppClient` applies, as the API would. */
|
|
@@ -236,7 +239,7 @@ interface MockUploadPreset {
|
|
|
236
239
|
/** Accepted content types, such as `["image/*"]`. Defaults to any type. */
|
|
237
240
|
allowedContentTypes?: string[];
|
|
238
241
|
maxFileSizeInBytes?: number;
|
|
239
|
-
/** Return `status` to the uploader. Defaults to `true`. */
|
|
242
|
+
/** Return `classification.moderation.status` to the uploader. Defaults to `true`. */
|
|
240
243
|
showDecisions?: boolean;
|
|
241
244
|
/** Defaults to `public`. */
|
|
242
245
|
visibility?: "public" | "private";
|
|
@@ -244,7 +247,9 @@ interface MockUploadPreset {
|
|
|
244
247
|
keepContentAfterProcessing?: boolean;
|
|
245
248
|
folderId?: string | null;
|
|
246
249
|
}
|
|
247
|
-
interface MockCalmLensServerClientOptions extends CalmLensServerClientOptions {
|
|
250
|
+
interface MockCalmLensServerClientOptions extends Omit<CalmLensServerClientOptions, "projectId"> {
|
|
251
|
+
/** Defaults to `project-1`. */
|
|
252
|
+
projectId?: string;
|
|
248
253
|
mockOptions?: {
|
|
249
254
|
databaseStorage?: MockDatabaseStorage;
|
|
250
255
|
imageStorage?: MockImageStorage;
|
|
@@ -268,7 +273,6 @@ interface MockCalmLensServerClientOptions extends CalmLensServerClientOptions {
|
|
|
268
273
|
* `completeProcessing`, and everything else is `allowed`.
|
|
269
274
|
*/
|
|
270
275
|
moderate?: MockModerate;
|
|
271
|
-
signedUrlBaseUrl?: string;
|
|
272
276
|
};
|
|
273
277
|
}
|
|
274
278
|
/**
|
|
@@ -286,7 +290,7 @@ export declare class MockCalmLensServerClient extends CalmLensServerClient {
|
|
|
286
290
|
* `mockOptions`. `maxRetries` defaults to 0, so a failed request fails once; retry backoff and
|
|
287
291
|
* `assets.waitForDecision` take no real time.
|
|
288
292
|
*/
|
|
289
|
-
constructor(
|
|
293
|
+
constructor(input: MockCalmLensServerClientOptions);
|
|
290
294
|
/**
|
|
291
295
|
* Every request sent to the mock's API and CDN, oldest first, by this client and the
|
|
292
296
|
* `MockCalmLensAppClient`s that use it, each with the client method that sent it.
|
|
@@ -298,6 +302,12 @@ export declare class MockCalmLensServerClient extends CalmLensServerClient {
|
|
|
298
302
|
* `callsTo("assets.waitForDecision")` the `assets.retrieve` requests it polls with.
|
|
299
303
|
*/
|
|
300
304
|
callsTo(operation: MockCalmLensOperation): MockCalmLensCall[];
|
|
305
|
+
/**
|
|
306
|
+
* Fetches a URL of the mock's CDN as a browser would, without the API key: a signed asset URL
|
|
307
|
+
* from `cdn.signAssetUrl` (with a resource appended), or a public one from `cdn.getAssetUrl`.
|
|
308
|
+
* The request is recorded like any other.
|
|
309
|
+
*/
|
|
310
|
+
fetchCdn(url: string, init?: RequestInit): Promise<Response>;
|
|
301
311
|
/** Forgets the requests recorded so far, so `calls` lists only later ones. */
|
|
302
312
|
clearCalls(): void;
|
|
303
313
|
/**
|
|
@@ -322,7 +332,7 @@ export declare class MockCalmLensServerClient extends CalmLensServerClient {
|
|
|
322
332
|
* Applies a reviewer's decision to a stored asset, as the portal or API would: the moderation
|
|
323
333
|
* status changes (`purged` also removes the content, with reason `requested` and an
|
|
324
334
|
* `asset.content-removed` event), the review joins `manualReviews`, and an `asset.<decision>`
|
|
325
|
-
* event
|
|
335
|
+
* event whose `actor` is a `user` joins the events feed. Rejects with
|
|
326
336
|
* `asset/not-found` for an unknown asset. It sends no request.
|
|
327
337
|
*/
|
|
328
338
|
decide(assetId: string, decision: MockReviewDecision): Promise<Asset>;
|
|
@@ -331,8 +341,11 @@ export declare class MockCalmLensServerClient extends CalmLensServerClient {
|
|
|
331
341
|
* else what `mockOptions.moderate` returns for the `complete` trigger (`allowed` by default).
|
|
332
342
|
* The asset gets the decision's report, and `asset.classified` and the automated
|
|
333
343
|
* `asset.<status>` (or `asset.failed`) join the events feed. No review is recorded, so the
|
|
334
|
-
* asset can still be moderated again.
|
|
335
|
-
* `
|
|
344
|
+
* asset can still be moderated again. A decided asset whose re-run (`assets.explain` with
|
|
345
|
+
* `rerun: true`) is still pending gets the decision in place of its old one, unless it is
|
|
346
|
+
* `pending` or `failed`. Rejects with `asset/not-found` for an unknown asset and
|
|
347
|
+
* `sdk/invalid-argument` for one that isn't processing or awaiting a pending re-run. It sends
|
|
348
|
+
* no request.
|
|
336
349
|
*/
|
|
337
350
|
completeProcessing(assetId: string, decision?: MockAssetOutcome | MockDecision): Promise<Asset>;
|
|
338
351
|
}
|