@calmlens/sdk 0.14.0 → 0.16.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 (38) hide show
  1. package/README.md +30 -10
  2. package/cjs/{CalmLensConnection-Bth5fJyp.js → CalmLensConnection-CPdx_acA.js} +2 -2
  3. package/cjs/{CalmLensUtils-DNdmYeX6.js → CalmLensUtils-DvhY8-cU.js} +1 -1
  4. package/cjs/{CalmLensVersion-Bs0DreBV.js → CalmLensVersion-CrlGk2gX.js} +6 -1
  5. package/cjs/{CalmLensWebhooks-6thkvr_F.js → CalmLensWebhooks-C2VrleZm.js} +4 -4
  6. package/cjs/Classification-DJU_DfOO.d.ts +4565 -0
  7. package/cjs/TestTriggers-CxFZ-3uz.d.ts +43 -0
  8. package/cjs/{WebhookPayload-vy8HNMaK.d.ts → WebhookPayload-BfUmVu2y.d.ts} +77 -4622
  9. package/cjs/app.d.ts +4 -3
  10. package/cjs/app.js +3 -3
  11. package/cjs/{index-Dz340UQ9.d.ts → index-VxklV9OQ.d.ts} +4 -1
  12. package/cjs/index.d.ts +4 -3
  13. package/cjs/index.js +1 -1
  14. package/cjs/server.d.ts +8 -7
  15. package/cjs/server.js +17 -21
  16. package/cjs/test-inputs.d.ts +2 -0
  17. package/cjs/test-inputs.js +265 -0
  18. package/cjs/testing.d.ts +3 -5
  19. package/cjs/testing.js +51 -30
  20. package/esm/{CalmLensConnection-DrCOL9h9.js → CalmLensConnection-DYo5U2L0.js} +2 -2
  21. package/esm/{CalmLensUtils-BQo79TA1.js → CalmLensUtils-BDtpOfho.js} +1 -1
  22. package/esm/{CalmLensVersion-DPnL_Ebv.js → CalmLensVersion-CchG7NWy.js} +6 -1
  23. package/esm/{CalmLensWebhooks-CWlD-f_P.js → CalmLensWebhooks-B7nQMCHx.js} +4 -4
  24. package/esm/Classification-DJU_DfOO.d.ts +4565 -0
  25. package/esm/TestTriggers-CxFZ-3uz.d.ts +43 -0
  26. package/esm/{WebhookPayload-vy8HNMaK.d.ts → WebhookPayload-BfUmVu2y.d.ts} +77 -4622
  27. package/esm/app.d.ts +4 -3
  28. package/esm/app.js +3 -3
  29. package/esm/{index-Dz340UQ9.d.ts → index-VxklV9OQ.d.ts} +4 -1
  30. package/esm/index.d.ts +4 -3
  31. package/esm/index.js +1 -1
  32. package/esm/server.d.ts +8 -7
  33. package/esm/server.js +17 -21
  34. package/esm/test-inputs.d.ts +2 -0
  35. package/esm/test-inputs.js +256 -0
  36. package/esm/testing.d.ts +3 -5
  37. package/esm/testing.js +51 -30
  38. package/package.json +13 -2
