calmlens 0.20.0 → 0.22.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 +15 -10
- package/bin/calmlens.js +1848 -679
- package/cjs/{BrowserUpload-C07aL9Vq.d.ts → BrowserUpload-BWjZ9ntu.d.ts} +2 -2
- package/cjs/{BrowserUpload-CjSHjx3C.js → BrowserUpload-Bwlib4Zc.js} +1 -1
- package/cjs/{CalmLensAppClient-DDLojj0P.d.ts → CalmLensAppClient-BaW3ddUR.d.ts} +13 -3
- package/cjs/{CalmLensAppClient-NaCxOVlM.js → CalmLensAppClient-DUYMo9PZ.js} +30 -10
- package/cjs/{CalmLensOptionKeys-p2QK687A.js → CalmLensOptionKeys-YvgV995V.js} +318 -374
- package/cjs/{CalmLensServerClient-BDzTthxE.js → CalmLensServerClient-3N-gdsxC.js} +346 -89
- package/cjs/CalmLensServerClient-BKzn8zmp.d.ts +353 -0
- package/cjs/{CalmLensTypes-COJbOuiv.d.ts → CalmLensTypes-BDKwThbO.d.ts} +26993 -27187
- package/cjs/{Classification-D3SkprrQ-CMnQKW13.d.ts → Classification-Q5zGpR8l-CEWjnE39.d.ts} +731 -607
- package/cjs/Core-C33pkBmf.d.ts +826 -0
- package/cjs/Core-Cm5Z1oJ9.js +1001 -0
- package/cjs/FileIcons-4qSX7DW2.d.ts +67 -0
- package/cjs/{ModerationContextLimits-2nIv7Zh3.js → ModerationContextLimits-ud1xpZRK.js} +727 -268
- package/cjs/{ReactUpload-BdTRCTGA.js → ReactUpload-DQ0BYISX.js} +1 -1
- package/cjs/{ReactUpload-CRJNPB5T.d.ts → ReactUpload-DhF8mm51.d.ts} +1 -1
- package/{esm/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts → cjs/TestTriggers-D0pYHbkr-D5T0VdSn.d.ts} +146 -8
- package/cjs/{TestTriggers-DbhsNPdg-DjvVuc2h.js → TestTriggers-D29T_R0M-D6Bu-Mln.js} +355 -47
- package/cjs/{UploadController-MLVs97Zt.js → UploadController-l8fZM2qT.js} +34 -14
- package/{esm/WebhookPayload-DkukERKE.d.ts → cjs/WebhookPayload-Dt6DttS0.d.ts} +120 -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-Bde1wjiw.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 -15
- package/cjs/testing.js +1722 -433
- package/cjs/ui-BRA4HQ8r.js +1359 -0
- package/cjs/ui-YQuvbidU.d.ts +139 -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/esm/{BrowserUpload-C07aL9Vq.d.ts → BrowserUpload-BWjZ9ntu.d.ts} +2 -2
- package/esm/{BrowserUpload-CAVkRotw.js → BrowserUpload-GRZVB0G_.js} +1 -1
- package/esm/{CalmLensAppClient-PQ9VBvlW.js → CalmLensAppClient-B5QIJ6KS.js} +30 -10
- package/esm/{CalmLensAppClient-DDLojj0P.d.ts → CalmLensAppClient-BaW3ddUR.d.ts} +13 -3
- package/esm/{CalmLensOptionKeys-Do2mPP6w.js → CalmLensOptionKeys-BG7Qrh8-.js} +317 -367
- package/esm/CalmLensServerClient-BKzn8zmp.d.ts +353 -0
- package/esm/{CalmLensServerClient-C_H5aAsV.js → CalmLensServerClient-bRUAebi-.js} +323 -90
- package/esm/{CalmLensTypes-COJbOuiv.d.ts → CalmLensTypes-BDKwThbO.d.ts} +26993 -27187
- package/esm/{Classification-D3SkprrQ-CMnQKW13.d.ts → Classification-Q5zGpR8l-CEWjnE39.d.ts} +731 -607
- package/esm/Core-BvQe4moS.js +846 -0
- package/esm/Core-C33pkBmf.d.ts +826 -0
- package/esm/FileIcons-4qSX7DW2.d.ts +67 -0
- package/esm/{ModerationContextLimits-Chw-AzgL.js → ModerationContextLimits-CrxSnVZ3.js} +682 -253
- package/esm/{ReactUpload-CMmL0R5Q.js → ReactUpload-BMO8saxT.js} +1 -1
- package/esm/{ReactUpload-CRJNPB5T.d.ts → ReactUpload-DhF8mm51.d.ts} +1 -1
- package/{cjs/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts → esm/TestTriggers-D0pYHbkr-D5T0VdSn.d.ts} +146 -8
- package/esm/{TestTriggers-DbhsNPdg-CUdrv8Nm.js → TestTriggers-D29T_R0M-Ztc74ucs.js} +332 -48
- package/esm/{UploadController-BJZghJpg.js → UploadController-DnJrWiE4.js} +34 -14
- package/{cjs/WebhookPayload-DkukERKE.d.ts → esm/WebhookPayload-Dt6DttS0.d.ts} +120 -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-Bde1wjiw.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 -15
- package/esm/testing.js +1718 -429
- package/esm/ui-YQuvbidU.d.ts +139 -0
- package/esm/ui-heryDd6g.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 +4 -2
- package/cjs/CalmLensServerClient-C-jsjn8m.d.ts +0 -259
- package/cjs/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +0 -67
- package/cjs/index-DxbJ_Xaa.d.ts +0 -253
- package/cjs/ui-BSqPGKrZ.d.ts +0 -539
- package/cjs/ui-CX1z2pD9.js +0 -586
- package/esm/CalmLensServerClient-C-jsjn8m.d.ts +0 -259
- package/esm/ModerationContext-9lGm-Mna-CcmbRnOy.d.ts +0 -67
- package/esm/index-DxbJ_Xaa.d.ts +0 -253
- package/esm/svelte/CalmLensMedia.svelte +0 -134
- package/esm/ui-BSqPGKrZ.d.ts +0 -539
- package/esm/ui-CXH7xJpb.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-C-jsjn8m.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 GetAssetInfoOptions, $n as FileMetadata, $t as UpgradePolicyOptions, A as CdnAssetReference, An as BoundingBox, At as MultipartUploadOptions, B as CreateMultipartUploadPartOptions, Bn as AssetSearchMatchField, Bt as SetPolicyAutomaticUpdatesOptions, C as AssetVisibility, Ct as ListHashListEntriesOptions, D as CalmLensAppClientOptions, Dn as PublicProjectSettings, Dt as ListUploadPresetsOptions, E as BatchAssetsResponse, En as ProjectSettingsResource, Et as ListPoliciesOptions, F as ClassifyTextOptions, Fn as ProcessingFeatureStage, Ft as RequestOptions, G as EnsureLensOptions, Gn as AssetHlsRendition, Gt as StreamingFeatureOptions, H as DecideAssetOptions, Ht as SignUploadTokenOptions, I as ConnectionOptions, In as ProcessingFeatures, It as ResetPolicyOptions, J as EnsureUploadPresetsOptions, Jn as AssetRendered, Jt as UpdateFolderOptions, K as EnsureLensesOptions, Kn as AssetHlsStatus, Kt as SubmitAssetOptions, L as CreateFolderOptions, Ln as Policy, Lt as RetrieveAssetOptions, M as CdnResource, Mn as DetectedPerson, Mt as PolicyIdOptions, N as CdnServeOptions, Nn as ProcessingFeatureId, Nt as PolicyPage, O as CalmLensServerClientOptions, On as UploadPreset, Ot as MoveAssetOptions, P as CdnTransform, Pn as ProcessingFeatureResults, Pt as RemoveAssetContentOptions, Q as FolderPage, Qn as ExtractedText, Qt as UpdateProjectSettingsOptions, R as CreateHashListOptions, Rn as CursorPage, Rt as RetryAssetOptions, S as AssetUploadStatus, Sn as EventType, St as ListFoldersOptions, T as BatchAssetsOptions, Tn as MetadataFieldsResource, Tt as ListLensesOptions, U as DeleteAssetOptions, Un as AssetInfo, Ut as SignedAssetUrl, V as CreatePolicyOptions, Vn as AssetSearchQuery, Vt as SignAssetUrlOptions, W as DeleteMetadataFieldOptions, Wn as AssetHls, Wt as SignedUploadToken, X as ExplainAssetOptions, Xn as AssetSafetyHold, Xt as UpdateLensOptions, Y as EnsureUploadPresetsResponse, Yn as AssetRenderedKind, Yt as UpdateHashListOptions, Z as FolderIdOptions, Zn as AssetSafetyHoldReason, Zt as UpdatePolicyOptions, _ as AssetSearchResponse, _n as EventCategory, _t as LensPage, a as AssetChildrenPage, an as UploadedAsset, at as ImageTransformOptions, b as AssetType, bn as EventFacts, bt as ListAssetsOptions, c as AssetClassificationStatus, cn as WaitForAssetDecisionOptions, ct as IterateAssetsOptions, d as AssetContentRemovalReason, dn as AssetBatchOperation, dt as IterateHashListsOptions, en as UploadAssetPartOptions, er as MetadataItem, et as HashListEntryIdOptions, f as AssetContentStatus, fn as AssetTimelineSegment, ft as IterateLensesOptions, g as AssetPage, gn as TypedEvent, gt as LensIdOptions, h as AssetModerationStatus, hn as EventAsset, ht as Lens, i as AssetChecksums, in as UploadPresetSubmitAssetOptions, it as IdempotencyOptions, j as CdnAssetUrlOptions, jn as DetectedFace, jt as MultipartUploadPartOptions, k as CdnAssetLocation, kn as AgeRange, kt as MoveFolderOptions, l as AssetContent, ln as WebhookHeadersInput, lt as IterateFoldersOptions, m as AssetModerationDecision, mt as IterateUploadPresetsOptions, n as Asset, nn as UploadPresetIdOptions, nt as HashListIdOptions, o as AssetClassification, on as VerifyWebhookSignatureOptions, ot as IterateAssetChildrenOptions, p as AssetModeration, pn as GetEventsResponse, pt as IteratePoliciesOptions, q as EnsureMetadataFieldsOptions, qn as AssetPreview, qt as UpdateAssetOptions, r as AssetAvailability, rn as UploadPresetPage, rt as HashListPage, s as AssetClassificationFailureReason, sn as ViewerClaims, st as IterateAssetTimelineOptions, t as AddHashListEntryOptions, tn as UploadPresetDefinition, tr as ProcessingOptions, tt as HashListEntryPage, u as AssetContentOptions, un as WebhookPayloadInput, ut as IterateHashListEntriesOptions, v as AssetSearchResult, vn as EventFact, vt as ListAssetChildrenOptions, w as AssignPolicyOptions, wn as Folder, wt as ListHashListsOptions, x as AssetUpload, xn as EventSeverity, xt as ListEventsOptions, y as AssetTimelinePage, yn as EventFactValues, yt as ListAssetTimelineOptions, z as CreateLensOptions, zn as LensType, zt as SearchAssetsOptions } from "./CalmLensTypes-BDKwThbO.js";
|
|
3
|
+
import { i as getAssetInfo, n as DEFAULT_CDN_BASE_URL, r as CDN_RESOURCES, t as SDK_VERSION } from "./index-Bde1wjiw.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-Dt6DttS0.js";
|
|
5
|
+
import { t as CalmLensServerClient } from "./CalmLensServerClient-BKzn8zmp.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 AssetHlsStatus, 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 DeleteMetadataFieldOptions, type DetectedFace, type DetectedPerson, type EnsureLensOptions, type EnsureLensesOptions, type EnsureMetadataFieldsOptions, type EnsureUploadPresetsOptions, type EnsureUploadPresetsResponse, 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 IterateUploadPresetsOptions, 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, type ListUploadPresetsOptions, MODERATION_CONTEXT_USED_CHARACTERS, MODERATION_CONTEXT_USED_ITEMS, type MetadataFieldsResource, 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 ProjectSettingsResource, type PublicProjectSettings, 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 UpdateProjectSettingsOptions, type UpgradePolicyOptions, type UploadAssetPartOptions, type UploadPreset, type UploadPresetDefinition, type UploadPresetIdOptions, type UploadPresetPage, 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-ud1xpZRK.js");
|
|
3
3
|
require("./index.js");
|
|
4
|
-
const require_CalmLensServerClient = require("./CalmLensServerClient-
|
|
4
|
+
const require_CalmLensServerClient = require("./CalmLensServerClient-3N-gdsxC.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_D29T_R0M = require("./TestTriggers-D29T_R0M-D6Bu-Mln.js");
|
|
3
|
+
exports.TEST_DETECTIONS_MAX = require_TestTriggers_D29T_R0M.TEST_DETECTIONS_MAX;
|
|
4
|
+
exports.TEST_DETECTION_BOX_MAX = require_TestTriggers_D29T_R0M.TEST_DETECTION_BOX_MAX;
|
|
5
|
+
exports.TEST_FACE_AGE_MAX = require_TestTriggers_D29T_R0M.TEST_FACE_AGE_MAX;
|
|
6
|
+
exports.TEST_FACE_AGE_PRESETS = require_TestTriggers_D29T_R0M.TEST_FACE_AGE_PRESETS;
|
|
7
|
+
exports.TEST_INPUT_KEY_PATTERN = require_TestTriggers_D29T_R0M.TEST_INPUT_KEY_PATTERN;
|
|
8
|
+
exports.TEST_INPUT_PRESETS = require_TestTriggers_D29T_R0M.TEST_INPUT_PRESETS;
|
|
9
|
+
exports.detectTestImage = require_TestTriggers_D29T_R0M.detectTestImage;
|
|
10
|
+
exports.detectTestTrigger = require_TestTriggers_D29T_R0M.detectTestTrigger;
|
|
11
|
+
exports.generateTestTextCode = require_TestTriggers_D29T_R0M.generateTestTextCode;
|
|
12
|
+
exports.getImageTestCategories = require_TestTriggers_D29T_R0M.getImageTestCategories;
|
|
13
|
+
exports.paintTestImage = require_TestTriggers_D29T_R0M.paintTestImage;
|
|
14
|
+
exports.testInputForSignal = require_TestTriggers_D29T_R0M.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 { Cn as PermissionGrant, D as CalmLensAppClientOptions, Hn as AssetBinaryPayloadInput, Ht as SignUploadTokenOptions, O as CalmLensServerClientOptions, Wt as SignedUploadToken, gn as TypedEvent, n as Asset, p as AssetModeration, wn as Folder } from "./CalmLensTypes-BDKwThbO.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-BaW3ddUR.js";
|
|
3
|
+
import { l as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-Dt6DttS0.js";
|
|
4
|
+
import { t as CalmLensServerClient } from "./CalmLensServerClient-BKzn8zmp.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,7 @@ 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
|
-
declare const MOCK_OPERATIONS: readonly ["assets.list", "assets.iterate", "assets.search", "assets.retrieve", "assets.waitForDecision", "assets.update", "assets.listChildren", "assets.iterateChildren", "assets.
|
|
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", "uploadPresets.list", "uploadPresets.iterate", "uploadPresets.ensure", "uploadPresets.delete", "projectSettings.get", "projectSettings.update", "metadataFields.list", "metadataFields.ensure", "metadataFields.delete"];
|
|
188
189
|
type MockCalmLensOperation = (typeof MOCK_OPERATIONS)[number];
|
|
189
190
|
/**
|
|
190
191
|
* One request a mock client sent, as the in-memory API received it. `operation` is the client
|
|
@@ -205,7 +206,11 @@ interface MockCalmLensCall {
|
|
|
205
206
|
query: Record<string, string>;
|
|
206
207
|
/** Request headers, with lowercase names. */
|
|
207
208
|
headers: Record<string, string>;
|
|
208
|
-
/**
|
|
209
|
+
/**
|
|
210
|
+
* The JSON body (plain text arrives as `{ name, content: { plainText, type } }`), an upload
|
|
211
|
+
* form as `{ options, file }` (the file as text for a `text/*` type, else bytes), the bytes of a
|
|
212
|
+
* later part, or `undefined`.
|
|
213
|
+
*/
|
|
209
214
|
body: unknown;
|
|
210
215
|
/** The HTTP status the mock answered with, or `undefined` when the request failed without one. */
|
|
211
216
|
status: number | undefined;
|
|
@@ -213,7 +218,7 @@ interface MockCalmLensCall {
|
|
|
213
218
|
/**
|
|
214
219
|
* What a simulated request failure does: `"transport-error"` and `"timeout"` fail the request
|
|
215
220
|
* like a network failure (`sdk/transport-error`) or a deadline (`sdk/timeout`); an API error
|
|
216
|
-
* code, such as `"
|
|
221
|
+
* code, such as `"usage/free-uploads-exhausted"`, answers with that API error and its HTTP status; a
|
|
217
222
|
* `CalmLensError` is thrown as is and any other `Error` as the cause of `sdk/transport-error`,
|
|
218
223
|
* like an exception from `fetch`.
|
|
219
224
|
*/
|
|
@@ -227,7 +232,8 @@ interface MockFailureOptions {
|
|
|
227
232
|
retryAfter?: number;
|
|
228
233
|
}
|
|
229
234
|
/** An event to add to the mock feed; omitted fields get defaults. */
|
|
230
|
-
|
|
235
|
+
/** An event to add to the feed; its `assetSequence` is assigned like the API's. */
|
|
236
|
+
type MockEventInput = Partial<Omit<TypedEvent, "type" | "assetSequence">> & {
|
|
231
237
|
type: TypedEvent["type"];
|
|
232
238
|
};
|
|
233
239
|
/** The upload preset settings a `MockCalmLensAppClient` applies, as the API would. */
|
|
@@ -237,7 +243,7 @@ interface MockUploadPreset {
|
|
|
237
243
|
/** Accepted content types, such as `["image/*"]`. Defaults to any type. */
|
|
238
244
|
allowedContentTypes?: string[];
|
|
239
245
|
maxFileSizeInBytes?: number;
|
|
240
|
-
/** Return `status` to the uploader. Defaults to `true`. */
|
|
246
|
+
/** Return `classification.moderation.status` to the uploader. Defaults to `true`. */
|
|
241
247
|
showDecisions?: boolean;
|
|
242
248
|
/** Defaults to `public`. */
|
|
243
249
|
visibility?: "public" | "private";
|
|
@@ -271,7 +277,6 @@ interface MockCalmLensServerClientOptions extends Omit<CalmLensServerClientOptio
|
|
|
271
277
|
* `completeProcessing`, and everything else is `allowed`.
|
|
272
278
|
*/
|
|
273
279
|
moderate?: MockModerate;
|
|
274
|
-
signedUrlBaseUrl?: string;
|
|
275
280
|
};
|
|
276
281
|
}
|
|
277
282
|
/**
|
|
@@ -301,6 +306,12 @@ export declare class MockCalmLensServerClient extends CalmLensServerClient {
|
|
|
301
306
|
* `callsTo("assets.waitForDecision")` the `assets.retrieve` requests it polls with.
|
|
302
307
|
*/
|
|
303
308
|
callsTo(operation: MockCalmLensOperation): MockCalmLensCall[];
|
|
309
|
+
/**
|
|
310
|
+
* Fetches a URL of the mock's CDN as a browser would, without the API key: a signed asset URL
|
|
311
|
+
* from `cdn.signAssetUrl` (with a resource appended), or a public one from `cdn.getAssetUrl`.
|
|
312
|
+
* The request is recorded like any other.
|
|
313
|
+
*/
|
|
314
|
+
fetchCdn(url: string, init?: RequestInit): Promise<Response>;
|
|
304
315
|
/** Forgets the requests recorded so far, so `calls` lists only later ones. */
|
|
305
316
|
clearCalls(): void;
|
|
306
317
|
/**
|
|
@@ -325,7 +336,7 @@ export declare class MockCalmLensServerClient extends CalmLensServerClient {
|
|
|
325
336
|
* Applies a reviewer's decision to a stored asset, as the portal or API would: the moderation
|
|
326
337
|
* status changes (`purged` also removes the content, with reason `requested` and an
|
|
327
338
|
* `asset.content-removed` event), the review joins `manualReviews`, and an `asset.<decision>`
|
|
328
|
-
* event
|
|
339
|
+
* event whose `actor` is a `user` joins the events feed. Rejects with
|
|
329
340
|
* `asset/not-found` for an unknown asset. It sends no request.
|
|
330
341
|
*/
|
|
331
342
|
decide(assetId: string, decision: MockReviewDecision): Promise<Asset>;
|
|
@@ -334,8 +345,11 @@ export declare class MockCalmLensServerClient extends CalmLensServerClient {
|
|
|
334
345
|
* else what `mockOptions.moderate` returns for the `complete` trigger (`allowed` by default).
|
|
335
346
|
* The asset gets the decision's report, and `asset.classified` and the automated
|
|
336
347
|
* `asset.<status>` (or `asset.failed`) join the events feed. No review is recorded, so the
|
|
337
|
-
* asset can still be moderated again.
|
|
338
|
-
* `
|
|
348
|
+
* asset can still be moderated again. A decided asset whose re-run (`assets.explain` with
|
|
349
|
+
* `rerun: true`) is still pending gets the decision in place of its old one, unless it is
|
|
350
|
+
* `pending` or `failed`. Rejects with `asset/not-found` for an unknown asset and
|
|
351
|
+
* `sdk/invalid-argument` for one that isn't processing or awaiting a pending re-run. It sends
|
|
352
|
+
* no request.
|
|
339
353
|
*/
|
|
340
354
|
completeProcessing(assetId: string, decision?: MockAssetOutcome | MockDecision): Promise<Asset>;
|
|
341
355
|
}
|