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/cjs/server.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { a as selectModerationContextItems,
|
|
2
|
-
import { $ as
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import { t as CalmLensServerClient } from "./CalmLensServerClient-DCSbwIBs.js";
|
|
1
|
+
import { a as ClassificationNotEvaluatedReason, c as ModerationQualifier, d as HashListEntry, f as ModerationContext, g as selectModerationContextItems, h as ModerationContextItem, i as ClassificationCategoryReport, l as PolicyAction, m as MODERATION_CONTEXT_USED_ITEMS, n as ClassificationCategories, o as ClassificationQualifierResults, p as MODERATION_CONTEXT_USED_CHARACTERS, r as ClassificationCategory, s as Likelihood, u as HashList } from "./Classification-Q5zGpR8l-CEWjnE39.js";
|
|
2
|
+
import { $ as HashListPage, $t as WebhookHeadersInput, A as CdnAssetReference, An as AssetHls, At as ResetPolicyOptions, B as CreateMultipartUploadPartOptions, Bn as ProcessingOptions, Bt as SubmitAssetOptions, C as AssetVisibility, Cn as Policy, Ct as MoveFolderOptions, D as CalmLensAppClientOptions, Dn as AssetSearchQuery, Dt as PolicyPage, E as BatchAssetsResponse, En as AssetSearchMatchField, Et as PolicyIdOptions, F as ClassifyTextOptions, Fn as AssetSafetyHold, Ft as SignAssetUrlOptions, G as EnsureLensesOptions, Gt as UpdatePolicyOptions, H as DecideAssetOptions, Ht as UpdateFolderOptions, I as ConnectionOptions, In as AssetSafetyHoldReason, It as SignUploadTokenOptions, J as FolderPage, Jt as UploadPresetSubmitAssetOptions, K as ExplainAssetOptions, Kt as UpgradePolicyOptions, L as CreateFolderOptions, Ln as ExtractedText, Lt as SignedAssetUrl, M as CdnResource, Mn as AssetPreview, Mt as RetryAssetOptions, N as CdnServeOptions, Nn as AssetRendered, Nt as SearchAssetsOptions, O as CalmLensServerClientOptions, Ot as RemoveAssetContentOptions, P as CdnTransform, Pn as AssetRenderedKind, Pt as SetPolicyAutomaticUpdatesOptions, Q as HashListIdOptions, Qt as WaitForAssetDecisionOptions, R as CreateHashListOptions, Rn as FileMetadata, Rt as SignedUploadToken, S as AssetUploadStatus, Sn as ProcessingFeatures, St as MoveAssetOptions, T as BatchAssetsOptions, Tn as LensType, Tt as MultipartUploadPartOptions, U as DeleteAssetOptions, Ut as UpdateHashListOptions, V as CreatePolicyOptions, Vt as UpdateAssetOptions, W as EnsureLensOptions, Wt as UpdateLensOptions, X as HashListEntryIdOptions, Xt as VerifyWebhookSignatureOptions, Y as GetAssetInfoOptions, Yt as UploadedAsset, Z as HashListEntryPage, Zt as ViewerClaims, _ as AssetSearchResponse, _n as DetectedFace, _t as ListFoldersOptions, a as AssetChildrenPage, an as EventAsset, at as IterateFoldersOptions, b as AssetType, bn as ProcessingFeatureResults, bt as ListLensesOptions, c as AssetClassificationStatus, cn as EventFact, ct as IterateLensesOptions, d as AssetContentRemovalReason, dn as EventSeverity, dt as LensIdOptions, en as WebhookPayloadInput, et as IdempotencyOptions, f as AssetContentStatus, fn as EventType, ft as LensPage, g as AssetPage, gn as BoundingBox, gt as ListEventsOptions, h as AssetModerationStatus, hn as AgeRange, ht as ListAssetsOptions, i as AssetChecksums, it as IterateAssetsOptions, j as CdnAssetUrlOptions, jn as AssetHlsRendition, jt as RetrieveAssetOptions, k as CdnAssetLocation, kn as AssetInfo, kt as RequestOptions, l as AssetContent, ln as EventFactValues, lt as IteratePoliciesOptions, m as AssetModerationDecision, mn as Folder, mt as ListAssetTimelineOptions, n as Asset, nn as AssetTimelineSegment, nt as IterateAssetChildrenOptions, o as AssetClassification, on as TypedEvent, ot as IterateHashListEntriesOptions, p as AssetModeration, pt as ListAssetChildrenOptions, q as FolderIdOptions, qt as UploadAssetPartOptions, r as AssetAvailability, rn as GetEventsResponse, rt as IterateAssetTimelineOptions, s as AssetClassificationFailureReason, sn as EventCategory, st as IterateHashListsOptions, t as AddHashListEntryOptions, tn as AssetBatchOperation, tt as ImageTransformOptions, u as AssetContentOptions, un as EventFacts, ut as Lens, v as AssetSearchResult, vn as DetectedPerson, vt as ListHashListEntriesOptions, w as AssignPolicyOptions, wn as CursorPage, wt as MultipartUploadOptions, x as AssetUpload, xn as ProcessingFeatureStage, xt as ListPoliciesOptions, y as AssetTimelinePage, yn as ProcessingFeatureId, yt as ListHashListsOptions, z as CreateLensOptions, zn as MetadataItem, zt as StreamingFeatureOptions } from "./CalmLensTypes-CUB0YYVz.js";
|
|
3
|
+
import { i as getAssetInfo, n as DEFAULT_CDN_BASE_URL, r as CDN_RESOURCES, t as SDK_VERSION } from "./index-CKRgjV16.js";
|
|
4
|
+
import { a as CalmLensErrorCode, c as SdkErrorCode, i as CalmLensError, l as ApiErrorCode, o as CalmLensErrorDetails, r as CALMLENS_ERROR_CODES, s as CalmLensErrorOptions, t as ReceivedWebhookEventPayload } from "./WebhookPayload-BLT2y_Jy.js";
|
|
5
|
+
import { t as CalmLensServerClient } from "./CalmLensServerClient-BHx3x_nZ.js";
|
|
7
6
|
export declare const WEBHOOK_DELIVERY_HEADER = "x-calmlens-delivery";
|
|
8
7
|
export declare const WEBHOOK_TIMESTAMP_HEADER = "x-calmlens-timestamp";
|
|
9
8
|
export declare const WEBHOOK_SIGNATURE_HEADER = "x-calmlens-signature";
|
|
@@ -25,9 +24,51 @@ export declare function verifyWebhookSignature(options: VerifyWebhookSignatureOp
|
|
|
25
24
|
* so keep a default branch when you switch on `type`.
|
|
26
25
|
*/
|
|
27
26
|
export declare function parseWebhookEvent(options: VerifyWebhookSignatureOptions): Promise<ReceivedWebhookEventPayload>;
|
|
27
|
+
type FactsOf<TEvent> = TEvent extends {
|
|
28
|
+
facts: ReadonlyArray<infer TFact>;
|
|
29
|
+
} ? TFact : never;
|
|
30
|
+
type FactValue<TEvent, TKey> = Extract<FactsOf<TEvent>, {
|
|
31
|
+
key: TKey;
|
|
32
|
+
}> extends {
|
|
33
|
+
value: infer V;
|
|
34
|
+
} ? V : unknown;
|
|
35
|
+
/**
|
|
36
|
+
* The value of one of an event's facts, by key, or `undefined` when the event doesn't carry it.
|
|
37
|
+
* Typed by the event's `type`, so `getEventFact(event, "flagged-categories")` on an
|
|
38
|
+
* `asset.blocked` event is a list of categories. The fact's `url`, when it has one, is on the fact
|
|
39
|
+
* in `event.facts`.
|
|
40
|
+
*/
|
|
41
|
+
export declare const getEventFact: <TEvent extends {
|
|
42
|
+
facts?: ReadonlyArray<{
|
|
43
|
+
key: string;
|
|
44
|
+
value: unknown;
|
|
45
|
+
}>;
|
|
46
|
+
}, TKey extends FactsOf<TEvent> extends {
|
|
47
|
+
key: infer K;
|
|
48
|
+
} ? K : string>(event: TEvent, key: TKey) => FactValue<TEvent, TKey> | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* An event's facts as an object of values by key, such as `{ "flagged-categories": ["hate"] }`.
|
|
51
|
+
* A key the event repeats keeps its first value, as `getEventFact` reads it.
|
|
52
|
+
*/
|
|
53
|
+
export declare const getEventFacts: <TEvent extends {
|
|
54
|
+
facts?: ReadonlyArray<{
|
|
55
|
+
key: string;
|
|
56
|
+
value: unknown;
|
|
57
|
+
}>;
|
|
58
|
+
}>(event: TEvent) => { [TKey in FactsOf<TEvent> extends {
|
|
59
|
+
key: infer K extends string;
|
|
60
|
+
} ? K : string]?: FactValue<TEvent, TKey>; };
|
|
28
61
|
/**
|
|
29
62
|
* Whether a webhook event is a test send from the portal or the CLI rather than a real event: it
|
|
30
63
|
* carries the registered `{ key: "test", value: true }` fact.
|
|
31
64
|
*/
|
|
32
65
|
export declare const isTestWebhookEvent: (event: Pick<ReceivedWebhookEventPayload, "facts">) => boolean;
|
|
33
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Whether to apply `event` after `lastSequence`, the highest `assetSequence` you have applied for
|
|
68
|
+
* its asset (`null` or `undefined` when none). Deliveries can arrive out of order: an event about
|
|
69
|
+
* an asset is newer only with a higher `assetSequence`, so a retried or repeated delivery of an
|
|
70
|
+
* earlier one returns `false`. Events that aren't about an asset have no sequence and are always
|
|
71
|
+
* new. Store the event's `assetSequence` per `assetId` once you have applied it.
|
|
72
|
+
*/
|
|
73
|
+
export declare const isNewerAssetEvent: (event: Pick<ReceivedWebhookEventPayload, "assetSequence">, lastSequence: number | null | undefined) => boolean;
|
|
74
|
+
export { type AddHashListEntryOptions, type AgeRange, type ApiErrorCode, type Asset, type AssetAvailability, type AssetBatchOperation, type AssetChecksums, type AssetChildrenPage, type AssetClassification, type AssetClassificationFailureReason, type AssetClassificationStatus, type AssetContent, type AssetContentOptions, type AssetContentRemovalReason, type AssetContentStatus, type AssetHls, type AssetHlsRendition, type AssetInfo, type AssetModeration, type AssetModerationDecision, type AssetModerationStatus, type AssetPage, type AssetPreview, type AssetRendered, type AssetRenderedKind, type AssetSafetyHold, type AssetSafetyHoldReason, type AssetSearchMatchField, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, type AssetTimelinePage, type AssetTimelineSegment, type AssetType, type AssetUpload, type AssetUploadStatus, type AssetVisibility, type AssignPolicyOptions, type BatchAssetsOptions, type BatchAssetsResponse, type BoundingBox, CALMLENS_ERROR_CODES, CDN_RESOURCES, type CalmLensAppClientOptions, CalmLensError, type CalmLensErrorCode, type CalmLensErrorDetails, type CalmLensErrorOptions, CalmLensServerClient, type CalmLensServerClientOptions, type CdnAssetLocation, type CdnAssetReference, type CdnAssetUrlOptions, type CdnResource, type CdnServeOptions, type CdnTransform, type ClassificationCategories, type ClassificationCategory, type ClassificationCategoryReport, type ClassificationNotEvaluatedReason, type ClassificationQualifierResults, type ClassifyTextOptions, type ConnectionOptions, type CreateFolderOptions, type CreateHashListOptions, type CreateLensOptions, type CreateMultipartUploadPartOptions, type CreatePolicyOptions, type CursorPage, DEFAULT_CDN_BASE_URL, type DecideAssetOptions, type DeleteAssetOptions, type DetectedFace, type DetectedPerson, type EnsureLensOptions, type EnsureLensesOptions, type EventAsset, type EventCategory, type EventFact, type EventFactValues, type EventFacts, type EventSeverity, type EventType, type GetEventsResponse as EventsPage, type ExplainAssetOptions, type ExtractedText, type FileMetadata, type Folder, type FolderIdOptions, type FolderPage, type GetAssetInfoOptions, type HashList, type HashListEntry, type HashListEntryIdOptions, type HashListEntryPage, type HashListIdOptions, type HashListPage, type IdempotencyOptions, type ImageTransformOptions, type IterateAssetChildrenOptions, type IterateAssetTimelineOptions, type IterateAssetsOptions, type IterateFoldersOptions, type IterateHashListEntriesOptions, type IterateHashListsOptions, type IterateLensesOptions, type IteratePoliciesOptions, type Lens, type LensIdOptions, type LensPage, type LensType, type Likelihood, type ListAssetChildrenOptions, type ListAssetTimelineOptions, type ListAssetsOptions, type ListEventsOptions, type ListFoldersOptions, type ListHashListEntriesOptions, type ListHashListsOptions, type ListLensesOptions, type ListPoliciesOptions, MODERATION_CONTEXT_USED_CHARACTERS, MODERATION_CONTEXT_USED_ITEMS, type MetadataItem, type ModerationContext, type ModerationContextItem, type ModerationQualifier, type MoveAssetOptions, type MoveFolderOptions, type MultipartUploadOptions, type MultipartUploadPartOptions, type Policy, type PolicyAction, type PolicyIdOptions, type PolicyPage, type ProcessingFeatureId, type ProcessingFeatureResults, type ProcessingFeatureStage, type ProcessingFeatures, type ProcessingOptions, type RemoveAssetContentOptions, type RequestOptions, type ResetPolicyOptions, type RetrieveAssetOptions, type RetryAssetOptions, SDK_VERSION, type SdkErrorCode, type SearchAssetsOptions, type SetPolicyAutomaticUpdatesOptions, type SignAssetUrlOptions, type SignUploadTokenOptions, type SignedAssetUrl, type SignedUploadToken, type StreamingFeatureOptions, type SubmitAssetOptions, type TypedEvent, type UpdateAssetOptions, type UpdateFolderOptions, type UpdateHashListOptions, type UpdateLensOptions, type UpdatePolicyOptions, type UpgradePolicyOptions, type UploadAssetPartOptions, type UploadPresetSubmitAssetOptions, type UploadedAsset, type VerifyWebhookSignatureOptions, type ViewerClaims, type WaitForAssetDecisionOptions, type ReceivedWebhookEventPayload as WebhookEventPayload, type WebhookHeadersInput, type WebhookPayloadInput, getAssetInfo, selectModerationContextItems };
|
package/cjs/server.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_ModerationContextLimits = require("./ModerationContextLimits-
|
|
2
|
+
const require_ModerationContextLimits = require("./ModerationContextLimits-BxOmeSqq.js");
|
|
3
3
|
require("./index.js");
|
|
4
|
-
const require_CalmLensServerClient = require("./CalmLensServerClient-
|
|
4
|
+
const require_CalmLensServerClient = require("./CalmLensServerClient-nfu6_YEW.js");
|
|
5
5
|
exports.CALMLENS_ERROR_CODES = require_ModerationContextLimits.CALMLENS_ERROR_CODES;
|
|
6
|
+
exports.CDN_RESOURCES = require_ModerationContextLimits.CDN_RESOURCES;
|
|
6
7
|
exports.CalmLensError = require_ModerationContextLimits.CalmLensError;
|
|
7
8
|
exports.CalmLensServerClient = require_CalmLensServerClient.CalmLensServerClient;
|
|
8
9
|
exports.DEFAULT_CDN_BASE_URL = require_ModerationContextLimits.DEFAULT_CDN_BASE_URL;
|
|
@@ -13,7 +14,10 @@ exports.WEBHOOK_DELIVERY_HEADER = require_CalmLensServerClient.WEBHOOK_DELIVERY_
|
|
|
13
14
|
exports.WEBHOOK_SIGNATURE_HEADER = require_CalmLensServerClient.WEBHOOK_SIGNATURE_HEADER;
|
|
14
15
|
exports.WEBHOOK_SIGNATURE_TOLERANCE_SECONDS = require_CalmLensServerClient.WEBHOOK_SIGNATURE_TOLERANCE_SECONDS;
|
|
15
16
|
exports.WEBHOOK_TIMESTAMP_HEADER = require_CalmLensServerClient.WEBHOOK_TIMESTAMP_HEADER;
|
|
16
|
-
exports.
|
|
17
|
+
exports.getAssetInfo = require_ModerationContextLimits.getAssetInfo;
|
|
18
|
+
exports.getEventFact = require_CalmLensServerClient.getEventFact;
|
|
19
|
+
exports.getEventFacts = require_CalmLensServerClient.getEventFacts;
|
|
20
|
+
exports.isNewerAssetEvent = require_CalmLensServerClient.isNewerAssetEvent;
|
|
17
21
|
exports.isTestWebhookEvent = require_CalmLensServerClient.isTestWebhookEvent;
|
|
18
22
|
exports.parseWebhookEvent = require_CalmLensServerClient.parseWebhookEvent;
|
|
19
23
|
exports.selectModerationContextItems = require_ModerationContextLimits.selectModerationContextItems;
|
package/cjs/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/cjs/test-inputs.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
2
|
+
const require_TestTriggers_BTyXtX0Q = require("./TestTriggers-BTyXtX0Q-ATuFDhLX.js");
|
|
3
|
+
exports.TEST_DETECTIONS_MAX = require_TestTriggers_BTyXtX0Q.TEST_DETECTIONS_MAX;
|
|
4
|
+
exports.TEST_DETECTION_BOX_MAX = require_TestTriggers_BTyXtX0Q.TEST_DETECTION_BOX_MAX;
|
|
5
|
+
exports.TEST_FACE_AGE_MAX = require_TestTriggers_BTyXtX0Q.TEST_FACE_AGE_MAX;
|
|
6
|
+
exports.TEST_FACE_AGE_PRESETS = require_TestTriggers_BTyXtX0Q.TEST_FACE_AGE_PRESETS;
|
|
7
|
+
exports.TEST_INPUT_KEY_PATTERN = require_TestTriggers_BTyXtX0Q.TEST_INPUT_KEY_PATTERN;
|
|
8
|
+
exports.TEST_INPUT_PRESETS = require_TestTriggers_BTyXtX0Q.TEST_INPUT_PRESETS;
|
|
9
|
+
exports.detectTestImage = require_TestTriggers_BTyXtX0Q.detectTestImage;
|
|
10
|
+
exports.detectTestTrigger = require_TestTriggers_BTyXtX0Q.detectTestTrigger;
|
|
11
|
+
exports.generateTestTextCode = require_TestTriggers_BTyXtX0Q.generateTestTextCode;
|
|
12
|
+
exports.getImageTestCategories = require_TestTriggers_BTyXtX0Q.getImageTestCategories;
|
|
13
|
+
exports.paintTestImage = require_TestTriggers_BTyXtX0Q.paintTestImage;
|
|
14
|
+
exports.testInputForSignal = require_TestTriggers_BTyXtX0Q.testInputForSignal;
|
package/cjs/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
|
}
|