calmlens 0.37.0 → 0.38.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 +31 -9
- package/cjs/{BrowserUpload-BOXt-BFy.js → BrowserUpload-BO_ZukUM.js} +1 -1
- package/{esm/BrowserUpload-CuG3tWSo.d.ts → cjs/BrowserUpload-BuTS7yTy.d.ts} +2 -2
- package/cjs/{CalmLensAppClient-Bt9GNyqS.js → CalmLensAppClient-DoNMg8Dh.js} +3 -3
- package/{esm/CalmLensAppClient-QqtovWE-.d.ts → cjs/CalmLensAppClient-L5x_sMOI.d.ts} +1 -1
- package/cjs/{CalmLensCdn-D4I4Km4j.js → CalmLensCdn-B_Tbwq10.js} +2 -2
- package/cjs/{CalmLensConnection-knkk2-BW.js → CalmLensConnection-Dhg1amnb.js} +25 -12
- package/cjs/{CalmLensError-ifj5rLmk.js → CalmLensError-C9g7GXfU.js} +7 -2
- package/{esm/CalmLensServerClient-csSQqHBt.d.ts → cjs/CalmLensServerClient-2H0ZpJlr.d.ts} +5 -5
- package/cjs/{CalmLensServerClient--L5qRzFd.js → CalmLensServerClient-D0wCcQNn.js} +16 -6
- package/cjs/{CalmLensTypes-_f7QVRtO.d.ts → CalmLensTypes-CCsoVr39.d.ts} +4 -4
- package/cjs/{Core-4iFxKJnY.d.ts → Core-B110Ug8_.d.ts} +2 -2
- package/cjs/{Core-CNsji7uR.js → Core-iNgZ8Cij.js} +3 -3
- package/cjs/{ReactUpload-DfioGW58.js → ReactUpload-BS8bYIhv.js} +1 -1
- package/cjs/{ReactUpload-4qd2xACg.d.ts → ReactUpload-CbtQtN6v.d.ts} +1 -1
- package/cjs/{UploadController-B-a2r2kN.js → UploadController-CVKtUCK0.js} +2 -2
- package/{esm/WebhookPayload-BJtggTLd.d.ts → cjs/WebhookPayload-_fvY2eu8.d.ts} +5 -3
- package/cjs/app.d.ts +4 -4
- package/cjs/app.js +3 -3
- package/cjs/elements.d.ts +4 -4
- package/cjs/elements.js +4 -4
- package/cjs/{index-IEA75nev.d.ts → index-Dk3I5YXf.d.ts} +2 -2
- package/cjs/index.d.ts +3 -3
- package/cjs/index.js +2 -2
- package/cjs/react-native.d.ts +2 -2
- package/cjs/react-native.js +4 -4
- package/cjs/react.d.ts +4 -4
- package/cjs/react.js +5 -5
- package/cjs/server.d.ts +4 -4
- package/cjs/server.js +3 -3
- package/cjs/{CalmLensTestInputArguments-C6S09FVQ.js → test-inputs-BVJZjtFd.js} +156 -16
- package/cjs/{TestTriggers-CjDhhz78.d.ts → test-inputs-JaZaV9Up.d.ts} +20 -1
- package/cjs/test-inputs.d.ts +2 -18
- package/cjs/test-inputs.js +15 -126
- package/cjs/testing.d.ts +13 -15
- package/cjs/testing.js +55 -68
- package/cjs/{ui-BMQW3Hse.d.ts → ui--E_s-cDd.d.ts} +2 -2
- package/cjs/{ui-DOkuD90x.js → ui-CuO37F4u.js} +2 -2
- package/cjs/ui.d.ts +2 -2
- package/cjs/ui.js +3 -3
- package/cjs/vue.d.ts +5 -5
- package/cjs/vue.js +4 -4
- package/{cjs/BrowserUpload-CuG3tWSo.d.ts → esm/BrowserUpload-BuTS7yTy.d.ts} +2 -2
- package/esm/{BrowserUpload-Ch67b69G.js → BrowserUpload-DxgiUXC2.js} +1 -1
- package/esm/{CalmLensAppClient-DEFSQC15.js → CalmLensAppClient-C7ScAfRx.js} +3 -3
- package/{cjs/CalmLensAppClient-QqtovWE-.d.ts → esm/CalmLensAppClient-L5x_sMOI.d.ts} +1 -1
- package/esm/{CalmLensCdn-xvzJyv9X.js → CalmLensCdn-CW5Fn3ph.js} +2 -2
- package/esm/{CalmLensConnection-D6BVOMri.js → CalmLensConnection-Blv8JyLF.js} +25 -12
- package/esm/{CalmLensError-C15tWu8W.js → CalmLensError-DjkibkdI.js} +7 -2
- package/{cjs/CalmLensServerClient-csSQqHBt.d.ts → esm/CalmLensServerClient-2H0ZpJlr.d.ts} +5 -5
- package/esm/{CalmLensServerClient-BGz_olSn.js → CalmLensServerClient-C7n6EzVd.js} +16 -6
- package/esm/{CalmLensTypes-_f7QVRtO.d.ts → CalmLensTypes-CCsoVr39.d.ts} +4 -4
- package/esm/{Core-4iFxKJnY.d.ts → Core-B110Ug8_.d.ts} +2 -2
- package/esm/{Core-Cj91IL4-.js → Core-BRrPxS4i.js} +3 -3
- package/esm/{ReactUpload-Bg4-5rV2.js → ReactUpload-BGPktblV.js} +1 -1
- package/esm/{ReactUpload-4qd2xACg.d.ts → ReactUpload-CbtQtN6v.d.ts} +1 -1
- package/esm/{UploadController-CpLvD8W-.js → UploadController-CQ4NouIU.js} +2 -2
- package/{cjs/WebhookPayload-BJtggTLd.d.ts → esm/WebhookPayload-_fvY2eu8.d.ts} +5 -3
- package/esm/app.d.ts +4 -4
- package/esm/app.js +3 -3
- package/esm/elements.d.ts +4 -4
- package/esm/elements.js +4 -4
- package/esm/{index-IEA75nev.d.ts → index-Dk3I5YXf.d.ts} +2 -2
- package/esm/index.d.ts +3 -3
- package/esm/index.js +2 -2
- package/esm/react-native.d.ts +2 -2
- package/esm/react-native.js +4 -4
- package/esm/react.d.ts +4 -4
- package/esm/react.js +5 -5
- package/esm/server.d.ts +4 -4
- package/esm/server.js +3 -3
- package/esm/{CalmLensTestInputArguments-DS_3mt1C.js → test-inputs-DizPp8_w.js} +145 -5
- package/esm/{TestTriggers-CjDhhz78.d.ts → test-inputs-JaZaV9Up.d.ts} +20 -1
- package/esm/test-inputs.d.ts +2 -18
- package/esm/test-inputs.js +1 -115
- package/esm/testing.d.ts +13 -15
- package/esm/testing.js +44 -57
- package/esm/{ui-BMQW3Hse.d.ts → ui--E_s-cDd.d.ts} +2 -2
- package/esm/{ui-CGrWIVKa.js → ui-B-QOHuVI.js} +2 -2
- package/esm/ui.d.ts +2 -2
- package/esm/ui.js +3 -3
- package/esm/vue.d.ts +5 -5
- package/esm/vue.js +4 -4
- package/package.json +1 -1
package/cjs/react-native.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_CalmLensCdn = require("./CalmLensCdn-
|
|
3
|
-
const require_Core = require("./Core-
|
|
4
|
-
const require_UploadController = require("./UploadController-
|
|
2
|
+
const require_CalmLensCdn = require("./CalmLensCdn-B_Tbwq10.js");
|
|
3
|
+
const require_Core = require("./Core-iNgZ8Cij.js");
|
|
4
|
+
const require_UploadController = require("./UploadController-CVKtUCK0.js");
|
|
5
5
|
const require_FileIcons = require("./FileIcons-Ob003MdS.js");
|
|
6
|
-
const require_ReactUpload = require("./ReactUpload-
|
|
6
|
+
const require_ReactUpload = require("./ReactUpload-BS8bYIhv.js");
|
|
7
7
|
let react = require("react");
|
|
8
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
9
|
let react_native = require("react-native");
|
package/cjs/react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, J as AssetSessionState, K as AssetOptions, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage } from "./Core-
|
|
2
|
-
import { n as CalmLensProviderProps, t as CalmLensProvider } from "./ReactUpload-
|
|
3
|
-
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, o as UseCalmLensUploadResult, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-
|
|
4
|
-
import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui-
|
|
1
|
+
import { $ as MediaPlayback, A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as resolveMessages, E as getUploadItemOutcome, F as UploadFile, G as AssetImageSource, H as AssetDisplay, J as AssetSessionState, K as AssetOptions, M as UploadClient, N as UploadController, O as CalmLensProvidedOptions, Q as INSTANT_LOAD_MS, R as UploadStage, S as formatBytes, T as getUploadItemMessage, U as AssetDocumentOptions, V as withProvidedOptions, W as AssetImageOptions, X as AssetVideoOptions, Y as AssetSpreadsheetOptions, Z as AssetView, _ as DEFAULT_MESSAGES, _t as DEFAULT_VIEWER_MESSAGES, a as ProgressFetchOptions, at as isImageReady, b as describeUploadItem, bt as resolveViewerMessages, c as ICON_ATTRIBUTES, ct as DocumentViewerOptions, d as AssetDisplayOptions, dt as TextViewerOptions, et as getAssetAspectRatio, f as AssetEventHandlers, ft as ViewerAsset, g as CalmLensMessages, gt as isSpreadsheetFormat, ht as getAssetViewerKind, i as CALMLENS_STYLES, it as getPlayedPercent, j as CustomUploadResult, l as IconName, lt as PdfAssetOptions, m as UploaderDisplayOptions, mt as ViewerTextOptions, n as CalmLensTheme, nt as getAssetViewKey, o as createProgressFetch, ot as pickAssetSource, p as AssetProps, pt as ViewerOptions, q as AssetSession, r as resolveTheme, rt as getPeakHeights, s as ICONS, st as AssetViewerKind, t as CALMLENS_THEME, tt as getAssetView, u as ASSET_FILE_ICON_SIZE, ut as SpreadsheetViewerOptions, v as UploadItemView, vt as ViewerMessages, w as getDropzoneHint, x as describeUploader, y as UploaderView, yt as formatViewerMessage } from "./Core-B110Ug8_.js";
|
|
2
|
+
import { n as CalmLensProviderProps, t as CalmLensProvider } from "./ReactUpload-CbtQtN6v.js";
|
|
3
|
+
import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, o as UseCalmLensUploadResult, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-BuTS7yTy.js";
|
|
4
|
+
import { _ as spreadsheetColumnIndex, a as isMountedViewerKind, b as AssetViewer, c as AssetViewerOptionsByKind, d as createTextViewer, f as SpreadsheetCell, g as parseSpreadsheetText, h as getSpreadsheetPage, i as getMountedViewerOptions, l as VIEWER_STYLES, m as SpreadsheetSheet, n as AssetViewerMount, o as ASSET_VIEWERS, p as SpreadsheetRow, r as MountedViewerKind, s as AssetViewerName, t as MediaStreamPlayer, u as createSpreadsheetViewer, v as loadPdfJs, x as ViewerState, y as createDocumentViewer } from "./ui--E_s-cDd.js";
|
|
5
5
|
import { CSSProperties, HTMLAttributes, ReactNode } from "react";
|
|
6
6
|
type ElementProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
7
7
|
/** Leaves out the stylesheet the viewers render, so you can style the `calmlens-*` classes. */
|
package/cjs/react.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_ui = require("./ui-
|
|
4
|
-
const require_Core = require("./Core-
|
|
5
|
-
const require_UploadController = require("./UploadController-
|
|
3
|
+
const require_ui = require("./ui-CuO37F4u.js");
|
|
4
|
+
const require_Core = require("./Core-iNgZ8Cij.js");
|
|
5
|
+
const require_UploadController = require("./UploadController-CVKtUCK0.js");
|
|
6
6
|
const require_FileIcons = require("./FileIcons-Ob003MdS.js");
|
|
7
|
-
const require_ReactUpload = require("./ReactUpload-
|
|
8
|
-
const require_BrowserUpload = require("./BrowserUpload-
|
|
7
|
+
const require_ReactUpload = require("./ReactUpload-BS8bYIhv.js");
|
|
8
|
+
const require_BrowserUpload = require("./BrowserUpload-BO_ZukUM.js");
|
|
9
9
|
let react = require("react");
|
|
10
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
11
11
|
const OPTION_NAMES = /* @__PURE__ */ new Set([
|
package/cjs/server.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as ClassificationQualifierResults, c as HashList, d as ModerationContext, i as ClassificationNotEvaluatedReason, l as HashListEntry, n as ClassificationCategory, o as Likelihood, r as ClassificationCategoryReport, s as ModerationQualifier, t as ClassificationCategories, u as PolicyAction } from "./Classification-C3pkrGYS-B7EygpJn.js";
|
|
2
|
-
import { $ as EventFactValues, $n as ProcessingOptions, $t as UpdateFolderOptions, A as CdnAssetLocation, An as LensType, At as PolicyIdOptions, B as CreateHashListOptions, Bn as AssetSearchQuery, Bt as RetrieveAssetByExternalIdOptions, C as AssetUploadStatus, Cn as DetectedFace, Ct as ListPoliciesOptions, D as BatchAssetsResponse, Dn as ProcessingFeatureStage, Dt as MultipartUploadOptions, E as BatchAssetsOptions, En as ProcessingFeatureResults, Et as MoveFolderOptions, F as CdnTransform, Fn as EventResourceKind, Ft as RemoveAssetContentOptions, G as DeleteAssetOptions, Gn as AssetPreview, Gt as SignAssetUrlOptions, H as CreateMultipartUploadPartOptions, Hn as AssetInfo, Ht as RetryAssetOptions, I as ClassifyTextOptions, In as EventSeverity, It as RequestAssetReviewOptions, J as EnsureLensesOptions, Jn as AssetSafetyHold, Jt as SignedUploadToken, K as DeleteMetadataFieldOptions, Kn as AssetRendered, Kt as SignUploadTokenOptions, L as ClientRequestDefaults, Lt as RequestAttempt, M as CdnAssetUrlOptions, Mn as EventResource, Mt as PolicySettings, N as CdnResource, Nt as ProjectSettingsResource, O as CalmLensAppClientOptions, On as ProcessingFeatures, Ot as MultipartUploadPartOptions, P as CdnServeOptions, Pn as EventCategory, Pt as PublicProjectSettings, Q as EventFact, Qn as MetadataItem, Qt as UpdateAssetOptions, R as ConnectionOptions, Rn as Folder, Rt as RequestOptions, S as AssetUpload, Sn as BoundingBox, St as ListLensesOptions, T as AssignPolicyOptions, Tn as ProcessingFeatureId, Tt as MoveAssetOptions, U as CreatePolicyOptions, Un as AssetHls, Ut as SearchAssetsOptions, V as CreateLensOptions, Vt as RetrieveAssetOptions, W as DecideAssetOptions, Wn as AssetHlsRendition, Wt as SetPolicyAutomaticUpdatesOptions, X as EnsureUploadPresetsOptions, Xn as ExtractedText, Xt as SubmitAssetOptions, Y as EnsureMetadataFieldsOptions, Yn as AssetSafetyHoldReason, Yt as StreamingFeatureOptions, Z as EnsureUploadPresetsResponse, Zn as FileMetadata, Zt as TypedEvent, _ as AssetPage, _n as AssetReviewRequest, _t as ListAssetsOptions, a as AssetChecksums, an as UploadAssetPartOptions, at as GetAssetInfoOptions, b as AssetTimelinePage, bn as UploadPreset, bt as ListHashListEntriesOptions, c as AssetClassificationFailureReason, cn as UploadPresetPage, ct as HashListIdOptions, d as AssetContentOptions, dn as VerifyWebhookSignatureOptions, dt as ImageTransformOptions, en as UpdateHashListOptions, et as EventFacts, f as AssetContentRemovalReason, fn as ViewerClaims, ft as Lens, g as AssetModerationStatus, gn as AssetBatchOperation, gt as ListAssetTimelineOptions, h as AssetModerationDecision, hn as WebhookPayloadInput, ht as ListAssetChildrenOptions, i as AssetAvailability, in as UpgradePolicyOptions, it as FolderPage, j as CdnAssetReference, jt as PolicyPage, k as CalmLensServerClientOptions, kn as CursorPage, kt as Policy, l as AssetClassificationStatus, ln as UploadPresetSubmitAssetOptions, lt as HashListPage, m as AssetModeration, mn as WebhookHeadersInput, mt as LensPage, n as AppInfo, nn as UpdatePolicyOptions, nt as EventsPage, o as AssetChildrenPage, on as UploadPresetDefinition, ot as HashListEntryIdOptions, p as AssetContentStatus, pn as WaitForAssetDecisionOptions, pt as LensIdOptions, q as EnsureLensOptions, qn as AssetRenderedKind, qt as SignedAssetUrl, r as Asset, rn as UpdateProjectSettingsOptions, rt as FolderIdOptions, s as AssetClassification, sn as UploadPresetIdOptions, st as HashListEntryPage, t as AddHashListEntryOptions, tn as UpdateLensOptions, tt as EventType, u as AssetContent, un as UploadedAsset, ut as IdempotencyOptions, v as AssetSearchResponse, vn as AssetTimelineSegment, vt as ListEventsOptions, w as AssetVisibility, wn as DetectedPerson, wt as ListUploadPresetsOptions, x as AssetType, xn as AgeRange, xt as ListHashListsOptions, y as AssetSearchResult, yn as MetadataFieldsResource, yt as ListFoldersOptions, z as CreateFolderOptions, zn as AssetSearchMatchField, zt as ResetPolicyOptions } from "./CalmLensTypes-
|
|
3
|
-
import { a as getAssetInfo, i as CDN_RESOURCES, n as SDK_VERSION, r as DEFAULT_CDN_BASE_URL, t as ModerationContextItem } from "./index-
|
|
4
|
-
import { A as CalmLensRateLimitError, C as CalmLensErrorKind, D as CalmLensNotFoundError, E as CalmLensInvalidResponseError, F as SdkErrorCode, I as ApiErrorCode, M as CalmLensTimeoutError, N as CalmLensUnprocessableEntityError, O as CalmLensPayloadTooLargeError, P as CalmLensWebhookVerificationError, S as CalmLensErrorDetails, T as CalmLensInvalidArgumentError, _ as CalmLensConfigurationError, a as AUTO_PAGING_TO_ARRAY_MAX, b as CalmLensError, c as CalmLensLastResponse, d as ListPromise, f as CALMLENS_ERROR_CODES, g as CalmLensCancelledError, h as CalmLensBadRequestError, i as ServedAssetInfo, j as CalmLensServerError, k as CalmLensPermissionDeniedError, l as CalmLensResponse, m as CalmLensAuthenticationError, o as AutoPaging, p as CalmLensApiError, r as CdnResponse, s as AutoPagingToArrayOptions, t as ReceivedWebhookEventPayload, u as ListPage, v as CalmLensConflictError, w as CalmLensErrorOptions, x as CalmLensErrorCode, y as CalmLensConnectionError } from "./WebhookPayload-
|
|
5
|
-
import { t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
2
|
+
import { $ as EventFactValues, $n as ProcessingOptions, $t as UpdateFolderOptions, A as CdnAssetLocation, An as LensType, At as PolicyIdOptions, B as CreateHashListOptions, Bn as AssetSearchQuery, Bt as RetrieveAssetByExternalIdOptions, C as AssetUploadStatus, Cn as DetectedFace, Ct as ListPoliciesOptions, D as BatchAssetsResponse, Dn as ProcessingFeatureStage, Dt as MultipartUploadOptions, E as BatchAssetsOptions, En as ProcessingFeatureResults, Et as MoveFolderOptions, F as CdnTransform, Fn as EventResourceKind, Ft as RemoveAssetContentOptions, G as DeleteAssetOptions, Gn as AssetPreview, Gt as SignAssetUrlOptions, H as CreateMultipartUploadPartOptions, Hn as AssetInfo, Ht as RetryAssetOptions, I as ClassifyTextOptions, In as EventSeverity, It as RequestAssetReviewOptions, J as EnsureLensesOptions, Jn as AssetSafetyHold, Jt as SignedUploadToken, K as DeleteMetadataFieldOptions, Kn as AssetRendered, Kt as SignUploadTokenOptions, L as ClientRequestDefaults, Lt as RequestAttempt, M as CdnAssetUrlOptions, Mn as EventResource, Mt as PolicySettings, N as CdnResource, Nt as ProjectSettingsResource, O as CalmLensAppClientOptions, On as ProcessingFeatures, Ot as MultipartUploadPartOptions, P as CdnServeOptions, Pn as EventCategory, Pt as PublicProjectSettings, Q as EventFact, Qn as MetadataItem, Qt as UpdateAssetOptions, R as ConnectionOptions, Rn as Folder, Rt as RequestOptions, S as AssetUpload, Sn as BoundingBox, St as ListLensesOptions, T as AssignPolicyOptions, Tn as ProcessingFeatureId, Tt as MoveAssetOptions, U as CreatePolicyOptions, Un as AssetHls, Ut as SearchAssetsOptions, V as CreateLensOptions, Vt as RetrieveAssetOptions, W as DecideAssetOptions, Wn as AssetHlsRendition, Wt as SetPolicyAutomaticUpdatesOptions, X as EnsureUploadPresetsOptions, Xn as ExtractedText, Xt as SubmitAssetOptions, Y as EnsureMetadataFieldsOptions, Yn as AssetSafetyHoldReason, Yt as StreamingFeatureOptions, Z as EnsureUploadPresetsResponse, Zn as FileMetadata, Zt as TypedEvent, _ as AssetPage, _n as AssetReviewRequest, _t as ListAssetsOptions, a as AssetChecksums, an as UploadAssetPartOptions, at as GetAssetInfoOptions, b as AssetTimelinePage, bn as UploadPreset, bt as ListHashListEntriesOptions, c as AssetClassificationFailureReason, cn as UploadPresetPage, ct as HashListIdOptions, d as AssetContentOptions, dn as VerifyWebhookSignatureOptions, dt as ImageTransformOptions, en as UpdateHashListOptions, et as EventFacts, f as AssetContentRemovalReason, fn as ViewerClaims, ft as Lens, g as AssetModerationStatus, gn as AssetBatchOperation, gt as ListAssetTimelineOptions, h as AssetModerationDecision, hn as WebhookPayloadInput, ht as ListAssetChildrenOptions, i as AssetAvailability, in as UpgradePolicyOptions, it as FolderPage, j as CdnAssetReference, jt as PolicyPage, k as CalmLensServerClientOptions, kn as CursorPage, kt as Policy, l as AssetClassificationStatus, ln as UploadPresetSubmitAssetOptions, lt as HashListPage, m as AssetModeration, mn as WebhookHeadersInput, mt as LensPage, n as AppInfo, nn as UpdatePolicyOptions, nt as EventsPage, o as AssetChildrenPage, on as UploadPresetDefinition, ot as HashListEntryIdOptions, p as AssetContentStatus, pn as WaitForAssetDecisionOptions, pt as LensIdOptions, q as EnsureLensOptions, qn as AssetRenderedKind, qt as SignedAssetUrl, r as Asset, rn as UpdateProjectSettingsOptions, rt as FolderIdOptions, s as AssetClassification, sn as UploadPresetIdOptions, st as HashListEntryPage, t as AddHashListEntryOptions, tn as UpdateLensOptions, tt as EventType, u as AssetContent, un as UploadedAsset, ut as IdempotencyOptions, v as AssetSearchResponse, vn as AssetTimelineSegment, vt as ListEventsOptions, w as AssetVisibility, wn as DetectedPerson, wt as ListUploadPresetsOptions, x as AssetType, xn as AgeRange, xt as ListHashListsOptions, y as AssetSearchResult, yn as MetadataFieldsResource, yt as ListFoldersOptions, z as CreateFolderOptions, zn as AssetSearchMatchField, zt as ResetPolicyOptions } from "./CalmLensTypes-CCsoVr39.js";
|
|
3
|
+
import { a as getAssetInfo, i as CDN_RESOURCES, n as SDK_VERSION, r as DEFAULT_CDN_BASE_URL, t as ModerationContextItem } from "./index-Dk3I5YXf.js";
|
|
4
|
+
import { A as CalmLensRateLimitError, C as CalmLensErrorKind, D as CalmLensNotFoundError, E as CalmLensInvalidResponseError, F as SdkErrorCode, I as ApiErrorCode, M as CalmLensTimeoutError, N as CalmLensUnprocessableEntityError, O as CalmLensPayloadTooLargeError, P as CalmLensWebhookVerificationError, S as CalmLensErrorDetails, T as CalmLensInvalidArgumentError, _ as CalmLensConfigurationError, a as AUTO_PAGING_TO_ARRAY_MAX, b as CalmLensError, c as CalmLensLastResponse, d as ListPromise, f as CALMLENS_ERROR_CODES, g as CalmLensCancelledError, h as CalmLensBadRequestError, i as ServedAssetInfo, j as CalmLensServerError, k as CalmLensPermissionDeniedError, l as CalmLensResponse, m as CalmLensAuthenticationError, o as AutoPaging, p as CalmLensApiError, r as CdnResponse, s as AutoPagingToArrayOptions, t as ReceivedWebhookEventPayload, u as ListPage, v as CalmLensConflictError, w as CalmLensErrorOptions, x as CalmLensErrorCode, y as CalmLensConnectionError } from "./WebhookPayload-_fvY2eu8.js";
|
|
5
|
+
import { t as CalmLensServerClient } from "./CalmLensServerClient-2H0ZpJlr.js";
|
|
6
6
|
export declare const WEBHOOK_DELIVERY_HEADER = "x-calmlens-delivery";
|
|
7
7
|
export declare const WEBHOOK_TIMESTAMP_HEADER = "x-calmlens-timestamp";
|
|
8
8
|
export declare const WEBHOOK_SIGNATURE_HEADER = "x-calmlens-signature";
|
package/cjs/server.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_CalmLensError = require("./CalmLensError-
|
|
3
|
-
const require_CalmLensCdn = require("./CalmLensCdn-
|
|
2
|
+
const require_CalmLensError = require("./CalmLensError-C9g7GXfU.js");
|
|
3
|
+
const require_CalmLensCdn = require("./CalmLensCdn-B_Tbwq10.js");
|
|
4
4
|
require("./index.js");
|
|
5
|
-
const require_CalmLensServerClient = require("./CalmLensServerClient
|
|
5
|
+
const require_CalmLensServerClient = require("./CalmLensServerClient-D0wCcQNn.js");
|
|
6
6
|
exports.AUTO_PAGING_TO_ARRAY_MAX = require_CalmLensCdn.AUTO_PAGING_TO_ARRAY_MAX;
|
|
7
7
|
exports.CALMLENS_ERROR_CODES = require_CalmLensError.CALMLENS_ERROR_CODES;
|
|
8
8
|
exports.CDN_RESOURCES = require_CalmLensCdn.CDN_RESOURCES;
|
|
@@ -19,7 +19,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
19
19
|
value: mod,
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
|
22
|
-
const require_CalmLensError = require("./CalmLensError-
|
|
22
|
+
const require_CalmLensError = require("./CalmLensError-C9g7GXfU.js");
|
|
23
23
|
const require_CryptoUtils_BLCa_oZe = require("./CryptoUtils-BLCa-oZe-leCkr1ko.js");
|
|
24
24
|
let zod = require("zod");
|
|
25
25
|
let zod$1 = __toESM(zod, 1);
|
|
@@ -1872,7 +1872,7 @@ const toBase64Url = (bytes) => btoa(String.fromCharCode(...bytes)).replaceAll("+
|
|
|
1872
1872
|
const fromBase64Url = (text) => Uint8Array.from(atob(text.replaceAll("-", "+").replaceAll("_", "/")), (char) => char.charCodeAt(0));
|
|
1873
1873
|
/** The signed bytes: the scenario's canonical JSON (ASCII). */
|
|
1874
1874
|
const envelope = (scenario) => new TextEncoder().encode(JSON.stringify(TEST_INPUT_SCHEMA.parse(scenario)));
|
|
1875
|
-
async function generateTestTextCode(scenario, key) {
|
|
1875
|
+
async function generateTestTextCode$1(scenario, key) {
|
|
1876
1876
|
if (!/^[a-f0-9]{32}$/.test(key)) throw new TypeError("Invalid test input key");
|
|
1877
1877
|
const payload = toBase64Url(envelope(typeof scenario === "string" ? testInputForSignal(scenario) : scenario));
|
|
1878
1878
|
if (payload.length > 8e3) throw new RangeError("Test scenario is too large");
|
|
@@ -1948,9 +1948,9 @@ const TEST_INPUT_CATEGORY_COLORS = {
|
|
|
1948
1948
|
* bytes, big-endian), the 16-byte tag, then the payload (the scenario JSON). The reader rebuilds
|
|
1949
1949
|
* the text code, so images and text share one verification.
|
|
1950
1950
|
*/
|
|
1951
|
-
async function paintTestImage(scenario, key) {
|
|
1951
|
+
async function paintTestImage$1(scenario, key) {
|
|
1952
1952
|
const input = TEST_INPUT_SCHEMA.parse(typeof scenario === "string" ? testInputForSignal(scenario, "image") : scenario);
|
|
1953
|
-
const [, signature, payload] = (await generateTestTextCode(input, key)).slice(0, -1).split(" ");
|
|
1953
|
+
const [, signature, payload] = (await generateTestTextCode$1(input, key)).slice(0, -1).split(" ");
|
|
1954
1954
|
const signed = fromBase64Url(payload);
|
|
1955
1955
|
const data = new Uint8Array(18 + signed.length);
|
|
1956
1956
|
data.set([signed.length >> 8, signed.length & 255]);
|
|
@@ -2000,6 +2000,146 @@ async function withValidTestInputArguments(key, generate) {
|
|
|
2000
2000
|
throw error;
|
|
2001
2001
|
}
|
|
2002
2002
|
}
|
|
2003
|
+
// src/client/TestImagePng.ts
|
|
2004
|
+
/**
|
|
2005
|
+
* Encodes a painted test image as a PNG: 8-bit RGBA rows without filtering in stored deflate
|
|
2006
|
+
* blocks, as every SDK writes it, so the bytes match across SDKs. Runs anywhere, with no
|
|
2007
|
+
* compression library.
|
|
2008
|
+
*/
|
|
2009
|
+
function encodeTestImagePng(width, height, rgba) {
|
|
2010
|
+
const stride = width * 4;
|
|
2011
|
+
const raw = new Uint8Array((stride + 1) * height);
|
|
2012
|
+
for (let row = 0; row < height; row++) raw.set(rgba.subarray(row * stride, (row + 1) * stride), row * (stride + 1) + 1);
|
|
2013
|
+
const blocks = Math.max(1, Math.ceil(raw.length / 65535));
|
|
2014
|
+
const stream = new Uint8Array(2 + raw.length + blocks * 5 + 4);
|
|
2015
|
+
stream.set([120, 1]);
|
|
2016
|
+
let position = 2;
|
|
2017
|
+
for (let offset = 0; offset < raw.length || position === 2; offset += 65535) {
|
|
2018
|
+
const block = raw.subarray(offset, offset + 65535);
|
|
2019
|
+
const length = block.length;
|
|
2020
|
+
stream.set([
|
|
2021
|
+
offset + length >= raw.length ? 1 : 0,
|
|
2022
|
+
length & 255,
|
|
2023
|
+
length >> 8,
|
|
2024
|
+
~length & 255,
|
|
2025
|
+
~length >> 8 & 255
|
|
2026
|
+
], position);
|
|
2027
|
+
stream.set(block, position + 5);
|
|
2028
|
+
position += 5 + length;
|
|
2029
|
+
}
|
|
2030
|
+
writeUint32(stream, position, adler32(raw));
|
|
2031
|
+
const header = /* @__PURE__ */ new Uint8Array(13);
|
|
2032
|
+
writeUint32(header, 0, width);
|
|
2033
|
+
writeUint32(header, 4, height);
|
|
2034
|
+
header.set([
|
|
2035
|
+
8,
|
|
2036
|
+
6,
|
|
2037
|
+
0,
|
|
2038
|
+
0,
|
|
2039
|
+
0
|
|
2040
|
+
], 8);
|
|
2041
|
+
return concat([
|
|
2042
|
+
Uint8Array.of(137, 80, 78, 71, 13, 10, 26, 10),
|
|
2043
|
+
chunk("IHDR", header),
|
|
2044
|
+
chunk("IDAT", stream),
|
|
2045
|
+
chunk("IEND", /* @__PURE__ */ new Uint8Array(0))
|
|
2046
|
+
]);
|
|
2047
|
+
}
|
|
2048
|
+
function chunk(kind, body) {
|
|
2049
|
+
const typed = new Uint8Array(4 + body.length);
|
|
2050
|
+
for (let i = 0; i < 4; i++) typed[i] = kind.charCodeAt(i);
|
|
2051
|
+
typed.set(body, 4);
|
|
2052
|
+
const out = new Uint8Array(12 + body.length);
|
|
2053
|
+
writeUint32(out, 0, body.length);
|
|
2054
|
+
out.set(typed, 4);
|
|
2055
|
+
writeUint32(out, 8 + body.length, crc32(typed));
|
|
2056
|
+
return out;
|
|
2057
|
+
}
|
|
2058
|
+
function writeUint32(target, offset, value) {
|
|
2059
|
+
target[offset] = value >>> 24;
|
|
2060
|
+
target[offset + 1] = value >>> 16 & 255;
|
|
2061
|
+
target[offset + 2] = value >>> 8 & 255;
|
|
2062
|
+
target[offset + 3] = value & 255;
|
|
2063
|
+
}
|
|
2064
|
+
function concat(parts) {
|
|
2065
|
+
const out = new Uint8Array(parts.reduce((total, part) => total + part.length, 0));
|
|
2066
|
+
let offset = 0;
|
|
2067
|
+
for (const part of parts) {
|
|
2068
|
+
out.set(part, offset);
|
|
2069
|
+
offset += part.length;
|
|
2070
|
+
}
|
|
2071
|
+
return out;
|
|
2072
|
+
}
|
|
2073
|
+
let crcTable;
|
|
2074
|
+
function crc32(bytes) {
|
|
2075
|
+
if (!crcTable) {
|
|
2076
|
+
crcTable = /* @__PURE__ */ new Uint32Array(256);
|
|
2077
|
+
for (let n = 0; n < 256; n++) {
|
|
2078
|
+
let c = n;
|
|
2079
|
+
for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
|
|
2080
|
+
crcTable[n] = c >>> 0;
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
let crc = 4294967295;
|
|
2084
|
+
for (const byte of bytes) crc = crcTable[(crc ^ byte) & 255] ^ crc >>> 8;
|
|
2085
|
+
return (crc ^ 4294967295) >>> 0;
|
|
2086
|
+
}
|
|
2087
|
+
function adler32(bytes) {
|
|
2088
|
+
let a = 1;
|
|
2089
|
+
let b = 0;
|
|
2090
|
+
for (const byte of bytes) {
|
|
2091
|
+
a = (a + byte) % 65521;
|
|
2092
|
+
b = (b + a) % 65521;
|
|
2093
|
+
}
|
|
2094
|
+
return (b << 16 | a) >>> 0;
|
|
2095
|
+
}
|
|
2096
|
+
// src/contract/MediaTestTriggers.js
|
|
2097
|
+
const MEDIA_TEST_SIGNALS = [...CLASSIFICATION_CATEGORIES, "violence.graphic"];
|
|
2098
|
+
const HEX_WORDS = [
|
|
2099
|
+
"zero",
|
|
2100
|
+
"one",
|
|
2101
|
+
"two",
|
|
2102
|
+
"three",
|
|
2103
|
+
"four",
|
|
2104
|
+
"five",
|
|
2105
|
+
"six",
|
|
2106
|
+
"seven",
|
|
2107
|
+
"eight",
|
|
2108
|
+
"nine",
|
|
2109
|
+
"alpha",
|
|
2110
|
+
"bravo",
|
|
2111
|
+
"charlie",
|
|
2112
|
+
"delta",
|
|
2113
|
+
"echo",
|
|
2114
|
+
"foxtrot"
|
|
2115
|
+
];
|
|
2116
|
+
/** Read this aloud, or render it as large, high-contrast text in a video frame. */
|
|
2117
|
+
async function generateMediaTestCode$1(signal, testInputKey) {
|
|
2118
|
+
if (!MEDIA_TEST_SIGNALS.includes(signal)) throw new RangeError("Unsupported media test signal");
|
|
2119
|
+
return `Calm Lens test ${[...await getTestInputTag("media", signal, testInputKey)].map((character) => HEX_WORDS[Number.parseInt(character, 16)]).join(" ")} ${signal.replace(/[.-]/g, " ")} end test`;
|
|
2120
|
+
}
|
|
2121
|
+
// src/test-inputs.ts
|
|
2122
|
+
/**
|
|
2123
|
+
* Portable test inputs: presets and custom instances share one authenticated format. CalmLens
|
|
2124
|
+
* recognises a code only as the whole text and a test image only as the whole
|
|
2125
|
+
* upload, signed with the project's own key.
|
|
2126
|
+
*/
|
|
2127
|
+
/** A spoken media test phrase for `signal`, signed with the project's test input key. */
|
|
2128
|
+
const generateMediaTestCode = (signal, key) => withValidTestInputArguments(key, () => generateMediaTestCode$1(signal, key));
|
|
2129
|
+
/** A text code for `scenario`, signed with the project's test input key. */
|
|
2130
|
+
const generateTestTextCode = (scenario, key) => withValidTestInputArguments(key, () => generateTestTextCode$1(scenario, key));
|
|
2131
|
+
/**
|
|
2132
|
+
* The test image for `scenario`, signed with the project's test input key. Upload its `png` bytes
|
|
2133
|
+
* (or encode `rgba` in another format: the image survives lossy formats and resizing) as the whole
|
|
2134
|
+
* image, optionally on a plain single-colour border.
|
|
2135
|
+
*/
|
|
2136
|
+
const paintTestImage = async (scenario, key) => {
|
|
2137
|
+
const image = await withValidTestInputArguments(key, () => paintTestImage$1(scenario, key));
|
|
2138
|
+
return {
|
|
2139
|
+
...image,
|
|
2140
|
+
png: encodeTestImagePng(image.width, image.height, image.rgba)
|
|
2141
|
+
};
|
|
2142
|
+
};
|
|
2003
2143
|
Object.defineProperty(exports, "CLASSIFICATION_CATEGORIES", {
|
|
2004
2144
|
enumerable: true,
|
|
2005
2145
|
get: function() {
|
|
@@ -2012,6 +2152,12 @@ Object.defineProperty(exports, "EU_COUNTRIES", {
|
|
|
2012
2152
|
return EU_COUNTRIES;
|
|
2013
2153
|
}
|
|
2014
2154
|
});
|
|
2155
|
+
Object.defineProperty(exports, "MEDIA_TEST_SIGNALS", {
|
|
2156
|
+
enumerable: true,
|
|
2157
|
+
get: function() {
|
|
2158
|
+
return MEDIA_TEST_SIGNALS;
|
|
2159
|
+
}
|
|
2160
|
+
});
|
|
2015
2161
|
Object.defineProperty(exports, "TEST_DETECTIONS_MAX", {
|
|
2016
2162
|
enumerable: true,
|
|
2017
2163
|
get: function() {
|
|
@@ -2066,22 +2212,22 @@ Object.defineProperty(exports, "detectTestTrigger", {
|
|
|
2066
2212
|
return detectTestTrigger;
|
|
2067
2213
|
}
|
|
2068
2214
|
});
|
|
2069
|
-
Object.defineProperty(exports, "
|
|
2215
|
+
Object.defineProperty(exports, "generateMediaTestCode", {
|
|
2070
2216
|
enumerable: true,
|
|
2071
2217
|
get: function() {
|
|
2072
|
-
return
|
|
2218
|
+
return generateMediaTestCode;
|
|
2073
2219
|
}
|
|
2074
2220
|
});
|
|
2075
|
-
Object.defineProperty(exports, "
|
|
2221
|
+
Object.defineProperty(exports, "generateTestTextCode", {
|
|
2076
2222
|
enumerable: true,
|
|
2077
2223
|
get: function() {
|
|
2078
|
-
return
|
|
2224
|
+
return generateTestTextCode;
|
|
2079
2225
|
}
|
|
2080
2226
|
});
|
|
2081
|
-
Object.defineProperty(exports, "
|
|
2227
|
+
Object.defineProperty(exports, "getImageTestCategories", {
|
|
2082
2228
|
enumerable: true,
|
|
2083
2229
|
get: function() {
|
|
2084
|
-
return
|
|
2230
|
+
return getImageTestCategories;
|
|
2085
2231
|
}
|
|
2086
2232
|
});
|
|
2087
2233
|
Object.defineProperty(exports, "lazySchema", {
|
|
@@ -2102,9 +2248,3 @@ Object.defineProperty(exports, "testInputForSignal", {
|
|
|
2102
2248
|
return testInputForSignal;
|
|
2103
2249
|
}
|
|
2104
2250
|
});
|
|
2105
|
-
Object.defineProperty(exports, "withValidTestInputArguments", {
|
|
2106
|
-
enumerable: true,
|
|
2107
|
-
get: function() {
|
|
2108
|
-
return withValidTestInputArguments;
|
|
2109
|
-
}
|
|
2110
|
-
});
|
|
@@ -402,4 +402,23 @@ declare function detectTestImage(image: RgbaImage, key: string,
|
|
|
402
402
|
}[] | undefined;
|
|
403
403
|
} | undefined;
|
|
404
404
|
} | undefined>;
|
|
405
|
-
|
|
405
|
+
declare const MEDIA_TEST_SIGNALS: readonly ["sexual", "violence", "self-harm", "harassment", "hate", "criminal-activity", "personal-information", "profanity", "violence.graphic"];
|
|
406
|
+
/** A spoken media test phrase for `signal`, signed with the project's test input key. */
|
|
407
|
+
declare const generateMediaTestCode: (signal: ClassificationTestSignal, key: string) => Promise<string>;
|
|
408
|
+
/** A text code for `scenario`, signed with the project's test input key. */
|
|
409
|
+
declare const generateTestTextCode: (scenario: TestInput | ClassificationTestSignal, key: string) => Promise<string>;
|
|
410
|
+
/** A painted test image: its RGBA pixels, row by row, and the same image as PNG bytes. */
|
|
411
|
+
interface TestImage {
|
|
412
|
+
width: number;
|
|
413
|
+
height: number;
|
|
414
|
+
rgba: Uint8Array;
|
|
415
|
+
/** The image as a PNG, to upload as it is. */
|
|
416
|
+
png: Uint8Array;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* The test image for `scenario`, signed with the project's test input key. Upload its `png` bytes
|
|
420
|
+
* (or encode `rgba` in another format: the image survives lossy formats and resizing) as the whole
|
|
421
|
+
* image, optionally on a plain single-colour border.
|
|
422
|
+
*/
|
|
423
|
+
declare const paintTestImage: (scenario: TestInput | ClassificationTestSignal, key: string) => Promise<TestImage>;
|
|
424
|
+
export { getImageTestCategories as _, MEDIA_TEST_SIGNALS as a, TEST_DETECTION_BOX_MAX as c, TEST_INPUT_KEY_PATTERN as d, TEST_INPUT_PRESETS as f, detectTestTrigger as g, detectTestImage as h, paintTestImage as i, TEST_FACE_AGE_MAX as l, TestInput as m, generateMediaTestCode as n, ClassificationTestSignal as o, TestDetections as p, generateTestTextCode as r, TEST_DETECTIONS_MAX as s, TestImage as t, TEST_FACE_AGE_PRESETS as u, testInputForSignal as v };
|
package/cjs/test-inputs.d.ts
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
|
|
3
|
-
export declare const generateTestTextCode: (scenario: TestInput | ClassificationTestSignal, key: string) => Promise<string>;
|
|
4
|
-
/** A painted test image: its RGBA pixels, row by row, and the same image as PNG bytes. */
|
|
5
|
-
export interface TestImage {
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
rgba: Uint8Array;
|
|
9
|
-
/** The image as a PNG, to upload as it is. */
|
|
10
|
-
png: Uint8Array;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* The test image for `scenario`, signed with the project's test input key. Upload its `png` bytes
|
|
14
|
-
* (or encode `rgba` in another format: the image survives lossy formats and resizing) as the whole
|
|
15
|
-
* image, optionally on a plain single-colour border.
|
|
16
|
-
*/
|
|
17
|
-
export declare const paintTestImage: (scenario: TestInput | ClassificationTestSignal, key: string) => Promise<TestImage>;
|
|
18
|
-
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, getImageTestCategories, testInputForSignal };
|
|
1
|
+
import { _ as getImageTestCategories, a as MEDIA_TEST_SIGNALS, c as TEST_DETECTION_BOX_MAX, d as TEST_INPUT_KEY_PATTERN, f as TEST_INPUT_PRESETS, g as detectTestTrigger, h as detectTestImage, i as paintTestImage, l as TEST_FACE_AGE_MAX, m as TestInput, n as generateMediaTestCode, o as ClassificationTestSignal, p as TestDetections, r as generateTestTextCode, s as TEST_DETECTIONS_MAX, t as TestImage, u as TEST_FACE_AGE_PRESETS, v as testInputForSignal } from "./test-inputs-JaZaV9Up.js";
|
|
2
|
+
export { type ClassificationTestSignal, MEDIA_TEST_SIGNALS, TEST_DETECTIONS_MAX, TEST_DETECTION_BOX_MAX, TEST_FACE_AGE_MAX, TEST_FACE_AGE_PRESETS, TEST_INPUT_KEY_PATTERN, TEST_INPUT_PRESETS, type TestDetections, TestImage, type TestInput, detectTestImage, detectTestTrigger, generateMediaTestCode, generateTestTextCode, getImageTestCategories, paintTestImage, testInputForSignal };
|
package/cjs/test-inputs.js
CHANGED
|
@@ -1,127 +1,16 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
for (let offset = 0; offset < raw.length || position === 2; offset += 65535) {
|
|
18
|
-
const block = raw.subarray(offset, offset + 65535);
|
|
19
|
-
const length = block.length;
|
|
20
|
-
stream.set([
|
|
21
|
-
offset + length >= raw.length ? 1 : 0,
|
|
22
|
-
length & 255,
|
|
23
|
-
length >> 8,
|
|
24
|
-
~length & 255,
|
|
25
|
-
~length >> 8 & 255
|
|
26
|
-
], position);
|
|
27
|
-
stream.set(block, position + 5);
|
|
28
|
-
position += 5 + length;
|
|
29
|
-
}
|
|
30
|
-
writeUint32(stream, position, adler32(raw));
|
|
31
|
-
const header = /* @__PURE__ */ new Uint8Array(13);
|
|
32
|
-
writeUint32(header, 0, width);
|
|
33
|
-
writeUint32(header, 4, height);
|
|
34
|
-
header.set([
|
|
35
|
-
8,
|
|
36
|
-
6,
|
|
37
|
-
0,
|
|
38
|
-
0,
|
|
39
|
-
0
|
|
40
|
-
], 8);
|
|
41
|
-
return concat([
|
|
42
|
-
Uint8Array.of(137, 80, 78, 71, 13, 10, 26, 10),
|
|
43
|
-
chunk("IHDR", header),
|
|
44
|
-
chunk("IDAT", stream),
|
|
45
|
-
chunk("IEND", /* @__PURE__ */ new Uint8Array(0))
|
|
46
|
-
]);
|
|
47
|
-
}
|
|
48
|
-
function chunk(kind, body) {
|
|
49
|
-
const typed = new Uint8Array(4 + body.length);
|
|
50
|
-
for (let i = 0; i < 4; i++) typed[i] = kind.charCodeAt(i);
|
|
51
|
-
typed.set(body, 4);
|
|
52
|
-
const out = new Uint8Array(12 + body.length);
|
|
53
|
-
writeUint32(out, 0, body.length);
|
|
54
|
-
out.set(typed, 4);
|
|
55
|
-
writeUint32(out, 8 + body.length, crc32(typed));
|
|
56
|
-
return out;
|
|
57
|
-
}
|
|
58
|
-
function writeUint32(target, offset, value) {
|
|
59
|
-
target[offset] = value >>> 24;
|
|
60
|
-
target[offset + 1] = value >>> 16 & 255;
|
|
61
|
-
target[offset + 2] = value >>> 8 & 255;
|
|
62
|
-
target[offset + 3] = value & 255;
|
|
63
|
-
}
|
|
64
|
-
function concat(parts) {
|
|
65
|
-
const out = new Uint8Array(parts.reduce((total, part) => total + part.length, 0));
|
|
66
|
-
let offset = 0;
|
|
67
|
-
for (const part of parts) {
|
|
68
|
-
out.set(part, offset);
|
|
69
|
-
offset += part.length;
|
|
70
|
-
}
|
|
71
|
-
return out;
|
|
72
|
-
}
|
|
73
|
-
let crcTable;
|
|
74
|
-
function crc32(bytes) {
|
|
75
|
-
if (!crcTable) {
|
|
76
|
-
crcTable = /* @__PURE__ */ new Uint32Array(256);
|
|
77
|
-
for (let n = 0; n < 256; n++) {
|
|
78
|
-
let c = n;
|
|
79
|
-
for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
|
|
80
|
-
crcTable[n] = c >>> 0;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
let crc = 4294967295;
|
|
84
|
-
for (const byte of bytes) crc = crcTable[(crc ^ byte) & 255] ^ crc >>> 8;
|
|
85
|
-
return (crc ^ 4294967295) >>> 0;
|
|
86
|
-
}
|
|
87
|
-
function adler32(bytes) {
|
|
88
|
-
let a = 1;
|
|
89
|
-
let b = 0;
|
|
90
|
-
for (const byte of bytes) {
|
|
91
|
-
a = (a + byte) % 65521;
|
|
92
|
-
b = (b + a) % 65521;
|
|
93
|
-
}
|
|
94
|
-
return (b << 16 | a) >>> 0;
|
|
95
|
-
}
|
|
96
|
-
// src/test-inputs.ts
|
|
97
|
-
/**
|
|
98
|
-
* Portable test inputs: presets and custom instances share one authenticated format. CalmLens
|
|
99
|
-
* recognises a code only as the whole text and a test image only as the whole
|
|
100
|
-
* upload, signed with the project's own key.
|
|
101
|
-
*/
|
|
102
|
-
/** A text code for `scenario`, signed with the project's test input key. */
|
|
103
|
-
const generateTestTextCode = (scenario, key) => require_CalmLensTestInputArguments.withValidTestInputArguments(key, () => require_CalmLensTestInputArguments.generateTestTextCode(scenario, key));
|
|
104
|
-
/**
|
|
105
|
-
* The test image for `scenario`, signed with the project's test input key. Upload its `png` bytes
|
|
106
|
-
* (or encode `rgba` in another format: the image survives lossy formats and resizing) as the whole
|
|
107
|
-
* image, optionally on a plain single-colour border.
|
|
108
|
-
*/
|
|
109
|
-
const paintTestImage = async (scenario, key) => {
|
|
110
|
-
const image = await require_CalmLensTestInputArguments.withValidTestInputArguments(key, () => require_CalmLensTestInputArguments.paintTestImage(scenario, key));
|
|
111
|
-
return {
|
|
112
|
-
...image,
|
|
113
|
-
png: encodeTestImagePng(image.width, image.height, image.rgba)
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
exports.TEST_DETECTIONS_MAX = require_CalmLensTestInputArguments.TEST_DETECTIONS_MAX;
|
|
117
|
-
exports.TEST_DETECTION_BOX_MAX = require_CalmLensTestInputArguments.TEST_DETECTION_BOX_MAX;
|
|
118
|
-
exports.TEST_FACE_AGE_MAX = require_CalmLensTestInputArguments.TEST_FACE_AGE_MAX;
|
|
119
|
-
exports.TEST_FACE_AGE_PRESETS = require_CalmLensTestInputArguments.TEST_FACE_AGE_PRESETS;
|
|
120
|
-
exports.TEST_INPUT_KEY_PATTERN = require_CalmLensTestInputArguments.TEST_INPUT_KEY_PATTERN;
|
|
121
|
-
exports.TEST_INPUT_PRESETS = require_CalmLensTestInputArguments.TEST_INPUT_PRESETS;
|
|
122
|
-
exports.detectTestImage = require_CalmLensTestInputArguments.detectTestImage;
|
|
123
|
-
exports.detectTestTrigger = require_CalmLensTestInputArguments.detectTestTrigger;
|
|
124
|
-
exports.generateTestTextCode = generateTestTextCode;
|
|
125
|
-
exports.getImageTestCategories = require_CalmLensTestInputArguments.getImageTestCategories;
|
|
126
|
-
exports.paintTestImage = paintTestImage;
|
|
127
|
-
exports.testInputForSignal = require_CalmLensTestInputArguments.testInputForSignal;
|
|
2
|
+
const require_test_inputs = require("./test-inputs-BVJZjtFd.js");
|
|
3
|
+
exports.MEDIA_TEST_SIGNALS = require_test_inputs.MEDIA_TEST_SIGNALS;
|
|
4
|
+
exports.TEST_DETECTIONS_MAX = require_test_inputs.TEST_DETECTIONS_MAX;
|
|
5
|
+
exports.TEST_DETECTION_BOX_MAX = require_test_inputs.TEST_DETECTION_BOX_MAX;
|
|
6
|
+
exports.TEST_FACE_AGE_MAX = require_test_inputs.TEST_FACE_AGE_MAX;
|
|
7
|
+
exports.TEST_FACE_AGE_PRESETS = require_test_inputs.TEST_FACE_AGE_PRESETS;
|
|
8
|
+
exports.TEST_INPUT_KEY_PATTERN = require_test_inputs.TEST_INPUT_KEY_PATTERN;
|
|
9
|
+
exports.TEST_INPUT_PRESETS = require_test_inputs.TEST_INPUT_PRESETS;
|
|
10
|
+
exports.detectTestImage = require_test_inputs.detectTestImage;
|
|
11
|
+
exports.detectTestTrigger = require_test_inputs.detectTestTrigger;
|
|
12
|
+
exports.generateMediaTestCode = require_test_inputs.generateMediaTestCode;
|
|
13
|
+
exports.generateTestTextCode = require_test_inputs.generateTestTextCode;
|
|
14
|
+
exports.getImageTestCategories = require_test_inputs.getImageTestCategories;
|
|
15
|
+
exports.paintTestImage = require_test_inputs.paintTestImage;
|
|
16
|
+
exports.testInputForSignal = require_test_inputs.testInputForSignal;
|
package/cjs/testing.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Jt as SignedUploadToken, Kt as SignUploadTokenOptions, Ln as PermissionGrant, Nn as TypedEvent, O as CalmLensAppClientOptions, Rn as Folder, Vn as AssetBinaryPayloadInput, k as CalmLensServerClientOptions, m as AssetModeration, on as UploadPresetDefinition, r as Asset } from "./CalmLensTypes-
|
|
2
|
-
import { t as CalmLensAppClient } from "./CalmLensAppClient-
|
|
3
|
-
import { I as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-
|
|
4
|
-
import { t as CalmLensServerClient } from "./CalmLensServerClient-
|
|
5
|
-
import {
|
|
1
|
+
import { Jt as SignedUploadToken, Kt as SignUploadTokenOptions, Ln as PermissionGrant, Nn as TypedEvent, O as CalmLensAppClientOptions, Rn as Folder, Vn as AssetBinaryPayloadInput, k as CalmLensServerClientOptions, m as AssetModeration, on as UploadPresetDefinition, r as Asset } from "./CalmLensTypes-CCsoVr39.js";
|
|
2
|
+
import { t as CalmLensAppClient } from "./CalmLensAppClient-L5x_sMOI.js";
|
|
3
|
+
import { I as ApiErrorCode, n as WebhookEventPayload } from "./WebhookPayload-_fvY2eu8.js";
|
|
4
|
+
import { t as CalmLensServerClient } from "./CalmLensServerClient-2H0ZpJlr.js";
|
|
5
|
+
import { a as MEDIA_TEST_SIGNALS, n as generateMediaTestCode } from "./test-inputs-JaZaV9Up.js";
|
|
6
6
|
import "zod";
|
|
7
7
|
/**
|
|
8
8
|
* Signs a single-use upload token with `apiKey`, locally. `CalmLensServerClient` and
|
|
@@ -14,7 +14,6 @@ declare const signUploadTokenWithApiKey: (apiKey: string, options: SignUploadTok
|
|
|
14
14
|
now?: number;
|
|
15
15
|
nonce?: string;
|
|
16
16
|
}) => Promise<SignedUploadToken>;
|
|
17
|
-
export declare const MEDIA_TEST_SIGNALS: readonly ["sexual", "violence", "self-harm", "harassment", "hate", "criminal-activity", "personal-information", "profanity", "violence.graphic"];
|
|
18
17
|
export declare const MOCK_API_KEY_PREFIX = "sk_test_";
|
|
19
18
|
/**
|
|
20
19
|
* Creates a mock API key holding `grants`. Throws `sdk/invalid-argument`, naming the grant, for
|
|
@@ -188,7 +187,8 @@ interface MockModerationInput {
|
|
|
188
187
|
trigger: MockModerationTrigger;
|
|
189
188
|
/**
|
|
190
189
|
* `true` when the API would queue the work rather than answer with the decision: queued
|
|
191
|
-
* uploads,
|
|
190
|
+
* uploads, uploads of audio, video, documents, websites and plain text over 4 MiB (always
|
|
191
|
+
* moderated in the background, even when the caller waits), retries and `completeProcessing`.
|
|
192
192
|
*/
|
|
193
193
|
queued: boolean;
|
|
194
194
|
}
|
|
@@ -233,11 +233,11 @@ interface MockDatabaseStorage {
|
|
|
233
233
|
getAsset(assetId: string): Promise<Asset | undefined>;
|
|
234
234
|
listAssets(projectId: string): Promise<Asset[]>;
|
|
235
235
|
deleteAsset(assetId: string): Promise<void>;
|
|
236
|
-
createFolder
|
|
237
|
-
updateFolder
|
|
238
|
-
getFolder
|
|
239
|
-
listFolders
|
|
240
|
-
deleteFolder
|
|
236
|
+
createFolder(folder: Folder): Promise<Folder>;
|
|
237
|
+
updateFolder(folder: Folder): Promise<Folder>;
|
|
238
|
+
getFolder(folderId: string): Promise<Folder | undefined>;
|
|
239
|
+
listFolders(projectId: string): Promise<Folder[]>;
|
|
240
|
+
deleteFolder(folderId: string): Promise<void>;
|
|
241
241
|
}
|
|
242
242
|
export declare class InMemoryMockDatabaseStorage implements MockDatabaseStorage {
|
|
243
243
|
private readonly assets;
|
|
@@ -504,6 +504,4 @@ export declare const createWebhookHeaders: (options: {
|
|
|
504
504
|
deliveryId: string;
|
|
505
505
|
timestampSeconds?: number;
|
|
506
506
|
}) => Promise<Record<string, string>>;
|
|
507
|
-
|
|
508
|
-
export declare const generateMediaTestCode: (signal: ClassificationTestSignal, key: string) => Promise<string>;
|
|
509
|
-
export { type MockAssetOutcome, type MockCalmLensAppClientOptions, type MockCalmLensCall, type MockCalmLensOperation, type MockCalmLensServerClientOptions, type MockDatabaseStorage, type MockDetectedFace, type MockDetectedLink, type MockDetectedPerson, type MockEventInput, type MockFailureOptions, type MockImageStorage, type MockModerate, type MockModerationInput, type MockModerationTrigger, type MockQrCode, type MockRegionalDecision, type MockRequestFailure, type MockReviewDecision, type MockServedUrl, type MockStoredContent, type MockTextRegion, type MockUploadPreset, signUploadTokenWithApiKey as signUploadToken };
|
|
507
|
+
export { MEDIA_TEST_SIGNALS, type MockAssetOutcome, type MockCalmLensAppClientOptions, type MockCalmLensCall, type MockCalmLensOperation, type MockCalmLensServerClientOptions, type MockDatabaseStorage, type MockDetectedFace, type MockDetectedLink, type MockDetectedPerson, type MockEventInput, type MockFailureOptions, type MockImageStorage, type MockModerate, type MockModerationInput, type MockModerationTrigger, type MockQrCode, type MockRegionalDecision, type MockRequestFailure, type MockReviewDecision, type MockServedUrl, type MockStoredContent, type MockTextRegion, type MockUploadPreset, generateMediaTestCode, signUploadTokenWithApiKey as signUploadToken };
|