calmlens 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/calmlens.js +293 -18
- package/{esm/BrowserUpload-RkxV_Vv7.d.ts → cjs/BrowserUpload-C07aL9Vq.d.ts} +2 -2
- package/cjs/{BrowserUpload-CJ4Xc9bR.js → BrowserUpload-CjSHjx3C.js} +1 -1
- package/{esm/CalmLensAppClient-B5gfOB6J.d.ts → cjs/CalmLensAppClient-DDLojj0P.d.ts} +1 -1
- package/cjs/{CalmLensAppClient-LHMEQ-UZ.js → CalmLensAppClient-NaCxOVlM.js} +2 -2
- package/cjs/{CalmLensOptionKeys-BUj7v5AG.js → CalmLensOptionKeys-p2QK687A.js} +63 -2
- package/cjs/{CalmLensServerClient-BVOEUT_v.js → CalmLensServerClient-BDzTthxE.js} +12 -7
- package/cjs/{CalmLensServerClient-DCSbwIBs.d.ts → CalmLensServerClient-C-jsjn8m.d.ts} +4 -4
- package/cjs/{CalmLensTypes-DpU-hXq2.d.ts → CalmLensTypes-COJbOuiv.d.ts} +2 -2
- package/cjs/{ModerationContextLimits-FDpQmw_T.js → ModerationContextLimits-2nIv7Zh3.js} +304 -12
- package/cjs/{ReactUpload-BvpW4hJi.js → ReactUpload-BdTRCTGA.js} +1 -1
- package/cjs/{ReactUpload-huIMnOJ4.d.ts → ReactUpload-CRJNPB5T.d.ts} +1 -1
- package/cjs/{TestTriggers-CMwMrbjy-K0YBzu2a.js → TestTriggers-DbhsNPdg-DjvVuc2h.js} +2 -2
- package/cjs/{UploadController-D4qOZZc3.js → UploadController-MLVs97Zt.js} +2 -2
- package/cjs/{WebhookPayload-CQg8BBZQ.d.ts → WebhookPayload-DkukERKE.d.ts} +1 -1
- package/cjs/app.d.ts +4 -4
- package/cjs/app.js +2 -2
- package/cjs/elements.d.ts +2 -2
- package/cjs/elements.js +3 -3
- package/{esm/index-BcDDQJF2.d.ts → cjs/index-DxbJ_Xaa.d.ts} +2 -2
- package/cjs/index.d.ts +3 -3
- package/cjs/index.js +1 -1
- package/cjs/react-native.d.ts +2 -2
- package/cjs/react-native.js +3 -3
- package/cjs/react.d.ts +2 -2
- package/cjs/react.js +4 -4
- package/cjs/server.d.ts +4 -4
- package/cjs/server.js +2 -2
- package/cjs/test-inputs.js +9 -9
- package/cjs/testing.d.ts +10 -7
- package/cjs/testing.js +121 -18
- package/cjs/{ui-B23r8BvW.d.ts → ui-BSqPGKrZ.d.ts} +2 -2
- package/cjs/{ui-Dq-cm6Rx.js → ui-CX1z2pD9.js} +2 -2
- package/cjs/ui.d.ts +1 -1
- package/cjs/ui.js +2 -2
- package/cjs/vue.d.ts +4 -4
- package/cjs/vue.js +3 -3
- package/{cjs/BrowserUpload-RkxV_Vv7.d.ts → esm/BrowserUpload-C07aL9Vq.d.ts} +2 -2
- package/esm/{BrowserUpload-DpzS2bbj.js → BrowserUpload-CAVkRotw.js} +1 -1
- package/{cjs/CalmLensAppClient-B5gfOB6J.d.ts → esm/CalmLensAppClient-DDLojj0P.d.ts} +1 -1
- package/esm/{CalmLensAppClient-BjlvBweS.js → CalmLensAppClient-PQ9VBvlW.js} +2 -2
- package/esm/{CalmLensOptionKeys-BKez0Wiw.js → CalmLensOptionKeys-Do2mPP6w.js} +58 -3
- package/esm/{CalmLensServerClient-DCSbwIBs.d.ts → CalmLensServerClient-C-jsjn8m.d.ts} +4 -4
- package/esm/{CalmLensServerClient-DemxbNMn.js → CalmLensServerClient-C_H5aAsV.js} +12 -7
- package/esm/{CalmLensTypes-DpU-hXq2.d.ts → CalmLensTypes-COJbOuiv.d.ts} +2 -2
- package/esm/{ModerationContextLimits-lLfmyLni.js → ModerationContextLimits-Chw-AzgL.js} +291 -11
- package/esm/{ReactUpload-6klucehl.js → ReactUpload-CMmL0R5Q.js} +1 -1
- package/esm/{ReactUpload-huIMnOJ4.d.ts → ReactUpload-CRJNPB5T.d.ts} +1 -1
- package/esm/{TestTriggers-CMwMrbjy-bdowBBKw.js → TestTriggers-DbhsNPdg-CUdrv8Nm.js} +2 -2
- package/esm/{UploadController-UxP6gj7A.js → UploadController-BJZghJpg.js} +2 -2
- package/esm/{WebhookPayload-CQg8BBZQ.d.ts → WebhookPayload-DkukERKE.d.ts} +1 -1
- package/esm/app.d.ts +4 -4
- package/esm/app.js +2 -2
- package/esm/elements.d.ts +2 -2
- package/esm/elements.js +3 -3
- package/{cjs/index-BcDDQJF2.d.ts → esm/index-DxbJ_Xaa.d.ts} +2 -2
- package/esm/index.d.ts +3 -3
- package/esm/index.js +1 -1
- package/esm/react-native.d.ts +2 -2
- package/esm/react-native.js +3 -3
- package/esm/react.d.ts +2 -2
- package/esm/react.js +4 -4
- package/esm/server.d.ts +4 -4
- package/esm/server.js +2 -2
- package/esm/test-inputs.js +1 -1
- package/esm/testing.d.ts +10 -7
- package/esm/testing.js +118 -15
- package/esm/{ui-B23r8BvW.d.ts → ui-BSqPGKrZ.d.ts} +2 -2
- package/esm/{ui-Bn29rfAi.js → ui-CXH7xJpb.js} +2 -2
- package/esm/ui.d.ts +1 -1
- package/esm/ui.js +2 -2
- package/esm/vue.d.ts +4 -4
- package/esm/vue.js +3 -3
- package/package.json +1 -1
package/esm/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as getUploadItemOutcome, E as getUploadItemMessage, F as UploadFile, G as MediaSource, H as MediaImageSource, J as pickMediaSource, K as MediaState, M as UploadClient, N as UploadController, O as resolveMessages, R as UploadStage, S as formatBytes, T as getMediaUnavailableMessage, U as MediaOptions, V as MediaAsset, W as MediaSettings, Y as resolveMediaProps, _ as DEFAULT_MESSAGES, a as ProgressFetchOptions, b as describeUploadItem, c as ICON_ATTRIBUTES, d as MediaProps, f as UploaderDisplayOptions, g as CalmLensMessages, h as getMediaLoadKey, i as CALMLENS_STYLES, j as CustomUploadResult, l as IconName, m as getMediaAspectRatio, n as CalmLensTheme, o as createProgressFetch, q as getMediaState, r as resolveTheme, s as ICONS, t as CALMLENS_THEME, u as MediaDisplayOptions, v as UploadItemView, w as getDropzoneHint, x as describeUploader, y as UploaderView } from "./ui-
|
|
2
|
-
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, o as UseCalmLensUploadResult, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-
|
|
1
|
+
import { A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as getUploadItemOutcome, E as getUploadItemMessage, F as UploadFile, G as MediaSource, H as MediaImageSource, J as pickMediaSource, K as MediaState, M as UploadClient, N as UploadController, O as resolveMessages, R as UploadStage, S as formatBytes, T as getMediaUnavailableMessage, U as MediaOptions, V as MediaAsset, W as MediaSettings, Y as resolveMediaProps, _ as DEFAULT_MESSAGES, a as ProgressFetchOptions, b as describeUploadItem, c as ICON_ATTRIBUTES, d as MediaProps, f as UploaderDisplayOptions, g as CalmLensMessages, h as getMediaLoadKey, i as CALMLENS_STYLES, j as CustomUploadResult, l as IconName, m as getMediaAspectRatio, n as CalmLensTheme, o as createProgressFetch, q as getMediaState, r as resolveTheme, s as ICONS, t as CALMLENS_THEME, u as MediaDisplayOptions, v as UploadItemView, w as getDropzoneHint, x as describeUploader, y as UploaderView } from "./ui-BSqPGKrZ.js";
|
|
2
|
+
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, o as UseCalmLensUploadResult, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-C07aL9Vq.js";
|
|
3
3
|
import { CSSProperties, HTMLAttributes } from "react";
|
|
4
4
|
/**
|
|
5
5
|
* Uploads files through an upload preset and re-renders as each one uploads and is checked. Use
|
package/esm/react.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, n as CALMLENS_STYLES_ID, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-
|
|
3
|
-
import { i as createProgressFetch, r as isFileAccepted, t as UploadController } from "./UploadController-
|
|
4
|
-
import { n as useOwnController, r as useUploadSnapshot, t as useCalmLensUpload$1 } from "./ReactUpload-
|
|
5
|
-
import { t as createUploadController } from "./BrowserUpload-
|
|
2
|
+
import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, n as CALMLENS_STYLES_ID, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-CXH7xJpb.js";
|
|
3
|
+
import { i as createProgressFetch, r as isFileAccepted, t as UploadController } from "./UploadController-BJZghJpg.js";
|
|
4
|
+
import { n as useOwnController, r as useUploadSnapshot, t as useCalmLensUpload$1 } from "./ReactUpload-CMmL0R5Q.js";
|
|
5
|
+
import { t as createUploadController } from "./BrowserUpload-CAVkRotw.js";
|
|
6
6
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
// src/react.tsx
|
package/esm/server.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as selectModerationContextItems, i as ModerationContextItem, n as MODERATION_CONTEXT_USED_CHARACTERS, o as HashList, r as MODERATION_CONTEXT_USED_ITEMS, s as HashListEntry, t as ModerationContext } from "./ModerationContext-9lGm-Mna-CcmbRnOy.js";
|
|
2
|
-
import { $ as ImageTransformOptions, $t as AssetSearchMatchField, A as CdnServeOptions, At as UploadedAsset, B as DeleteAssetContentOptions, Bt as TypedEvent, C as AssignPolicyOptions, Ct as SubmitAssetOptions, D as CalmLensServerClientOptions, Dt as UpdatePolicyOptions, E as CalmLensAppClientOptions, Et as UpdateHashListOptions, F as CreateFolderOptions, Ft as WebhookPayloadInput, G as FolderIdOptions, Gt as EventSeverity, H as EnsureLensOptions, Ht as EventFact, I as CreateHashListOptions, It as AssetBatchOperation, J as HashListEntryIdOptions, Jt as Folder, Kt as EventType, L as CreateMultipartUploadPartOptions, Lt as GetEventsResponse, M as ClassifyTextOptions, Mt as ViewerClaims, N as ConnectionOptions, Nt as WaitForAssetDecisionOptions, O as CdnAssetUrlOptions, Ot as UploadAssetPartOptions, P as CreateAssetSignedUrlOptions, Pt as WebhookHeadersInput, Q as IdempotencyOptions, Qt as LensType, R as CreatePolicyOptions, S as AssetVisibility, St as SignedUrl, T as BatchAssetsResponse, Tt as UpdateFolderOptions, U as EnsureLensesOptions, Ut as EventFactValues, V as DeleteAssetOptions, Vt as EventCategory, W as ExplainAssetOptions, Wt as EventFacts, X as HashListIdOptions, Xt as CursorPage, Y as HashListEntryPage, Yt as Policy, Z as HashListPage, Zt as Order, _ as AssetSearchResponse, _t as RetryAssetOptions, a as AssetChildrenPage, an as ExtractedText, at as ListEventsOptions, b as AssetUpload, bt as SignUploadTokenOptions, c as AssetClassificationStatus, cn as ProcessingOptions, ct as ListHashListsOptions, d as AssetContentRemovalReason, dt as MultipartUploadOptions, en as AssetSearchQuery, et as IterateAssetChildrenOptions, f as AssetContentStatus, ft as MultipartUploadPartOptions, g as AssetPage, gt as RetrieveAssetOptions, h as AssetModerationStatus, ht as RequestOptions, i as AssetChecksums, in as AssetSafetyHoldReason, it as ListAssetsOptions, j as CdnTransform, jt as VerifyWebhookSignatureOptions, k as CdnResource, kt as UploadPresetSubmitAssetOptions, l as AssetContent, lt as MoveAssetOptions, m as AssetModerationDecision, mt as PolicyList, n as ApplyPolicyPresetOptions, nn as AssetImage, nt as Lens, o as AssetClassification, on as FileMetadata, p as AssetModeration, pt as PolicyIdOptions, q as GetAssetUrlOptions, r as Asset, rn as AssetSafetyHold, rt as ListAssetChildrenOptions, s as AssetClassificationFailureReason, sn as MetadataItem, st as ListHashListEntriesOptions, t as AddHashListEntryOptions, tt as IterateAssetsOptions, u as AssetContentOptions, ut as MoveFolderOptions, v as AssetSearchResult, vt as SearchAssetsOptions, w as BatchAssetsOptions, wt as UpdateAssetOptions, x as AssetUploadStatus, xt as SignedUploadToken, y as AssetType, yt as SetPolicyAutomaticUpdatesOptions, z as DecideAssetOptions, zt as EventAsset } from "./CalmLensTypes-
|
|
3
|
-
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-
|
|
4
|
-
import { a as ProcessingFeatureId, c as ProcessingFeatures, d as getAssetUrl, i as DetectedPerson, l as SDK_VERSION, n as BoundingBox, o as ProcessingFeatureResults, r as DetectedFace, s as ProcessingFeatureStage, t as AgeRange, u as DEFAULT_CDN_BASE_URL } from "./index-
|
|
2
|
+
import { $ as ImageTransformOptions, $t as AssetSearchMatchField, A as CdnServeOptions, At as UploadedAsset, B as DeleteAssetContentOptions, Bt as TypedEvent, C as AssignPolicyOptions, Ct as SubmitAssetOptions, D as CalmLensServerClientOptions, Dt as UpdatePolicyOptions, E as CalmLensAppClientOptions, Et as UpdateHashListOptions, F as CreateFolderOptions, Ft as WebhookPayloadInput, G as FolderIdOptions, Gt as EventSeverity, H as EnsureLensOptions, Ht as EventFact, I as CreateHashListOptions, It as AssetBatchOperation, J as HashListEntryIdOptions, Jt as Folder, Kt as EventType, L as CreateMultipartUploadPartOptions, Lt as GetEventsResponse, M as ClassifyTextOptions, Mt as ViewerClaims, N as ConnectionOptions, Nt as WaitForAssetDecisionOptions, O as CdnAssetUrlOptions, Ot as UploadAssetPartOptions, P as CreateAssetSignedUrlOptions, Pt as WebhookHeadersInput, Q as IdempotencyOptions, Qt as LensType, R as CreatePolicyOptions, S as AssetVisibility, St as SignedUrl, T as BatchAssetsResponse, Tt as UpdateFolderOptions, U as EnsureLensesOptions, Ut as EventFactValues, V as DeleteAssetOptions, Vt as EventCategory, W as ExplainAssetOptions, Wt as EventFacts, X as HashListIdOptions, Xt as CursorPage, Y as HashListEntryPage, Yt as Policy, Z as HashListPage, Zt as Order, _ as AssetSearchResponse, _t as RetryAssetOptions, a as AssetChildrenPage, an as ExtractedText, at as ListEventsOptions, b as AssetUpload, bt as SignUploadTokenOptions, c as AssetClassificationStatus, cn as ProcessingOptions, ct as ListHashListsOptions, d as AssetContentRemovalReason, dt as MultipartUploadOptions, en as AssetSearchQuery, et as IterateAssetChildrenOptions, f as AssetContentStatus, ft as MultipartUploadPartOptions, g as AssetPage, gt as RetrieveAssetOptions, h as AssetModerationStatus, ht as RequestOptions, i as AssetChecksums, in as AssetSafetyHoldReason, it as ListAssetsOptions, j as CdnTransform, jt as VerifyWebhookSignatureOptions, k as CdnResource, kt as UploadPresetSubmitAssetOptions, l as AssetContent, lt as MoveAssetOptions, m as AssetModerationDecision, mt as PolicyList, n as ApplyPolicyPresetOptions, nn as AssetImage, nt as Lens, o as AssetClassification, on as FileMetadata, p as AssetModeration, pt as PolicyIdOptions, q as GetAssetUrlOptions, r as Asset, rn as AssetSafetyHold, rt as ListAssetChildrenOptions, s as AssetClassificationFailureReason, sn as MetadataItem, st as ListHashListEntriesOptions, t as AddHashListEntryOptions, tt as IterateAssetsOptions, u as AssetContentOptions, ut as MoveFolderOptions, v as AssetSearchResult, vt as SearchAssetsOptions, w as BatchAssetsOptions, wt as UpdateAssetOptions, x as AssetUploadStatus, xt as SignedUploadToken, y as AssetType, yt as SetPolicyAutomaticUpdatesOptions, z as DecideAssetOptions, zt as EventAsset } from "./CalmLensTypes-COJbOuiv.js";
|
|
3
|
+
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-DkukERKE.js";
|
|
4
|
+
import { a as ProcessingFeatureId, c as ProcessingFeatures, d as getAssetUrl, i as DetectedPerson, l as SDK_VERSION, n as BoundingBox, o as ProcessingFeatureResults, r as DetectedFace, s as ProcessingFeatureStage, t as AgeRange, u as DEFAULT_CDN_BASE_URL } from "./index-DxbJ_Xaa.js";
|
|
5
5
|
import { a as ClassificationNotEvaluatedReason, c as ModerationQualifier, i as ClassificationLabel, l as PolicyAction, n as ClassificationCategory, o as ClassificationQualifierResults, r as ClassificationCategoryReport, s as Likelihood, t as ClassificationCategories } from "./Classification-D3SkprrQ-CMnQKW13.js";
|
|
6
|
-
import { t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
6
|
+
import { t as CalmLensServerClient } from "./CalmLensServerClient-C-jsjn8m.js";
|
|
7
7
|
export declare const WEBHOOK_DELIVERY_HEADER = "x-calmlens-delivery";
|
|
8
8
|
export declare const WEBHOOK_TIMESTAMP_HEADER = "x-calmlens-timestamp";
|
|
9
9
|
export declare const WEBHOOK_SIGNATURE_HEADER = "x-calmlens-signature";
|
package/esm/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as CALMLENS_ERROR_CODES, N as CalmLensError, c as DEFAULT_CDN_BASE_URL, f as getAssetUrl, i as SDK_VERSION, n as MODERATION_CONTEXT_USED_ITEMS, r as selectModerationContextItems, t as MODERATION_CONTEXT_USED_CHARACTERS } from "./ModerationContextLimits-Chw-AzgL.js";
|
|
2
2
|
import "./index.js";
|
|
3
|
-
import { a as WEBHOOK_TIMESTAMP_HEADER, c as verifyWebhookSignature, i as WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, n as WEBHOOK_DELIVERY_HEADER, o as isTestWebhookEvent, r as WEBHOOK_SIGNATURE_HEADER, s as parseWebhookEvent, t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
3
|
+
import { a as WEBHOOK_TIMESTAMP_HEADER, c as verifyWebhookSignature, i as WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, n as WEBHOOK_DELIVERY_HEADER, o as isTestWebhookEvent, r as WEBHOOK_SIGNATURE_HEADER, s as parseWebhookEvent, t as CalmLensServerClient } from "./CalmLensServerClient-C_H5aAsV.js";
|
|
4
4
|
export { CALMLENS_ERROR_CODES, CalmLensError, CalmLensServerClient, DEFAULT_CDN_BASE_URL, MODERATION_CONTEXT_USED_CHARACTERS, MODERATION_CONTEXT_USED_ITEMS, SDK_VERSION, WEBHOOK_DELIVERY_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, WEBHOOK_TIMESTAMP_HEADER, getAssetUrl, isTestWebhookEvent, parseWebhookEvent, selectModerationContextItems, verifyWebhookSignature };
|
package/esm/test-inputs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as TEST_INPUT_KEY_PATTERN, n as TEST_INPUT_PRESETS, r as detectTestImage, i as detectTestTrigger, a as generateTestTextCode, o as getImageTestCategories, c as paintTestImage, l as testInputForSignal } from "./TestTriggers-
|
|
1
|
+
export { t as TEST_INPUT_KEY_PATTERN, n as TEST_INPUT_PRESETS, r as detectTestImage, i as detectTestTrigger, a as generateTestTextCode, o as getImageTestCategories, c as paintTestImage, l as testInputForSignal } from "./TestTriggers-DbhsNPdg-CUdrv8Nm.js";
|
package/esm/testing.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Bt as TypedEvent, D as CalmLensServerClientOptions, E as CalmLensAppClientOptions, Jt as Folder, bt as SignUploadTokenOptions, p as AssetModeration, qt as PermissionGrant, r as Asset, tn as AssetBinaryPayloadInput, xt as SignedUploadToken } from "./CalmLensTypes-
|
|
2
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
3
|
-
import { l as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-
|
|
4
|
-
import { t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
1
|
+
import { Bt as TypedEvent, D as CalmLensServerClientOptions, E as CalmLensAppClientOptions, Jt as Folder, bt as SignUploadTokenOptions, p as AssetModeration, qt as PermissionGrant, r as Asset, tn as AssetBinaryPayloadInput, xt as SignedUploadToken } from "./CalmLensTypes-COJbOuiv.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-DDLojj0P.js";
|
|
3
|
+
import { l as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-DkukERKE.js";
|
|
4
|
+
import { t as CalmLensServerClient } from "./CalmLensServerClient-C-jsjn8m.js";
|
|
5
5
|
import { t as ClassificationTestSignal } from "./TestTriggers-D-fwfhEP-hlaP1oW2.js";
|
|
6
6
|
import "zod";
|
|
7
7
|
/**
|
|
@@ -184,7 +184,8 @@ type MockReviewDecision = "allowed" | "limited" | "age-restricted" | "blocked" |
|
|
|
184
184
|
* method that sends it; `callsTo` and `failNextRequest` also match the others (see
|
|
185
185
|
* `MockCalmLensCall`).
|
|
186
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.create", "assets.classify", "assets.uploadPart", "assets.createSignedUrl", "assets.move", "assets.retry", "assets.explain", "assets.decide", "assets.deleteContent", "assets.delete", "assets.batch", "text.classify", "cdn.serve", "events.list", "events.pages", "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.applyPreset", "policies.setAutomaticUpdates", "policies.delete", "policies.assign", "ensureLens", "ensureLenses"];
|
|
188
|
+
type MockCalmLensOperation = (typeof MOCK_OPERATIONS)[number];
|
|
188
189
|
/**
|
|
189
190
|
* One request a mock client sent, as the in-memory API received it. `operation` is the client
|
|
190
191
|
* method that sends it; requests several methods send are recorded under the first: `text.classify`
|
|
@@ -244,7 +245,9 @@ interface MockUploadPreset {
|
|
|
244
245
|
keepContentAfterProcessing?: boolean;
|
|
245
246
|
folderId?: string | null;
|
|
246
247
|
}
|
|
247
|
-
interface MockCalmLensServerClientOptions extends CalmLensServerClientOptions {
|
|
248
|
+
interface MockCalmLensServerClientOptions extends Omit<CalmLensServerClientOptions, "projectId"> {
|
|
249
|
+
/** Defaults to `project-1`. */
|
|
250
|
+
projectId?: string;
|
|
248
251
|
mockOptions?: {
|
|
249
252
|
databaseStorage?: MockDatabaseStorage;
|
|
250
253
|
imageStorage?: MockImageStorage;
|
|
@@ -286,7 +289,7 @@ export declare class MockCalmLensServerClient extends CalmLensServerClient {
|
|
|
286
289
|
* `mockOptions`. `maxRetries` defaults to 0, so a failed request fails once; retry backoff and
|
|
287
290
|
* `assets.waitForDecision` take no real time.
|
|
288
291
|
*/
|
|
289
|
-
constructor(
|
|
292
|
+
constructor(input: MockCalmLensServerClientOptions);
|
|
290
293
|
/**
|
|
291
294
|
* Every request sent to the mock's API and CDN, oldest first, by this client and the
|
|
292
295
|
* `MockCalmLensAppClient`s that use it, each with the client method that sent it.
|
package/esm/testing.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as WEBHOOK_TIMESTAMP_HEADER, l as signUploadTokenWithApiKey, n as WEBHOOK_DELIVERY_HEADER, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient, u as stringifyJsonCanonical } from "./CalmLensServerClient-
|
|
3
|
-
import {
|
|
1
|
+
import { F as invalidArgument, I as invalidConfig, L as API_ERROR_CODES, N as CalmLensError, P as SDK_ERROR_CODES, R as API_ERROR_DEFINITIONS, g as randomUuid, j as getRejectedUploadMimeTypeError, k as MAX_IMAGE_UPLOAD_BYTES, m as parseTransformSelector, p as isAcceptedUploadMimeType, r as selectModerationContextItems, u as checkTransformOptions, w as validateServerClientOptions, x as validateAppClientOptions } from "./ModerationContextLimits-Chw-AzgL.js";
|
|
2
|
+
import { a as WEBHOOK_TIMESTAMP_HEADER, l as signUploadTokenWithApiKey, n as WEBHOOK_DELIVERY_HEADER, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient, u as stringifyJsonCanonical } from "./CalmLensServerClient-C_H5aAsV.js";
|
|
3
|
+
import { _ as validateAssetPayload, a as MOCK_HOOKS, g as assetToData, h as assetDataToUint8Array, m as sleep } from "./CalmLensOptionKeys-Do2mPP6w.js";
|
|
4
4
|
import { t as hmacSha256Hex } from "./CryptoUtils-B_x8lMIx-DhuWGzqn.js";
|
|
5
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
6
|
-
import { a as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-
|
|
7
|
-
import { s as getTestInputTag, u as CLASSIFICATION_CATEGORIES } from "./TestTriggers-
|
|
5
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-PQ9VBvlW.js";
|
|
6
|
+
import { a as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-BJZghJpg.js";
|
|
7
|
+
import { s as getTestInputTag, u as CLASSIFICATION_CATEGORIES } from "./TestTriggers-DbhsNPdg-CUdrv8Nm.js";
|
|
8
8
|
import * as zod from "zod";
|
|
9
9
|
// src/contract/MediaTestTriggers.js
|
|
10
10
|
const MEDIA_TEST_SIGNALS = [...CLASSIFICATION_CATEGORIES, "violence.graphic"];
|
|
@@ -8584,6 +8584,60 @@ const REVIEW_DECISIONS = [
|
|
|
8584
8584
|
"blocked",
|
|
8585
8585
|
"purged"
|
|
8586
8586
|
];
|
|
8587
|
+
/**
|
|
8588
|
+
* A client method, named like its path on the client. A request is recorded under the first
|
|
8589
|
+
* method that sends it; `callsTo` and `failNextRequest` also match the others (see
|
|
8590
|
+
* `MockCalmLensCall`).
|
|
8591
|
+
*/
|
|
8592
|
+
const MOCK_OPERATIONS = [
|
|
8593
|
+
"assets.list",
|
|
8594
|
+
"assets.iterate",
|
|
8595
|
+
"assets.search",
|
|
8596
|
+
"assets.retrieve",
|
|
8597
|
+
"assets.waitForDecision",
|
|
8598
|
+
"assets.update",
|
|
8599
|
+
"assets.listChildren",
|
|
8600
|
+
"assets.iterateChildren",
|
|
8601
|
+
"assets.create",
|
|
8602
|
+
"assets.classify",
|
|
8603
|
+
"assets.uploadPart",
|
|
8604
|
+
"assets.createSignedUrl",
|
|
8605
|
+
"assets.move",
|
|
8606
|
+
"assets.retry",
|
|
8607
|
+
"assets.explain",
|
|
8608
|
+
"assets.decide",
|
|
8609
|
+
"assets.deleteContent",
|
|
8610
|
+
"assets.delete",
|
|
8611
|
+
"assets.batch",
|
|
8612
|
+
"text.classify",
|
|
8613
|
+
"cdn.serve",
|
|
8614
|
+
"events.list",
|
|
8615
|
+
"events.pages",
|
|
8616
|
+
"folders.list",
|
|
8617
|
+
"folders.retrieve",
|
|
8618
|
+
"folders.create",
|
|
8619
|
+
"folders.update",
|
|
8620
|
+
"folders.delete",
|
|
8621
|
+
"folders.move",
|
|
8622
|
+
"hashLists.list",
|
|
8623
|
+
"hashLists.retrieve",
|
|
8624
|
+
"hashLists.create",
|
|
8625
|
+
"hashLists.update",
|
|
8626
|
+
"hashLists.delete",
|
|
8627
|
+
"hashLists.listEntries",
|
|
8628
|
+
"hashLists.addEntry",
|
|
8629
|
+
"hashLists.removeEntry",
|
|
8630
|
+
"policies.list",
|
|
8631
|
+
"policies.retrieve",
|
|
8632
|
+
"policies.create",
|
|
8633
|
+
"policies.update",
|
|
8634
|
+
"policies.applyPreset",
|
|
8635
|
+
"policies.setAutomaticUpdates",
|
|
8636
|
+
"policies.delete",
|
|
8637
|
+
"policies.assign",
|
|
8638
|
+
"ensureLens",
|
|
8639
|
+
"ensureLenses"
|
|
8640
|
+
];
|
|
8587
8641
|
const MAX_PAGE_SIZE = 100;
|
|
8588
8642
|
const MAX_DECISION_NOTE_LENGTH = 1499;
|
|
8589
8643
|
/** How the API names a reviewer acting through an unnamed API key. */
|
|
@@ -8661,6 +8715,19 @@ var ApiFailure = class {
|
|
|
8661
8715
|
const fail = (code, { message, details } = {}) => new ApiFailure(API_ERROR_DEFINITIONS[code].status, code, message ?? API_ERROR_DEFINITIONS[code].message, details);
|
|
8662
8716
|
/** A request the API's schema refuses: `validation/<zod issue>` with HTTP 400 and the field. */
|
|
8663
8717
|
const invalidField = (code, path) => new ApiFailure(400, code, `Invalid ${path}`, { path });
|
|
8718
|
+
/**
|
|
8719
|
+
* Refuses `metadata` the API's schema refuses (METADATA_ITEM_SCHEMA): it is `null` or a list of
|
|
8720
|
+
* `{ id, value }` objects with a string `id` and any JSON `value`.
|
|
8721
|
+
*/
|
|
8722
|
+
const checkMetadata = (metadata) => {
|
|
8723
|
+
if (metadata === void 0 || metadata === null) return;
|
|
8724
|
+
if (!Array.isArray(metadata)) throw invalidField("validation/invalid-type", "metadata");
|
|
8725
|
+
metadata.forEach((item, index) => {
|
|
8726
|
+
if (typeof item !== "object" || item === null || Array.isArray(item)) throw invalidField("validation/invalid-type", `metadata.${index}`);
|
|
8727
|
+
if (typeof item.id !== "string") throw invalidField("validation/invalid-type", `metadata.${index}.id`);
|
|
8728
|
+
if (item.value === void 0) throw invalidField("validation/invalid-value", `metadata.${index}.value`);
|
|
8729
|
+
});
|
|
8730
|
+
};
|
|
8664
8731
|
/** The built-in presets the mock knows, by display name. */
|
|
8665
8732
|
const MOCK_PRESET_NAMES = {
|
|
8666
8733
|
"general-community": "General",
|
|
@@ -8775,6 +8842,8 @@ var MockCalmLensApi = class {
|
|
|
8775
8842
|
}
|
|
8776
8843
|
/** Queues a failure for the next request, or the next one `operation` sends. */
|
|
8777
8844
|
failNextRequest(failure, options = {}) {
|
|
8845
|
+
if (options.operation !== void 0 && !MOCK_OPERATIONS.includes(options.operation)) throw invalidArgument(`${options.operation} is not a client method that sends requests`);
|
|
8846
|
+
if (!(typeof failure === "string" && failure in API_ERROR_DEFINITIONS) && (options.details !== void 0 || options.retryAfter !== void 0)) throw invalidArgument("details and retryAfter apply only to an API error code");
|
|
8778
8847
|
if (options.retryAfter !== void 0 && !(Number.isInteger(options.retryAfter) && options.retryAfter >= 0)) throw invalidArgument("retryAfter must be a whole number of seconds");
|
|
8779
8848
|
this.pendingFailures.push({
|
|
8780
8849
|
failure,
|
|
@@ -8953,6 +9022,7 @@ var MockCalmLensApi = class {
|
|
|
8953
9022
|
method: (init?.method ?? "GET").toUpperCase(),
|
|
8954
9023
|
url,
|
|
8955
9024
|
segments: path.split("/").filter(Boolean).map(decodeSegment),
|
|
9025
|
+
rawSegments: path.split("/").filter(Boolean),
|
|
8956
9026
|
query: new URLSearchParams(queryIndex === -1 ? "" : relative.slice(queryIndex + 1)),
|
|
8957
9027
|
headers,
|
|
8958
9028
|
bytes,
|
|
@@ -9151,7 +9221,7 @@ var MockCalmLensApi = class {
|
|
|
9151
9221
|
preset: {
|
|
9152
9222
|
id: "general-community",
|
|
9153
9223
|
version: 1,
|
|
9154
|
-
|
|
9224
|
+
own: true
|
|
9155
9225
|
},
|
|
9156
9226
|
createdAt: now
|
|
9157
9227
|
});
|
|
@@ -9209,7 +9279,7 @@ var MockCalmLensApi = class {
|
|
|
9209
9279
|
...preset ? { preset: {
|
|
9210
9280
|
id: preset,
|
|
9211
9281
|
version: 1,
|
|
9212
|
-
|
|
9282
|
+
own: false
|
|
9213
9283
|
} } : {},
|
|
9214
9284
|
createdAt: this.now()
|
|
9215
9285
|
});
|
|
@@ -9246,7 +9316,7 @@ var MockCalmLensApi = class {
|
|
|
9246
9316
|
setPolicyAutomaticUpdates(policyId, body) {
|
|
9247
9317
|
const policy = this.findPolicy(policyId);
|
|
9248
9318
|
const enabled = body.enabled === true;
|
|
9249
|
-
if (policy.preset?.
|
|
9319
|
+
if (!policy.preset?.own || policy.automaticUpdates === enabled) throw fail(API_ERROR_CODES.POLICY_AUTOMATIC_UPDATES_UNAVAILABLE);
|
|
9250
9320
|
if (body.revision !== policy.revision) throw fail(API_ERROR_CODES.POLICY_REVISION_CONFLICT);
|
|
9251
9321
|
if (body.presetVersion !== 1) throw fail(API_ERROR_CODES.POLICY_PRESET_VERSION_CONFLICT);
|
|
9252
9322
|
return this.savePolicy(policy, body.revision, {
|
|
@@ -9452,6 +9522,8 @@ var MockCalmLensApi = class {
|
|
|
9452
9522
|
});
|
|
9453
9523
|
}
|
|
9454
9524
|
async updateAsset(assetId, body) {
|
|
9525
|
+
checkMetadata(body.metadata);
|
|
9526
|
+
if (body.name === null) throw invalidField("validation/invalid-type", "name");
|
|
9455
9527
|
const asset = await this.findOwnAsset(assetId);
|
|
9456
9528
|
if (body.externalId) {
|
|
9457
9529
|
if ((await this.databaseStorage.listAssets(this.projectId)).some((other) => other.id !== asset.id && other.externalId === body.externalId)) throw fail(API_ERROR_CODES.DUPLICATE_EXTERNAL_ID);
|
|
@@ -9479,6 +9551,13 @@ var MockCalmLensApi = class {
|
|
|
9479
9551
|
});
|
|
9480
9552
|
}
|
|
9481
9553
|
async createSignedUrl(assetId, body) {
|
|
9554
|
+
for (const key of [
|
|
9555
|
+
"viewerClaims",
|
|
9556
|
+
"resource",
|
|
9557
|
+
"lens",
|
|
9558
|
+
"transform",
|
|
9559
|
+
"expiresInSeconds"
|
|
9560
|
+
]) if (body[key] === null) throw invalidField(key === "resource" ? "validation/invalid-value" : "validation/invalid-type", key);
|
|
9482
9561
|
const asset = await this.findOwnAsset(assetId);
|
|
9483
9562
|
const expiresInSeconds = body.expiresInSeconds ?? 900;
|
|
9484
9563
|
const resource = body.resource ?? "rendered";
|
|
@@ -9598,7 +9677,11 @@ var MockCalmLensApi = class {
|
|
|
9598
9677
|
/** The upload fields of `POST .../assets`: raw uploads carry them in the query. */
|
|
9599
9678
|
uploadFields(request) {
|
|
9600
9679
|
const upload = request.headers.get("x-calmlens-upload");
|
|
9601
|
-
if (upload !== "content" && upload !== "part")
|
|
9680
|
+
if (upload !== "content" && upload !== "part") {
|
|
9681
|
+
const body = this.json(request);
|
|
9682
|
+
checkMetadata(body.metadata);
|
|
9683
|
+
return body;
|
|
9684
|
+
}
|
|
9602
9685
|
const { query } = request;
|
|
9603
9686
|
const text = (name) => query.get(name) ?? void 0;
|
|
9604
9687
|
const parsed = (name) => {
|
|
@@ -9611,6 +9694,7 @@ var MockCalmLensApi = class {
|
|
|
9611
9694
|
}
|
|
9612
9695
|
};
|
|
9613
9696
|
const total = query.get("totalSizeInBytes");
|
|
9697
|
+
checkMetadata(parsed("metadata"));
|
|
9614
9698
|
return {
|
|
9615
9699
|
name: query.get("name") ?? "",
|
|
9616
9700
|
description: text("description"),
|
|
@@ -9639,7 +9723,7 @@ var MockCalmLensApi = class {
|
|
|
9639
9723
|
if (!fields.name) throw fail(API_ERROR_CODES.INVALID_UPLOAD_PAYLOAD, { message: "Asset name is required" });
|
|
9640
9724
|
const { contentType, part } = fields;
|
|
9641
9725
|
const bytes = fields.bytes ?? /* @__PURE__ */ new Uint8Array(0);
|
|
9642
|
-
if (contentType !== void 0 &&
|
|
9726
|
+
if (contentType !== void 0 && !isAcceptedUploadMimeType(contentType)) throw fail(API_ERROR_CODES.INVALID_UPLOAD_MIME_TYPE, {
|
|
9643
9727
|
message: getRejectedUploadMimeTypeError(contentType),
|
|
9644
9728
|
details: { mimeType: contentType }
|
|
9645
9729
|
});
|
|
@@ -10257,6 +10341,17 @@ var MockCalmLensApi = class {
|
|
|
10257
10341
|
code: "asset/not-found",
|
|
10258
10342
|
message: "Asset not found"
|
|
10259
10343
|
}, url);
|
|
10344
|
+
const invalidTransform = () => this.jsonResponse(400, {
|
|
10345
|
+
code: "asset/invalid-transform",
|
|
10346
|
+
message: "Invalid transform selector"
|
|
10347
|
+
}, url);
|
|
10348
|
+
let selector;
|
|
10349
|
+
try {
|
|
10350
|
+
selector = parseTransformSelector(request.rawSegments.slice(4).join("/"));
|
|
10351
|
+
} catch {
|
|
10352
|
+
return invalidTransform();
|
|
10353
|
+
}
|
|
10354
|
+
if (resource === "original" && (selector.lens || selector.options)) return invalidTransform();
|
|
10260
10355
|
if (root !== "assets" || projectId !== this.projectId || !assetIdentifier) return notFound();
|
|
10261
10356
|
const asset = (await this.databaseStorage.listAssets(this.projectId)).find((asset) => asset.id === assetIdentifier || asset.externalId === assetIdentifier);
|
|
10262
10357
|
if (!asset) return notFound();
|
|
@@ -10294,6 +10389,13 @@ var MockCalmLensApi = class {
|
|
|
10294
10389
|
code: "asset/api-key-missing-permission",
|
|
10295
10390
|
message: "This API key needs assets:download permission for this asset’s folder."
|
|
10296
10391
|
}, url);
|
|
10392
|
+
if (selector.options) {
|
|
10393
|
+
const { unknownKeys, invalidKeys } = checkTransformOptions(selector.options);
|
|
10394
|
+
if (unknownKeys.length || invalidKeys.length) return this.jsonResponse(400, {
|
|
10395
|
+
code: "asset/invalid-transform-options",
|
|
10396
|
+
message: `Invalid transform options: ${[...unknownKeys, ...invalidKeys].join(", ")}`
|
|
10397
|
+
}, url);
|
|
10398
|
+
}
|
|
10297
10399
|
const parts = [...storedContent.parts.entries()].sort(([left], [right]) => left - right).map(([, value]) => value);
|
|
10298
10400
|
const bytes = new Uint8Array(parts.reduce((sum, value) => sum + value.byteLength, 0));
|
|
10299
10401
|
let offset = 0;
|
|
@@ -10402,7 +10504,6 @@ var InMemoryMockDatabaseStorage = class {
|
|
|
10402
10504
|
this.folders.delete(folderId);
|
|
10403
10505
|
}
|
|
10404
10506
|
};
|
|
10405
|
-
// src/testing/MockCalmLensServerClient.ts
|
|
10406
10507
|
const apis = /* @__PURE__ */ new WeakMap();
|
|
10407
10508
|
/** The in-memory API a mock server client runs against, for `MockCalmLensAppClient`. */
|
|
10408
10509
|
const getMockApi = (client) => {
|
|
@@ -10450,7 +10551,11 @@ var MockCalmLensServerClient = class extends CalmLensServerClient {
|
|
|
10450
10551
|
* `mockOptions`. `maxRetries` defaults to 0, so a failed request fails once; retry backoff and
|
|
10451
10552
|
* `assets.waitForDecision` take no real time.
|
|
10452
10553
|
*/
|
|
10453
|
-
constructor(
|
|
10554
|
+
constructor(input) {
|
|
10555
|
+
const options = {
|
|
10556
|
+
...input,
|
|
10557
|
+
projectId: input.projectId ?? "project-1"
|
|
10558
|
+
};
|
|
10454
10559
|
validateServerClientOptions(options);
|
|
10455
10560
|
const { mockOptions = {}, ...clientOptions } = options;
|
|
10456
10561
|
const api = new MockCalmLensApi({
|
|
@@ -10552,7 +10657,6 @@ var MockCalmLensServerClient = class extends CalmLensServerClient {
|
|
|
10552
10657
|
}
|
|
10553
10658
|
};
|
|
10554
10659
|
// src/testing/MockCalmLensAppClient.ts
|
|
10555
|
-
const MOCK_PROJECT_ID = "proj_0000000000000000c1a5";
|
|
10556
10660
|
/**
|
|
10557
10661
|
* The real `CalmLensAppClient`, answered by the in-memory API of a `MockCalmLensServerClient`.
|
|
10558
10662
|
* The API applies `mockOptions.preset` to this client's uploads like CalmLens applies an upload
|
|
@@ -10575,7 +10679,6 @@ var MockCalmLensAppClient = class extends CalmLensAppClient {
|
|
|
10575
10679
|
folderId: null,
|
|
10576
10680
|
includeSubfolders: true
|
|
10577
10681
|
}]),
|
|
10578
|
-
projectId: MOCK_PROJECT_ID,
|
|
10579
10682
|
mockOptions: { moderate: mockOptions.moderate }
|
|
10580
10683
|
});
|
|
10581
10684
|
let endpoints;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as CalmLensAppClientOptions, Mt as ViewerClaims, h as AssetModerationStatus, j as CdnTransform } from "./CalmLensTypes-
|
|
2
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
1
|
+
import { E as CalmLensAppClientOptions, Mt as ViewerClaims, h as AssetModerationStatus, j as CdnTransform } from "./CalmLensTypes-COJbOuiv.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-DDLojj0P.js";
|
|
3
3
|
/**
|
|
4
4
|
* The parts of an asset, as the API or a webhook returns it, that the media component reads.
|
|
5
5
|
* Assets from `CalmLensServerClient` fit as they are.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as placeholderHashToDataURL } from "./UploadController-
|
|
1
|
+
import { E as EU_COUNTRIES, _ as serializeTransform, b as transformSelector, f as getAssetUrl } from "./ModerationContextLimits-Chw-AzgL.js";
|
|
2
|
+
import { a as placeholderHashToDataURL } from "./UploadController-BJZghJpg.js";
|
|
3
3
|
import { a as getFileIcon, c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
|
|
4
4
|
// src/ui/Icons.ts
|
|
5
5
|
/** Path data for the components' 24×24 stroke icons, so every framework draws the same ones. */
|
package/esm/ui.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as getUploadItemOutcome, E as getUploadItemMessage, F as UploadFile, G as MediaSource, H as MediaImageSource, I as UploadItem, J as pickMediaSource, K as MediaState, L as UploadSnapshot, M as UploadClient, N as UploadController, O as resolveMessages, P as UploadControllerOptions, R as UploadStage, S as formatBytes, T as getMediaUnavailableMessage, U as MediaOptions, V as MediaAsset, W as MediaSettings, Y as resolveMediaProps, _ as DEFAULT_MESSAGES, a as ProgressFetchOptions, b as describeUploadItem, c as ICON_ATTRIBUTES, d as MediaProps, f as UploaderDisplayOptions, g as CalmLensMessages, h as getMediaLoadKey, i as CALMLENS_STYLES, j as CustomUploadResult, k as CalmLensUpload, l as IconName, m as getMediaAspectRatio, n as CalmLensTheme, o as createProgressFetch, p as UploaderProps, q as getMediaState, r as resolveTheme, s as ICONS, t as CALMLENS_THEME, u as MediaDisplayOptions, v as UploadItemView, w as getDropzoneHint, x as describeUploader, y as UploaderView, z as createUploadController } from "./ui-
|
|
1
|
+
import { A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as getUploadItemOutcome, E as getUploadItemMessage, F as UploadFile, G as MediaSource, H as MediaImageSource, I as UploadItem, J as pickMediaSource, K as MediaState, L as UploadSnapshot, M as UploadClient, N as UploadController, O as resolveMessages, P as UploadControllerOptions, R as UploadStage, S as formatBytes, T as getMediaUnavailableMessage, U as MediaOptions, V as MediaAsset, W as MediaSettings, Y as resolveMediaProps, _ as DEFAULT_MESSAGES, a as ProgressFetchOptions, b as describeUploadItem, c as ICON_ATTRIBUTES, d as MediaProps, f as UploaderDisplayOptions, g as CalmLensMessages, h as getMediaLoadKey, i as CALMLENS_STYLES, j as CustomUploadResult, k as CalmLensUpload, l as IconName, m as getMediaAspectRatio, n as CalmLensTheme, o as createProgressFetch, p as UploaderProps, q as getMediaState, r as resolveTheme, s as ICONS, t as CALMLENS_THEME, u as MediaDisplayOptions, v as UploadItemView, w as getDropzoneHint, x as describeUploader, y as UploaderView, z as createUploadController } from "./ui-BSqPGKrZ.js";
|
|
2
2
|
export { CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, type IconName, type MediaAsset, type MediaDisplayOptions, type MediaImageSource, type MediaOptions, type MediaProps, type MediaSettings, type MediaSource, type MediaState, type ProgressFetchOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getDropzoneHint, getMediaAspectRatio, getMediaLoadKey, getMediaState, getMediaUnavailableMessage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickMediaSource, resolveMediaProps, resolveMessages, resolveTheme };
|
package/esm/ui.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-
|
|
2
|
-
import { i as createProgressFetch, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-
|
|
1
|
+
import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-CXH7xJpb.js";
|
|
2
|
+
import { i as createProgressFetch, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-BJZghJpg.js";
|
|
3
3
|
export { CALMLENS_STYLES, CALMLENS_THEME, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, UploadController, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getDropzoneHint, getMediaAspectRatio, getMediaLoadKey, getMediaState, getMediaUnavailableMessage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickMediaSource, resolveMediaProps, resolveMessages, resolveTheme };
|
package/esm/vue.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { E as CalmLensAppClientOptions, Mt as ViewerClaims, h as AssetModerationStatus, j as CdnTransform } from "./CalmLensTypes-
|
|
2
|
-
import "./index-
|
|
3
|
-
import { A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as getUploadItemOutcome, E as getUploadItemMessage, F as UploadFile, G as MediaSource, H as MediaImageSource, J as pickMediaSource, K as MediaState, M as UploadClient, N as UploadController, O as resolveMessages, R as UploadStage, S as formatBytes, T as getMediaUnavailableMessage, U as MediaOptions, V as MediaAsset, W as MediaSettings, Y as resolveMediaProps, _ as DEFAULT_MESSAGES, a as ProgressFetchOptions, b as describeUploadItem, c as ICON_ATTRIBUTES, d as MediaProps, f as UploaderDisplayOptions, g as CalmLensMessages, h as getMediaLoadKey, i as CALMLENS_STYLES, j as CustomUploadResult, l as IconName, m as getMediaAspectRatio, n as CalmLensTheme, o as createProgressFetch, q as getMediaState, r as resolveTheme, s as ICONS, t as CALMLENS_THEME, u as MediaDisplayOptions, v as UploadItemView, w as getDropzoneHint, x as describeUploader, y as UploaderView } from "./ui-
|
|
4
|
-
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-
|
|
1
|
+
import { E as CalmLensAppClientOptions, Mt as ViewerClaims, h as AssetModerationStatus, j as CdnTransform } from "./CalmLensTypes-COJbOuiv.js";
|
|
2
|
+
import "./index-DxbJ_Xaa.js";
|
|
3
|
+
import { A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as getUploadItemOutcome, E as getUploadItemMessage, F as UploadFile, G as MediaSource, H as MediaImageSource, J as pickMediaSource, K as MediaState, M as UploadClient, N as UploadController, O as resolveMessages, R as UploadStage, S as formatBytes, T as getMediaUnavailableMessage, U as MediaOptions, V as MediaAsset, W as MediaSettings, Y as resolveMediaProps, _ as DEFAULT_MESSAGES, a as ProgressFetchOptions, b as describeUploadItem, c as ICON_ATTRIBUTES, d as MediaProps, f as UploaderDisplayOptions, g as CalmLensMessages, h as getMediaLoadKey, i as CALMLENS_STYLES, j as CustomUploadResult, l as IconName, m as getMediaAspectRatio, n as CalmLensTheme, o as createProgressFetch, q as getMediaState, r as resolveTheme, s as ICONS, t as CALMLENS_THEME, u as MediaDisplayOptions, v as UploadItemView, w as getDropzoneHint, x as describeUploader, y as UploaderView } from "./ui-BSqPGKrZ.js";
|
|
4
|
+
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-C07aL9Vq.js";
|
|
5
5
|
import { MaybeRefOrGetter, PropType, ShallowRef } from "vue";
|
|
6
6
|
export interface UseCalmLensUploadResult<F extends UploadFile = File> {
|
|
7
7
|
snapshot: Readonly<ShallowRef<UploadSnapshot<F>>>;
|
package/esm/vue.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-
|
|
2
|
-
import { i as createProgressFetch, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-
|
|
3
|
-
import { t as createUploadController } from "./BrowserUpload-
|
|
1
|
+
import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-CXH7xJpb.js";
|
|
2
|
+
import { i as createProgressFetch, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-BJZghJpg.js";
|
|
3
|
+
import { t as createUploadController } from "./BrowserUpload-CAVkRotw.js";
|
|
4
4
|
import { computed, defineComponent, h, onMounted, onScopeDispose, ref, shallowRef, toValue, watch, watchEffect } from "vue";
|
|
5
5
|
// src/vue.ts
|
|
6
6
|
const icon = (name) => h("svg", ICON_ATTRIBUTES, [h("path", { d: ICONS[name] })]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "calmlens",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Official CalmLens SDK for JavaScript and TypeScript: content moderation, asset storage and CDN delivery.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://calmlens.com/docs/sdk/javascript",
|