@calmlens/sdk 0.13.0 → 0.15.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.
Files changed (30) hide show
  1. package/README.md +44 -40
  2. package/cjs/{CalmLensConnection-DzRDCMOP.js → CalmLensConnection-DoemramF.js} +4 -3
  3. package/cjs/{CalmLensUtils-vX5H_vMn.js → CalmLensUtils-Cv1Ylp9-.js} +10 -10
  4. package/cjs/{CalmLensVersion-DjhsJ1gj.js → CalmLensVersion-CuxKdijk.js} +67 -2
  5. package/cjs/{CalmLensWebhooks-hVquX5L1.js → CalmLensWebhooks-qrL-Zdu3.js} +2 -2
  6. package/cjs/{WebhookPayload-B7CgSmI5.d.ts → WebhookPayload-vy8HNMaK.d.ts} +4355 -449
  7. package/cjs/app.d.ts +3 -3
  8. package/cjs/app.js +3 -3
  9. package/cjs/{index-BywTQbRq.d.ts → index-Dz340UQ9.d.ts} +27 -1
  10. package/cjs/index.d.ts +3 -3
  11. package/cjs/index.js +1 -1
  12. package/cjs/server.d.ts +9 -8
  13. package/cjs/server.js +10 -9
  14. package/cjs/testing.d.ts +19 -45
  15. package/cjs/testing.js +99 -30
  16. package/esm/{CalmLensConnection-D8VsTdsA.js → CalmLensConnection-CQLoUoBd.js} +4 -3
  17. package/esm/{CalmLensUtils-B4i3Z2He.js → CalmLensUtils-B3S--hBG.js} +10 -10
  18. package/esm/{CalmLensVersion-DK4BMEST.js → CalmLensVersion-N71PMJAz.js} +67 -2
  19. package/esm/{CalmLensWebhooks-DyCoEvpf.js → CalmLensWebhooks-BxMSx1Vm.js} +2 -2
  20. package/esm/{WebhookPayload-B7CgSmI5.d.ts → WebhookPayload-vy8HNMaK.d.ts} +4355 -449
  21. package/esm/app.d.ts +3 -3
  22. package/esm/app.js +3 -3
  23. package/esm/{index-BywTQbRq.d.ts → index-Dz340UQ9.d.ts} +27 -1
  24. package/esm/index.d.ts +3 -3
  25. package/esm/index.js +1 -1
  26. package/esm/server.d.ts +9 -8
  27. package/esm/server.js +10 -9
  28. package/esm/testing.d.ts +19 -45
  29. package/esm/testing.js +99 -30
  30. package/package.json +1 -1
package/esm/app.d.ts CHANGED
@@ -1,5 +1,5 @@
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";
1
+ import { $ as ModerateTextOptions, A as CalmLensServerClientOptions, At as EventSeverity, B as EnsureLensOptions, Bt as AssetSafetyHold, C as AssetProcessingStatus, D as AssetType, Dt as EventFact, E as AssetSearchResult, Et as EventCategory, F as CreateAssetSignedUrlOptions, Ft as Page, G as ImageTransformOptions, Gt as PreviewImage, H as FolderIdOptions, Ht as ExtractedText, I as CreateFolderOptions, It as LensType, J as Lens, K as IterateAssetChildrenOptions, Kt as ProcessingOptions, L as CreateMultipartUploadPartOptions, Lt as AssetSearchMatchField, M as CdnServeOptions, N as CdnTransform, Nt as Folder, O as AssetVisibility, Ot as EventFactValues, P as ConnectionOptions, Pt as Order, Q as ListEventsOptions, R as DeleteAssetContentOptions, Rt as AssetSearchQuery, S as AssetProcessing, T as AssetSearchResponse, Tt as TypedEvent, U as IdempotencyOptions, Ut as ImageData, V as EnsureLensesOptions, Vt as AssetSafetyHoldReason, W as ImageTransform, Wt as MetadataItem, X as ListAssetChildrenOptions, Y as LensTransform, Z as ListAssetsOptions, _ as AssetContentStatus, _t as VerifyWebhookSignatureOptions, a as ClassificationLabel, at as RetrieveAssetOptions, b as AssetModerationStatus, bt as WebhookPayloadInput, c as ClassificationReport, ct as SignUploadTokenOptions, d as Asset, dt as SubmitAssetOptions, et as MoveAssetOptions, f as AssetChecksums, ft as UpdateAssetOptions, g as AssetContentRemovalReason, gt as UploadedAsset, h as AssetContentOptions, ht as UploadPresetSubmitAssetOptions, i as ClassificationCategoryReport, it as RequestOptions, j as CdnAssetUrlOptions, jt as EventType, k as CalmLensAppClientOptions, kt as EventFacts, l as Likelihood, lt as SignedUploadToken, m as AssetContent, mt as UploadAssetPartOptions, n as ClassificationCategories, nt as MultipartUploadOptions, o as ClassificationNotEvaluatedReason, ot as RetryAssetOptions, p as AssetChildrenPage, pt as UpdateFolderOptions, q as IterateAssetsOptions, r as ClassificationCategory, rt as MultipartUploadPartOptions, s as ClassificationQualifierResults, st as SearchAssetsOptions, t as WebhookEventPayload, tt as MoveFolderOptions, u as ModerationQualifier, ut as SignedUrl, v as AssetModeration, vt as WaitForAssetDecisionOptions, w as AssetReviewerAction, wt as EventAsset, x as AssetPage, xt as GetEventsResponse, y as AssetModerationAction, yt as WebhookHeadersInput, z as DeleteAssetOptions } from "./WebhookPayload-vy8HNMaK.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-Dz340UQ9.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 WaitForAssetDecisionOptions, type WebhookEventPayload, type WebhookHeadersInput, type WebhookPayloadInput };
43
+ export { type AgeRange, type ApiErrorCode, type Asset, type AssetChecksums, type AssetChildrenPage, type AssetContent, type AssetContentOptions, type AssetContentRemovalReason, type AssetContentStatus, type AssetModeration, type AssetModerationAction, type AssetModerationStatus, type AssetPage, type AssetProcessing, type AssetProcessingStatus, type AssetReviewerAction, type AssetSafetyHold, type AssetSafetyHoldReason, type AssetSearchMatchField, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, 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 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 CALMLENS_ERROR_CODES, c as invalidArgument, l as invalidConfig, o as CalmLensError, t as SDK_VERSION } from "./CalmLensVersion-DK4BMEST.js";
1
+ import { a as CALMLENS_ERROR_CODES, c as invalidArgument, l as invalidConfig, o as CalmLensError, t as SDK_VERSION } from "./CalmLensVersion-N71PMJAz.js";
2
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";
3
+ import { c as validateAppClientOptions, n as encodePathSegment } from "./CalmLensUtils-B3S--hBG.js";
4
+ import { o as prepareSubmitAssetOptions, r as expectUploadedAsset, s as resolveConnectionOptions, t as CalmLensConnection } from "./CalmLensConnection-CQLoUoBd.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-B7CgSmI5.js";
1
+ import "./WebhookPayload-vy8HNMaK.js";
2
2
  import * as zod from "zod";
