@calmlens/sdk 0.12.0 → 0.14.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 (37) hide show
  1. package/README.md +54 -37
  2. package/cjs/CalmLensConnection-Bth5fJyp.js +234 -0
  3. package/cjs/CalmLensUtils-DNdmYeX6.js +699 -0
  4. package/cjs/{CalmLensError-CKwMKV0S.js → CalmLensVersion-Bs0DreBV.js} +114 -1
  5. package/cjs/{CalmLensWebhooks-BTPxKvcD.js → CalmLensWebhooks-6thkvr_F.js} +9 -9
  6. package/cjs/WebhookPayload-vy8HNMaK.d.ts +15834 -0
  7. package/cjs/app.d.ts +3 -3
  8. package/cjs/app.js +10 -10
  9. package/cjs/{index-BgmWj3KL.d.ts → index-Dz340UQ9.d.ts} +29 -1
  10. package/cjs/index.d.ts +3 -3
  11. package/cjs/index.js +4 -5
  12. package/cjs/server.d.ts +16 -7
  13. package/cjs/server.js +35 -21
  14. package/cjs/testing.d.ts +21 -42
  15. package/cjs/testing.js +181 -94
  16. package/esm/CalmLensConnection-DrCOL9h9.js +193 -0
  17. package/esm/{CalmLensUtils-Cx32j2zt.js → CalmLensUtils-BQo79TA1.js} +316 -2
  18. package/esm/{CalmLensError-CihGG26K.js → CalmLensVersion-DPnL_Ebv.js} +91 -2
  19. package/esm/{CalmLensWebhooks-DShmAal4.js → CalmLensWebhooks-CWlD-f_P.js} +2 -2
  20. package/esm/WebhookPayload-vy8HNMaK.d.ts +15834 -0
  21. package/esm/app.d.ts +3 -3
  22. package/esm/app.js +4 -4
  23. package/esm/{index-BgmWj3KL.d.ts → index-Dz340UQ9.d.ts} +29 -1
  24. package/esm/index.d.ts +3 -3
  25. package/esm/index.js +1 -3
  26. package/esm/server.d.ts +16 -7
  27. package/esm/server.js +24 -10
  28. package/esm/testing.d.ts +21 -42
  29. package/esm/testing.js +152 -65
  30. package/package.json +1 -1
  31. package/cjs/CalmLensConnection-CYtBP-vu.js +0 -516
  32. package/cjs/CalmLensUtils-Dg3s4loH.js +0 -367
  33. package/cjs/WebhookPayload-Cgb32aSH.d.ts +0 -10187
  34. package/cjs/src-Dsc8Pn6v.js +0 -45
  35. package/esm/CalmLensConnection-wLNy0OIP.js +0 -475
  36. package/esm/WebhookPayload-Cgb32aSH.d.ts +0 -10187
  37. package/esm/src-CJhrILvM.js +0 -22
