@calmlens/sdk 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -1
- package/cjs/CalmLensConnection-DzRDCMOP.js +233 -0
- package/cjs/CalmLensUtils-vX5H_vMn.js +699 -0
- package/cjs/{CalmLensError-CKwMKV0S.js → CalmLensVersion-DjhsJ1gj.js} +48 -0
- package/cjs/{CalmLensWebhooks-BTPxKvcD.js → CalmLensWebhooks-hVquX5L1.js} +9 -9
- package/cjs/{WebhookPayload-Cgb32aSH.d.ts → WebhookPayload-B7CgSmI5.d.ts} +4996 -3255
- package/cjs/app.d.ts +3 -3
- package/cjs/app.js +10 -10
- package/cjs/{index-BgmWj3KL.d.ts → index-BywTQbRq.d.ts} +3 -1
- package/cjs/index.d.ts +3 -3
- package/cjs/index.js +4 -5
- package/cjs/server.d.ts +12 -4
- package/cjs/server.js +31 -18
- package/cjs/testing.d.ts +6 -1
- package/cjs/testing.js +91 -73
- package/esm/CalmLensConnection-D8VsTdsA.js +192 -0
- package/esm/{CalmLensUtils-Cx32j2zt.js → CalmLensUtils-B4i3Z2He.js} +316 -2
- package/esm/{CalmLensError-CihGG26K.js → CalmLensVersion-DK4BMEST.js} +25 -1
- package/esm/{CalmLensWebhooks-DShmAal4.js → CalmLensWebhooks-DyCoEvpf.js} +2 -2
- package/esm/{WebhookPayload-Cgb32aSH.d.ts → WebhookPayload-B7CgSmI5.d.ts} +4996 -3255
- package/esm/app.d.ts +3 -3
- package/esm/app.js +4 -4
- package/esm/{index-BgmWj3KL.d.ts → index-BywTQbRq.d.ts} +3 -1
- package/esm/index.d.ts +3 -3
- package/esm/index.js +1 -3
- package/esm/server.d.ts +12 -4
- package/esm/server.js +20 -7
- package/esm/testing.d.ts +6 -1
- package/esm/testing.js +59 -41
- package/package.json +1 -1
- package/cjs/CalmLensConnection-CYtBP-vu.js +0 -516
- package/cjs/CalmLensUtils-Dg3s4loH.js +0 -367
- package/cjs/src-Dsc8Pn6v.js +0 -45
- package/esm/CalmLensConnection-wLNy0OIP.js +0 -475
- package/esm/src-CJhrILvM.js +0 -22
package/esm/app.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as SearchAssetsOptions, A as DeleteAssetContentOptions,
|
|
2
|
-
import { _ as ProcessingFeatureStage, a as CalmLensErrorDetails, c as ApiErrorCode, d as AgeRange, f as BoundingBox, g as ProcessingFeatureResults, h as ProcessingFeatureId, i as CalmLensErrorCode, l as FlaggedContentAction, m as DetectedPerson, n as CALMLENS_ERROR_CODES, o as CalmLensErrorOptions, p as DetectedFace, r as CalmLensError, s as SdkErrorCode, t as SDK_VERSION, u as FlaggedContentPolicy, v as ProcessingFeatures } from "./index-
|
|
1
|
+
import { $ as SearchAssetsOptions, A as DeleteAssetContentOptions, B as Lens, C as CdnAssetUrlOptions, Ct as EventSeverity, D as CreateAssetSignedUrlOptions, Dt as LensType, E as ConnectionOptions, Et as Page, F as IdempotencyOptions, Ft as ImageData, G as ModerateTextOptions, H as ListAssetChildrenOptions, I as ImageTransform, It as MetadataItem, J as MultipartUploadOptions, K as MoveAssetOptions, L as ImageTransformOptions, Lt as PreviewImage, M as EnsureLensOptions, Mt as AssetSafetyHoldReason, N as EnsureLensesOptions, Nt as DocumentData, O as CreateFolderOptions, Ot as AssetSearchMatchField, P as FolderIdOptions, Pt as ExtractedText, Q as RetryAssetOptions, R as IterateAssetChildrenOptions, Rt as ProcessingOptions, S as CalmLensServerClientOptions, St as EventFacts, T as CdnTransform, Tt as Order, U as ListAssetsOptions, V as LensTransform, W as ListEventsOptions, X as RequestOptions, Y as MultipartUploadPartOptions, Z as RetrieveAssetOptions, _ as AssetSearchResult, _t as EventAsset, a as ClassificationLabel, at as UpdateFolderOptions, b as AssetVisibility, bt as EventFact, c as ClassificationReport, ct as UploadedAsset, d as Asset, dt as WebhookHeadersInput, et as SignUploadTokenOptions, f as AssetChecksums, ft as WebhookPayloadInput, g as AssetSearchResponse, h as AssetPage, ht as Folder, i as ClassificationCategoryReport, it as UpdateAssetOptions, j as DeleteAssetOptions, jt as AssetSafetyHold, k as CreateMultipartUploadPartOptions, kt as AssetSearchQuery, l as Likelihood, lt as VerifyWebhookSignatureOptions, m as AssetContentOptions, n as ClassificationCategories, nt as SignedUrl, o as ClassificationNotEvaluatedReason, ot as UploadAssetPartOptions, p as AssetChildrenPage, pt as GetEventsResponse, q as MoveFolderOptions, r as ClassificationCategory, rt as SubmitAssetOptions, s as ClassificationQualifierResults, st as UploadPresetSubmitAssetOptions, t as WebhookEventPayload, tt as SignedUploadToken, u as ModerationQualifier, ut as WaitForAssetDecisionOptions, v as AssetStatus, vt as TypedEvent, w as CdnServeOptions, wt as EventType, x as CalmLensAppClientOptions, xt as EventFactValues, y as AssetType, yt as EventCategory, z as IterateAssetsOptions } from "./WebhookPayload-B7CgSmI5.js";
|
|
2
|
+
import { _ as ProcessingFeatureStage, a as CalmLensErrorDetails, c as ApiErrorCode, d as AgeRange, f as BoundingBox, g as ProcessingFeatureResults, h as ProcessingFeatureId, i as CalmLensErrorCode, l as FlaggedContentAction, m as DetectedPerson, n as CALMLENS_ERROR_CODES, o as CalmLensErrorOptions, p as DetectedFace, r as CalmLensError, s as SdkErrorCode, t as SDK_VERSION, u as FlaggedContentPolicy, v as ProcessingFeatures } from "./index-BywTQbRq.js";
|
|
3
3
|
//#region src/client/CalmLensAppClient.d.ts
|
|
4
4
|
declare const inspectSymbol: unique symbol;
|
|
5
5
|
/**
|
|
@@ -40,4 +40,4 @@ declare class CalmLensAppClient {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
43
|
-
export { type AgeRange, type ApiErrorCode, type Asset, type AssetChecksums, type AssetChildrenPage, type AssetContentOptions, type AssetPage, type AssetSafetyHold, type AssetSafetyHoldReason, type AssetSearchMatchField, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, type AssetStatus, type AssetType, type AssetVisibility, type BoundingBox, CALMLENS_ERROR_CODES, CalmLensAppClient, type CalmLensAppClientOptions, CalmLensError, type CalmLensErrorCode, type CalmLensErrorDetails, type CalmLensErrorOptions, type CalmLensServerClientOptions, type CdnAssetUrlOptions, type CdnServeOptions, type CdnTransform, type ClassificationCategories, type ClassificationCategory, type ClassificationCategoryReport, type ClassificationLabel, type ClassificationNotEvaluatedReason, type ClassificationQualifierResults, type ClassificationReport, type ConnectionOptions, type CreateAssetSignedUrlOptions, type CreateFolderOptions, type CreateMultipartUploadPartOptions, type DeleteAssetContentOptions, type DeleteAssetOptions, type DetectedFace, type DetectedPerson, type DocumentData, type EnsureLensOptions, type EnsureLensesOptions, type EventAsset, type EventCategory, type EventFact, type EventFactValues, type EventFacts, type EventSeverity, type EventType, type GetEventsResponse as EventsPage, type ExtractedText, type FlaggedContentAction, type FlaggedContentPolicy, type Folder, type FolderIdOptions, type IdempotencyOptions, type ImageData, type ImageTransform, type ImageTransformOptions, type IterateAssetChildrenOptions, type IterateAssetsOptions, type Lens, type LensTransform, type LensType, type Likelihood, type ListAssetChildrenOptions, type ListAssetsOptions, type ListEventsOptions, type MetadataItem, type ModerateTextOptions, type ModerationQualifier, type MoveAssetOptions, type MoveFolderOptions, type MultipartUploadOptions, type MultipartUploadPartOptions, type Order, type Page, type PreviewImage, type ProcessingFeatureId, type ProcessingFeatureResults, type ProcessingFeatureStage, type ProcessingFeatures, type ProcessingOptions, type RequestOptions, type RetrieveAssetOptions, type RetryAssetOptions, SDK_VERSION, type SdkErrorCode, type SearchAssetsOptions, type SignUploadTokenOptions, type SignedUploadToken, type SignedUrl, type SubmitAssetOptions, type TypedEvent, type UpdateAssetOptions, type UpdateFolderOptions, type UploadAssetPartOptions, type UploadPresetSubmitAssetOptions, type UploadedAsset, type VerifyWebhookSignatureOptions, type WebhookEventPayload, type WebhookHeadersInput, type WebhookPayloadInput };
|
|
43
|
+
export { type AgeRange, type ApiErrorCode, type Asset, type AssetChecksums, type AssetChildrenPage, type AssetContentOptions, type AssetPage, type AssetSafetyHold, type AssetSafetyHoldReason, type AssetSearchMatchField, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, type AssetStatus, type AssetType, type AssetVisibility, type BoundingBox, CALMLENS_ERROR_CODES, CalmLensAppClient, type CalmLensAppClientOptions, CalmLensError, type CalmLensErrorCode, type CalmLensErrorDetails, type CalmLensErrorOptions, type CalmLensServerClientOptions, type CdnAssetUrlOptions, type CdnServeOptions, type CdnTransform, type ClassificationCategories, type ClassificationCategory, type ClassificationCategoryReport, type ClassificationLabel, type ClassificationNotEvaluatedReason, type ClassificationQualifierResults, type ClassificationReport, type ConnectionOptions, type CreateAssetSignedUrlOptions, type CreateFolderOptions, type CreateMultipartUploadPartOptions, type DeleteAssetContentOptions, type DeleteAssetOptions, type DetectedFace, type DetectedPerson, type DocumentData, type EnsureLensOptions, type EnsureLensesOptions, type EventAsset, type EventCategory, type EventFact, type EventFactValues, type EventFacts, type EventSeverity, type EventType, type GetEventsResponse as EventsPage, type ExtractedText, type FlaggedContentAction, type FlaggedContentPolicy, type Folder, type FolderIdOptions, type IdempotencyOptions, type ImageData, type ImageTransform, type ImageTransformOptions, type IterateAssetChildrenOptions, type IterateAssetsOptions, type Lens, type LensTransform, type LensType, type Likelihood, type ListAssetChildrenOptions, type ListAssetsOptions, type ListEventsOptions, type MetadataItem, type ModerateTextOptions, type ModerationQualifier, type MoveAssetOptions, type MoveFolderOptions, type MultipartUploadOptions, type MultipartUploadPartOptions, type Order, type Page, type PreviewImage, type ProcessingFeatureId, type ProcessingFeatureResults, type ProcessingFeatureStage, type ProcessingFeatures, type ProcessingOptions, type RequestOptions, type RetrieveAssetOptions, type RetryAssetOptions, SDK_VERSION, type SdkErrorCode, type SearchAssetsOptions, type SignUploadTokenOptions, type SignedUploadToken, type SignedUrl, type SubmitAssetOptions, type TypedEvent, type UpdateAssetOptions, type UpdateFolderOptions, type UploadAssetPartOptions, type UploadPresetSubmitAssetOptions, type UploadedAsset, type VerifyWebhookSignatureOptions, type WaitForAssetDecisionOptions, type WebhookEventPayload, type WebhookHeadersInput, type WebhookPayloadInput };
|
package/esm/app.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { o as prepareSubmitAssetOptions, r as expectUploadedAsset, s as resolveConnectionOptions, t as CalmLensConnection } from "./CalmLensConnection-
|
|
1
|
+
import { a as CALMLENS_ERROR_CODES, c as invalidArgument, l as invalidConfig, o as CalmLensError, t as SDK_VERSION } from "./CalmLensVersion-DK4BMEST.js";
|
|
2
|
+
import "./index.js";
|
|
3
|
+
import { c as validateAppClientOptions, n as encodePathSegment } from "./CalmLensUtils-B4i3Z2He.js";
|
|
4
|
+
import { o as prepareSubmitAssetOptions, r as expectUploadedAsset, s as resolveConnectionOptions, t as CalmLensConnection } from "./CalmLensConnection-D8VsTdsA.js";
|
|
5
5
|
//#region src/client/CalmLensAppClient.ts
|
|
6
6
|
const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
7
7
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./WebhookPayload-
|
|
1
|
+
import "./WebhookPayload-B7CgSmI5.js";
|
|
2
2
|
import * as zod from "zod";
|
|
3
3
|
//#region ../shared/src/ProcessingFeatures.d.ts
|
|
4
4
|
/**
|
|
@@ -152,6 +152,7 @@ declare const API_ERROR_CODES: {
|
|
|
152
152
|
readonly MULTIPART_IMAGE_TOO_LARGE: "upload/multipart-image-too-large";
|
|
153
153
|
readonly IMAGE_EXCEEDED_MAX_DIMENSIONS: "upload/image-exceeded-max-dimensions";
|
|
154
154
|
readonly UPLOAD_LIMIT_EXCEEDED: "upload/limit-exceeded";
|
|
155
|
+
readonly SPEND_LIMIT_REACHED: "upload/spend-limit-reached";
|
|
155
156
|
readonly INVALID_UPLOAD_MIME_TYPE: "upload/invalid-mime-type";
|
|
156
157
|
readonly INVALID_EVENT_CURSOR: "events/invalid-cursor";
|
|
157
158
|
readonly INVALID_UPLOAD_PAYLOAD: "upload/invalid-payload";
|
|
@@ -230,6 +231,7 @@ declare const CALMLENS_ERROR_CODES: {
|
|
|
230
231
|
readonly MULTIPART_IMAGE_TOO_LARGE: "upload/multipart-image-too-large";
|
|
231
232
|
readonly IMAGE_EXCEEDED_MAX_DIMENSIONS: "upload/image-exceeded-max-dimensions";
|
|
232
233
|
readonly UPLOAD_LIMIT_EXCEEDED: "upload/limit-exceeded";
|
|
234
|
+
readonly SPEND_LIMIT_REACHED: "upload/spend-limit-reached";
|
|
233
235
|
readonly INVALID_UPLOAD_MIME_TYPE: "upload/invalid-mime-type";
|
|
234
236
|
readonly INVALID_EVENT_CURSOR: "events/invalid-cursor";
|
|
235
237
|
readonly INVALID_UPLOAD_PAYLOAD: "upload/invalid-payload";
|
package/esm/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as SearchAssetsOptions, A as DeleteAssetContentOptions,
|
|
2
|
-
import { _ as ProcessingFeatureStage, a as CalmLensErrorDetails, c as ApiErrorCode, d as AgeRange, f as BoundingBox, g as ProcessingFeatureResults, h as ProcessingFeatureId, i as CalmLensErrorCode, l as FlaggedContentAction, m as DetectedPerson, n as CALMLENS_ERROR_CODES, o as CalmLensErrorOptions, p as DetectedFace, r as CalmLensError, s as SdkErrorCode, t as SDK_VERSION, u as FlaggedContentPolicy, v as ProcessingFeatures } from "./index-
|
|
3
|
-
export { type AgeRange, type ApiErrorCode, type Asset, type AssetChecksums, type AssetChildrenPage, type AssetContentOptions, type AssetPage, type AssetSafetyHold, type AssetSafetyHoldReason, type AssetSearchMatchField, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, type AssetStatus, type AssetType, type AssetVisibility, type BoundingBox, CALMLENS_ERROR_CODES, type CalmLensAppClientOptions, CalmLensError, type CalmLensErrorCode, type CalmLensErrorDetails, type CalmLensErrorOptions, type CalmLensServerClientOptions, type CdnAssetUrlOptions, type CdnServeOptions, type CdnTransform, type ClassificationCategories, type ClassificationCategory, type ClassificationCategoryReport, type ClassificationLabel, type ClassificationNotEvaluatedReason, type ClassificationQualifierResults, type ClassificationReport, type ConnectionOptions, type CreateAssetSignedUrlOptions, type CreateFolderOptions, type CreateMultipartUploadPartOptions, type DeleteAssetContentOptions, type DeleteAssetOptions, type DetectedFace, type DetectedPerson, type DocumentData, type EnsureLensOptions, type EnsureLensesOptions, type EventAsset, type EventCategory, type EventFact, type EventFactValues, type EventFacts, type EventSeverity, type EventType, type GetEventsResponse as EventsPage, type ExtractedText, type FlaggedContentAction, type FlaggedContentPolicy, type Folder, type FolderIdOptions, type IdempotencyOptions, type ImageData, type ImageTransform, type ImageTransformOptions, type IterateAssetChildrenOptions, type IterateAssetsOptions, type Lens, type LensTransform, type LensType, type Likelihood, type ListAssetChildrenOptions, type ListAssetsOptions, type ListEventsOptions, type MetadataItem, type ModerateTextOptions, type ModerationQualifier, type MoveAssetOptions, type MoveFolderOptions, type MultipartUploadOptions, type MultipartUploadPartOptions, type Order, type Page, type PreviewImage, type ProcessingFeatureId, type ProcessingFeatureResults, type ProcessingFeatureStage, type ProcessingFeatures, type ProcessingOptions, type RequestOptions, type RetrieveAssetOptions, type RetryAssetOptions, SDK_VERSION, type SdkErrorCode, type SearchAssetsOptions, type SignUploadTokenOptions, type SignedUploadToken, type SignedUrl, type SubmitAssetOptions, type TypedEvent, type UpdateAssetOptions, type UpdateFolderOptions, type UploadAssetPartOptions, type UploadPresetSubmitAssetOptions, type UploadedAsset, type VerifyWebhookSignatureOptions, type WebhookEventPayload, type WebhookHeadersInput, type WebhookPayloadInput };
|
|
1
|
+
import { $ as SearchAssetsOptions, A as DeleteAssetContentOptions, B as Lens, C as CdnAssetUrlOptions, Ct as EventSeverity, D as CreateAssetSignedUrlOptions, Dt as LensType, E as ConnectionOptions, Et as Page, F as IdempotencyOptions, Ft as ImageData, G as ModerateTextOptions, H as ListAssetChildrenOptions, I as ImageTransform, It as MetadataItem, J as MultipartUploadOptions, K as MoveAssetOptions, L as ImageTransformOptions, Lt as PreviewImage, M as EnsureLensOptions, Mt as AssetSafetyHoldReason, N as EnsureLensesOptions, Nt as DocumentData, O as CreateFolderOptions, Ot as AssetSearchMatchField, P as FolderIdOptions, Pt as ExtractedText, Q as RetryAssetOptions, R as IterateAssetChildrenOptions, Rt as ProcessingOptions, S as CalmLensServerClientOptions, St as EventFacts, T as CdnTransform, Tt as Order, U as ListAssetsOptions, V as LensTransform, W as ListEventsOptions, X as RequestOptions, Y as MultipartUploadPartOptions, Z as RetrieveAssetOptions, _ as AssetSearchResult, _t as EventAsset, a as ClassificationLabel, at as UpdateFolderOptions, b as AssetVisibility, bt as EventFact, c as ClassificationReport, ct as UploadedAsset, d as Asset, dt as WebhookHeadersInput, et as SignUploadTokenOptions, f as AssetChecksums, ft as WebhookPayloadInput, g as AssetSearchResponse, h as AssetPage, ht as Folder, i as ClassificationCategoryReport, it as UpdateAssetOptions, j as DeleteAssetOptions, jt as AssetSafetyHold, k as CreateMultipartUploadPartOptions, kt as AssetSearchQuery, l as Likelihood, lt as VerifyWebhookSignatureOptions, m as AssetContentOptions, n as ClassificationCategories, nt as SignedUrl, o as ClassificationNotEvaluatedReason, ot as UploadAssetPartOptions, p as AssetChildrenPage, pt as GetEventsResponse, q as MoveFolderOptions, r as ClassificationCategory, rt as SubmitAssetOptions, s as ClassificationQualifierResults, st as UploadPresetSubmitAssetOptions, t as WebhookEventPayload, tt as SignedUploadToken, u as ModerationQualifier, ut as WaitForAssetDecisionOptions, v as AssetStatus, vt as TypedEvent, w as CdnServeOptions, wt as EventType, x as CalmLensAppClientOptions, xt as EventFactValues, y as AssetType, yt as EventCategory, z as IterateAssetsOptions } from "./WebhookPayload-B7CgSmI5.js";
|
|
2
|
+
import { _ as ProcessingFeatureStage, a as CalmLensErrorDetails, c as ApiErrorCode, d as AgeRange, f as BoundingBox, g as ProcessingFeatureResults, h as ProcessingFeatureId, i as CalmLensErrorCode, l as FlaggedContentAction, m as DetectedPerson, n as CALMLENS_ERROR_CODES, o as CalmLensErrorOptions, p as DetectedFace, r as CalmLensError, s as SdkErrorCode, t as SDK_VERSION, u as FlaggedContentPolicy, v as ProcessingFeatures } from "./index-BywTQbRq.js";
|
|
3
|
+
export { type AgeRange, type ApiErrorCode, type Asset, type AssetChecksums, type AssetChildrenPage, type AssetContentOptions, type AssetPage, type AssetSafetyHold, type AssetSafetyHoldReason, type AssetSearchMatchField, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, type AssetStatus, type AssetType, type AssetVisibility, type BoundingBox, CALMLENS_ERROR_CODES, type CalmLensAppClientOptions, CalmLensError, type CalmLensErrorCode, type CalmLensErrorDetails, type CalmLensErrorOptions, type CalmLensServerClientOptions, type CdnAssetUrlOptions, type CdnServeOptions, type CdnTransform, type ClassificationCategories, type ClassificationCategory, type ClassificationCategoryReport, type ClassificationLabel, type ClassificationNotEvaluatedReason, type ClassificationQualifierResults, type ClassificationReport, type ConnectionOptions, type CreateAssetSignedUrlOptions, type CreateFolderOptions, type CreateMultipartUploadPartOptions, type DeleteAssetContentOptions, type DeleteAssetOptions, type DetectedFace, type DetectedPerson, type DocumentData, type EnsureLensOptions, type EnsureLensesOptions, type EventAsset, type EventCategory, type EventFact, type EventFactValues, type EventFacts, type EventSeverity, type EventType, type GetEventsResponse as EventsPage, type ExtractedText, type FlaggedContentAction, type FlaggedContentPolicy, type Folder, type FolderIdOptions, type IdempotencyOptions, type ImageData, type ImageTransform, type ImageTransformOptions, type IterateAssetChildrenOptions, type IterateAssetsOptions, type Lens, type LensTransform, type LensType, type Likelihood, type ListAssetChildrenOptions, type ListAssetsOptions, type ListEventsOptions, type MetadataItem, type ModerateTextOptions, type ModerationQualifier, type MoveAssetOptions, type MoveFolderOptions, type MultipartUploadOptions, type MultipartUploadPartOptions, type Order, type Page, type PreviewImage, type ProcessingFeatureId, type ProcessingFeatureResults, type ProcessingFeatureStage, type ProcessingFeatures, type ProcessingOptions, type RequestOptions, type RetrieveAssetOptions, type RetryAssetOptions, SDK_VERSION, type SdkErrorCode, type SearchAssetsOptions, type SignUploadTokenOptions, type SignedUploadToken, type SignedUrl, type SubmitAssetOptions, type TypedEvent, type UpdateAssetOptions, type UpdateFolderOptions, type UploadAssetPartOptions, type UploadPresetSubmitAssetOptions, type UploadedAsset, type VerifyWebhookSignatureOptions, type WaitForAssetDecisionOptions, type WebhookEventPayload, type WebhookHeadersInput, type WebhookPayloadInput };
|
package/esm/index.js
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as SDK_VERSION } from "./src-CJhrILvM.js";
|
|
3
|
-
export { CALMLENS_ERROR_CODES, CalmLensError, SDK_VERSION };
|
|
1
|
+
export { a as CALMLENS_ERROR_CODES, o as CalmLensError, t as SDK_VERSION } from "./CalmLensVersion-DK4BMEST.js";
|
package/esm/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as SearchAssetsOptions, A as DeleteAssetContentOptions,
|
|
2
|
-
import { _ as ProcessingFeatureStage, a as CalmLensErrorDetails, c as ApiErrorCode, d as AgeRange, f as BoundingBox, g as ProcessingFeatureResults, h as ProcessingFeatureId, i as CalmLensErrorCode, l as FlaggedContentAction, m as DetectedPerson, n as CALMLENS_ERROR_CODES, o as CalmLensErrorOptions, p as DetectedFace, r as CalmLensError, s as SdkErrorCode, t as SDK_VERSION, u as FlaggedContentPolicy, v as ProcessingFeatures } from "./index-
|
|
1
|
+
import { $ as SearchAssetsOptions, A as DeleteAssetContentOptions, B as Lens, C as CdnAssetUrlOptions, Ct as EventSeverity, D as CreateAssetSignedUrlOptions, Dt as LensType, E as ConnectionOptions, Et as Page, F as IdempotencyOptions, Ft as ImageData, G as ModerateTextOptions, H as ListAssetChildrenOptions, I as ImageTransform, It as MetadataItem, J as MultipartUploadOptions, K as MoveAssetOptions, L as ImageTransformOptions, Lt as PreviewImage, M as EnsureLensOptions, Mt as AssetSafetyHoldReason, N as EnsureLensesOptions, Nt as DocumentData, O as CreateFolderOptions, Ot as AssetSearchMatchField, P as FolderIdOptions, Pt as ExtractedText, Q as RetryAssetOptions, R as IterateAssetChildrenOptions, Rt as ProcessingOptions, S as CalmLensServerClientOptions, St as EventFacts, T as CdnTransform, Tt as Order, U as ListAssetsOptions, V as LensTransform, W as ListEventsOptions, X as RequestOptions, Y as MultipartUploadPartOptions, Z as RetrieveAssetOptions, _ as AssetSearchResult, _t as EventAsset, a as ClassificationLabel, at as UpdateFolderOptions, b as AssetVisibility, bt as EventFact, c as ClassificationReport, ct as UploadedAsset, d as Asset, dt as WebhookHeadersInput, et as SignUploadTokenOptions, f as AssetChecksums, ft as WebhookPayloadInput, g as AssetSearchResponse, h as AssetPage, ht as Folder, i as ClassificationCategoryReport, it as UpdateAssetOptions, j as DeleteAssetOptions, jt as AssetSafetyHold, k as CreateMultipartUploadPartOptions, kt as AssetSearchQuery, l as Likelihood, lt as VerifyWebhookSignatureOptions, m as AssetContentOptions, mt as PostAssetSignedUrlResponse, n as ClassificationCategories, nt as SignedUrl, o as ClassificationNotEvaluatedReason, ot as UploadAssetPartOptions, p as AssetChildrenPage, pt as GetEventsResponse, q as MoveFolderOptions, r as ClassificationCategory, rt as SubmitAssetOptions, s as ClassificationQualifierResults, st as UploadPresetSubmitAssetOptions, t as WebhookEventPayload, tt as SignedUploadToken, u as ModerationQualifier, ut as WaitForAssetDecisionOptions, v as AssetStatus, vt as TypedEvent, w as CdnServeOptions, wt as EventType, x as CalmLensAppClientOptions, xt as EventFactValues, y as AssetType, yt as EventCategory, z as IterateAssetsOptions } from "./WebhookPayload-B7CgSmI5.js";
|
|
2
|
+
import { _ as ProcessingFeatureStage, a as CalmLensErrorDetails, c as ApiErrorCode, d as AgeRange, f as BoundingBox, g as ProcessingFeatureResults, h as ProcessingFeatureId, i as CalmLensErrorCode, l as FlaggedContentAction, m as DetectedPerson, n as CALMLENS_ERROR_CODES, o as CalmLensErrorOptions, p as DetectedFace, r as CalmLensError, s as SdkErrorCode, t as SDK_VERSION, u as FlaggedContentPolicy, v as ProcessingFeatures } from "./index-BywTQbRq.js";
|
|
3
3
|
//#region src/client/CalmLensServerClient.d.ts
|
|
4
4
|
interface LensCache {
|
|
5
5
|
readonly ensuredLenses: Map<string, Lens>;
|
|
@@ -115,6 +115,12 @@ declare class CalmLensServerClient {
|
|
|
115
115
|
* moderated like a new upload; its content must still be stored.
|
|
116
116
|
*/
|
|
117
117
|
retry: ({ assetId }: RetryAssetOptions) => Promise<Asset>;
|
|
118
|
+
/**
|
|
119
|
+
* Waits for an asset's moderation decision (`approved`, `rejected` or `error`) and returns
|
|
120
|
+
* the decided asset, checking every few seconds. Rejects with `sdk/timeout` if there is no
|
|
121
|
+
* decision within `timeoutMs` (default 60000). Webhooks report decisions without polling.
|
|
122
|
+
*/
|
|
123
|
+
waitForDecision: ({ assetId, ...options }: WaitForAssetDecisionOptions) => Promise<Asset>;
|
|
118
124
|
/**
|
|
119
125
|
* Removes an asset's stored content (source, preview and retained extracted text) while
|
|
120
126
|
* keeping the asset record, metadata and moderation report. The returned asset has
|
|
@@ -169,11 +175,13 @@ declare class CalmLensServerClient {
|
|
|
169
175
|
*/
|
|
170
176
|
ensureLens(options: EnsureLensOptions): Promise<Lens>;
|
|
171
177
|
/**
|
|
172
|
-
* Create or update several named lenses in one API request
|
|
178
|
+
* Create or update several named lenses. New definitions are sent in one API request, or in
|
|
179
|
+
* consecutive requests of at most {@link ENSURE_LENSES_MAX_PER_REQUEST} definitions, in order.
|
|
173
180
|
* Each lens follows the same versioning and idempotency rules as ensureLens().
|
|
174
181
|
*/
|
|
175
182
|
ensureLenses({ lenses }: EnsureLensesOptions): Promise<Lens[]>;
|
|
176
183
|
private submitEnsureLenses;
|
|
184
|
+
private submitEnsureLensesChunk;
|
|
177
185
|
}
|
|
178
186
|
//#endregion
|
|
179
187
|
//#region src/client/CalmLensWebhooks.d.ts
|
|
@@ -199,4 +207,4 @@ export declare function verifyWebhookSignature(options: VerifyWebhookSignatureOp
|
|
|
199
207
|
*/
|
|
200
208
|
export declare function parseWebhookEvent(options: VerifyWebhookSignatureOptions): Promise<WebhookEventPayload>;
|
|
201
209
|
//#endregion
|
|
202
|
-
export { type AgeRange, type ApiErrorCode, type Asset, type AssetChecksums, type AssetChildrenPage, type AssetContentOptions, type AssetPage, type AssetSafetyHold, type AssetSafetyHoldReason, type AssetSearchMatchField, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, type AssetStatus, type AssetType, type AssetVisibility, type BoundingBox, CALMLENS_ERROR_CODES, type CalmLensAppClientOptions, CalmLensError, type CalmLensErrorCode, type CalmLensErrorDetails, type CalmLensErrorOptions, CalmLensServerClient, type CalmLensServerClientOptions, type CdnAssetUrlOptions, type CdnServeOptions, type CdnTransform, type ClassificationCategories, type ClassificationCategory, type ClassificationCategoryReport, type ClassificationLabel, type ClassificationNotEvaluatedReason, type ClassificationQualifierResults, type ClassificationReport, type ConnectionOptions, type CreateAssetSignedUrlOptions, type CreateFolderOptions, type CreateMultipartUploadPartOptions, type DeleteAssetContentOptions, type DeleteAssetOptions, type DetectedFace, type DetectedPerson, type DocumentData, type EnsureLensOptions, type EnsureLensesOptions, type EventAsset, type EventCategory, type EventFact, type EventFactValues, type EventFacts, type EventSeverity, type EventType, type GetEventsResponse as EventsPage, type ExtractedText, type FlaggedContentAction, type FlaggedContentPolicy, type Folder, type FolderIdOptions, type IdempotencyOptions, type ImageData, type ImageTransform, type ImageTransformOptions, type IterateAssetChildrenOptions, type IterateAssetsOptions, type Lens, type LensTransform, type LensType, type Likelihood, type ListAssetChildrenOptions, type ListAssetsOptions, type ListEventsOptions, type MetadataItem, type ModerateTextOptions, type ModerationQualifier, type MoveAssetOptions, type MoveFolderOptions, type MultipartUploadOptions, type MultipartUploadPartOptions, type Order, type Page, type PreviewImage, type ProcessingFeatureId, type ProcessingFeatureResults, type ProcessingFeatureStage, type ProcessingFeatures, type ProcessingOptions, type RequestOptions, type RetrieveAssetOptions, type RetryAssetOptions, SDK_VERSION, type SdkErrorCode, type SearchAssetsOptions, type SignUploadTokenOptions, type SignedUploadToken, type SignedUrl, type SubmitAssetOptions, type TypedEvent, type UpdateAssetOptions, type UpdateFolderOptions, type UploadAssetPartOptions, type UploadPresetSubmitAssetOptions, type UploadedAsset, type VerifyWebhookSignatureOptions, type WebhookEventPayload, type WebhookHeadersInput, type WebhookPayloadInput };
|
|
210
|
+
export { type AgeRange, type ApiErrorCode, type Asset, type AssetChecksums, type AssetChildrenPage, type AssetContentOptions, type AssetPage, type AssetSafetyHold, type AssetSafetyHoldReason, type AssetSearchMatchField, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, type AssetStatus, type AssetType, type AssetVisibility, type BoundingBox, CALMLENS_ERROR_CODES, type CalmLensAppClientOptions, CalmLensError, type CalmLensErrorCode, type CalmLensErrorDetails, type CalmLensErrorOptions, CalmLensServerClient, type CalmLensServerClientOptions, type CdnAssetUrlOptions, type CdnServeOptions, type CdnTransform, type ClassificationCategories, type ClassificationCategory, type ClassificationCategoryReport, type ClassificationLabel, type ClassificationNotEvaluatedReason, type ClassificationQualifierResults, type ClassificationReport, type ConnectionOptions, type CreateAssetSignedUrlOptions, type CreateFolderOptions, type CreateMultipartUploadPartOptions, type DeleteAssetContentOptions, type DeleteAssetOptions, type DetectedFace, type DetectedPerson, type DocumentData, type EnsureLensOptions, type EnsureLensesOptions, type EventAsset, type EventCategory, type EventFact, type EventFactValues, type EventFacts, type EventSeverity, type EventType, type GetEventsResponse as EventsPage, type ExtractedText, type FlaggedContentAction, type FlaggedContentPolicy, type Folder, type FolderIdOptions, type IdempotencyOptions, type ImageData, type ImageTransform, type ImageTransformOptions, type IterateAssetChildrenOptions, type IterateAssetsOptions, type Lens, type LensTransform, type LensType, type Likelihood, type ListAssetChildrenOptions, type ListAssetsOptions, type ListEventsOptions, type MetadataItem, type ModerateTextOptions, type ModerationQualifier, type MoveAssetOptions, type MoveFolderOptions, type MultipartUploadOptions, type MultipartUploadPartOptions, type Order, type Page, type PreviewImage, type ProcessingFeatureId, type ProcessingFeatureResults, type ProcessingFeatureStage, type ProcessingFeatures, type ProcessingOptions, type RequestOptions, type RetrieveAssetOptions, type RetryAssetOptions, SDK_VERSION, type SdkErrorCode, type SearchAssetsOptions, type SignUploadTokenOptions, type SignedUploadToken, type SignedUrl, type SubmitAssetOptions, type TypedEvent, type UpdateAssetOptions, type UpdateFolderOptions, type UploadAssetPartOptions, type UploadPresetSubmitAssetOptions, type UploadedAsset, type VerifyWebhookSignatureOptions, type WaitForAssetDecisionOptions, type WebhookEventPayload, type WebhookHeadersInput, type WebhookPayloadInput };
|
package/esm/server.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import
|
|
3
|
-
import { a as parseWebhookEvent, i as WEBHOOK_TIMESTAMP_HEADER, l as stringifyJsonCanonical, n as WEBHOOK_SIGNATURE_HEADER, o as verifyWebhookSignature, r as WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, s as signUploadTokenWithApiKey, t as WEBHOOK_DELIVERY_HEADER } from "./CalmLensWebhooks-
|
|
4
|
-
import {
|
|
5
|
-
import { a as newIdempotencyKey, i as invalidPayload, n as expectAsset, o as prepareSubmitAssetOptions, s as resolveConnectionOptions, t as CalmLensConnection } from "./CalmLensConnection-
|
|
6
|
-
//#region src/client/CalmLensServerClient.ts
|
|
1
|
+
import { a as CALMLENS_ERROR_CODES, c as invalidArgument, i as isReactNativeRuntime, l as invalidConfig, o as CalmLensError, r as isBrowserRuntime, s as SDK_ERROR_CODES, t as SDK_VERSION } from "./CalmLensVersion-DK4BMEST.js";
|
|
2
|
+
import "./index.js";
|
|
3
|
+
import { a as parseWebhookEvent, i as WEBHOOK_TIMESTAMP_HEADER, l as stringifyJsonCanonical, n as WEBHOOK_SIGNATURE_HEADER, o as verifyWebhookSignature, r as WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, s as signUploadTokenWithApiKey, t as WEBHOOK_DELIVERY_HEADER } from "./CalmLensWebhooks-DyCoEvpf.js";
|
|
4
|
+
import { f as sleep, l as validateRequestOptions, n as encodePathSegment, o as toTextAssetOptions, r as pollForDecision, s as transformSelector, t as appendCdnSelector, u as validateServerClientOptions } from "./CalmLensUtils-B4i3Z2He.js";
|
|
5
|
+
import { a as newIdempotencyKey, i as invalidPayload, n as expectAsset, o as prepareSubmitAssetOptions, s as resolveConnectionOptions, t as CalmLensConnection } from "./CalmLensConnection-D8VsTdsA.js";
|
|
7
6
|
const getEnsureLensCacheKey = (options) => stringifyJsonCanonical({
|
|
8
7
|
identifier: options.identifier,
|
|
9
8
|
name: options.name,
|
|
@@ -241,6 +240,16 @@ sign: async (options) => {
|
|
|
241
240
|
*/
|
|
242
241
|
retry: async ({ assetId }) => this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/retry`),
|
|
243
242
|
/**
|
|
243
|
+
* Waits for an asset's moderation decision (`approved`, `rejected` or `error`) and returns
|
|
244
|
+
* the decided asset, checking every few seconds. Rejects with `sdk/timeout` if there is no
|
|
245
|
+
* decision within `timeoutMs` (default 60000). Webhooks report decisions without polling.
|
|
246
|
+
*/
|
|
247
|
+
waitForDecision: async ({ assetId, ...options }) => {
|
|
248
|
+
requireId(assetId, "Asset ID");
|
|
249
|
+
const client = options.signal ? this.withRequestOptions({ signal: options.signal }) : this;
|
|
250
|
+
return pollForDecision(() => client.assets.retrieve({ assetId }), options, sleep);
|
|
251
|
+
},
|
|
252
|
+
/**
|
|
244
253
|
* Removes an asset's stored content (source, preview and retained extracted text) while
|
|
245
254
|
* keeping the asset record, metadata and moderation report. The returned asset has
|
|
246
255
|
* `storageDeletedAt` set; the CDN no longer serves it.
|
|
@@ -312,7 +321,8 @@ sign: async (options) => {
|
|
|
312
321
|
return lens;
|
|
313
322
|
}
|
|
314
323
|
/**
|
|
315
|
-
* Create or update several named lenses in one API request
|
|
324
|
+
* Create or update several named lenses. New definitions are sent in one API request, or in
|
|
325
|
+
* consecutive requests of at most {@link ENSURE_LENSES_MAX_PER_REQUEST} definitions, in order.
|
|
316
326
|
* Each lens follows the same versioning and idempotency rules as ensureLens().
|
|
317
327
|
*/
|
|
318
328
|
async ensureLenses({ lenses }) {
|
|
@@ -345,6 +355,9 @@ sign: async (options) => {
|
|
|
345
355
|
});
|
|
346
356
|
}
|
|
347
357
|
async submitEnsureLenses(options) {
|
|
358
|
+
for (let start = 0; start < options.length; start += 100) await this.submitEnsureLensesChunk(options.slice(start, start + 100));
|
|
359
|
+
}
|
|
360
|
+
async submitEnsureLensesChunk(options) {
|
|
348
361
|
const result = await this.request("PUT", `${this.projectPath}/lenses`, { body: { lenses: options } });
|
|
349
362
|
const returned = Array.isArray(result?.lenses) ? result.lenses : [];
|
|
350
363
|
if (returned.length !== options.length) throw new CalmLensError(SDK_ERROR_CODES.INVALID_RESPONSE, { message: `Expected ${options.length} lenses but CalmLens returned ${returned.length}` });
|
package/esm/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as SearchAssetsOptions, A as DeleteAssetContentOptions, B as Lens, C as CdnAssetUrlOptions, D as CreateAssetSignedUrlOptions, G as ModerateTextOptions, H as ListAssetChildrenOptions, K as MoveAssetOptions, M as EnsureLensOptions, N as EnsureLensesOptions, O as CreateFolderOptions, P as FolderIdOptions, Q as RetryAssetOptions, R as IterateAssetChildrenOptions, S as CalmLensServerClientOptions, U as ListAssetsOptions, W as ListEventsOptions, Z as RetrieveAssetOptions,
|
|
1
|
+
import { $ as SearchAssetsOptions, A as DeleteAssetContentOptions, At as AssetBinaryPayloadInput, B as Lens, C as CdnAssetUrlOptions, D as CreateAssetSignedUrlOptions, G as ModerateTextOptions, H as ListAssetChildrenOptions, K as MoveAssetOptions, M as EnsureLensOptions, N as EnsureLensesOptions, O as CreateFolderOptions, P as FolderIdOptions, Q as RetryAssetOptions, R as IterateAssetChildrenOptions, S as CalmLensServerClientOptions, U as ListAssetsOptions, W as ListEventsOptions, Z as RetrieveAssetOptions, at as UpdateFolderOptions, d as Asset, et as SignUploadTokenOptions, g as AssetSearchResponse, gt as Event, h as AssetPage, ht as Folder, it as UpdateAssetOptions, j as DeleteAssetOptions, mt as PostAssetSignedUrlResponse, ot as UploadAssetPartOptions, p as AssetChildrenPage, pt as GetEventsResponse, q as MoveFolderOptions, r as ClassificationCategory, rt as SubmitAssetOptions, t as WebhookEventPayload, tt as SignedUploadToken, ut as WaitForAssetDecisionOptions, v as AssetStatus, vt as TypedEvent, w as CdnServeOptions, z as IterateAssetsOptions } from "./WebhookPayload-B7CgSmI5.js";
|
|
2
2
|
import * as zod from "zod";
|
|
3
3
|
//#region ../shared/src/TestTriggers.d.ts
|
|
4
4
|
type ClassificationTestSignal = ClassificationCategory | "sexual.involving-minors" | "violence.graphic";
|
|
@@ -32,6 +32,8 @@ declare const GRANT_SCHEMA: zod.ZodObject<{
|
|
|
32
32
|
"metadata:read": "metadata:read";
|
|
33
33
|
"metadata:write": "metadata:write";
|
|
34
34
|
"project:manage": "project:manage";
|
|
35
|
+
"reviews:read": "reviews:read";
|
|
36
|
+
"reviews:write": "reviews:write";
|
|
35
37
|
"settings:read": "settings:read";
|
|
36
38
|
"settings:write": "settings:write";
|
|
37
39
|
"upload-presets:read": "upload-presets:read";
|
|
@@ -131,6 +133,7 @@ interface MockCalmLensOperationOptions {
|
|
|
131
133
|
"assets.createSignedUrl": CreateAssetSignedUrlOptions;
|
|
132
134
|
"assets.move": MoveAssetOptions;
|
|
133
135
|
"assets.retry": RetryAssetOptions;
|
|
136
|
+
"assets.waitForDecision": WaitForAssetDecisionOptions;
|
|
134
137
|
"assets.deleteContent": DeleteAssetContentOptions;
|
|
135
138
|
"assets.delete": DeleteAssetOptions;
|
|
136
139
|
"text.moderate": ModerateTextOptions;
|
|
@@ -260,6 +263,8 @@ export declare class MockCalmLensServerClient {
|
|
|
260
263
|
createSignedUrl: (signedUrlOptions: CreateAssetSignedUrlOptions) => Promise<PostAssetSignedUrlResponse>;
|
|
261
264
|
move: (options: MoveAssetOptions) => Promise<Asset>;
|
|
262
265
|
retry: (options: RetryAssetOptions) => Promise<Asset>;
|
|
266
|
+
/** Waits like the real client, checking the mock's storage for a decision. */
|
|
267
|
+
waitForDecision: (options: WaitForAssetDecisionOptions) => Promise<Asset>;
|
|
263
268
|
deleteContent: (options: DeleteAssetContentOptions) => Promise<Asset>;
|
|
264
269
|
delete: (options: DeleteAssetOptions) => Promise<void>;
|
|
265
270
|
};
|
package/esm/testing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as hmacSha256Hex, i as WEBHOOK_TIMESTAMP_HEADER, l as stringifyJsonCanonical, n as WEBHOOK_SIGNATURE_HEADER, s as signUploadTokenWithApiKey, t as WEBHOOK_DELIVERY_HEADER } from "./CalmLensWebhooks-
|
|
3
|
-
import {
|
|
1
|
+
import { c as invalidArgument, d as API_ERROR_DEFINITIONS, o as CalmLensError, s as SDK_ERROR_CODES, u as API_ERROR_CODES } from "./CalmLensVersion-DK4BMEST.js";
|
|
2
|
+
import { c as hmacSha256Hex, i as WEBHOOK_TIMESTAMP_HEADER, l as stringifyJsonCanonical, n as WEBHOOK_SIGNATURE_HEADER, s as signUploadTokenWithApiKey, t as WEBHOOK_DELIVERY_HEADER } from "./CalmLensWebhooks-DyCoEvpf.js";
|
|
3
|
+
import { b as getRejectedUploadMimeTypeError, f as sleep, g as validateAssetPayload, h as getAssetPayloadByteLength, m as assetToData, n as encodePathSegment, o as toTextAssetOptions, p as assetDataToUint8Array, r as pollForDecision, s as transformSelector, t as appendCdnSelector, u as validateServerClientOptions, x as isRejectedUploadMimeType } from "./CalmLensUtils-B4i3Z2He.js";
|
|
4
4
|
import * as zod from "zod";
|
|
5
5
|
import "zod/v4";
|
|
6
6
|
//#region ../shared/src/ModerationCategoryDefinitions.ts
|
|
@@ -36,58 +36,63 @@ const MODERATION_CATEGORY_DEFINITIONS = {
|
|
|
36
36
|
docsHref: "/docs/guides/moderation-categories#hate-and-identity-abuse"
|
|
37
37
|
},
|
|
38
38
|
"criminal-activity": {
|
|
39
|
-
summary: "Planning, assistance, instructions, encouragement or facilitation of a concrete criminal or seriously dangerous act.",
|
|
40
|
-
definition: "covers planning, requests for assistance, instructions, encouragement or facilitation of a concrete criminal or seriously dangerous act. A request can qualify even when no act occurs and a later reply refuses it. Dangerous activity requires a concrete serious risk of physical harm.",
|
|
41
|
-
exclusions: "Neutral reporting, prevention, lawful safety advice, fiction without criminal assistance, and vague dangerous references do not qualify. Masks, computers, payment cards, detention or ordinary tools do not establish criminal facilitation by themselves. A clear visual demonstration of how to carry out a crime can qualify.",
|
|
39
|
+
summary: "Planning, assistance, instructions, encouragement or facilitation of a concrete criminal or seriously dangerous act, and illegal drugs or contraband.",
|
|
40
|
+
definition: "covers planning, requests for assistance, instructions, encouragement or facilitation of a concrete criminal or seriously dangerous act. A request can qualify even when no act occurs and a later reply refuses it. Dangerous activity requires a concrete serious risk of physical harm. It also covers illegal drug use, dealing, production or trafficking, and contraband such as stolen goods, counterfeit money or documents and smuggled or illegally traded weapons.",
|
|
41
|
+
exclusions: "Neutral reporting, prevention, lawful safety advice, fiction without criminal assistance, and vague dangerous references do not qualify. Medical, pharmaceutical, clinical, research and educational content does not qualify, including prescriptions, dosages, side effects, controlled medicines used as prescribed, pharmacies, hospitals and drug manufacturing by pharmaceutical companies. Lawful alcohol and tobacco, harm reduction, addiction recovery and drug-policy discussion do not qualify either. Masks, computers, payment cards, detention or ordinary tools do not establish criminal facilitation by themselves. A clear visual demonstration of how to carry out a crime can qualify.",
|
|
42
42
|
docsHref: "/docs/guides/moderation-categories#criminal-and-dangerous-activity"
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region ../shared/src/ModerationPolicyDimensions.ts
|
|
47
47
|
const MODERATION_QUALIFIERS = [
|
|
48
|
-
"nudity",
|
|
48
|
+
"sexual-nudity",
|
|
49
49
|
"sexual-activity",
|
|
50
|
-
"explicit-
|
|
50
|
+
"sexual-explicit-language",
|
|
51
51
|
"sexual-solicitation",
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
52
|
+
"sexual-historical",
|
|
53
|
+
"sexual-documentary",
|
|
54
|
+
"sexual-fictional",
|
|
55
|
+
"sexual-support-prevention",
|
|
56
|
+
"violence-attack",
|
|
57
|
+
"violence-threat",
|
|
58
|
+
"violence-preparation",
|
|
59
|
+
"violence-encouragement",
|
|
60
|
+
"violence-injury",
|
|
61
|
+
"violence-death",
|
|
62
|
+
"violence-graphic",
|
|
63
|
+
"violence-historical",
|
|
64
|
+
"violence-documentary",
|
|
65
|
+
"violence-fictional",
|
|
66
|
+
"violence-support-prevention",
|
|
59
67
|
"self-harm-thoughts",
|
|
60
68
|
"self-harm-preparation",
|
|
61
69
|
"self-harm-act",
|
|
62
70
|
"self-harm-methods",
|
|
63
71
|
"self-harm-encouragement",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
72
|
+
"self-harm-documentary",
|
|
73
|
+
"self-harm-fictional",
|
|
74
|
+
"self-harm-support-prevention",
|
|
75
|
+
"harassment-abuse",
|
|
76
|
+
"harassment-intimidation",
|
|
66
77
|
"harassment-threat",
|
|
67
|
-
"sexual
|
|
78
|
+
"harassment-sexual",
|
|
68
79
|
"harassment-encouragement",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
80
|
+
"harassment-fictional",
|
|
81
|
+
"hate-abuse",
|
|
82
|
+
"hate-dehumanization",
|
|
83
|
+
"hate-inferiority",
|
|
84
|
+
"hate-exclusion",
|
|
73
85
|
"hate-threat",
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"criminal-
|
|
77
|
-
"criminal-
|
|
78
|
-
"criminal-
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
86
|
+
"hate-historical",
|
|
87
|
+
"hate-fictional",
|
|
88
|
+
"criminal-activity-demonstration",
|
|
89
|
+
"criminal-activity-preparation",
|
|
90
|
+
"criminal-activity-request",
|
|
91
|
+
"criminal-activity-instructions",
|
|
92
|
+
"criminal-activity-promotion",
|
|
93
|
+
"criminal-activity-substances",
|
|
94
|
+
"criminal-activity-fictional"
|
|
83
95
|
];
|
|
84
|
-
const SHARED_QUALIFIERS = [
|
|
85
|
-
"historical",
|
|
86
|
-
"documentary",
|
|
87
|
-
"fictional",
|
|
88
|
-
"support-prevention"
|
|
89
|
-
];
|
|
90
|
-
[...SHARED_QUALIFIERS], [...SHARED_QUALIFIERS], [...SHARED_QUALIFIERS], [...SHARED_QUALIFIERS], [...SHARED_QUALIFIERS], [...SHARED_QUALIFIERS];
|
|
91
96
|
//#endregion
|
|
92
97
|
//#region ../../node_modules/zod-meta/esm/index.js
|
|
93
98
|
const ZOD_META_KEY = "__zod_meta__";
|
|
@@ -252,7 +257,11 @@ const LIKELIHOOD_SCHEMA = zod.enum([
|
|
|
252
257
|
"likely",
|
|
253
258
|
"very-likely"
|
|
254
259
|
]);
|
|
255
|
-
const CLASSIFICATION_NOT_EVALUATED_REASON_SCHEMA = zod.enum([
|
|
260
|
+
const CLASSIFICATION_NOT_EVALUATED_REASON_SCHEMA = zod.enum([
|
|
261
|
+
"not-supported",
|
|
262
|
+
"unavailable",
|
|
263
|
+
"not-requested"
|
|
264
|
+
]);
|
|
256
265
|
const CLASSIFICATION_QUALIFIER_RESULTS_SCHEMA = zod.partialRecord(zod.enum(MODERATION_QUALIFIERS), zod.discriminatedUnion("status", [zod.object({
|
|
257
266
|
status: zod.literal("evaluated"),
|
|
258
267
|
score: zod.number().min(0).max(1),
|
|
@@ -380,6 +389,8 @@ const ACTION_SCHEMA = zod.enum([
|
|
|
380
389
|
"lenses:write",
|
|
381
390
|
"upload-presets:read",
|
|
382
391
|
"upload-presets:write",
|
|
392
|
+
"reviews:read",
|
|
393
|
+
"reviews:write",
|
|
383
394
|
"project:manage"
|
|
384
395
|
]);
|
|
385
396
|
const PROJECT_ACTIONS = [...[
|
|
@@ -389,7 +400,8 @@ const PROJECT_ACTIONS = [...[
|
|
|
389
400
|
"connectors",
|
|
390
401
|
"metadata",
|
|
391
402
|
"lenses",
|
|
392
|
-
"upload-presets"
|
|
403
|
+
"upload-presets",
|
|
404
|
+
"reviews"
|
|
393
405
|
].flatMap((feature) => [`${feature}:read`, `${feature}:write`]), "project:manage"];
|
|
394
406
|
const isProjectAction = (action) => PROJECT_ACTIONS.includes(action);
|
|
395
407
|
/** The actions that include `action`: its feature's write action and project:manage. */
|
|
@@ -402,7 +414,7 @@ const GRANT_SCHEMA = zod.object({
|
|
|
402
414
|
const GRANTS_SCHEMA = zod.array(GRANT_SCHEMA).max(100);
|
|
403
415
|
zod.enum([
|
|
404
416
|
"admin",
|
|
405
|
-
"
|
|
417
|
+
"editor",
|
|
406
418
|
"viewer",
|
|
407
419
|
"custom"
|
|
408
420
|
]);
|
|
@@ -1061,6 +1073,12 @@ var MockCalmLensServerClient = class {
|
|
|
1061
1073
|
updatedAt: this.now()
|
|
1062
1074
|
});
|
|
1063
1075
|
},
|
|
1076
|
+
/** Waits like the real client, checking the mock's storage for a decision. */
|
|
1077
|
+
waitForDecision: async (options) => {
|
|
1078
|
+
this.begin("assets.waitForDecision", options);
|
|
1079
|
+
const { assetId, ...waitOptions } = options;
|
|
1080
|
+
return pollForDecision(() => this.findOwnAsset(assetId), waitOptions, sleep);
|
|
1081
|
+
},
|
|
1064
1082
|
deleteContent: async (options) => {
|
|
1065
1083
|
this.begin("assets.deleteContent", options);
|
|
1066
1084
|
const asset = await this.findOwnAsset(options?.assetId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calmlens/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.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",
|