3
3
  //#region ../shared/src/ProcessingFeatures.d.ts
4
4
  /**
@@ -180,6 +180,8 @@ declare const API_ERROR_CODES: {
180
180
  readonly UPLOAD_PRESET_NOT_FOUND: "upload-preset/not-found";
181
181
  readonly UPLOAD_PRESET_DISABLED: "upload-preset/disabled";
182
182
  readonly UPLOAD_PRESET_TOKEN_REQUIRED: "upload-preset/token-required";
183
+ readonly REMOTE_URL_NOT_ALLOWED: "upload/remote-url-not-allowed";
184
+ readonly WEBSITE_RATE_LIMIT_EXCEEDED: "upload/website-rate-limit-exceeded";
183
185
  readonly UPLOAD_PRESET_CONTENT_TYPE_NOT_ALLOWED: "upload-preset/content-type-not-allowed";
184
186
  readonly UPLOAD_PRESET_TOO_LARGE: "upload-preset/too-large";
185
187
  readonly UPLOAD_PRESET_DAILY_LIMIT_REACHED: "upload-preset/daily-limit-reached";
@@ -188,6 +190,17 @@ declare const API_ERROR_CODES: {
188
190
  readonly UPLOAD_TOKEN_INVALID: "upload-token/invalid";
189
191
  readonly UPLOAD_TOKEN_EXPIRED: "upload-token/expired";
190
192
  readonly UPLOAD_TOKEN_USED: "upload-token/used";
193
+ readonly INVALID_REMOTE_URL: "asset/invalid-remote-url";
194
+ readonly REMOTE_URL_UNAVAILABLE: "asset/remote-url-unavailable";
195
+ readonly APPEAL_NOT_FOUND: "appeal/not-found";
196
+ readonly APPEAL_JUDGMENT_NOT_FOUND: "appeal/judgment-not-found";
197
+ readonly APPEAL_ASSET_NOT_FOUND: "appeal/asset-not-found";
198
+ readonly APPEAL_PERMISSION_DENIED: "appeal/permission-denied";
199
+ readonly APPEAL_ALREADY_REVIEWED: "appeal/already-reviewed";
200
+ readonly APPEAL_DECISION_CHANGED: "appeal/decision-changed";
201
+ readonly APPEAL_INVALID_ACTION: "appeal/invalid-action";
202
+ readonly APPEAL_SAFETY_HELD: "appeal/safety-held";
203
+ readonly APPEAL_CONTENT_UNAVAILABLE: "appeal/content-unavailable";
191
204
  };
192
205
  type ApiErrorCode = (typeof API_ERROR_CODES)[keyof typeof API_ERROR_CODES];
193
206
  //#endregion
@@ -259,6 +272,8 @@ declare const CALMLENS_ERROR_CODES: {
259
272
  readonly UPLOAD_PRESET_NOT_FOUND: "upload-preset/not-found";
260
273
  readonly UPLOAD_PRESET_DISABLED: "upload-preset/disabled";
261
274
  readonly UPLOAD_PRESET_TOKEN_REQUIRED: "upload-preset/token-required";
275
+ readonly REMOTE_URL_NOT_ALLOWED: "upload/remote-url-not-allowed";
276
+ readonly WEBSITE_RATE_LIMIT_EXCEEDED: "upload/website-rate-limit-exceeded";
262
277
  readonly UPLOAD_PRESET_CONTENT_TYPE_NOT_ALLOWED: "upload-preset/content-type-not-allowed";
263
278
  readonly UPLOAD_PRESET_TOO_LARGE: "upload-preset/too-large";
264
279
  readonly UPLOAD_PRESET_DAILY_LIMIT_REACHED: "upload-preset/daily-limit-reached";
@@ -267,6 +282,17 @@ declare const CALMLENS_ERROR_CODES: {
267
282
  readonly UPLOAD_TOKEN_INVALID: "upload-token/invalid";
268
283
  readonly UPLOAD_TOKEN_EXPIRED: "upload-token/expired";
269
284
  readonly UPLOAD_TOKEN_USED: "upload-token/used";
285
+ readonly INVALID_REMOTE_URL: "asset/invalid-remote-url";
286
+ readonly REMOTE_URL_UNAVAILABLE: "asset/remote-url-unavailable";
287
+ readonly APPEAL_NOT_FOUND: "appeal/not-found";
288
+ readonly APPEAL_JUDGMENT_NOT_FOUND: "appeal/judgment-not-found";
289
+ readonly APPEAL_ASSET_NOT_FOUND: "appeal/asset-not-found";
290
+ readonly APPEAL_PERMISSION_DENIED: "appeal/permission-denied";
291
+ readonly APPEAL_ALREADY_REVIEWED: "appeal/already-reviewed";
292
+ readonly APPEAL_DECISION_CHANGED: "appeal/decision-changed";
293
+ readonly APPEAL_INVALID_ACTION: "appeal/invalid-action";
294
+ readonly APPEAL_SAFETY_HELD: "appeal/safety-held";
295
+ readonly APPEAL_CONTENT_UNAVAILABLE: "appeal/content-unavailable";
270
296
  /** The request could not be completed: DNS, TLS, a refused or reset connection, a truncated body. */