package/esm/app.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as SearchAssetsOptions, A as DeleteAssetContentOptions, At as AssetSafetyHold, B as Lens, C as CdnAssetUrlOptions, Ct as EventType, D as CreateAssetSignedUrlOptions, Dt as AssetSearchMatchField, E as ConnectionOptions, Et as LensType, F as IdempotencyOptions, Ft as MetadataItem, G as ModerateTextOptions, H as ListAssetChildrenOptions, I as ImageTransform, It as PreviewImage, J as MultipartUploadOptions, K as MoveAssetOptions, L as ImageTransformOptions, Lt as ProcessingOptions, M as EnsureLensOptions, Mt as DocumentData, N as EnsureLensesOptions, Nt as ExtractedText, O as CreateFolderOptions, Ot as AssetSearchQuery, P as FolderIdOptions, Pt as ImageData, Q as RetryAssetOptions, R as IterateAssetChildrenOptions, S as CalmLensServerClientOptions, St as EventSeverity, T as CdnTransform, Tt as Page, U as ListAssetsOptions, V as LensTransform, W as ListEventsOptions, X as RequestOptions, Y as MultipartUploadPartOptions, Z as RetrieveAssetOptions, _ as AssetSearchResult, _t as TypedEvent, a as ClassificationLabel, at as UpdateFolderOptions, b as AssetVisibility, bt as EventFactValues, c as ClassificationReport, ct as UploadedAsset, d as Asset, dt as WebhookPayloadInput, et as SignUploadTokenOptions, f as AssetChecksums, ft as GetEventsResponse, g as AssetSearchResponse, gt as EventAsset, h as AssetPage, i as ClassificationCategoryReport, it as UpdateAssetOptions, j as DeleteAssetOptions, jt as AssetSafetyHoldReason, k as CreateMultipartUploadPartOptions, l as Likelihood, lt as VerifyWebhookSignatureOptions, m as AssetContentOptions, mt as Folder, n as ClassificationCategories, nt as SignedUrl, o as ClassificationNotEvaluatedReason, ot as UploadAssetPartOptions, p as AssetChildrenPage, 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 WebhookHeadersInput, v as AssetStatus, vt as EventCategory, w as CdnServeOptions, wt as Order, x as CalmLensAppClientOptions, xt as EventFacts, y as AssetType, yt as EventFact, z as IterateAssetsOptions } from "./WebhookPayload-Cgb32aSH.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-BgmWj3KL.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 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 invalidConfig, i as invalidArgument, n as CalmLensError, t as CALMLENS_ERROR_CODES } from "./CalmLensError-CihGG26K.js";
2
- import { t as SDK_VERSION } from "./src-CJhrILvM.js";
3
- import { n as encodePathSegment, s as validateAppClientOptions } from "./CalmLensUtils-Cx32j2zt.js";
4
- import { o as prepareSubmitAssetOptions, r as expectUploadedAsset, s as resolveConnectionOptions, t as CalmLensConnection } from "./CalmLensConnection-wLNy0OIP.js";
1
+ import { a as CALMLENS_ERROR_CODES, c as invalidArgument, l as invalidConfig, o as CalmLensError, t as SDK_VERSION } from "./CalmLensVersion-DPnL_Ebv.js";
2
+ import "./index.js";
3
+ import { c as validateAppClientOptions, n as encodePathSegment } from "./CalmLensUtils-BQo79TA1.js";
4
+ import { o as prepareSubmitAssetOptions, r as expectUploadedAsset, s as resolveConnectionOptions, t as CalmLensConnection } from "./CalmLensConnection-DrCOL9h9.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-Cgb32aSH.js";
1
+ import "./WebhookPayload-vy8HNMaK.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";
@@ -179,6 +180,8 @@ declare const API_ERROR_CODES: {
179
180
  readonly UPLOAD_PRESET_NOT_FOUND: "upload-preset/not-found";
180
181
  readonly UPLOAD_PRESET_DISABLED: "upload-preset/disabled";
181
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";
182
185
  readonly UPLOAD_PRESET_CONTENT_TYPE_NOT_ALLOWED: "upload-preset/content-type-not-allowed";
183
186
  readonly UPLOAD_PRESET_TOO_LARGE: "upload-preset/too-large";
184
187
  readonly UPLOAD_PRESET_DAILY_LIMIT_REACHED: "upload-preset/daily-limit-reached";
@@ -187,6 +190,17 @@ declare const API_ERROR_CODES: {
187
190
  readonly UPLOAD_TOKEN_INVALID: "upload-token/invalid";
188
191
  readonly UPLOAD_TOKEN_EXPIRED: "upload-token/expired";
189
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";
190
204
  };
191
205
  type ApiErrorCode = (typeof API_ERROR_CODES)[keyof typeof API_ERROR_CODES];
192
206
  //#endregion
@@ -230,6 +244,7 @@ declare const CALMLENS_ERROR_CODES: {
230
244
  readonly MULTIPART_IMAGE_TOO_LARGE: "upload/multipart-image-too-large";
231
245
  readonly IMAGE_EXCEEDED_MAX_DIMENSIONS: "upload/image-exceeded-max-dimensions";
232
246
  readonly UPLOAD_LIMIT_EXCEEDED: "upload/limit-exceeded";
247
+ readonly SPEND_LIMIT_REACHED: "upload/spend-limit-reached";
233
248
  readonly INVALID_UPLOAD_MIME_TYPE: "upload/invalid-mime-type";
234
249
  readonly INVALID_EVENT_CURSOR: "events/invalid-cursor";
235
250
  readonly INVALID_UPLOAD_PAYLOAD: "upload/invalid-payload";
@@ -257,6 +272,8 @@ declare const CALMLENS_ERROR_CODES: {
257
272
  readonly UPLOAD_PRESET_NOT_FOUND: "upload-preset/not-found";
258
273
  readonly UPLOAD_PRESET_DISABLED: "upload-preset/disabled";
259
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";
260
277
  readonly UPLOAD_PRESET_CONTENT_TYPE_NOT_ALLOWED: "upload-preset/content-type-not-allowed";
261
278
  readonly UPLOAD_PRESET_TOO_LARGE: "upload-preset/too-large";
262
279
  readonly UPLOAD_PRESET_DAILY_LIMIT_REACHED: "upload-preset/daily-limit-reached";
@@ -265,6 +282,17 @@ declare const CALMLENS_ERROR_CODES: {
265
282
  readonly UPLOAD_TOKEN_INVALID: "upload-token/invalid";
266
283
  readonly UPLOAD_TOKEN_EXPIRED: "upload-token/expired";
267
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";
268
296
  /** The request could not be completed: DNS, TLS, a refused or reset connection, a truncated body. */
269
297
  readonly TRANSPORT_ERROR: "sdk/transport-error";
270
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, At as AssetSafetyHold, B as Lens, C as CdnAssetUrlOptions, Ct as EventType, D as CreateAssetSignedUrlOptions, Dt as AssetSearchMatchField, E as ConnectionOptions, Et as LensType, F as IdempotencyOptions, Ft as MetadataItem, G as ModerateTextOptions, H as ListAssetChildrenOptions, I as ImageTransform, It as PreviewImage, J as MultipartUploadOptions, K as MoveAssetOptions, L as ImageTransformOptions, Lt as ProcessingOptions, M as EnsureLensOptions, Mt as DocumentData, N as EnsureLensesOptions, Nt as ExtractedText, O as CreateFolderOptions, Ot as AssetSearchQuery, P as FolderIdOptions, Pt as ImageData, Q as RetryAssetOptions, R as IterateAssetChildrenOptions, S as CalmLensServerClientOptions, St as EventSeverity, T as CdnTransform, Tt as Page, U as ListAssetsOptions, V as LensTransform, W as ListEventsOptions, X as RequestOptions, Y as MultipartUploadPartOptions, Z as RetrieveAssetOptions, _ as AssetSearchResult, _t as TypedEvent, a as ClassificationLabel, at as UpdateFolderOptions, b as AssetVisibility, bt as EventFactValues, c as ClassificationReport, ct as UploadedAsset, d as Asset, dt as WebhookPayloadInput, et as SignUploadTokenOptions, f as AssetChecksums, ft as GetEventsResponse, g as AssetSearchResponse, gt as EventAsset, h as AssetPage, i as ClassificationCategoryReport, it as UpdateAssetOptions, j as DeleteAssetOptions, jt as AssetSafetyHoldReason, k as CreateMultipartUploadPartOptions, l as Likelihood, lt as VerifyWebhookSignatureOptions, m as AssetContentOptions, mt as Folder, n as ClassificationCategories, nt as SignedUrl, o as ClassificationNotEvaluatedReason, ot as UploadAssetPartOptions, p as AssetChildrenPage, 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 WebhookHeadersInput, v as AssetStatus, vt as EventCategory, w as CdnServeOptions, wt as Order, x as CalmLensAppClientOptions, xt as EventFacts, y as AssetType, yt as EventFact, z as IterateAssetsOptions } from "./WebhookPayload-Cgb32aSH.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-BgmWj3KL.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 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,3 +1 @@
1
- import { n as CalmLensError, t as CALMLENS_ERROR_CODES } from "./CalmLensError-CihGG26K.js";
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-DPnL_Ebv.js";
package/esm/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as SearchAssetsOptions, A as DeleteAssetContentOptions, At as AssetSafetyHold, B as Lens, C as CdnAssetUrlOptions, Ct as EventType, D as CreateAssetSignedUrlOptions, Dt as AssetSearchMatchField, E as ConnectionOptions, Et as LensType, F as IdempotencyOptions, Ft as MetadataItem, G as ModerateTextOptions, H as ListAssetChildrenOptions, I as ImageTransform, It as PreviewImage, J as MultipartUploadOptions, K as MoveAssetOptions, L as ImageTransformOptions, Lt as ProcessingOptions, M as EnsureLensOptions, Mt as DocumentData, N as EnsureLensesOptions, Nt as ExtractedText, O as CreateFolderOptions, Ot as AssetSearchQuery, P as FolderIdOptions, Pt as ImageData, Q as RetryAssetOptions, R as IterateAssetChildrenOptions, S as CalmLensServerClientOptions, St as EventSeverity, T as CdnTransform, Tt as Page, U as ListAssetsOptions, V as LensTransform, W as ListEventsOptions, X as RequestOptions, Y as MultipartUploadPartOptions, Z as RetrieveAssetOptions, _ as AssetSearchResult, _t as TypedEvent, a as ClassificationLabel, at as UpdateFolderOptions, b as AssetVisibility, bt as EventFactValues, c as ClassificationReport, ct as UploadedAsset, d as Asset, dt as WebhookPayloadInput, et as SignUploadTokenOptions, f as AssetChecksums, ft as GetEventsResponse, g as AssetSearchResponse, gt as EventAsset, h as AssetPage, i as ClassificationCategoryReport, it as UpdateAssetOptions, j as DeleteAssetOptions, jt as AssetSafetyHoldReason, k as CreateMultipartUploadPartOptions, l as Likelihood, lt as VerifyWebhookSignatureOptions, m as AssetContentOptions, mt as Folder, n as ClassificationCategories, nt as SignedUrl, o as ClassificationNotEvaluatedReason, ot as UploadAssetPartOptions, p as AssetChildrenPage, pt as PostAssetSignedUrlResponse, 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 WebhookHeadersInput, v as AssetStatus, vt as EventCategory, w as CdnServeOptions, wt as Order, x as CalmLensAppClientOptions, xt as EventFacts, y as AssetType, yt as EventFact, z as IterateAssetsOptions } from "./WebhookPayload-Cgb32aSH.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-BgmWj3KL.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,10 +111,17 @@ 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>;
119
+ /**
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
122
+ * decision within `timeoutMs` (default 60000). Webhooks report decisions without polling.
123
+ */
124
+ waitForDecision: ({ assetId, ...options }: WaitForAssetDecisionOptions) => Promise<Asset>;
118
125
  /**
119
126
  * Removes an asset's stored content (source, preview and retained extracted text) while
120
127
  * keeping the asset record, metadata and moderation report. The returned asset has
@@ -169,11 +176,13 @@ declare class CalmLensServerClient {
169
176
  */
170
177
  ensureLens(options: EnsureLensOptions): Promise<Lens>;
171
178
  /**
172
- * Create or update several named lenses in one API request.
179
+ * Create or update several named lenses. New definitions are sent in one API request, or in
180
+ * consecutive requests of at most {@link ENSURE_LENSES_MAX_PER_REQUEST} definitions, in order.
173
181
  * Each lens follows the same versioning and idempotency rules as ensureLens().
174
182
  */
175
183
  ensureLenses({ lenses }: EnsureLensesOptions): Promise<Lens[]>;
176
184
  private submitEnsureLenses;
185
+ private submitEnsureLensesChunk;
177
186
  }
178
187
  //#endregion
179
188
  //#region src/client/CalmLensWebhooks.d.ts
@@ -199,4 +208,4 @@ export declare function verifyWebhookSignature(options: VerifyWebhookSignatureOp
199
208
  */
200
209
  export declare function parseWebhookEvent(options: VerifyWebhookSignatureOptions): Promise<WebhookEventPayload>;
201
210
  //#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 };
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,9 +1,8 @@
1
- import { a as invalidConfig, i as invalidArgument, n as CalmLensError, r as SDK_ERROR_CODES, t as CALMLENS_ERROR_CODES } from "./CalmLensError-CihGG26K.js";
2
- import { i as isReactNativeRuntime, r as isBrowserRuntime, t as SDK_VERSION } from "./src-CJhrILvM.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-DShmAal4.js";
4
- import { a as toTextAssetOptions, c as validateRequestOptions, l as validateServerClientOptions, n as encodePathSegment, o as transformSelector, t as appendCdnSelector } from "./CalmLensUtils-Cx32j2zt.js";
5
- import { a as newIdempotencyKey, i as invalidPayload, n as expectAsset, o as prepareSubmitAssetOptions, s as resolveConnectionOptions, t as CalmLensConnection } from "./CalmLensConnection-wLNy0OIP.js";
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-DPnL_Ebv.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-CWlD-f_P.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-BQo79TA1.js";
5
+ import { a as newIdempotencyKey, i as invalidPayload, n as expectAsset, o as prepareSubmitAssetOptions, s as resolveConnectionOptions, t as CalmLensConnection } from "./CalmLensConnection-DrCOL9h9.js";
7
6
  const getEnsureLensCacheKey = (options) => stringifyJsonCanonical({
8
7
  identifier: options.identifier,
9
8
  name: options.name,
@@ -198,8 +197,8 @@ sign: async (options) => {
198
197
  }));
199
198
  },
200
199
  /**
201
- * Uploads an asset and queues it for moderation, returning immediately with status
202
- * `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
203
202
  * `Idempotency-Key`.
204
203
  */
205
204
  create: async (options) => this.submitAsset(options, true),
@@ -236,11 +235,22 @@ sign: async (options) => {
236
235
  /** Moves an asset into a folder, or to the project root with `folderId: null`. */
237
236
  move: async ({ assetId, folderId }) => this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/move`, { body: { folderId } }),
238
237
  /**
239
- * 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
240
240
  * moderated like a new upload; its content must still be stored.
241
241
  */
242
242
  retry: async ({ assetId }) => this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/retry`),
243
243
  /**
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
246
+ * decision within `timeoutMs` (default 60000). Webhooks report decisions without polling.
247
+ */
248
+ waitForDecision: async ({ assetId, ...options }) => {
249
+ requireId(assetId, "Asset ID");
250
+ const client = options.signal ? this.withRequestOptions({ signal: options.signal }) : this;
251
+ return pollForDecision(() => client.assets.retrieve({ assetId }), options, sleep);
252
+ },
253
+ /**
244
254
  * Removes an asset's stored content (source, preview and retained extracted text) while
245
255
  * keeping the asset record, metadata and moderation report. The returned asset has
246
256
  * `storageDeletedAt` set; the CDN no longer serves it.
@@ -312,7 +322,8 @@ sign: async (options) => {
312
322
  return lens;
313
323
  }
314
324
  /**
315
- * Create or update several named lenses in one API request.
325
+ * Create or update several named lenses. New definitions are sent in one API request, or in
326
+ * consecutive requests of at most {@link ENSURE_LENSES_MAX_PER_REQUEST} definitions, in order.
316
327
  * Each lens follows the same versioning and idempotency rules as ensureLens().
317
328
  */
318
329
  async ensureLenses({ lenses }) {
@@ -345,6 +356,9 @@ sign: async (options) => {
345
356
  });
346
357
  }
