calmlens 0.28.1 → 0.29.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 (74) hide show
  1. package/bin/calmlens.js +151 -123
  2. package/cjs/{BrowserUpload-DLoi5qVj.js → BrowserUpload-CcSQI7Kf.js} +1 -1
  3. package/cjs/{BrowserUpload-CRbCsX7a.d.ts → BrowserUpload-CeGsM9h1.d.ts} +2 -2
  4. package/cjs/{CalmLensAppClient-C--UAnoz.js → CalmLensAppClient-BPILD5mg.js} +11 -17
  5. package/cjs/{CalmLensAppClient-B3u6BlP5.d.ts → CalmLensAppClient-D-BD_Ny1.d.ts} +7 -1
  6. package/cjs/{CalmLensOptionKeys-BxrJ47zd.js → CalmLensConnection-Wfxn25LT.js} +660 -643
  7. package/cjs/{CalmLensServerClient-B8ntjNL3.d.ts → CalmLensServerClient-BYN_N0lt.d.ts} +33 -2
  8. package/cjs/{CalmLensServerClient-CPbCEJMK.js → CalmLensServerClient-C_42j_i4.js} +72 -41
  9. package/cjs/{CalmLensTypes-CtO4Dieu.d.ts → CalmLensTypes-C2blKgTu.d.ts} +51 -75
  10. package/{esm/Core-BJaLU71Q.d.ts → cjs/Core-CNmoxDCW.d.ts} +2 -2
  11. package/cjs/{Core-CB0-p-ro.js → Core-CfdovxKJ.js} +2 -2
  12. package/cjs/{ModerationContextLimits-CuL1TOuf.js → ModerationContextLimits-DXlPrt4K.js} +24 -13
  13. package/cjs/{ReactUpload-3QgzpdMu.js → ReactUpload-CzsQwVKM.js} +1 -1
  14. package/{esm/ReactUpload-BGUkcMpg.d.ts → cjs/ReactUpload-kqEe6gcN.d.ts} +1 -1
  15. package/cjs/{UploadController-BSZnq84V.js → UploadController-D_Y5wktq.js} +2 -2
  16. package/{esm/WebhookPayload-DZadhbAJ.d.ts → cjs/WebhookPayload-DZWlnvcY.d.ts} +3 -2
  17. package/cjs/app.d.ts +5 -5
  18. package/cjs/app.js +2 -2
  19. package/cjs/elements.d.ts +4 -4
  20. package/cjs/elements.js +4 -4
  21. package/cjs/{index-DQUZYLVY.d.ts → index-Dl2qwS8L.d.ts} +2 -2
  22. package/cjs/index.d.ts +4 -4
  23. package/cjs/index.js +1 -1
  24. package/cjs/react-native.d.ts +2 -2
  25. package/cjs/react-native.js +4 -4
  26. package/cjs/react.d.ts +4 -4
  27. package/cjs/react.js +5 -5
  28. package/cjs/server.d.ts +5 -5
  29. package/cjs/server.js +2 -2
  30. package/cjs/testing.d.ts +54 -26
  31. package/cjs/testing.js +413 -93
  32. package/cjs/{ui-BGywTQ2M.d.ts → ui-BtmJC-f9.d.ts} +2 -2
  33. package/cjs/{ui-CkQQm3Qw.js → ui-CkOexkAO.js} +2 -2
  34. package/cjs/ui.d.ts +2 -2
  35. package/cjs/ui.js +3 -3
  36. package/cjs/vue.d.ts +5 -5
  37. package/cjs/vue.js +4 -4
  38. package/esm/{BrowserUpload-CRbCsX7a.d.ts → BrowserUpload-CeGsM9h1.d.ts} +2 -2
  39. package/esm/{BrowserUpload-BKrrHzoh.js → BrowserUpload-DJ2euKyv.js} +1 -1
  40. package/esm/{CalmLensAppClient-D_SprSKl.js → CalmLensAppClient-CCT5Em2S.js} +3 -9
  41. package/esm/{CalmLensAppClient-B3u6BlP5.d.ts → CalmLensAppClient-D-BD_Ny1.d.ts} +7 -1
  42. package/esm/{CalmLensOptionKeys-B6an7neE.js → CalmLensConnection-CfBXkam-.js} +661 -644
  43. package/esm/{CalmLensServerClient-B8ntjNL3.d.ts → CalmLensServerClient-BYN_N0lt.d.ts} +33 -2
  44. package/esm/{CalmLensServerClient-BY45aX5Q.js → CalmLensServerClient-e6gVcMxy.js} +58 -27
  45. package/esm/{CalmLensTypes-CtO4Dieu.d.ts → CalmLensTypes-C2blKgTu.d.ts} +51 -75
  46. package/{cjs/Core-BJaLU71Q.d.ts → esm/Core-CNmoxDCW.d.ts} +2 -2
  47. package/esm/{Core-dzPyrg_G.js → Core-CojlqrKH.js} +2 -2
  48. package/esm/{ModerationContextLimits-IH2zX1wg.js → ModerationContextLimits-Abu_L1Df.js} +24 -13
  49. package/esm/{ReactUpload-4DeUbua_.js → ReactUpload-CDrA7hRn.js} +1 -1
  50. package/{cjs/ReactUpload-BGUkcMpg.d.ts → esm/ReactUpload-kqEe6gcN.d.ts} +1 -1
  51. package/esm/{UploadController-DKjI8S2K.js → UploadController-BubUXclM.js} +2 -2
  52. package/{cjs/WebhookPayload-DZadhbAJ.d.ts → esm/WebhookPayload-DZWlnvcY.d.ts} +3 -2
  53. package/esm/app.d.ts +5 -5
  54. package/esm/app.js +2 -2
  55. package/esm/elements.d.ts +4 -4
  56. package/esm/elements.js +4 -4
  57. package/esm/{index-DQUZYLVY.d.ts → index-Dl2qwS8L.d.ts} +2 -2
  58. package/esm/index.d.ts +4 -4
  59. package/esm/index.js +1 -1
  60. package/esm/react-native.d.ts +2 -2
  61. package/esm/react-native.js +4 -4
  62. package/esm/react.d.ts +4 -4
  63. package/esm/react.js +5 -5
  64. package/esm/server.d.ts +5 -5
  65. package/esm/server.js +2 -2
  66. package/esm/testing.d.ts +54 -26
  67. package/esm/testing.js +406 -87
  68. package/esm/{ui-BovDqg9n.js → ui--AzgLLVf.js} +2 -2
  69. package/esm/{ui-BGywTQ2M.d.ts → ui-BtmJC-f9.d.ts} +2 -2
  70. package/esm/ui.d.ts +2 -2
  71. package/esm/ui.js +3 -3
  72. package/esm/vue.d.ts +5 -5
  73. package/esm/vue.js +4 -4
  74. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { d as HashListEntry, u as HashList } from "./Classification-CMM2tZpJ-IdIh63n0.js";