271
297
  readonly TRANSPORT_ERROR: "sdk/transport-error";
272
298
  /** The request did not finish within `timeoutMs`. */
package/esm/index.d.ts CHANGED
@@ -1,3 +1,3 @@
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 };
1
+ import { $ as ModerateTextOptions, A as CalmLensServerClientOptions, At as EventSeverity, B as EnsureLensOptions, Bt as AssetSafetyHold, C as AssetProcessingStatus, D as AssetType, Dt as EventFact, E as AssetSearchResult, Et as EventCategory, F as CreateAssetSignedUrlOptions, Ft as Page, G as ImageTransformOptions, Gt as PreviewImage, H as FolderIdOptions, Ht as ExtractedText, I as CreateFolderOptions, It as LensType, J as Lens, K as IterateAssetChildrenOptions, Kt as ProcessingOptions, L as CreateMultipartUploadPartOptions, Lt as AssetSearchMatchField, M as CdnServeOptions, N as CdnTransform, Nt as Folder, O as AssetVisibility, Ot as EventFactValues, P as ConnectionOptions, Pt as Order, Q as ListEventsOptions, R as DeleteAssetContentOptions, Rt as AssetSearchQuery, S as AssetProcessing, T as AssetSearchResponse, Tt as TypedEvent, U as IdempotencyOptions, Ut as ImageData, V as EnsureLensesOptions, Vt as AssetSafetyHoldReason, W as ImageTransform, Wt as MetadataItem, X as ListAssetChildrenOptions, Y as LensTransform, Z as ListAssetsOptions, _ as AssetContentStatus, _t as VerifyWebhookSignatureOptions, a as ClassificationLabel, at as RetrieveAssetOptions, b as AssetModerationStatus, bt as WebhookPayloadInput, c as ClassificationReport, ct as SignUploadTokenOptions, d as Asset, dt as SubmitAssetOptions, et as MoveAssetOptions, f as AssetChecksums, ft as UpdateAssetOptions, g as AssetContentRemovalReason, gt as UploadedAsset, h as AssetContentOptions, ht as UploadPresetSubmitAssetOptions, i as ClassificationCategoryReport, it as RequestOptions, j as CdnAssetUrlOptions, jt as EventType, k as CalmLensAppClientOptions, kt as EventFacts, l as Likelihood, lt as SignedUploadToken, m as AssetContent, mt as UploadAssetPartOptions, n as ClassificationCategories, nt as MultipartUploadOptions, o as ClassificationNotEvaluatedReason, ot as RetryAssetOptions, p as AssetChildrenPage, pt as UpdateFolderOptions, q as IterateAssetsOptions, r as ClassificationCategory, rt as MultipartUploadPartOptions, s as ClassificationQualifierResults, st as SearchAssetsOptions, t as WebhookEventPayload, tt as MoveFolderOptions, u as ModerationQualifier, ut as SignedUrl, v as AssetModeration, vt as WaitForAssetDecisionOptions, w as AssetReviewerAction, wt as EventAsset, x as AssetPage, xt as GetEventsResponse, y as AssetModerationAction, yt as WebhookHeadersInput, z as DeleteAssetOptions } from "./WebhookPayload-vy8HNMaK.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-Dz340UQ9.js";
3
+ export { type AgeRange, type ApiErrorCode, type Asset, type AssetChecksums, type AssetChildrenPage, type AssetContent, type AssetContentOptions, type AssetContentRemovalReason, type AssetContentStatus, type AssetModeration, type AssetModerationAction, type AssetModerationStatus, type AssetPage, type AssetProcessing, type AssetProcessingStatus, type AssetReviewerAction, type AssetSafetyHold, type AssetSafetyHoldReason, type AssetSearchMatchField, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, 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 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 +1 @@
1
- export { a as CALMLENS_ERROR_CODES, o as CalmLensError, t as SDK_VERSION } from "./CalmLensVersion-DK4BMEST.js";
1
+ export { a as CALMLENS_ERROR_CODES, o as CalmLensError, t as SDK_VERSION } from "./CalmLensVersion-N71PMJAz.js";
package/esm/server.d.ts CHANGED
@@ -1,5 +1,5 @@
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";
1
+ import { $ as ModerateTextOptions, A as CalmLensServerClientOptions, At as EventSeverity, B as EnsureLensOptions, Bt as AssetSafetyHold, C as AssetProcessingStatus, D as AssetType, Dt as EventFact, E as AssetSearchResult, Et as EventCategory, F as CreateAssetSignedUrlOptions, Ft as Page, G as ImageTransformOptions, Gt as PreviewImage, H as FolderIdOptions, Ht as ExtractedText, I as CreateFolderOptions, It as LensType, J as Lens, K as IterateAssetChildrenOptions, Kt as ProcessingOptions, L as CreateMultipartUploadPartOptions, Lt as AssetSearchMatchField, M as CdnServeOptions, N as CdnTransform, Nt as Folder, O as AssetVisibility, Ot as EventFactValues, P as ConnectionOptions, Pt as Order, Q as ListEventsOptions, R as DeleteAssetContentOptions, Rt as AssetSearchQuery, S as AssetProcessing, St as PostAssetSignedUrlResponse, T as AssetSearchResponse, Tt as TypedEvent, U as IdempotencyOptions, Ut as ImageData, V as EnsureLensesOptions, Vt as AssetSafetyHoldReason, W as ImageTransform, Wt as MetadataItem, X as ListAssetChildrenOptions, Y as LensTransform, Z as ListAssetsOptions, _ as AssetContentStatus, _t as VerifyWebhookSignatureOptions, a as ClassificationLabel, at as RetrieveAssetOptions, b as AssetModerationStatus, bt as WebhookPayloadInput, c as ClassificationReport, ct as SignUploadTokenOptions, d as Asset, dt as SubmitAssetOptions, et as MoveAssetOptions, f as AssetChecksums, ft as UpdateAssetOptions, g as AssetContentRemovalReason, gt as UploadedAsset, h as AssetContentOptions, ht as UploadPresetSubmitAssetOptions, i as ClassificationCategoryReport, it as RequestOptions, j as CdnAssetUrlOptions, jt as EventType, k as CalmLensAppClientOptions, kt as EventFacts, l as Likelihood, lt as SignedUploadToken, m as AssetContent, mt as UploadAssetPartOptions, n as ClassificationCategories, nt as MultipartUploadOptions, o as ClassificationNotEvaluatedReason, ot as RetryAssetOptions, p as AssetChildrenPage, pt as UpdateFolderOptions, q as IterateAssetsOptions, r as ClassificationCategory, rt as MultipartUploadPartOptions, s as ClassificationQualifierResults, st as SearchAssetsOptions, t as WebhookEventPayload, tt as MoveFolderOptions, u as ModerationQualifier, ut as SignedUrl, v as AssetModeration, vt as WaitForAssetDecisionOptions, w as AssetReviewerAction, wt as EventAsset, x as AssetPage, xt as GetEventsResponse, y as AssetModerationAction, yt as WebhookHeadersInput, z as DeleteAssetOptions } from "./WebhookPayload-vy8HNMaK.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-Dz340UQ9.js";
3
3
  //#region src/client/CalmLensServerClient.d.ts
4
4
  interface LensCache {
5
5
  readonly ensuredLenses: Map<string, Lens>;
@@ -88,8 +88,8 @@ declare class CalmLensServerClient {
88
88
  /** Yields every child of an asset, fetching pages as needed. */
89
89
  iterateChildren: (options: IterateAssetChildrenOptions) => AsyncGenerator<Asset, void, undefined>;
90
90
  /**
91
- * Uploads an asset and queues it for moderation, returning immediately with status
92
- * `pending` (or `uploading` for the first multipart part). Retried safely with an
91
+ * Uploads an asset and queues it for moderation, returning immediately with processing
92
+ * status `processing` (or `uploading` for the first multipart part). Retried safely with an
93
93
  * `Idempotency-Key`.
94
94
  */
95
95
  create: (options: SubmitAssetOptions) => Promise<Asset>;
@@ -111,13 +111,14 @@ declare class CalmLensServerClient {
111
111
  /** Moves an asset into a folder, or to the project root with `folderId: null`. */
112
112
  move: ({ assetId, folderId }: MoveAssetOptions) => Promise<Asset>;
113
113
  /**
114
- * Processes an asset that failed (status `error`) again. It returns to `pending` and is
114
+ * Processes an asset that failed (processing status `failed`) again. It returns to
115
+ * `processing` and is
115
116
  * moderated like a new upload; its content must still be stored.
116
117
  */
117
118
  retry: ({ assetId }: RetryAssetOptions) => Promise<Asset>;
118
119
  /**
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
120
+ * Waits until an asset's `moderation.status` is `approved` or `rejected`, or its
121
+ * `processing.status` is `failed`, and returns that asset, checking every few seconds. Rejects with `sdk/timeout` if there is no
121
122
  * decision within `timeoutMs` (default 60000). Webhooks report decisions without polling.
122
123
  */
123
124
  waitForDecision: ({ assetId, ...options }: WaitForAssetDecisionOptions) => Promise<Asset>;
@@ -207,4 +208,4 @@ export declare function verifyWebhookSignature(options: VerifyWebhookSignatureOp
207
208
  */
208
209
  export declare function parseWebhookEvent(options: VerifyWebhookSignatureOptions): Promise<WebhookEventPayload>;
209
210
  //#endregion
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 };
211
+ export { type AgeRange, type ApiErrorCode, type Asset, type AssetChecksums, type AssetChildrenPage, type AssetContent, type AssetContentOptions, type AssetContentRemovalReason, type AssetContentStatus, type AssetModeration, type AssetModerationAction, type AssetModerationStatus, type AssetPage, type AssetProcessing, type AssetProcessingStatus, type AssetReviewerAction, type AssetSafetyHold, type AssetSafetyHoldReason, type AssetSearchMatchField, type AssetSearchQuery, type AssetSearchResponse, type AssetSearchResult, 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 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,8 +1,8 @@
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";
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-N71PMJAz.js";
2
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";
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-BxMSx1Vm.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-B3S--hBG.js";
5
+ import { a as newIdempotencyKey, i as invalidPayload, n as expectAsset, o as prepareSubmitAssetOptions, s as resolveConnectionOptions, t as CalmLensConnection } from "./CalmLensConnection-CQLoUoBd.js";
6
6
  const getEnsureLensCacheKey = (options) => stringifyJsonCanonical({
7
7
  identifier: options.identifier,
8
8
  name: options.name,
@@ -197,8 +197,8 @@ sign: async (options) => {
197
197
  }));
198
198
  },
199
199
  /**
200
- * Uploads an asset and queues it for moderation, returning immediately with status
201
- * `pending` (or `uploading` for the first multipart part). Retried safely with an
200
+ * Uploads an asset and queues it for moderation, returning immediately with processing
201
+ * status `processing` (or `uploading` for the first multipart part). Retried safely with an
202
202
  * `Idempotency-Key`.
203
203
  */
204
204
  create: async (options) => this.submitAsset(options, true),
@@ -235,13 +235,14 @@ sign: async (options) => {
235
235
  /** Moves an asset into a folder, or to the project root with `folderId: null`. */
236
236
  move: async ({ assetId, folderId }) => this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/move`, { body: { folderId } }),
237
237
  /**
238
- * Processes an asset that failed (status `error`) again. It returns to `pending` and is
238
+ * Processes an asset that failed (processing status `failed`) again. It returns to
239
+ * `processing` and is
239
240
  * moderated like a new upload; its content must still be stored.
240
241
  */
241
242
  retry: async ({ assetId }) => this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/retry`),
242
243
  /**
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
244
+ * Waits until an asset's `moderation.status` is `approved` or `rejected`, or its
245
+ * `processing.status` is `failed`, and returns that asset, checking every few seconds. Rejects with `sdk/timeout` if there is no
245
246
  * decision within `timeoutMs` (default 60000). Webhooks report decisions without polling.
246
247
  */
247
248
  waitForDecision: async ({ assetId, ...options }) => {
package/esm/testing.d.ts CHANGED
@@ -1,48 +1,11 @@
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
- import * as zod from "zod";
1
+ import { $ as ModerateTextOptions, A as CalmLensServerClientOptions, B as EnsureLensOptions, Ct as Event, F as CreateAssetSignedUrlOptions, H as FolderIdOptions, I as CreateFolderOptions, J as Lens, K as IterateAssetChildrenOptions, M as CdnServeOptions, Mt as PermissionGrant, Nt as Folder, Q as ListEventsOptions, R as DeleteAssetContentOptions, St as PostAssetSignedUrlResponse, T as AssetSearchResponse, Tt as TypedEvent, V as EnsureLensesOptions, X as ListAssetChildrenOptions, Z as ListAssetsOptions, at as RetrieveAssetOptions, ct as SignUploadTokenOptions, d as Asset, dt as SubmitAssetOptions, et as MoveAssetOptions, ft as UpdateAssetOptions, j as CdnAssetUrlOptions, lt as SignedUploadToken, mt as UploadAssetPartOptions, ot as RetryAssetOptions, p as AssetChildrenPage, pt as UpdateFolderOptions, q as IterateAssetsOptions, r as ClassificationCategory, st as SearchAssetsOptions, t as WebhookEventPayload, tt as MoveFolderOptions, vt as WaitForAssetDecisionOptions, x as AssetPage, xt as GetEventsResponse, z as DeleteAssetOptions, zt as AssetBinaryPayloadInput } from "./WebhookPayload-vy8HNMaK.js";
3
2
  //#region ../shared/src/TestTriggers.d.ts
4
3
  type ClassificationTestSignal = ClassificationCategory | "sexual.involving-minors" | "violence.graphic";
5
4
  //#endregion
6
5
  //#region ../shared/src/MediaTestTriggers.d.ts
7
6
  export declare const MEDIA_TEST_SIGNALS: readonly ["sexual", "violence", "self-harm", "harassment", "hate", "criminal-activity", "violence.graphic"];
8
7
  /** Read this aloud, or render it as large, high-contrast text in a video frame. */
9
- export declare function generateMediaTestCode(signal: ClassificationTestSignal, projectId: string): string;
10
- //#endregion
11
- //#region ../shared/src/Permissions.d.ts
12
- declare const GRANT_SCHEMA: zod.ZodObject<{
13
- actions: zod.ZodArray<zod.ZodEnum<{
14
- "api-keys:read": "api-keys:read";
15
- "api-keys:write": "api-keys:write";
16
- "assets:create": "assets:create";
17
- "assets:delete": "assets:delete";
18
- "assets:download": "assets:download";
19
- "assets:read": "assets:read";
20
- "assets:share": "assets:share";
21
- "assets:update": "assets:update";
22
- "connectors:read": "connectors:read";
23
- "connectors:write": "connectors:write";
24
- "folders:create": "folders:create";
25
- "folders:delete": "folders:delete";
26
- "folders:read": "folders:read";
27
- "folders:update": "folders:update";
28
- "lenses:read": "lenses:read";
29
- "lenses:write": "lenses:write";
30
- "members:read": "members:read";
31
- "members:write": "members:write";
32
- "metadata:read": "metadata:read";
33
- "metadata:write": "metadata:write";
34
- "project:manage": "project:manage";
35
- "reviews:read": "reviews:read";
36
- "reviews:write": "reviews:write";
37
- "settings:read": "settings:read";
38
- "settings:write": "settings:write";
39
- "upload-presets:read": "upload-presets:read";
40
- "upload-presets:write": "upload-presets:write";
41
- }>>;
42
- folderId: zod.ZodNullable<zod.ZodString>;
43
- includeSubfolders: zod.ZodBoolean;
44
- }, zod.core.$strict>;
45
- type PermissionGrant = zod.infer<typeof GRANT_SCHEMA>;
8
+ export declare function generateMediaTestCode(signal: ClassificationTestSignal, testInputKey: string): string;
46
9
  //#endregion
47
10
  //#region src/testing/MockApiKey.d.ts
48
11
  export declare const MOCK_API_KEY_PREFIX = "sk_test_";
@@ -113,13 +76,18 @@ interface MockCalmLensServerClientOptions extends CalmLensServerClientOptions {
113
76
  imageStorage?: MockImageStorage;
114
77
  createId?: () => string;
115
78
  now?: () => number;
116
- /** Status `assets.create` returns. Defaults to `pending`. */
117
- queuedStatus?: AssetStatus;
118
- /** Status `assets.moderate` and `text.moderate` return. Defaults to `approved`. */
119
- analyzedStatus?: AssetStatus;
79
+ /** Outcome of `assets.create` (and queued multipart uploads). Defaults to `pending`. */
80
+ queuedOutcome?: MockAssetOutcome;
81
+ /** Outcome of `assets.moderate` and `text.moderate`. Defaults to `approved`. */
82
+ analyzedOutcome?: MockAssetOutcome;
120
83
  signedUrlBaseUrl?: string;
121
84
  };
122
85
  }
86
+ /**
87
+ * Where a mock upload ends up: `pending` (still processing), `approved` or `rejected` (processing
88
+ * done with that decision), or `failed` (processing failed, retryable).
89
+ */
90
+ type MockAssetOutcome = "pending" | "approved" | "rejected" | "failed";
123
91
  /** The options each `MockCalmLensServerClient` method was given, by operation name. */
124
92
  interface MockCalmLensOperationOptions {
125
93
  "assets.list": ListAssetsOptions;
@@ -179,8 +147,8 @@ export declare class MockCalmLensServerClient {
179
147
  readonly imageStorage: MockImageStorage;
180
148
  private readonly createId;
181
149
  private readonly now;
182
- private readonly queuedStatus;
183
- private readonly analyzedStatus;
150
+ private readonly queuedOutcome;
151
+ private readonly analyzedOutcome;
184
152
  private readonly apiKeyGrants;
185
153
  private readonly signedUrlBaseUrl;
186
154
  private readonly cdnBaseUrl;
@@ -287,9 +255,15 @@ export declare class MockCalmLensServerClient {
287
255
  private withIdempotency;
288
256
  private moderateAsset;
289
257
  private createAsset;
258
+ /**
259
+ * Moves an asset to `outcome` like the pipeline would: a decision finishes processing, and
260
+ * finished processing removes content kept only temporarily (`keepContentAfterProcessing` off).
261
+ */
262
+ private applyOutcome;
290
263
  private resolveFolder;
291
264
  private findOwnFolder;
292
265
  private assertUniqueFolderName;
266
+ private getContentFormat;
293
267
  private getSizeInBytes;
294
268
  }
295
269
  //#endregion
package/esm/testing.js CHANGED
@@ -1,6 +1,6 @@
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";
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-N71PMJAz.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-BxMSx1Vm.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-B3S--hBG.js";
4
4
  import * as zod from "zod";
5
5
  import "zod/v4";
6
6
  //#region ../shared/src/ModerationCategoryDefinitions.ts
@@ -311,7 +311,6 @@ const CLASSIFICATION_LABEL_SCHEMA = zod.object({
311
311
  zod.object({
312
312
  processedAt: zod.number(),
313
313
  categories: CATEGORIES_SCHEMA,
314
- flagged: zod.boolean(),
315
314
  score: zod.number(),
316
315
  notes: saneStringField().nullish(),
317
316
  media: zod.object({
@@ -356,10 +355,10 @@ const HEX_WORDS = [
356
355
  "foxtrot"
357
356
  ];
358
357
  /** Read this aloud, or render it as large, high-contrast text in a video frame. */
359
- function generateMediaTestCode(signal, projectId) {
358
+ function generateMediaTestCode(signal, testInputKey) {
360
359
  if (!MEDIA_TEST_SIGNALS.includes(signal)) throw new Error("Unsupported media test signal");
361
- const suffix = projectId.slice(-8).toLowerCase();
362
- if (!/^[a-f0-9]{8}$/.test(suffix)) throw new Error("Expected a project ID with an eight-character hexadecimal suffix");
360
+ const suffix = testInputKey.toLowerCase();
361
+ if (!/^[a-f0-9]{8}$/.test(suffix)) throw new Error("Expected an eight-character hexadecimal test input key");
363
362
  return `Calm Lens test ${[...suffix].map((character) => HEX_WORDS[Number.parseInt(character, 16)]).join(" ")} ${signal.replace(/[.-]/g, " ")} end test`;
364
363
  }
365
364
  //#endregion
@@ -708,8 +707,8 @@ var MockCalmLensServerClient = class {
708
707
  this.imageStorage = options.mockOptions?.imageStorage ?? new InMemoryMockImageStorage();
709
708
  this.createId = options.mockOptions?.createId ?? crypto.randomUUID.bind(crypto);
710
709
  this.now = options.mockOptions?.now ?? Date.now;
711
- this.queuedStatus = options.mockOptions?.queuedStatus ?? "pending";
712
- this.analyzedStatus = options.mockOptions?.analyzedStatus ?? "approved";
710
+ this.queuedOutcome = options.mockOptions?.queuedOutcome ?? "pending";
711
+ this.analyzedOutcome = options.mockOptions?.analyzedOutcome ?? "approved";
713
712
  this.apiKeyGrants = getMockApiKeyGrants(options.apiKey);
714
713
  this.signedUrlBaseUrl = options.mockOptions?.signedUrlBaseUrl ?? "mock://calmlens";
715
714
  this.cdnBaseUrl = (options.cdnBaseUrl ?? "mock://calmlens/v1").replace(/\/+$/, "");
@@ -1021,18 +1020,22 @@ var MockCalmLensServerClient = class {
1021
1020
  isFinal: part.isFinal
1022
1021
  });
1023
1022
  if (!validation.ok) throw this.invalidPayload(validation.error);
1024
- if (asset.status !== "uploading") throw this.apiError(API_ERROR_CODES.UPLOAD_NOT_OPEN);
1025
- const expectedPartNumber = (asset.uploadPartsReceived ?? 1) + 1;
1023
+ if (asset.processing.status !== "uploading") throw this.apiError(API_ERROR_CODES.UPLOAD_NOT_OPEN);
1024
+ const expectedPartNumber = (asset.processing.uploadPartsReceived ?? 1) + 1;
1026
1025
  if (part.partNumber !== expectedPartNumber) throw this.apiError(API_ERROR_CODES.INVALID_UPLOAD_PART_NUMBER, { details: { expectedPartNumber } });
1027
1026
  await this.imageStorage.putPart(assetId, part);
1028
1027
  const queue = options.queue ?? this.uploadQueues.get(assetId) ?? false;
1029
1028
  if (part.isFinal) this.uploadQueues.delete(assetId);
1030
- return this.databaseStorage.updateAsset({
1029
+ const now = this.now();
1030
+ const received = {
1031
1031
  ...asset,
1032
- status: part.isFinal ? queue ? this.queuedStatus : this.analyzedStatus : "uploading",
1033
- uploadPartsReceived: part.partNumber,
1034
- updatedAt: this.now()
1035
- });
1032
+ processing: {
1033
+ ...asset.processing,
1034
+ uploadPartsReceived: part.partNumber
1035
+ },
1036
+ updatedAt: now
1037
+ };
1038
+ return this.databaseStorage.updateAsset(part.isFinal ? await this.applyOutcome(received, queue ? this.queuedOutcome : this.analyzedOutcome) : received);
1036
1039
  });
1037
1040
  },
1038
1041
  createSignedUrl: async (signedUrlOptions) => {
@@ -1065,13 +1068,9 @@ var MockCalmLensServerClient = class {
1065
1068
  retry: async (options) => {
1066
1069
  this.begin("assets.retry", options);
1067
1070
  const asset = await this.findOwnAsset(options?.assetId);
1068
- if (asset.status !== "error") throw this.apiError(API_ERROR_CODES.ASSET_NOT_RETRYABLE);
1069
- if (asset.storageDeletedAt) throw this.apiError(API_ERROR_CODES.ASSET_CONTENT_UNAVAILABLE);
1070
- return this.databaseStorage.updateAsset({
1071
- ...asset,
1072
- status: "pending",
1073
- updatedAt: this.now()
1074
- });
1071
+ if (asset.processing.status !== "failed") throw this.apiError(API_ERROR_CODES.ASSET_NOT_RETRYABLE);
1072
+ if (asset.content.status === "removed") throw this.apiError(API_ERROR_CODES.ASSET_CONTENT_UNAVAILABLE);
1073
+ return this.databaseStorage.updateAsset(await this.applyOutcome(asset, "pending"));
1075
1074
  },
1076
1075
  /** Waits like the real client, checking the mock's storage for a decision. */
1077
1076
  waitForDecision: async (options) => {
@@ -1083,11 +1082,17 @@ var MockCalmLensServerClient = class {
1083
1082
  this.begin("assets.deleteContent", options);
1084
1083
  const asset = await this.findOwnAsset(options?.assetId);
1085
1084
  await this.imageStorage.deleteContent(asset.id);
1085
+ const now = this.now();
1086
1086
  return this.databaseStorage.updateAsset({
1087
1087
  ...asset,
1088
- extractedText: null,
1089
- storageDeletedAt: asset.storageDeletedAt ?? this.now(),
1090
- updatedAt: this.now()
1088
+ content: asset.content.status === "removed" ? asset.content : {
1089
+ ...asset.content,
1090
+ status: "removed",
1091
+ removalReason: "requested",
1092
+ updatedAt: now,
1093
+ extractedText: null
1094
+ },
1095
+ updatedAt: now
1091
1096
  });
1092
1097
  },
1093
1098
  delete: async (options) => {
@@ -1271,6 +1276,7 @@ var MockCalmLensServerClient = class {
1271
1276
  const id = this.createId();
1272
1277
  const now = this.now();
1273
1278
  const isOpenUpload = "part" in options && !options.part.isFinal;
1279
+ const keepContent = options.processingOptions?.keepContentAfterProcessing === true;
1274
1280
  const asset = {
1275
1281
  id,
1276
1282
  projectId: this.projectId,
@@ -1283,11 +1289,37 @@ var MockCalmLensServerClient = class {
1283
1289
  externalUrl: "url" in options ? options.url : "content" in options ? options.externalUrl : void 0,
1284
1290
  type: inferAssetType(options),
1285
1291
  metadata: options.metadata,
1286
- status: isOpenUpload ? "uploading" : queue ? this.queuedStatus : this.analyzedStatus,
1287
1292
  processingOptions: options.processingOptions,
1288
1293
  visibility: options.visibility ?? "private",
1289
- sizeInBytes: this.getSizeInBytes(options),
1290
- uploadPartsReceived: "part" in options ? options.part.partNumber ?? 1 : void 0
1294
+ processing: {
1295
+ status: isOpenUpload ? "uploading" : "processing",
1296
+ updatedAt: now,
1297
+ uploadPartsReceived: "part" in options ? options.part.partNumber ?? 1 : null
1298
+ },
1299
+ moderation: {
1300
+ status: "pending",
1301
+ action: null,
1302
+ note: null,
1303
+ reviewerAction: null,
1304
+ reviewerNote: null,
1305
+ reviewerUserId: null,
1306
+ reviewedAt: null,
1307
+ decidedAt: null,
1308
+ report: null
1309
+ },
1310
+ content: {
1311
+ status: keepContent ? "stored" : "temporary",
1312
+ removalReason: null,
1313
+ updatedAt: now,
1314
+ safetyHold: null,
1315
+ format: this.getContentFormat(options),
1316
+ extension: null,
1317
+ sizeInBytes: this.getSizeInBytes(options) ?? null,
1318
+ checksums: null,
1319
+ image: null,
1320
+ previewImage: null,
1321
+ extractedText: null
1322
+ }
1291
1323
  };
1292
1324
  if ("content" in options) {
1293
1325
  if (!("plainText" in options.content)) await this.imageStorage.putContent(id, options.content);
@@ -1295,7 +1327,39 @@ var MockCalmLensServerClient = class {
1295
1327
  await this.imageStorage.putPart(id, options.part);
1296
1328
  if (isOpenUpload) this.uploadQueues.set(id, queue);
1297
1329
  }
1298
- return this.databaseStorage.createAsset(asset);
1330
+ return this.databaseStorage.createAsset(isOpenUpload ? asset : await this.applyOutcome(asset, queue ? this.queuedOutcome : this.analyzedOutcome));
1331
+ }
1332
+ /**
1333
+ * Moves an asset to `outcome` like the pipeline would: a decision finishes processing, and
1334
+ * finished processing removes content kept only temporarily (`keepContentAfterProcessing` off).
1335
+ */
1336
+ async applyOutcome(asset, outcome) {
1337
+ const now = this.now();
1338
+ const decided = outcome === "approved" || outcome === "rejected";
1339
+ const processingStatus = decided ? "done" : outcome === "failed" ? "failed" : "processing";
1340
+ const removeContent = processingStatus === "done" && asset.content.status === "temporary";
1341
+ if (removeContent) await this.imageStorage.deleteContent(asset.id);
1342
+ return {
1343
+ ...asset,
1344
+ updatedAt: now,
1345
+ processing: {
1346
+ ...asset.processing,
1347
+ status: processingStatus,
1348
+ updatedAt: now
1349
+ },
1350
+ moderation: {
1351
+ ...asset.moderation,
1352
+ status: decided ? outcome : "pending",
1353
+ decidedAt: decided ? now : null
1354
+ },
1355
+ content: removeContent ? {
1356
+ ...asset.content,
1357
+ status: "removed",
1358
+ removalReason: "retention",
1359
+ updatedAt: now,
1360
+ extractedText: null
1361
+ } : asset.content
1362
+ };
1299
1363
  }
1300
1364
  async resolveFolder(folderId) {
1301
1365
  if (!this.databaseStorage.getFolder) return void 0;
@@ -1312,6 +1376,11 @@ var MockCalmLensServerClient = class {
1312
1376
  async assertUniqueFolderName(name, parentId, excludeFolderId) {
1313
1377
  if ((this.databaseStorage.listFolders ? await this.databaseStorage.listFolders(this.projectId) : []).find((f) => f.id !== excludeFolderId && f.parentId === (parentId ?? null) && f.name === name)) throw this.apiError(API_ERROR_CODES.DUPLICATE_FOLDER_NAME, { message: `A folder named "${name}" already exists in this location.` });
1314
1378
  }
1379
+ getContentFormat(options) {
1380
+ if ("content" in options) return options.content.type;
1381
+ if ("part" in options) return options.part.type;
1382
+ return null;
1383
+ }
1315
1384
  getSizeInBytes(options) {
1316
1385
  if ("content" in options) {
1317
1386
  if ("plainText" in options.content) return new TextEncoder().encode(options.content.plainText).byteLength;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calmlens/sdk",
3
- "version": "0.13.0",
3
+ "version": "0.15.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",