347
358
  async submitEnsureLenses(options) {
359
+ for (let start = 0; start < options.length; start += 100) await this.submitEnsureLensesChunk(options.slice(start, start + 100));
360
+ }
361
+ async submitEnsureLensesChunk(options) {
348
362
  const result = await this.request("PUT", `${this.projectPath}/lenses`, { body: { lenses: options } });
349
363
  const returned = Array.isArray(result?.lenses) ? result.lenses : [];
350
364
  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,5 +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, _t as TypedEvent, at as UpdateFolderOptions, d as Asset, et as SignUploadTokenOptions, ft as GetEventsResponse, g as AssetSearchResponse, h as AssetPage, ht as Event, it as UpdateAssetOptions, j as DeleteAssetOptions, kt as AssetBinaryPayloadInput, mt as Folder, ot as UploadAssetPartOptions, p as AssetChildrenPage, pt as PostAssetSignedUrlResponse, q as MoveFolderOptions, r as ClassificationCategory, rt as SubmitAssetOptions, t as WebhookEventPayload, tt as SignedUploadToken, v as AssetStatus, w as CdnServeOptions, z as IterateAssetsOptions } from "./WebhookPayload-Cgb32aSH.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
@@ -8,40 +7,6 @@ export declare const MEDIA_TEST_SIGNALS: readonly ["sexual", "violence", "self-h
8
7
  /** Read this aloud, or render it as large, high-contrast text in a video frame. */
9
8
  export declare function generateMediaTestCode(signal: ClassificationTestSignal, projectId: string): string;
10
9
  //#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
- "settings:read": "settings:read";
36
- "settings:write": "settings:write";
37
- "upload-presets:read": "upload-presets:read";
38
- "upload-presets:write": "upload-presets:write";
39
- }>>;
40
- folderId: zod.ZodNullable<zod.ZodString>;
41
- includeSubfolders: zod.ZodBoolean;
42
- }, zod.core.$strict>;
43
- type PermissionGrant = zod.infer<typeof GRANT_SCHEMA>;
44
- //#endregion
45
10
  //#region src/testing/MockApiKey.d.ts