2
- import { $ as FolderPage, $t as VerifyWebhookSignatureOptions, An as Policy, At as RetrieveAssetOptions, B as CreateHashListOptions, Bt as UpdateAssetOptions, D as BatchAssetsResponse, E as BatchAssetsOptions, Et as RemoveAssetContentOptions, Ft as SignUploadTokenOptions, G as DeleteAssetOptions, Gt as UpdateProjectSettingsOptions, Ht as UpdateHashListOptions, I as ClassifyTextOptions, In as AssetInfo, It as SignedAssetUrl, J as EnsureLensesOptions, K as DeleteMetadataFieldOptions, Kt as UpgradePolicyOptions, Lt as SignedUploadToken, M as CdnAssetUrlOptions, Nt as SetPolicyAutomaticUpdatesOptions, Ot as RequestOptions, P as CdnServeOptions, Pn as AssetSearchQuery, Pt as SignAssetUrlOptions, Q as FolderIdOptions, T as AssignPolicyOptions, Tt as PolicyPage, U as CreatePolicyOptions, Ut as UpdateLensOptions, V as CreateLensOptions, Vt as UpdateFolderOptions, W as DecideAssetOptions, Wt as UpdatePolicyOptions, X as EnsureUploadPresetsOptions, Xt as UploadPresetPage, Y as EnsureMetadataFieldsOptions, Yt as UploadPresetIdOptions, Z as EnsureUploadPresetsResponse, _ as AssetPage, _n as Folder, _t as ListLensesOptions, b as AssetTimelinePage, bt as MoveAssetOptions, ct as LensIdOptions, dt as ListAssetTimelineOptions, et as GetAssetInfoOptions, ft as ListAssetsOptions, gt as ListHashListsOptions, ht as ListHashListEntriesOptions, it as HashListPage, jt as RetryAssetOptions, k as CalmLensServerClientOptions, kt as ResetPolicyOptions, lt as LensPage, mt as ListFoldersOptions, nt as HashListEntryPage, o as AssetChildrenPage, on as GetEventsResponse, pt as ListEventsOptions, q as EnsureLensOptions, qt as UploadAssetPartOptions, r as Asset, rt as HashListIdOptions, st as Lens, t as AddHashListEntryOptions, tn as WaitForAssetDecisionOptions, tt as HashListEntryIdOptions, ut as ListAssetChildrenOptions, v as AssetSearchResponse, vn as MetadataFieldsResource, vt as ListPoliciesOptions, wt as PolicyIdOptions, xt as MoveFolderOptions, yn as ProjectSettingsResource, yt as ListUploadPresetsOptions, z as CreateFolderOptions, zt as SubmitAssetOptions } from "./CalmLensTypes-CtO4Dieu.js";
3
- import { d as ListPromise, l as CalmLensResponse, r as CdnResponse } from "./WebhookPayload-DZadhbAJ.js";
2
+ import { $ as FolderPage, At as ResetPolicyOptions, B as CreateHashListOptions, D as BatchAssetsResponse, Dt as RequestAssetReviewOptions, E as BatchAssetsOptions, Et as RemoveAssetContentOptions, Ft as SetPolicyAutomaticUpdatesOptions, G as DeleteAssetOptions, Gt as UpdateLensOptions, Ht as UpdateAssetOptions, I as ClassifyTextOptions, In as AssetSearchQuery, It as SignAssetUrlOptions, J as EnsureLensesOptions, Jt as UpgradePolicyOptions, K as DeleteMetadataFieldOptions, Kt as UpdatePolicyOptions, Lt as SignUploadTokenOptions, M as CdnAssetUrlOptions, Mn as Policy, Mt as RetrieveAssetOptions, Nt as RetryAssetOptions, P as CdnServeOptions, Q as FolderIdOptions, Qt as UploadPresetPage, Rn as AssetInfo, Rt as SignedAssetUrl, T as AssignPolicyOptions, Tt as PolicyPage, U as CreatePolicyOptions, Ut as UpdateFolderOptions, V as CreateLensOptions, Vt as SubmitAssetOptions, W as DecideAssetOptions, Wt as UpdateHashListOptions, X as EnsureUploadPresetsOptions, Y as EnsureMetadataFieldsOptions, Yt as UploadAssetPartOptions, Z as EnsureUploadPresetsResponse, Zt as UploadPresetIdOptions, _ as AssetPage, _t as ListLensesOptions, b as AssetTimelinePage, bn as MetadataFieldsResource, bt as MoveAssetOptions, ct as LensIdOptions, dt as ListAssetTimelineOptions, et as GetAssetInfoOptions, ft as ListAssetsOptions, gt as ListHashListsOptions, ht as ListHashListEntriesOptions, it as HashListPage, jt as RetrieveAssetByExternalIdOptions, k as CalmLensServerClientOptions, kt as RequestOptions, ln as GetEventsResponse, lt as LensPage, mt as ListFoldersOptions, nt as HashListEntryPage, o as AssetChildrenPage, pt as ListEventsOptions, q as EnsureLensOptions, qt as UpdateProjectSettingsOptions, r as Asset, rn as WaitForAssetDecisionOptions, rt as HashListIdOptions, sn as AssetReviewRequest, st as Lens, t as AddHashListEntryOptions, tn as VerifyWebhookSignatureOptions, tt as HashListEntryIdOptions, ut as ListAssetChildrenOptions, v as AssetSearchResponse, vt as ListPoliciesOptions, wt as PolicyIdOptions, xn as ProjectSettingsResource, xt as MoveFolderOptions, yn as Folder, yt as ListUploadPresetsOptions, z as CreateFolderOptions, zt as SignedUploadToken } from "./CalmLensTypes-C2blKgTu.js";
3
+ import { d as ListPromise, l as CalmLensResponse, r as CdnResponse } from "./WebhookPayload-DZWlnvcY.js";
4
4
  interface TransportRequest {
5
5
  /** The client method sending the request, such as `assets.retrieve`, for hooks and logs. */
6
6
  operation?: string;
@@ -21,6 +21,11 @@ interface TransportRequest {
21
21
  signal?: AbortSignal;
22
22
  /** Overrides the client's `maxRetries` for this request. */
23
23
  maxRetries?: number;
24
+ /**
25
+ * When the call's deadline passes, on the transport's clock: no attempt starts after it, an
26
+ * attempt's own deadline never runs past it, and no retry waits up to it.
27
+ */
28
+ deadlineAt?: number;
24
29
  }
25
30
  interface LensCache {
26
31
  readonly ensuredLenses: Map<string, Lens>;
@@ -123,6 +128,12 @@ declare class CalmLensServerClient {
123
128
  list: (options?: ListAssetsOptions, requestOptions?: RequestOptions) => ListPromise<AssetPage>;
124
129
  /** Retrieves an asset with its status and classification results. */
125
130
  retrieve: (options: RetrieveAssetOptions, requestOptions?: RequestOptions) => Promise<CalmLensResponse<Asset>>;
131
+ /**
132
+ * Retrieves the project's asset that has this `externalId`, such as the one an
133
+ * `asset/duplicate-external-id` error names. Rejects with `asset/not-found` when no asset
134
+ * has it.
135
+ */
136
+ retrieveByExternalId: (options: RetrieveAssetByExternalIdOptions, requestOptions?: RequestOptions) => Promise<CalmLensResponse<Asset>>;
126
137
  /** Updates an asset's editable fields. */
127
138
  update: (options: UpdateAssetOptions, requestOptions?: RequestOptions) => Promise<CalmLensResponse<Asset>>;
128
139
  /**
@@ -167,6 +178,16 @@ declare class CalmLensServerClient {
167
178
  * needs `confirmPurge: true` and permanently deletes the stored content.
168
179
  */
169
180
  decide: (options: DecideAssetOptions, requestOptions?: RequestOptions) => Promise<CalmLensResponse<Asset>>;
181
+ /**
182
+ * Sends an asset to the project's human review queue, such as when one of your app's users
183
+ * reports it, with an optional `note` reviewers see. It doesn't change how the asset is
184
+ * delivered: a reviewer's decision does. Resolves with the review: a new one (HTTP 201,
185
+ * reason `reported`, sending `asset.review-requested`), or the one already waiting for the
186
+ * asset (HTTP 200), unchanged. Rejects with `asset/not-reviewable` (`details.reason`:
187
+ * `child-asset`, `not-moderated` or `content-unavailable`) and `asset/held`. Retried safely
188
+ * with an `idempotencyKey` request option.
189
+ */
190
+ requestReview: (options: RequestAssetReviewOptions, requestOptions?: RequestOptions) => Promise<CalmLensResponse<AssetReviewRequest>>;
170
191
  /**
171
192
  * Waits until an asset is settled, its `classification.status` `completed` (with its
172
193
  * decision in `classification.moderation.decision`) or `failed`, and returns that asset,
@@ -219,6 +240,16 @@ declare class CalmLensServerClient {
219
240
  * after `cursor`; save the last page's `nextCursor` to resume later.
220
241
  */
221
242
  list: (options?: ListEventsOptions, requestOptions?: RequestOptions) => ListPromise<GetEventsResponse>;
243
+ /**
244
+ * Retrieves the asset an event is about, as it is now, such as one from `events.list` or a
245
+ * parsed webhook delivery; events carry only the asset's ID. Resolves to `null` for an
246
+ * event that isn't about an asset, and rejects with `asset/not-found` once the asset is
247
+ * deleted. The asset's `eventSequence` orders it against events: an event with a higher
248
+ * `assetSequence` happened after this state, one with an equal or lower one is reflected in it.
249
+ */
250
+ retrieveAsset: (event: {
251
+ readonly assetId?: string | null;
252
+ }, requestOptions?: RequestOptions) => Promise<CalmLensResponse<Asset> | null>;
222
253
  };
223
254
  get folders(): {
224
255
  /**
@@ -1,5 +1,5 @@
1
- import { B as copyLastResponse, C as toTextAssetOptions, D as validateServerClientOptions, E as validateBatchAssetsOptions, H as readEnv, L as isBrowserRuntime, Q as CalmLensError, R as isReactNativeRuntime, S as stringifyQuery, V as listPages, dt as invalidConfig, f as validateSignAssetUrlOptions, g as encodePathSegment, l as buildAssetUrl, lt as SDK_ERROR_CODES, m as checkOptionKeys, p as DEFAULT_CDN_BASE_URL, s as appendSignedLocation, u as getAssetInfo, ut as invalidArgument, y as pollForDecision } from "./ModerationContextLimits-IH2zX1wg.js";
2
- import { c as getMockHooks, d as prepareSubmitAssetOptions, f as resolveConnectionOptions, i as CalmLensConnection, l as invalidPayload, m as validateCallOptions, n as NULLABLE_OPTION_KEYS, o as expectAsset, p as splitsIntoParts, r as SERVER_OPTION_KEYS, u as newIdempotencyKey } from "./CalmLensOptionKeys-B6an7neE.js";
1
+ import { B as copyLastResponse, C as toTextAssetOptions, D as validateServerClientOptions, E as validateBatchAssetsOptions, H as readEnv, L as isBrowserRuntime, Q as CalmLensError, R as isReactNativeRuntime, S as stringifyQuery, V as listPages, dt as invalidConfig, f as validateSignAssetUrlOptions, g as encodePathSegment, l as buildAssetUrl, lt as SDK_ERROR_CODES, m as checkOptionKeys, p as DEFAULT_CDN_BASE_URL, s as appendSignedLocation, u as getAssetInfo, ut as invalidArgument, y as pollForDecision } from "./ModerationContextLimits-Abu_L1Df.js";
2
+ import { a as getMockHooks, c as prepareSubmitAssetOptions, d as validateCallOptions, l as resolveConnectionOptions, m as SERVER_OPTION_KEYS, o as invalidPayload, p as NULLABLE_OPTION_KEYS, r as expectAsset, s as newIdempotencyKey, t as CalmLensConnection, u as splitsIntoParts } from "./CalmLensConnection-CfBXkam-.js";
3
3
  import { n as sha256Hex, r as timingSafeEqual, t as hmacSha256Hex } from "./CryptoUtils-BLCa-oZe-DKr3LmN6.js";
4
4
  // src/contract/JsonUtils.js
5
5
  const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
@@ -152,8 +152,8 @@ const isOptional = (value, type, nullable) => value === void 0 || nullable && va
152
152
  */
153
153
  const isWebhookEvent = (value) => {
154
154
  if (!isObject(value) || typeof value.id !== "string" || typeof value.type !== "string" || typeof value.projectId !== "string" || typeof value.createdAt !== "number") return false;
155
- const { severity, title, description, assetId, assetSequence, asset, facts } = value;
156
- return isOptional(severity, "string", false) && isOptional(title, "string", false) && isOptional(description, "string", true) && isOptional(assetId, "string", true) && isOptional(assetSequence, "number", true) && (asset === void 0 || asset === null || isObject(asset) && typeof asset.id === "string") && (facts === void 0 || Array.isArray(facts) && facts.every((fact) => isObject(fact) && typeof fact.key === "string" && "value" in fact && isOptional(fact.url, "string", false)));
155
+ const { severity, title, description, assetId, assetSequence, facts } = value;
156
+ return isOptional(severity, "string", false) && isOptional(title, "string", false) && isOptional(description, "string", true) && isOptional(assetId, "string", true) && isOptional(assetSequence, "number", true) && (facts === void 0 || Array.isArray(facts) && facts.every((fact) => isObject(fact) && typeof fact.key === "string" && "value" in fact && isOptional(fact.url, "string", false)));
157
157
  };
158
158
  /**
159
159
  * The value of one of an event's facts, by key, or `undefined` when the event doesn't carry it.
@@ -396,13 +396,10 @@ var CalmLensServerClient = class {
396
396
  partSizeBytes: connection.partSizeBytes
397
397
  });
398
398
  const uploadsPath = `${this.#projectPath}/assets`;
399
- if ("content" in body && splitsIntoParts(body.content, connection.partSizeBytes)) {
400
- const { idempotencyKey: _key, extraBody: _body, ...readOptions } = requestOptions ?? {};
401
- return expectAsset(await connection.submitInParts(uploadsPath, body, wait, {
402
- partPath: (assetId) => `/assets/${encodeURIComponent(assetId)}/part`,
403
- retrieve: (assetId) => this.#buildAssets().retrieve({ assetId }, readOptions)
404
- }));
405
- }
399
+ if ("content" in body && splitsIntoParts(body.content, connection.partSizeBytes)) return expectAsset(await connection.submitInParts(uploadsPath, body, wait, {
400
+ partPath: (assetId) => `/assets/${encodeURIComponent(assetId)}/part`,
401
+ retrieve: (assetId, read) => read.json("GET", `/assets/${requireId(assetId, "Asset ID")}`)
402
+ }));
406
403
  if ("content" in body || "part" in body) return expectAsset(await connection.submitUpload(uploadsPath, body, wait));
407
404
  const { idempotencyKey, ...fields } = body;
408
405
  const data = await connection.json("POST", uploadsPath, {
@@ -526,6 +523,15 @@ sign: async (options) => {
526
523
  const { assetId } = checked("assets.retrieve", options);
527
524
  return this.#send("assets.retrieve", requestOptions, "GET", `/assets/${requireId(assetId, "Asset ID")}`);
528
525
  },
526
+ /**
527
+ * Retrieves the project's asset that has this `externalId`, such as the one an
528
+ * `asset/duplicate-external-id` error names. Rejects with `asset/not-found` when no asset
529
+ * has it.
530
+ */
531
+ retrieveByExternalId: async (options, requestOptions) => {
532
+ const { externalId } = checked("assets.retrieveByExternalId", options);
533
+ return this.#send("assets.retrieveByExternalId", requestOptions, "GET", `${this.#projectPath}/assets/by-external-id/${requireId(externalId, "External ID")}`);
534
+ },
529
535
  /** Updates an asset's editable fields. */
530
536
  update: async (options, requestOptions) => {
531
537
  const { assetId, ...body } = checked("assets.update", options);
@@ -591,6 +597,19 @@ sign: async (options) => {
591
597
  return this.#send("assets.decide", requestOptions, "POST", `/assets/${requireId(assetId, "Asset ID")}/decision`, { body });
592
598
  },
593
599
  /**
600
+ * Sends an asset to the project's human review queue, such as when one of your app's users
601
+ * reports it, with an optional `note` reviewers see. It doesn't change how the asset is
602
+ * delivered: a reviewer's decision does. Resolves with the review: a new one (HTTP 201,
603
+ * reason `reported`, sending `asset.review-requested`), or the one already waiting for the
604
+ * asset (HTTP 200), unchanged. Rejects with `asset/not-reviewable` (`details.reason`:
605
+ * `child-asset`, `not-moderated` or `content-unavailable`) and `asset/held`. Retried safely
606
+ * with an `idempotencyKey` request option.
607
+ */
608
+ requestReview: async (options, requestOptions) => {
609
+ const { assetId, ...body } = checked("assets.requestReview", options);
610
+ return this.#send("assets.requestReview", requestOptions, "POST", `/assets/${requireId(assetId, "Asset ID")}/review-requests`, { body });
611
+ },
612
+ /**
594
613
  * Waits until an asset is settled, its `classification.status` `completed` (with its
595
614
  * decision in `classification.moderation.decision`) or `failed`, and returns that asset,
596
615
  * checking every few seconds. A `queued` or `processing` asset is still waiting, even when a
@@ -603,11 +622,14 @@ sign: async (options) => {
603
622
  validateCallOptions(requestOptions);
604
623
  const signals = [options.signal, requestOptions?.signal].filter((signal) => signal !== void 0);
605
624
  const signal = signals.length > 1 ? anySignal(signals) : signals[0];
606
- const checkOptions = {
625
+ const connection = this.#connection.forCall("assets.waitForDecision", {
607
626
  ...requestOptions,
608
627
  ...signal && { signal }
609
- };
610
- return pollForDecision(() => this.#send("assets.waitForDecision", checkOptions, "GET", `/assets/${requireId(assetId, "Asset ID")}`), options, this.#connection.sleep, this.#connection.hooks?.now);
628
+ });
629
+ return pollForDecision(() => connection.json("GET", `/assets/${requireId(assetId, "Asset ID")}`), {
630
+ ...options,
631
+ deadlineAt: connection.call.deadlineAt
632
+ }, connection.sleep, connection.now);
611
633
  },
612
634
  /**
613
635
  * Removes an asset's stored content (source, preview and retained extracted text) while
@@ -650,19 +672,28 @@ sign: async (options) => {
650
672
  };
651
673
  }
652
674
  get events() {
653
- return {
654
- /**
655
- * Lists project events after a cursor, oldest first. Call without `cursor` to get a cursor
656
- * for "now", then poll with each response's `nextCursor`. Webhook deliveries carry each
657
- * event's same fields as a flat JSON body. `types` and `assetId` narrow the feed to some
658
- * event types or one asset's events; a cursor belongs to the filters it was issued with, so
659
- * pass the same ones with each `cursor`. `for await` over it yields every event waiting
660
- * after `cursor`; save the last page's `nextCursor` to resume later.
661
- */
662
- list: (options = {}, requestOptions) => this.#paginate("events.list", options, requestOptions, ({ types, ...query }) => this.#send("events.list", requestOptions, "GET", `${this.#projectPath}/events`, { query: {
663
- ...query,
664
- types: types?.length ? types.join(",") : void 0
665
- } })) };
675
+ return {
676
+ /**
677
+ * Lists project events after a cursor, oldest first. Call without `cursor` to get a cursor
678
+ * for "now", then poll with each response's `nextCursor`. Webhook deliveries carry each
679
+ * event's same fields as a flat JSON body. `types` and `assetId` narrow the feed to some
680
+ * event types or one asset's events; a cursor belongs to the filters it was issued with, so
681
+ * pass the same ones with each `cursor`. `for await` over it yields every event waiting
682
+ * after `cursor`; save the last page's `nextCursor` to resume later.
683
+ */
684
+ list: (options = {}, requestOptions) => this.#paginate("events.list", options, requestOptions, ({ types, ...query }) => this.#send("events.list", requestOptions, "GET", `${this.#projectPath}/events`, { query: {
685
+ ...query,
686
+ types: types?.length ? types.join(",") : void 0
687
+ } })),
688
+ /**
689
+ * Retrieves the asset an event is about, as it is now, such as one from `events.list` or a
690
+ * parsed webhook delivery; events carry only the asset's ID. Resolves to `null` for an
691
+ * event that isn't about an asset, and rejects with `asset/not-found` once the asset is
692
+ * deleted. The asset's `eventSequence` orders it against events: an event with a higher
693
+ * `assetSequence` happened after this state, one with an equal or lower one is reflected in it.
694
+ */
695
+ retrieveAsset: async (event, requestOptions) => event.assetId ? this.assets.retrieve({ assetId: event.assetId }, requestOptions) : null
696
+ };
666
697
  }