package/cjs/app.d.ts CHANGED
@@ -1,5 +1,6 @@
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";
1
+ import { $ as SearchAssetsOptions, A as DeleteAssetContentOptions, At as AssetSearchQuery, B as Lens, C as CdnAssetUrlOptions, Ct as EventType, D as CreateAssetSignedUrlOptions, Dt as Order, E as ConnectionOptions, Et as CursorPage, 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 AssetSafetyHold, N as EnsureLensesOptions, Nt as AssetSafetyHoldReason, O as CreateFolderOptions, Ot as LensType, P as FolderIdOptions, Pt as ExtractedText, Q as RetryAssetOptions, R as IterateAssetChildrenOptions, Rt as ProcessingOptions, S as CalmLensServerClientOptions, St as EventSeverity, T as CdnTransform, Tt as Folder, U as ListAssetsOptions, V as LensTransform, W as ListEventsOptions, X as RequestOptions, Y as MultipartUploadPartOptions, Z as RetrieveAssetOptions, _ as AssetSearchResponse, _t as TypedEvent, a as AssetChildrenPage, at as UpdateFolderOptions, b as AssetVisibility, bt as EventFactValues, c as AssetContentRemovalReason, ct as UploadedAsset, d as AssetModerationAction, dt as WebhookHeadersInput, et as SignUploadTokenOptions, f as AssetModerationStatus, ft as WebhookPayloadInput, g as AssetReviewerAction, gt as EventAsset, h as AssetProcessingStatus, i as AssetChecksums, it as UpdateAssetOptions, j as DeleteAssetOptions, k as CreateMultipartUploadPartOptions, kt as AssetSearchMatchField, l as AssetContentStatus, lt as VerifyWebhookSignatureOptions, m as AssetProcessing, nt as SignedUrl, o as AssetContent, ot as UploadAssetPartOptions, p as AssetPage, pt as GetEventsResponse, q as MoveFolderOptions, r as Asset, rt as SubmitAssetOptions, s as AssetContentOptions, st as UploadPresetSubmitAssetOptions, t as ReceivedWebhookEventPayload, tt as SignedUploadToken, u as AssetModeration, ut as WaitForAssetDecisionOptions, v as AssetSearchResult, vt as EventCategory, w as CdnServeOptions, x as CalmLensAppClientOptions, xt as EventFacts, y as AssetType, yt as EventFact, z as IterateAssetsOptions } from "./WebhookPayload-BfUmVu2y.js";
2
+ import { a as ClassificationNotEvaluatedReason, c as Likelihood, i as ClassificationLabel, l as ModerationQualifier, n as ClassificationCategory, o as ClassificationQualifierResults, r as ClassificationCategoryReport, s as ClassificationReport, t as ClassificationCategories } from "./Classification-DJU_DfOO.js";
3
+ 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-VxklV9OQ.js";
3
4
  //#region src/client/CalmLensAppClient.d.ts
4
5
  declare const inspectSymbol: unique symbol;
5
6
  /**
@@ -40,4 +41,4 @@ declare class CalmLensAppClient {
40
41
  };
41
42
  }
42
43
  //#endregion
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 };
44
+ 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 CursorPage, 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 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 ReceivedWebhookEventPayload as WebhookEventPayload, type WebhookHeadersInput, type WebhookPayloadInput };
package/cjs/app.js CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_CalmLensVersion = require("./CalmLensVersion-Bs0DreBV.js");
2
+ const require_CalmLensVersion = require("./CalmLensVersion-CrlGk2gX.js");
3
3
  require("./index.js");
4
- const require_CalmLensUtils = require("./CalmLensUtils-DNdmYeX6.js");
5
- const require_CalmLensConnection = require("./CalmLensConnection-Bth5fJyp.js");
4
+ const require_CalmLensUtils = require("./CalmLensUtils-DvhY8-cU.js");
5
+ const require_CalmLensConnection = require("./CalmLensConnection-CPdx_acA.js");
6
6
  //#region src/client/CalmLensAppClient.ts
7
7
  const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
8
8
  /**
@@ -1,4 +1,5 @@
1
- import "./WebhookPayload-vy8HNMaK.js";
1
+ import "./WebhookPayload-BfUmVu2y.js";
2
+ import "./Classification-DJU_DfOO.js";
2
3
  import * as zod from "zod";
3
4
  //#region ../shared/src/ProcessingFeatures.d.ts
4
5
  /**
@@ -142,6 +143,7 @@ type FlaggedContentPolicy = zod.infer<typeof FLAGGED_CONTENT_POLICY_SCHEMA>;
142
143
  //#region src/client/CalmLensErrorCodes.d.ts
143
144
  /** Error codes the CalmLens API documents, by name. */