46
11
  export declare const MOCK_API_KEY_PREFIX = "sk_test_";
47
12
  export declare const createMockApiKey: (grants?: PermissionGrant[]) => string;
@@ -111,13 +76,18 @@ interface MockCalmLensServerClientOptions extends CalmLensServerClientOptions {
111
76
  imageStorage?: MockImageStorage;
112
77
  createId?: () => string;
113
78
  now?: () => number;
114
- /** Status `assets.create` returns. Defaults to `pending`. */
115
- queuedStatus?: AssetStatus;
116
- /** Status `assets.moderate` and `text.moderate` return. Defaults to `approved`. */
117
- 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;
118
83
  signedUrlBaseUrl?: string;
119
84
  };
120
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";
121
91
  /** The options each `MockCalmLensServerClient` method was given, by operation name. */
122
92
  interface MockCalmLensOperationOptions {
123
93
  "assets.list": ListAssetsOptions;
@@ -131,6 +101,7 @@ interface MockCalmLensOperationOptions {
131
101
  "assets.createSignedUrl": CreateAssetSignedUrlOptions;
132
102
  "assets.move": MoveAssetOptions;
133
103
  "assets.retry": RetryAssetOptions;
104
+ "assets.waitForDecision": WaitForAssetDecisionOptions;
134
105
  "assets.deleteContent": DeleteAssetContentOptions;
135
106
  "assets.delete": DeleteAssetOptions;
136
107
  "text.moderate": ModerateTextOptions;
@@ -176,8 +147,8 @@ export declare class MockCalmLensServerClient {
176
147
  readonly imageStorage: MockImageStorage;
177
148
  private readonly createId;
178
149
  private readonly now;
179
- private readonly queuedStatus;
180
- private readonly analyzedStatus;
150
+ private readonly queuedOutcome;
151
+ private readonly analyzedOutcome;
181
152
  private readonly apiKeyGrants;
182
153
  private readonly signedUrlBaseUrl;
183
154
  private readonly cdnBaseUrl;
@@ -260,6 +231,8 @@ export declare class MockCalmLensServerClient {
260
231
  createSignedUrl: (signedUrlOptions: CreateAssetSignedUrlOptions) => Promise<PostAssetSignedUrlResponse>;
261
232
  move: (options: MoveAssetOptions) => Promise<Asset>;
262
233
  retry: (options: RetryAssetOptions) => Promise<Asset>;
234
+ /** Waits like the real client, checking the mock's storage for a decision. */
235
+ waitForDecision: (options: WaitForAssetDecisionOptions) => Promise<Asset>;
263
236
  deleteContent: (options: DeleteAssetContentOptions) => Promise<Asset>;
264
237
  delete: (options: DeleteAssetOptions) => Promise<void>;
265
238
  };
@@ -282,9 +255,15 @@ export declare class MockCalmLensServerClient {
282
255
  private withIdempotency;
283
256
  private moderateAsset;
284
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;
285
263
  private resolveFolder;
286
264
  private findOwnFolder;
287
265
  private assertUniqueFolderName;
266
+ private getContentFormat;
288
267
  private getSizeInBytes;
289
268
  }
290
269
  //#endregion