667
698
  get folders() {
668
699
  return {
@@ -263,6 +263,7 @@ declare const ASSET_MODERATION_SCHEMA: zod.ZodObject<{
263
263
  pendingReview: zod.ZodNullable<zod.ZodObject<{
264
264
  requestedAt: zod.ZodNumber;
265
265
  reason: zod.ZodEnum<{
266
+ reported: "reported";
266
267
  sampled: "sampled";
267
268
  uncertain: "uncertain";
268
269
  }>;
@@ -5088,6 +5089,7 @@ declare const ASSET_CLASSIFICATION_SCHEMA: zod.ZodObject<{
5088
5089
  pendingReview: zod.ZodNullable<zod.ZodObject<{
5089
5090
  requestedAt: zod.ZodNumber;
5090
5091
  reason: zod.ZodEnum<{
5092
+ reported: "reported";
5091
5093
  sampled: "sampled";
5092
5094
  uncertain: "uncertain";
5093
5095
  }>;
@@ -10211,6 +10213,7 @@ declare const ASSET_SCHEMA: zod.ZodObject<{
10211
10213
  pendingReview: zod.ZodNullable<zod.ZodObject<{
10212
10214
  requestedAt: zod.ZodNumber;
10213
10215
  reason: zod.ZodEnum<{
10216
+ reported: "reported";
10214
10217
  sampled: "sampled";
10215
10218
  uncertain: "uncertain";
10216
10219
  }>;
@@ -15199,6 +15202,7 @@ declare const ASSET_SCHEMA: zod.ZodObject<{
15199
15202
  averageColor: zod.ZodNullable<zod.ZodPipe<zod.ZodString, zod.ZodTransform<string, string>>>;
15200
15203
  }, zod.core.$strip>>;
15201
15204
  }, zod.core.$strip>;
15205
+ eventSequence: zod.ZodNumber;
15202
15206
  }, zod.core.$strip>;
15203
15207
  type Asset$1 = zod.infer<typeof ASSET_SCHEMA>;
15204
15208
  /**
@@ -15467,6 +15471,7 @@ declare const ASSET_SEARCH_RESULT_SCHEMA: zod.ZodObject<{
15467
15471
  pendingReview: zod.ZodNullable<zod.ZodObject<{
15468
15472
  requestedAt: zod.ZodNumber;
15469
15473
  reason: zod.ZodEnum<{
15474
+ reported: "reported";
15470
15475
  sampled: "sampled";
15471
15476
  uncertain: "uncertain";
15472
15477
  }>;
@@ -20455,6 +20460,7 @@ declare const ASSET_SEARCH_RESULT_SCHEMA: zod.ZodObject<{
20455
20460
  averageColor: zod.ZodNullable<zod.ZodPipe<zod.ZodString, zod.ZodTransform<string, string>>>;
20456
20461
  }, zod.core.$strip>>;
20457
20462
  }, zod.core.$strip>;
20463
+ eventSequence: zod.ZodNumber;
20458
20464
  }, zod.core.$strip>;
20459
20465
  score: zod.ZodNumber;
20460
20466
  matchedFields: zod.ZodArray<zod.ZodEnum<{
@@ -36808,6 +36814,7 @@ declare const EVENT_TYPE_INFO: {
36808
36814
  website: "website";
36809
36815
  }>>>>;
36810
36816
  parentAsset: EventFieldDefinition<zod.ZodOptional<zod.ZodString>>;
36817
+ reviewId: EventFieldDefinition<zod.ZodString>;
36811
36818
  automatedStatus: EventFieldDefinition<zod.ZodEnum<{
36812
36819
  "age-restricted": "age-restricted";
36813
36820
  allowed: "allowed";
@@ -36815,6 +36822,7 @@ declare const EVENT_TYPE_INFO: {
36815
36822
  limited: "limited";
36816
36823
  }>>;
36817
36824
  reviewReason: EventFieldDefinition<zod.ZodEnum<{
36825
+ reported: "reported";
36818
36826
  sampled: "sampled";
36819
36827
  uncertain: "uncertain";
36820
36828
  }>>;
@@ -36828,15 +36836,18 @@ declare const EVENT_TYPE_INFO: {
36828
36836
  sexual: "sexual";
36829
36837
  violence: "violence";
36830
36838
  }>>>;
36839
+ note: EventFieldDefinition<zod.ZodOptional<zod.ZodString>>;
36831
36840
  };
36832
36841
  /** Example data, used for synthetic test sends (`createSampleEvent`). */
36833
36842
  example: NoInfer<{
36834
36843
  assetName?: string | null | undefined;
36835
36844
  assetType?: "audio" | "file" | "image" | "multimedia-document" | "plaintext-document" | "video" | "website" | null | undefined;
36836
36845
  parentAsset?: string | undefined;
36846
+ reviewId: string;
36837
36847
  automatedStatus: "age-restricted" | "allowed" | "blocked" | "limited";
36838
- reviewReason: "sampled" | "uncertain";
36848
+ reviewReason: "reported" | "sampled" | "uncertain";
36839
36849
  uncertainCategories: ("criminal-activity" | "harassment" | "hate" | "personal-information" | "profanity" | "self-harm" | "sexual" | "violence")[];
36850
+ note?: string | undefined;
36840
36851
  }>;
36841
36852
  factInfo: {
36842
36853
  label: string;
@@ -36871,6 +36882,7 @@ declare const EVENT_TYPE_INFO: {
36871
36882
  website: "website";
36872
36883
  }>>>;
36873
36884
  parentAsset: zod.ZodOptional<zod.ZodString>;
36885
+ reviewId: zod.ZodString;
36874
36886
  automatedStatus: zod.ZodEnum<{
36875
36887
  "age-restricted": "age-restricted";
36876
36888
  allowed: "allowed";
@@ -36878,6 +36890,7 @@ declare const EVENT_TYPE_INFO: {
36878
36890
  limited: "limited";
36879
36891
  }>;
36880
36892
  reviewReason: zod.ZodEnum<{
36893
+ reported: "reported";
36881
36894
  sampled: "sampled";
36882
36895
  uncertain: "uncertain";
36883
36896
  }>;
@@ -36891,6 +36904,7 @@ declare const EVENT_TYPE_INFO: {
36891
36904
  sexual: "sexual";
36892
36905
  violence: "violence";
36893
36906
  }>>;
36907
+ note: zod.ZodOptional<zod.ZodString>;
36894
36908
  }, zod.core.$strip>;
36895
36909
  };
36896
36910
  readonly "asset.review-completed": {
@@ -38176,43 +38190,6 @@ declare const ACTOR_SCHEMA: zod.ZodObject<{
38176
38190
  id: zod.ZodNullable<zod.ZodString>;
38177
38191
  }, zod.core.$strict>;
38178
38192
  type Actor = zod.infer<typeof ACTOR_SCHEMA>;
38179
- declare const EVENT_ASSET_SCHEMA: zod.ZodObject<{
38180
- id: zod.ZodString;
38181
- externalId: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
38182
- uploadPresetId: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
38183
- upload: zod.ZodObject<{
38184
- status: zod.ZodEnum<{
38185
- completed: "completed";
38186
- uploading: "uploading";
38187
- }>;
38188
- }, zod.core.$strip>;
38189
- classification: zod.ZodObject<{
38190
- status: zod.ZodEnum<{
38191
- completed: "completed";
38192
- failed: "failed";
38193
- processing: "processing";
38194
- queued: "queued";
38195
- }>;
38196
- testInput: zod.ZodBoolean;
38197
- moderation: zod.ZodObject<{
38198
- decision: zod.ZodNullable<zod.ZodEnum<{
38199
- "age-restricted": "age-restricted";
38200
- allowed: "allowed";
38201
- blocked: "blocked";
38202
- limited: "limited";
38203
- purged: "purged";
38204
- }>>;
38205
- }, zod.core.$strip>;
38206
- }, zod.core.$strip>;
38207
- content: zod.ZodObject<{
38208
- status: zod.ZodEnum<{
38209
- removed: "removed";
38210
- stored: "stored";
38211
- temporary: "temporary";
38212
- }>;
38213
- }, zod.core.$strip>;
38214
- }, zod.core.$strip>;
38215
- type EventAsset = zod.infer<typeof EVENT_ASSET_SCHEMA>;
38216
38193
  /** An event as `GET /events` lists it and webhooks deliver it. */
38217
38194
  declare const PUBLIC_EVENT_SCHEMA: zod.ZodObject<{
38218
38195
  id: zod.ZodString;
@@ -38269,42 +38246,6 @@ declare const PUBLIC_EVENT_SCHEMA: zod.ZodObject<{
38269
38246
  description: zod.ZodOptional<zod.ZodNullable<zod.ZodPipe<zod.ZodString, zod.ZodTransform<string, string>>>>;
38270
38247
  assetId: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
38271
38248
  assetSequence: zod.ZodOptional<zod.ZodNullable<zod.ZodNumber>>;
38272
- asset: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{
38273
- id: zod.ZodString;
38274
- externalId: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
38275
- uploadPresetId: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
38276
- upload: zod.ZodObject<{
38277
- status: zod.ZodEnum<{
38278
- completed: "completed";
38279
- uploading: "uploading";
38280
- }>;
38281
- }, zod.core.$strip>;
38282
- classification: zod.ZodObject<{
38283
- status: zod.ZodEnum<{
38284
- completed: "completed";
38285
- failed: "failed";
38286
- processing: "processing";
38287
- queued: "queued";
38288
- }>;
38289
- testInput: zod.ZodBoolean;
38290
- moderation: zod.ZodObject<{
38291
- decision: zod.ZodNullable<zod.ZodEnum<{
38292
- "age-restricted": "age-restricted";
38293
- allowed: "allowed";
38294
- blocked: "blocked";
38295
- limited: "limited";
38296
- purged: "purged";
38297
- }>>;
38298
- }, zod.core.$strip>;
38299
- }, zod.core.$strip>;
38300
- content: zod.ZodObject<{
38301
- status: zod.ZodEnum<{
38302
- removed: "removed";
38303
- stored: "stored";
38304
- temporary: "temporary";
38305
- }>;
38306
- }, zod.core.$strip>;
38307
- }, zod.core.$strip>>>;
38308
38249
  facts: zod.ZodArray<zod.ZodObject<{
38309
38250
  key: zod.ZodString;
38310
38251
  value: zod.ZodUnknown & zod.ZodType<{} | null, unknown, zod.core.$ZodTypeInternals<{} | null, unknown>>;
@@ -42416,6 +42357,26 @@ declare const POST_ASSET_DECISION_BODY_SCHEMA: zod.ZodDiscriminatedUnion<[zod.Zo
42416
42357
  confirmPurge: zod.ZodLiteral<true>;
42417
42358
  }, zod.core.$strip>], "decision">;
42418
42359
  type PostAssetDecisionBody = zod.infer<typeof POST_ASSET_DECISION_BODY_SCHEMA>;
42360
+ declare const POST_ASSET_REVIEW_REQUEST_BODY_SCHEMA: zod.ZodObject<{
42361
+ note: zod.ZodOptional<zod.ZodString>;
42362
+ }, zod.core.$strip>;
42363
+ type PostAssetReviewRequestBody = zod.infer<typeof POST_ASSET_REVIEW_REQUEST_BODY_SCHEMA>;
42364
+ declare const ASSET_REVIEW_REQUEST_SCHEMA: zod.ZodObject<{
42365
+ id: zod.ZodString;
42366
+ assetId: zod.ZodString;
42367
+ reason: zod.ZodEnum<{
42368
+ reported: "reported";
42369
+ sampled: "sampled";
42370
+ uncertain: "uncertain";
42371
+ }>;
42372
+ status: zod.ZodEnum<{
42373
+ completed: "completed";
42374
+ pending: "pending";
42375
+ }>;
42376
+ note: zod.ZodNullable<zod.ZodString>;
42377
+ createdAt: zod.ZodNumber;
42378
+ }, zod.core.$strip>;
42379
+ type AssetReviewRequest = zod.infer<typeof ASSET_REVIEW_REQUEST_SCHEMA>;
42419
42380
  declare const ASSET_BATCH_OPERATIONS: readonly ["delete", "remove-content"];
42420
42381
  type AssetBatchOperation = (typeof ASSET_BATCH_OPERATIONS)[number];
42421
42382
  declare const POST_ASSET_BATCH_OPERATION_RESPONSE_SCHEMA: zod.ZodObject<{
@@ -42734,6 +42695,13 @@ interface RequestOptions {
42734
42695
  signal?: AbortSignal;
42735
42696
  /** Deadline in milliseconds for each attempt of this call's requests. */
42736
42697
  timeoutMs?: number;
42698
+ /**
42699
+ * Deadline in milliseconds for the whole call: every attempt, the waits between retries
42700
+ * (`Retry-After` included) and `assets.waitForDecision`'s polling. When it passes, the call
42701
+ * rejects with `sdk/timeout` and makes no further attempt; a retry whose wait would reach it
42702
+ * isn't made, and the last attempt's error is thrown. A list call's deadline covers each page.
42703
+ */
42704
+ deadlineMs?: number;
42737
42705
  /** How many times to retry this call's requests; 0 turns retries off. */
42738
42706
  maxRetries?: number;
42739
42707
  /**
@@ -43016,6 +42984,14 @@ type ListEventsOptions = GetEventsQuery;
43016
42984
  interface RetrieveAssetOptions {
43017
42985
  assetId: string;
43018
42986
  }
42987
+ interface RetrieveAssetByExternalIdOptions {
42988
+ /** The `externalId` the asset was uploaded or updated with. */
42989
+ externalId: string;
42990
+ }
42991
+ /** Options for `assets.requestReview`: the asset, and an optional note reviewers see. */
42992
+ type RequestAssetReviewOptions = {
42993
+ assetId: string;
42994
+ } & PostAssetReviewRequestBody;
43019
42995
  interface RetryAssetOptions {
43020
42996
  assetId: string;
43021
42997
  }
@@ -43243,4 +43219,4 @@ interface ClassifyTextOptions extends Omit<SubmitAssetCommonOptions, "name" | "i
43243
43219
  /** `folders.list` options. `sort` is `name` (the default) or `createdAt`, descending when prefixed with `-`. */
43244
43220
  type ListFoldersOptions = GetFoldersQuery;
43245
43221
  type FolderPage = GetFoldersResponse;
43246
- export { FolderPage as $, VerifyWebhookSignatureOptions as $t, CdnAssetLocation as A, Policy as An, RetrieveAssetOptions as At, CreateHashListOptions as B, AssetRendered as Bn, UpdateAssetOptions as Bt, AssetUploadStatus as C, BoundingBox as Cn, MultipartUploadPartOptions as Ct, BatchAssetsResponse as D, ProcessingFeatureResults as Dn, RequestAttempt as Dt, BatchAssetsOptions as E, ProcessingFeatureId as En, RemoveAssetContentOptions as Et, CdnTransform as F, AssetBinaryPayloadInput as Fn, SignUploadTokenOptions as Ft, DeleteAssetOptions as G, FileMetadata as Gn, UpdateProjectSettingsOptions as Gt, CreateMultipartUploadPartOptions as H, AssetSafetyHold as Hn, UpdateHashListOptions as Ht, ClassifyTextOptions as I, AssetInfo as In, SignedAssetUrl as It, EnsureLensesOptions as J, UploadPresetDefinition as Jt, DeleteMetadataFieldOptions as K, MetadataItem as Kn, UpgradePolicyOptions as Kt, ClientRequestDefaults as L, AssetHls as Ln, SignedUploadToken as Lt, CdnAssetUrlOptions as M, LensType as Mn, SearchAssetsOptions as Mt, CdnResource as N, AssetSearchMatchField as Nn, SetPolicyAutomaticUpdatesOptions as Nt, CalmLensAppClientOptions as O, ProcessingFeatureStage as On, RequestOptions as Ot, CdnServeOptions as P, AssetSearchQuery as Pn, SignAssetUrlOptions as Pt, FolderIdOptions as Q, UploadedAsset as Qt, ConnectionOptions as R, AssetHlsRendition as Rn, StreamingFeatureOptions as Rt, AssetUpload as S, AgeRange as Sn, MultipartUploadOptions as St, AssignPolicyOptions as T, DetectedPerson as Tn, PolicyPage as Tt, CreatePolicyOptions as U, AssetSafetyHoldReason as Un, UpdateLensOptions as Ut, CreateLensOptions as V, AssetRenderedKind as Vn, UpdateFolderOptions as Vt, DecideAssetOptions as W, ExtractedText as Wn, UpdatePolicyOptions as Wt, EnsureUploadPresetsOptions as X, UploadPresetPage as Xt, EnsureMetadataFieldsOptions as Y, UploadPresetIdOptions as Yt, EnsureUploadPresetsResponse as Z, UploadPresetSubmitAssetOptions as Zt, AssetPage as _, Folder as _n, ListLensesOptions as _t, AssetChecksums as a, AssetTimelineSegment as an, IdempotencyOptions as at, AssetTimelinePage as b, PublicProjectSettings as bn, MoveAssetOptions as bt, AssetClassificationFailureReason as c, EventAsset as cn, LensIdOptions as ct, AssetContentOptions as d, EventFact as dn, ListAssetTimelineOptions as dt, ViewerClaims as en, GetAssetInfoOptions as et, AssetContentRemovalReason as f, EventFactValues as fn, ListAssetsOptions as ft, AssetModerationStatus as g, PermissionGrant as gn, ListHashListsOptions as gt, AssetModerationDecision as h, EventType as hn, ListHashListEntriesOptions as ht, AssetAvailability as i, AssetBatchOperation as in, HashListPage as it, CdnAssetReference as j, CursorPage as jn, RetryAssetOptions as jt, CalmLensServerClientOptions as k, ProcessingFeatures as kn, ResetPolicyOptions as kt, AssetClassificationStatus as l, TypedEvent as ln, LensPage as lt, AssetModeration as m, EventSeverity as mn, ListFoldersOptions as mt, AppInfo as n, WebhookHeadersInput as nn, HashListEntryPage as nt, AssetChildrenPage as o, GetEventsResponse as on, ImageTransformOptions as ot, AssetContentStatus as p, EventFacts as pn, ListEventsOptions as pt, EnsureLensOptions as q, ProcessingOptions as qn, UploadAssetPartOptions as qt, Asset as r, WebhookPayloadInput as rn, HashListIdOptions as rt, AssetClassification as s, Actor as sn, Lens as st, AddHashListEntryOptions as t, WaitForAssetDecisionOptions as tn, HashListEntryIdOptions as tt, AssetContent as u, EventCategory as un, ListAssetChildrenOptions as ut, AssetSearchResponse as v, MetadataFieldsResource as vn, ListPoliciesOptions as vt, AssetVisibility as w, DetectedFace as wn, PolicyIdOptions as wt, AssetType as x, UploadPreset as xn, MoveFolderOptions as xt, AssetSearchResult as y, ProjectSettingsResource as yn, ListUploadPresetsOptions as yt, CreateFolderOptions as z, AssetPreview as zn, SubmitAssetOptions as zt };
43222
+ export { FolderPage as $, UploadPresetSubmitAssetOptions as $t, CdnAssetLocation as A, ProcessingFeatureStage as An, ResetPolicyOptions as At, CreateHashListOptions as B, AssetHlsRendition as Bn, StreamingFeatureOptions as Bt, AssetUploadStatus as C, UploadPreset as Cn, MultipartUploadPartOptions as Ct, BatchAssetsResponse as D, DetectedPerson as Dn, RequestAssetReviewOptions as Dt, BatchAssetsOptions as E, DetectedFace as En, RemoveAssetContentOptions as Et, CdnTransform as F, AssetSearchMatchField as Fn, SetPolicyAutomaticUpdatesOptions as Ft, DeleteAssetOptions as G, AssetSafetyHoldReason as Gn, UpdateLensOptions as Gt, CreateMultipartUploadPartOptions as H, AssetRendered as Hn, UpdateAssetOptions as Ht, ClassifyTextOptions as I, AssetSearchQuery as In, SignAssetUrlOptions as It, EnsureLensesOptions as J, MetadataItem as Jn, UpgradePolicyOptions as Jt, DeleteMetadataFieldOptions as K, ExtractedText as Kn, UpdatePolicyOptions as Kt, ClientRequestDefaults as L, AssetBinaryPayloadInput as Ln, SignUploadTokenOptions as Lt, CdnAssetUrlOptions as M, Policy as Mn, RetrieveAssetOptions as Mt, CdnResource as N, CursorPage as Nn, RetryAssetOptions as Nt, CalmLensAppClientOptions as O, ProcessingFeatureId as On, RequestAttempt as Ot, CdnServeOptions as P, LensType as Pn, SearchAssetsOptions as Pt, FolderIdOptions as Q, UploadPresetPage as Qt, ConnectionOptions as R, AssetInfo as Rn, SignedAssetUrl as Rt, AssetUpload as S, PublicProjectSettings as Sn, MultipartUploadOptions as St, AssignPolicyOptions as T, BoundingBox as Tn, PolicyPage as Tt, CreatePolicyOptions as U, AssetRenderedKind as Un, UpdateFolderOptions as Ut, CreateLensOptions as V, AssetPreview as Vn, SubmitAssetOptions as Vt, DecideAssetOptions as W, AssetSafetyHold as Wn, UpdateHashListOptions as Wt, EnsureUploadPresetsOptions as X, UploadPresetDefinition as Xt, EnsureMetadataFieldsOptions as Y, ProcessingOptions as Yn, UploadAssetPartOptions as Yt, EnsureUploadPresetsResponse as Z, UploadPresetIdOptions as Zt, AssetPage as _, EventType as _n, ListLensesOptions as _t, AssetChecksums as a, WebhookPayloadInput as an, IdempotencyOptions as at, AssetTimelinePage as b, MetadataFieldsResource as bn, MoveAssetOptions as bt, AssetClassificationFailureReason as c, AssetTimelineSegment as cn, LensIdOptions as ct, AssetContentOptions as d, TypedEvent as dn, ListAssetTimelineOptions as dt, UploadedAsset as en, GetAssetInfoOptions as et, AssetContentRemovalReason as f, EventCategory as fn, ListAssetsOptions as ft, AssetModerationStatus as g, EventSeverity as gn, ListHashListsOptions as gt, AssetModerationDecision as h, EventFacts as hn, ListHashListEntriesOptions as ht, AssetAvailability as i, WebhookHeadersInput as in, HashListPage as it, CdnAssetReference as j, ProcessingFeatures as jn, RetrieveAssetByExternalIdOptions as jt, CalmLensServerClientOptions as k, ProcessingFeatureResults as kn, RequestOptions as kt, AssetClassificationStatus as l, GetEventsResponse as ln, LensPage as lt, AssetModeration as m, EventFactValues as mn, ListFoldersOptions as mt, AppInfo as n, ViewerClaims as nn, HashListEntryPage as nt, AssetChildrenPage as o, AssetBatchOperation as on, ImageTransformOptions as ot, AssetContentStatus as p, EventFact as pn, ListEventsOptions as pt, EnsureLensOptions as q, FileMetadata as qn, UpdateProjectSettingsOptions as qt, Asset as r, WaitForAssetDecisionOptions as rn, HashListIdOptions as rt, AssetClassification as s, AssetReviewRequest as sn, Lens as st, AddHashListEntryOptions as t, VerifyWebhookSignatureOptions as tn, HashListEntryIdOptions as tt, AssetContent as u, Actor as un, ListAssetChildrenOptions as ut, AssetSearchResponse as v, PermissionGrant as vn, ListPoliciesOptions as vt, AssetVisibility as w, AgeRange as wn, PolicyIdOptions as wt, AssetType as x, ProjectSettingsResource as xn, MoveFolderOptions as xt, AssetSearchResult as y, Folder as yn, ListUploadPresetsOptions as yt, CreateFolderOptions as z, AssetHls as zn, SignedUploadToken as zt };
@@ -1,5 +1,5 @@
1
- import { F as CdnTransform, O as CalmLensAppClientOptions, en as ViewerClaims, g as AssetModerationStatus, i as AssetAvailability } from "./CalmLensTypes-CtO4Dieu.js";
2
- import { t as CalmLensAppClient } from "./CalmLensAppClient-B3u6BlP5.js";
1
+ import { F as CdnTransform, O as CalmLensAppClientOptions, g as AssetModerationStatus, i as AssetAvailability, nn as ViewerClaims } from "./CalmLensTypes-C2blKgTu.js";
2
+ import { t as CalmLensAppClient } from "./CalmLensAppClient-D-BD_Ny1.js";
3
3
  import { o as UploadFileIconFamily } from "./FileIcons-4qSX7DW2.js";
4
4
  /**
5
5
  * The text the asset viewers show, keyed by name. `{name}` placeholders are filled in when shown.
@@ -1,5 +1,5 @@
1
- import { Q as CalmLensError, c as assetUrlOf, d as toUrlViewerClaims, o as appendAssetLocation, u as getAssetInfo, w as transformSelector, x as serializeTransform } from "./ModerationContextLimits-IH2zX1wg.js";
2
- import { o as placeholderHashToDataURL } from "./UploadController-DKjI8S2K.js";
1
+ import { Q as CalmLensError, c as assetUrlOf, d as toUrlViewerClaims, o as appendAssetLocation, u as getAssetInfo, w as transformSelector, x as serializeTransform } from "./ModerationContextLimits-Abu_L1Df.js";
2
+ import { o as placeholderHashToDataURL } from "./UploadController-BubUXclM.js";
3
3
  import { a as getFileIcon, c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
4
4
  // src/ui/viewers/ViewerAsset.ts
5
5
  /** Spreadsheet MIME types, as `content.format` reports them (compared lower-cased). */
@@ -67,6 +67,7 @@ const API_ERROR_CODES = {
67
67
  ASSET_NOT_RETRYABLE: "asset/not-retryable",
68
68
  ASSET_CONTENT_UNAVAILABLE: "asset/content-unavailable",
69
69
  ASSET_CONTENT_PURGED: "asset/content-purged",
70
+ ASSET_NOT_REVIEWABLE: "asset/not-reviewable",
70
71
  SUPPORT_TICKET_NOT_FOUND: "support-ticket/not-found",
71
72
  DUPLICATE_EXTERNAL_ID: "asset/duplicate-external-id",
72
73
  FOLDER_NOT_FOUND: "folder/not-found",
@@ -387,6 +388,10 @@ const API_ERROR_DEFINITIONS = {
387
388
  status: 409,
388
389
  message: "This asset's content was purged, so it can only be blocked. Upload it again to have it moderated afresh."
389
390
  },
391
+ "asset/not-reviewable": {
392
+ status: 409,
393
+ message: "The human review queue can't take this asset. details.reason is `child-asset` for content extracted from another asset (report the uploaded asset instead), `not-moderated` while it has no moderation decision yet, or `content-unavailable` when its content is no longer stored."
394
+ },
390
395
  "support-ticket/not-found": {
391
396
  status: 404,
392
397
  message: "Support ticket not found."
@@ -1062,7 +1067,7 @@ const listPages = (fetchPage, { cursor, feed = false } = {}) => {
1062
1067
  };
1063
1068
  // src/client/CalmLensVersion.ts
1064
1069
  /** This SDK's version, from its package.json. */
1065
- const SDK_VERSION = "0.28.1";
1070
+ const SDK_VERSION = "0.29.0";
1066
1071
  const runtimeName = () => {
1067
1072
  const runtime = globalThis;
1068
1073
  if (isReactNativeRuntime()) return "react-native";
@@ -1321,9 +1326,13 @@ var CalmLensTransport = class {
1321
1326
  const headers = this.headersFor(request);
1322
1327
  const now = this.settings.now ?? Date.now;
1323
1328
  const path = pathOf(request.url);
1329
+ const { deadlineAt } = request;
1330
+ const startsInTime = (delayMs) => deadlineAt === void 0 || now() + delayMs < deadlineAt;
1324
1331
  for (let attemptNumber = 0;; attemptNumber++) {
1325
1332
  const canRetryAgain = retryable && attemptNumber < this.maxRetriesFor(request);
1326
- const attempt = createAttemptSignal(this.signalsFor(request), request.timeoutMs);
1333
+ const remainingMs = deadlineAt === void 0 ? void 0 : deadlineAt - now();
1334
+ if (remainingMs !== void 0 && remainingMs <= 0) throw new CalmLensError(SDK_ERROR_CODES.TIMEOUT, { message: "The call's deadline passed" });
1335
+ const attempt = createAttemptSignal(this.signalsFor(request), remainingMs === void 0 ? request.timeoutMs : Math.min(request.timeoutMs ?? remainingMs, remainingMs));
1327
1336
  const started = now();
1328
1337
  const report = (outcome, delayMs) => this.report({
1329
1338
  operation: request.operation ?? null,
@@ -1359,8 +1368,8 @@ var CalmLensTransport = class {
1359
1368
  } catch (cause) {
1360
1369
  attempt.release();
1361
1370
  const failure = toFailure(cause, attempt);
1362
- if (canRetryAgain && failure.isRetryable()) {
1363
- const delayMs = getRetryDelayMs(attemptNumber);
1371
+ const delayMs = getRetryDelayMs(attemptNumber);
1372
+ if (canRetryAgain && failure.isRetryable() && startsInTime(delayMs)) {
1364
1373
  report({ error: failure }, delayMs);
1365
1374
  await this.backoff(delayMs, request);
1366
1375
  continue;
@@ -1379,7 +1388,7 @@ var CalmLensTransport = class {
1379
1388
  if (allowHttpErrors) {
1380
1389
  const retryAfter = parseRetryAfter(response.headers.get("retry-after"));
1381
1390
  const delayMs = retryAfter !== void 0 ? retryAfter * 1e3 : getRetryDelayMs(attemptNumber);
1382
- if (!canRetryAgain || !RETRYABLE_STATUSES.has(response.status) || delayMs > 6e4) {
1391
+ if (!canRetryAgain || !RETRYABLE_STATUSES.has(response.status) || delayMs > 6e4 || !startsInTime(delayMs)) {
1383
1392
  report({ response }, null);
1384
1393
  return {
1385
1394
  response,
@@ -1401,7 +1410,7 @@ var CalmLensTransport = class {
1401
1410
  attempt.release();
1402
1411
  }
1403
1412
  const retryDelayMs = error.retryAfter !== void 0 ? error.retryAfter * 1e3 : getRetryDelayMs(attemptNumber);
1404
- if (canRetryAgain && retryDelayMs <= 6e4 && error.isRetryable()) {
1413
+ if (canRetryAgain && retryDelayMs <= 6e4 && error.isRetryable() && startsInTime(retryDelayMs)) {
1405
1414
  report({ error }, retryDelayMs);
1406
1415
  await this.backoff(retryDelayMs, request);
1407
1416
  continue;
@@ -2173,27 +2182,29 @@ const DECISION_POLL_MAX_DELAY_MS = 2e3;
2173
2182
  const DEFAULT_DECISION_TIMEOUT_MS = 6e4;
2174
2183
  /**
2175
2184
  * Retrieves an asset until it is settled (see `isAssetDecided`), waiting 0.5s between checks and
2176
- * 1.5 times longer
2177
- * each time, up to 2s. Rejects with `sdk/timeout` once `timeoutMs` passes without one.
2185
+ * 1.5 times longer each time, up to 2s. Rejects with `sdk/timeout` once `timeoutMs` passes
2186
+ * without one, or the call's `deadlineAt`, whichever comes first.
2178
2187
  */
2179
- const pollForDecision = async (retrieve, { timeoutMs = DEFAULT_DECISION_TIMEOUT_MS, signal }, sleep, now = Date.now) => {
2188
+ const pollForDecision = async (retrieve, { timeoutMs = DEFAULT_DECISION_TIMEOUT_MS, signal, deadlineAt }, sleep, now = Date.now) => {
2180
2189
  if (!Number.isFinite(timeoutMs) || timeoutMs < 0) throw invalidArgument("timeoutMs must be a non-negative number");
2181
- const deadline = now() + timeoutMs;
2190
+ const started = now();
2191
+ const deadline = started + timeoutMs;
2182
2192
  let delay = 500;
2183
2193
  for (;;) {
2184
2194
  if (signal?.aborted) throw new CalmLensError(SDK_ERROR_CODES.CANCELLED, { message: "Request cancelled" });
2185
2195
  const asset = await retrieve();
2186
2196
  if (isAssetDecided(asset)) return asset;
2187
2197
  const remaining = deadline - now();
2188
- if (remaining <= 0) throw new CalmLensError(SDK_ERROR_CODES.TIMEOUT, {
2189
- message: `Asset ${asset.id} had no moderation decision after ${timeoutMs}ms (classification status: ${asset.classification.status}, moderation decision: ${asset.classification.moderation.decision})`,
2198
+ const wait = Math.min(delay, remaining);
2199
+ if (remaining <= 0 || deadlineAt !== void 0 && now() + wait >= deadlineAt) throw new CalmLensError(SDK_ERROR_CODES.TIMEOUT, {
2200
+ message: `Asset ${asset.id} had no moderation decision after ${now() - started}ms (classification status: ${asset.classification.status}, moderation decision: ${asset.classification.moderation.decision})`,
2190
2201
  details: {
2191
2202
  assetId: asset.id,
2192
2203
  classificationStatus: asset.classification.status,
2193
2204
  moderationDecision: asset.classification.moderation.decision
2194
2205
  }
2195
2206
  });
2196
- await sleep(Math.min(delay, remaining), signal);
2207
+ await sleep(wait, signal);
2197
2208
  delay = Math.min(DECISION_POLL_MAX_DELAY_MS, delay * DECISION_POLL_DELAY_FACTOR);
2198
2209
  }
2199
2210
  };
@@ -1,4 +1,4 @@
1
- import { i as withProvidedOptions, n as createUploadController } from "./UploadController-DKjI8S2K.js";
1
+ import { i as withProvidedOptions, n as createUploadController } from "./UploadController-BubUXclM.js";
2
2
  import { createContext, createElement, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
3
3
  // src/ui/ReactUpload.ts
4
4
  const CalmLensContext = createContext(void 0);
@@ -1,4 +1,4 @@
1
- import { F as UploadFile, L as UploadSnapshot, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions } from "./Core-BJaLU71Q.js";
1
+ import { F as UploadFile, L as UploadSnapshot, N as UploadController, O as CalmLensProvidedOptions, P as UploadControllerOptions } from "./Core-CNmoxDCW.js";
2
2
  import { ReactNode } from "react";
3
3
  type CalmLensProviderProps<F extends UploadFile = File> = CalmLensProvidedOptions<F> & {
4
4
  children?: ReactNode;
@@ -1,5 +1,5 @@
1
- import { Q as CalmLensError, lt as SDK_ERROR_CODES } from "./ModerationContextLimits-IH2zX1wg.js";
2
- import { t as CalmLensAppClient } from "./CalmLensAppClient-D_SprSKl.js";
1
+ import { Q as CalmLensError, lt as SDK_ERROR_CODES } from "./ModerationContextLimits-Abu_L1Df.js";
2
+ import { t as CalmLensAppClient } from "./CalmLensAppClient-CCT5Em2S.js";
3
3
  // src/contract/PlaceholderHashDecode.js
4
4
  /**
5
5
  * Decodes a ThumbHash to an RGBA image. RGB is not be premultiplied by A.