144
145
  declare const API_ERROR_CODES: {
146
+ readonly INVALID_CURSOR: "validation/invalid-cursor";
145
147
  readonly MISSING_TOKEN: "auth/missing-token";
146
148
  readonly INVALID_API_KEY: "auth/invalid-api-key";
147
149
  readonly API_KEY_PROJECT_MISMATCH: "auth/project-mismatch";
@@ -234,6 +236,7 @@ declare const SDK_ERROR_CODES: {
234
236
  type SdkErrorCode = (typeof SDK_ERROR_CODES)[keyof typeof SDK_ERROR_CODES];
235
237
  /** Every error code the SDK can throw: the documented API codes and the SDK's own `sdk/*` codes. */
236
238
  declare const CALMLENS_ERROR_CODES: {
239
+ readonly INVALID_CURSOR: "validation/invalid-cursor";
237
240
  readonly MISSING_TOKEN: "auth/missing-token";
238
241
  readonly INVALID_API_KEY: "auth/invalid-api-key";
239
242
  readonly API_KEY_PROJECT_MISMATCH: "auth/project-mismatch";
package/cjs/index.d.ts CHANGED
@@ -1,3 +1,4 @@
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 };
1
+ import { $ as SearchAssetsOptions, A as DeleteAssetContentOptions, At as AssetSearchQuery, B as Lens, C as CdnAssetUrlOptions, Ct as EventType, D as CreateAssetSignedUrlOptions, Dt as Order, E as ConnectionOptions, Et as CursorPage, 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 AssetSafetyHold, N as EnsureLensesOptions, Nt as AssetSafetyHoldReason, O as CreateFolderOptions, Ot as LensType, P as FolderIdOptions, Pt as ExtractedText, Q as RetryAssetOptions, R as IterateAssetChildrenOptions, Rt as ProcessingOptions, S as CalmLensServerClientOptions, St as EventSeverity, T as CdnTransform, Tt as Folder, U as ListAssetsOptions, V as LensTransform, W as ListEventsOptions, X as RequestOptions, Y as MultipartUploadPartOptions, Z as RetrieveAssetOptions, _ as AssetSearchResponse, _t as TypedEvent, a as AssetChildrenPage, at as UpdateFolderOptions, b as AssetVisibility, bt as EventFactValues, c as AssetContentRemovalReason, ct as UploadedAsset, d as AssetModerationAction, dt as WebhookHeadersInput, et as SignUploadTokenOptions, f as AssetModerationStatus, ft as WebhookPayloadInput, g as AssetReviewerAction, gt as EventAsset, h as AssetProcessingStatus, i as AssetChecksums, it as UpdateAssetOptions, j as DeleteAssetOptions, k as CreateMultipartUploadPartOptions, kt as AssetSearchMatchField, l as AssetContentStatus, lt as VerifyWebhookSignatureOptions, m as AssetProcessing, nt as SignedUrl, o as AssetContent, ot as UploadAssetPartOptions, p as AssetPage, pt as GetEventsResponse, q as MoveFolderOptions, r as Asset, rt as SubmitAssetOptions, s as AssetContentOptions, st as UploadPresetSubmitAssetOptions, t as ReceivedWebhookEventPayload, tt as SignedUploadToken, u as AssetModeration, ut as WaitForAssetDecisionOptions, v as AssetSearchResult, vt as EventCategory, w as CdnServeOptions, x as CalmLensAppClientOptions, xt as EventFacts, y as AssetType, yt as EventFact, z as IterateAssetsOptions } from "./WebhookPayload-BfUmVu2y.js";
2
+ import { a as ClassificationNotEvaluatedReason, c as Likelihood, i as ClassificationLabel, l as ModerationQualifier, n as ClassificationCategory, o as ClassificationQualifierResults, r as ClassificationCategoryReport, s as ClassificationReport, t as ClassificationCategories } from "./Classification-DJU_DfOO.js";
3
+ 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-VxklV9OQ.js";
4
+ 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 CursorPage, 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 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 ReceivedWebhookEventPayload as WebhookEventPayload, type WebhookHeadersInput, type WebhookPayloadInput };
package/cjs/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_CalmLensVersion = require("./CalmLensVersion-Bs0DreBV.js");
2
+ const require_CalmLensVersion = require("./CalmLensVersion-CrlGk2gX.js");
3
3
  exports.CALMLENS_ERROR_CODES = require_CalmLensVersion.CALMLENS_ERROR_CODES;
4
4
  exports.CalmLensError = require_CalmLensVersion.CalmLensError;
5
5
  exports.SDK_VERSION = require_CalmLensVersion.SDK_VERSION;
package/cjs/server.d.ts CHANGED
@@ -1,5 +1,6 @@
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";
1
+ import { $ as SearchAssetsOptions, A as DeleteAssetContentOptions, At as AssetSearchQuery, B as Lens, C as CdnAssetUrlOptions, Ct as EventType, D as CreateAssetSignedUrlOptions, Dt as Order, E as ConnectionOptions, Et as CursorPage, 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 AssetSafetyHold, N as EnsureLensesOptions, Nt as AssetSafetyHoldReason, O as CreateFolderOptions, Ot as LensType, P as FolderIdOptions, Pt as ExtractedText, Q as RetryAssetOptions, R as IterateAssetChildrenOptions, Rt as ProcessingOptions, S as CalmLensServerClientOptions, St as EventSeverity, T as CdnTransform, Tt as Folder, U as ListAssetsOptions, V as LensTransform, W as ListEventsOptions, X as RequestOptions, Y as MultipartUploadPartOptions, Z as RetrieveAssetOptions, _ as AssetSearchResponse, _t as TypedEvent, a as AssetChildrenPage, at as UpdateFolderOptions, b as AssetVisibility, bt as EventFactValues, c as AssetContentRemovalReason, ct as UploadedAsset, d as AssetModerationAction, dt as WebhookHeadersInput, et as SignUploadTokenOptions, f as AssetModerationStatus, ft as WebhookPayloadInput, g as AssetReviewerAction, gt as EventAsset, h as AssetProcessingStatus, i as AssetChecksums, it as UpdateAssetOptions, j as DeleteAssetOptions, k as CreateMultipartUploadPartOptions, kt as AssetSearchMatchField, l as AssetContentStatus, lt as VerifyWebhookSignatureOptions, m as AssetProcessing, mt as PostAssetSignedUrlResponse, nt as SignedUrl, o as AssetContent, ot as UploadAssetPartOptions, p as AssetPage, pt as GetEventsResponse, q as MoveFolderOptions, r as Asset, rt as SubmitAssetOptions, s as AssetContentOptions, st as UploadPresetSubmitAssetOptions, t as ReceivedWebhookEventPayload, tt as SignedUploadToken, u as AssetModeration, ut as WaitForAssetDecisionOptions, v as AssetSearchResult, vt as EventCategory, w as CdnServeOptions, x as CalmLensAppClientOptions, xt as EventFacts, y as AssetType, yt as EventFact, z as IterateAssetsOptions } from "./WebhookPayload-BfUmVu2y.js";
2
+ import { a as ClassificationNotEvaluatedReason, c as Likelihood, i as ClassificationLabel, l as ModerationQualifier, n as ClassificationCategory, o as ClassificationQualifierResults, r as ClassificationCategoryReport, s as ClassificationReport, t as ClassificationCategories } from "./Classification-DJU_DfOO.js";
3
+ 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-VxklV9OQ.js";
3
4
  //#region src/client/CalmLensServerClient.d.ts
4
5
  interface LensCache {
5
6
  readonly ensuredLenses: Map<string, Lens>;
@@ -75,8 +76,8 @@ declare class CalmLensServerClient {
75
76
  /** Lists one page of the project's assets, with optional filter and ordering. */
76
77
  list: (options?: ListAssetsOptions) => Promise<AssetPage>;
77
78
  /**
78
- * Yields every asset matching `options`, fetching pages as needed. Assets created or
79
- * deleted while iterating can shift pages, so an asset may be skipped or repeated.
79
+ * Yields every asset matching `options`, fetching pages as needed. The cursor keeps the position
80
+ * stable when other assets are inserted or deleted.
80
81
  */
81
82
  iterate: (options?: IterateAssetsOptions) => AsyncGenerator<Asset, void, undefined>;
82
83
  /** Retrieves an asset with its status and moderation report. */
@@ -201,11 +202,11 @@ export declare function verifyWebhookSignature(options: VerifyWebhookSignatureOp
201
202
  /**
202
203
  * Verifies a webhook delivery and parses its body. Throws `sdk/invalid-webhook-signature`
203
204
  * when the signature or timestamp does not verify, and `sdk/invalid-webhook-payload` when a
204
- * verified body is not a webhook event. Narrow the result on `type` for typed `data.facts`.
205
+ * verified body is not a webhook event. Unknown event types, fact values and fields remain available.
205
206
  *
206
207
  * Event types and fact keys added to CalmLens after this SDK version are returned as they are,
207
208
  * so keep a default branch when you switch on `type`.
208
209
  */
209
- export declare function parseWebhookEvent(options: VerifyWebhookSignatureOptions): Promise<WebhookEventPayload>;
210
+ export declare function parseWebhookEvent(options: VerifyWebhookSignatureOptions): Promise<ReceivedWebhookEventPayload>;
210
211
  //#endregion
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 };
212
+ 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 CursorPage, 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 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 ReceivedWebhookEventPayload as WebhookEventPayload, type WebhookHeadersInput, type WebhookPayloadInput };
package/cjs/server.js CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_CalmLensVersion = require("./CalmLensVersion-Bs0DreBV.js");
2
+ const require_CalmLensVersion = require("./CalmLensVersion-CrlGk2gX.js");
3
3
  require("./index.js");
4
- const require_CalmLensWebhooks = require("./CalmLensWebhooks-6thkvr_F.js");
5
- const require_CalmLensUtils = require("./CalmLensUtils-DNdmYeX6.js");
6
- const require_CalmLensConnection = require("./CalmLensConnection-Bth5fJyp.js");
4
+ const require_CalmLensWebhooks = require("./CalmLensWebhooks-C2VrleZm.js");
5
+ const require_CalmLensUtils = require("./CalmLensUtils-DvhY8-cU.js");
6
+ const require_CalmLensConnection = require("./CalmLensConnection-CPdx_acA.js");
7
7
  const getEnsureLensCacheKey = (options) => require_CalmLensWebhooks.stringifyJsonCanonical({
8
8
  identifier: options.identifier,
9
9
  name: options.name,
@@ -168,33 +168,27 @@ sign: async (options) => {
168
168
  /** Searches accessible assets by keyword or a natural-language description. */
169
169
  search: async (options) => this.request("GET", `${this.projectPath}/assets/search`, { query: options }),
170
170
  /** Lists one page of the project's assets, with optional filter and ordering. */
171
- list: async (options = {}) => this.request("GET", `${this.projectPath}/assets/page`, { query: {
172
- ...options,
173
- pageIndex: options.pageIndex ?? 0
174
- } }),
171
+ list: async (options = {}) => this.request("GET", `${this.projectPath}/assets/page`, { query: options }),
175
172
  /**
176
- * Yields every asset matching `options`, fetching pages as needed. Assets created or
177
- * deleted while iterating can shift pages, so an asset may be skipped or repeated.
173
+ * Yields every asset matching `options`, fetching pages as needed. The cursor keeps the position
174
+ * stable when other assets are inserted or deleted.
178
175
  */
179
- iterate: (options = {}) => this.iteratePages((pageIndex) => this.buildAssets().list({
176
+ iterate: (options = {}) => this.iteratePages((cursor) => this.buildAssets().list({
180
177
  ...options,
181
- pageIndex
178
+ cursor
182
179
  })),
183
180
  /** Retrieves an asset with its status and moderation report. */
184
181
  retrieve: async ({ assetId }) => this.request("GET", `/assets/${requireId(assetId, "Asset ID")}`),
185
182
  /** Updates an asset's editable fields. */
186
183
  update: async ({ assetId, ...body }) => this.request("PATCH", `/assets/${requireId(assetId, "Asset ID")}`, { body }),
187
184
  /** Lists one page of the assets extracted from a website or multimedia document. */
188
- listChildren: async ({ assetId, ...options } = {}) => this.request("GET", `/assets/${requireId(assetId, "Asset ID")}/children`, { query: {
189
- ...options,
190
- pageIndex: options.pageIndex ?? 0
191
- } }),
185
+ listChildren: async ({ assetId, ...options } = {}) => this.request("GET", `/assets/${requireId(assetId, "Asset ID")}/children`, { query: options }),
192
186
  /** Yields every child of an asset, fetching pages as needed. */
193
187
  iterateChildren: (options) => {
194
188
  requireId(options?.assetId, "Asset ID");
195
- return this.iteratePages((pageIndex) => this.buildAssets().listChildren({
189
+ return this.iteratePages((cursor) => this.buildAssets().listChildren({
196
190
  ...options,
197
- pageIndex
191
+ cursor
198
192
  }));
199
193
  },
200
194
  /**
@@ -291,10 +285,12 @@ sign: async (options) => {
291
285
  }
292
286
  }
293
287
  async *iteratePages(listPage) {
294
- for (let pageIndex = 0;; pageIndex++) {
295
- const page = await listPage(pageIndex);
288
+ let cursor;
289
+ for (;;) {
290
+ const page = await listPage(cursor);
296
291
  yield* page.items;
297
- if (!page.hasMore || page.items.length === 0) return;
292
+ if (!page.nextCursor || !page.hasMore || page.items.length === 0) return;
293
+ cursor = page.nextCursor;
298
294
  }
299
295
  }
300
296
  get folders() {
@@ -0,0 +1,2 @@
1
+ import { a as detectTestImage, c as getImageTestCategories, d as paintTestImage, i as TestImageKeyCell, l as getTestImageKeyCells, n as TEST_IMAGE_PALETTES, o as detectTestTrigger, r as TEST_INPUT_KEY_PATTERN, s as generateTestTextCode, t as ClassificationTestSignal, u as getTestImageKeyColors } from "./TestTriggers-CxFZ-3uz.js";
2
+ export { type ClassificationTestSignal, TEST_IMAGE_PALETTES, TEST_INPUT_KEY_PATTERN, type TestImageKeyCell, detectTestImage, detectTestTrigger, generateTestTextCode, getImageTestCategories, getTestImageKeyCells, getTestImageKeyColors, paintTestImage };
@@ -0,0 +1,265 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region ../shared/src/TestTriggers.ts
3
+ const TEST_IMAGE_PALETTES = {
4
+ sexual: [
5
+ [
6
+ 255,
7
+ 20,
8
+ 147,
9
+ 255
10
+ ],
11
+ [
12
+ 255,
13
+ 105,
14
+ 180,
15
+ 255
16
+ ],
17
+ [
18
+ 199,
19
+ 21,
20
+ 133,
21
+ 255
22
+ ],
23
+ [
24
+ 255,
25
+ 69,
26
+ 0,
27
+ 255
28
+ ]
29
+ ],
30
+ violence: [
31
+ [
32
+ 139,
33
+ 0,
34
+ 0,
35
+ 255
36
+ ],
37
+ [
38
+ 220,
39
+ 20,
40
+ 60,
41
+ 255
42
+ ],
43
+ [
44
+ 178,
45
+ 34,
46
+ 34,
47
+ 255
48
+ ],
49
+ [
50
+ 255,
51
+ 0,
52
+ 0,
53
+ 255
54
+ ]
55
+ ],
56
+ harassment: [
57
+ [
58
+ 180,
59
+ 83,
60
+ 9,
61
+ 255
62
+ ],
63
+ [
64
+ 217,
65
+ 119,
66
+ 6,
67
+ 255
68
+ ],
69
+ [
70
+ 245,
71
+ 158,
72
+ 11,
73
+ 255
74
+ ],
75
+ [
76
+ 251,
77
+ 191,
78
+ 36,
79
+ 255
80
+ ]
81
+ ],
82
+ hate: [
83
+ [
84
+ 30,
85
+ 64,
86
+ 175,
87
+ 255
88
+ ],
89
+ [
90
+ 37,
91
+ 99,
92
+ 235,
93
+ 255
94
+ ],
95
+ [
96
+ 59,
97
+ 130,
98
+ 246,
99
+ 255
100
+ ],
101
+ [
102
+ 96,
103
+ 165,
104
+ 250,
105
+ 255
106
+ ]
107
+ ],
108
+ "criminal-activity": [
109
+ [
110
+ 6,
111
+ 95,
112
+ 70,
113
+ 255
114
+ ],
115
+ [
116
+ 5,
117
+ 150,
118
+ 105,
119
+ 255
120
+ ],
121
+ [
122
+ 16,
123
+ 185,
124
+ 129,
125
+ 255
126
+ ],
127
+ [
128
+ 52,
129
+ 211,
130
+ 153,
131
+ 255
132
+ ]
133
+ ],
134
+ "self-harm": [
135
+ [
136
+ 75,
137
+ 0,
138
+ 130,
139
+ 255
140
+ ],
141
+ [
142
+ 138,
143
+ 43,
144
+ 226,
145
+ 255
146
+ ],
147
+ [
148
+ 72,
149
+ 61,
150
+ 139,
151
+ 255
152
+ ],
153
+ [
154
+ 147,
155
+ 112,
156
+ 219,
157
+ 255
158
+ ]
159
+ ]
160
+ };
161
+ /** A project's test input key: eight hexadecimal characters only its members can see. */
162
+ const TEST_INPUT_KEY_PATTERN = /^[a-f0-9]{8}$/;
163
+ const TEXT_CODE_SIGNALS = [
164
+ "harassment",
165
+ "hate",
166
+ "criminal-activity",
167
+ "sexual.involving-minors"
168
+ ];
169
+ /**
170
+ * The text code that CalmLens classifies as `category` for the project with this test input key.
171
+ * @returns The code, or an empty string for a category without a text code
172
+ */
173
+ const generateTestTextCode = (category, testInputKey) => TEXT_CODE_SIGNALS.includes(category) ? `<!calmlens-test ${testInputKey} ${category}>` : "";
174
+ const TEST_TRIGGER_PATTERN = /<!calmlens-test\s+([a-f0-9]{8})\s+(harassment|hate|criminal-activity|sexual\.involving-minors)\s*>/gi;
175
+ /**
176
+ * The test signals in `text` whose codes carry the project's test input key. Codes with another
177
+ * key are ignored, so a code can only be used by the project it belongs to.
178
+ */
179
+ const detectTestTrigger = (text, testInputKey) => {
180
+ const signals = [];
181
+ for (const [, key, signal] of text.matchAll(TEST_TRIGGER_PATTERN)) {
182
+ if (key.toLowerCase() !== testInputKey.toLowerCase()) continue;
183
+ const testSignal = signal.toLowerCase();
184
+ if (!signals.includes(testSignal)) signals.push(testSignal);
185
+ }
186
+ return {
187
+ isTestTrigger: signals.length > 0,
188
+ signals
189
+ };
190
+ };
191
+ /** Sixteen cells encode two bits each using the category's four existing colours. */
192
+ const getTestImageKeyCells = (width, height) => {
193
+ return Array.from({ length: 16 }, (_, index) => {
194
+ const column = index % 4;
195
+ const row = Math.floor(index / 4);
196
+ const x = Math.floor(column * width / 4);
197
+ const y = Math.floor(row * height / 4);
198
+ return {
199
+ x,
200
+ y,
201
+ width: Math.floor((column + 1) * width / 4) - x,
202
+ height: Math.floor((row + 1) * height / 4) - y
203
+ };
204
+ });
205
+ };
206
+ const getTestImageKeyColors = (signal, testInputKey) => {
207
+ const colors = TEST_IMAGE_PALETTES[signal];
208
+ if (!colors || !TEST_INPUT_KEY_PATTERN.test(testInputKey)) throw new Error("Invalid image test signal or key");
209
+ return [...testInputKey].flatMap((character) => {
210
+ const value = Number.parseInt(character, 16);
211
+ return [colors[value >> 2], colors[value & 3]];
212
+ });
213
+ };
214
+ /**
215
+ * Gets all test trigger categories that support images
216
+ */
217
+ const getImageTestCategories = () => {
218
+ return Object.keys(TEST_IMAGE_PALETTES);
219
+ };
220
+ /** Paint a full-image 4×4 grid as RGBA pixels; callers choose their image encoder. */
221
+ const paintTestImage = (signal, testInputKey, width = 512, height = width) => {
222
+ if (!Number.isSafeInteger(width) || !Number.isSafeInteger(height) || width < 24 || height < 24) throw new RangeError("Test image dimensions must be integers of at least 24 pixels");
223
+ const colors = getTestImageKeyColors(signal, testInputKey);
224
+ const rgba = new Uint8Array(width * height * 4);
225
+ getTestImageKeyCells(width, height).forEach((cell, index) => {
226
+ for (let y = cell.y; y < cell.y + cell.height; y++) for (let x = cell.x; x < cell.x + cell.width; x++) rgba.set(colors[index], (y * width + x) * 4);
227
+ });
228
+ return rgba;
229
+ };
230
+ /** Decode the project key from pixels, tolerating resizing and lossy compression. */
231
+ const detectTestImage = (image, testInputKey) => {
232
+ const { width, height, rgba } = image;
233
+ if (!Number.isSafeInteger(width) || !Number.isSafeInteger(height) || width < 24 || height < 24 || rgba.length !== width * height * 4 || !TEST_INPUT_KEY_PATTERN.test(testInputKey)) return void 0;
234
+ const cells = getTestImageKeyCells(width, height);
235
+ for (const category of getImageTestCategories()) {
236
+ const colors = getTestImageKeyColors(category, testInputKey);
237
+ if (cells.every((cell, index) => {
238
+ const sample = [
239
+ 0,
240
+ 0,
241
+ 0
242
+ ];
243
+ let count = 0;
244
+ for (let y = cell.y + Math.ceil(cell.height / 4); y < cell.y + cell.height * 3 / 4; y++) for (let x = cell.x + Math.ceil(cell.width / 4); x < cell.x + cell.width * 3 / 4; x++) {
245
+ const offset = (y * width + x) * 4;
246
+ if (rgba[offset + 3] < 250) return false;
247
+ for (let c = 0; c < 3; c++) sample[c] += rgba[offset + c];
248
+ count++;
249
+ }
250
+ const distances = TEST_IMAGE_PALETTES[category].map((color) => sample.reduce((sum, value, c) => sum + (value / count - color[c]) ** 2, 0));
251
+ const nearest = distances.indexOf(Math.min(...distances));
252
+ return distances[nearest] <= 900 && TEST_IMAGE_PALETTES[category][nearest] === colors[index];
253
+ })) return category;
254
+ }
255
+ };
256
+ //#endregion
257
+ exports.TEST_IMAGE_PALETTES = TEST_IMAGE_PALETTES;
258
+ exports.TEST_INPUT_KEY_PATTERN = TEST_INPUT_KEY_PATTERN;
259
+ exports.detectTestImage = detectTestImage;
260
+ exports.detectTestTrigger = detectTestTrigger;
261
+ exports.generateTestTextCode = generateTestTextCode;
262
+ exports.getImageTestCategories = getImageTestCategories;
263
+ exports.getTestImageKeyCells = getTestImageKeyCells;
264
+ exports.getTestImageKeyColors = getTestImageKeyColors;
265
+ exports.paintTestImage = paintTestImage;
package/cjs/testing.d.ts CHANGED
@@ -1,11 +1,9 @@
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";
2
- //#region ../shared/src/TestTriggers.d.ts
3
- type ClassificationTestSignal = ClassificationCategory | "sexual.involving-minors" | "violence.graphic";
4
- //#endregion
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, Tt as Folder, U as ListAssetsOptions, W as ListEventsOptions, Z as RetrieveAssetOptions, _ as AssetSearchResponse, _t as TypedEvent, a as AssetChildrenPage, at as UpdateFolderOptions, et as SignUploadTokenOptions, ht as Event, it as UpdateAssetOptions, j as DeleteAssetOptions, jt as AssetBinaryPayloadInput, mt as PostAssetSignedUrlResponse, n as WebhookEventPayload, ot as UploadAssetPartOptions, p as AssetPage, pt as GetEventsResponse, q as MoveFolderOptions, r as Asset, rt as SubmitAssetOptions, tt as SignedUploadToken, ut as WaitForAssetDecisionOptions, w as CdnServeOptions, wt as PermissionGrant, z as IterateAssetsOptions } from "./WebhookPayload-BfUmVu2y.js";
2
+ import { t as ClassificationTestSignal } from "./TestTriggers-CxFZ-3uz.js";
5
3
  //#region ../shared/src/MediaTestTriggers.d.ts
6
4
  export declare const MEDIA_TEST_SIGNALS: readonly ["sexual", "violence", "self-harm", "harassment", "hate", "criminal-activity", "violence.graphic"];
7
5
  /** Read this aloud, or render it as large, high-contrast text in a video frame. */
8
- export declare function generateMediaTestCode(signal: ClassificationTestSignal, projectId: string): string;
6
+ export declare function generateMediaTestCode(signal: ClassificationTestSignal, testInputKey: string): string;
9
7
  //#endregion
10
8
  //#region src/testing/MockApiKey.d.ts
11
9
  export declare const MOCK_API_KEY_PREFIX = "sk_test_";