calmlens 0.22.0 → 0.23.1

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 (84) hide show
  1. package/bin/calmlens.js +44 -26
  2. package/cjs/{BrowserUpload-BWjZ9ntu.d.ts → BrowserUpload-B2kmc3Y_.d.ts} +2 -2
  3. package/cjs/{BrowserUpload-Bwlib4Zc.js → BrowserUpload-HQjhZrW-.js} +1 -1
  4. package/{esm/CalmLensAppClient-BaW3ddUR.d.ts → cjs/CalmLensAppClient-CMVh0y5w.d.ts} +1 -1
  5. package/cjs/{CalmLensAppClient-DUYMo9PZ.js → CalmLensAppClient-yNhGTyvi.js} +2 -2
  6. package/cjs/{CalmLensOptionKeys-YvgV995V.js → CalmLensOptionKeys-B4gAOSbY.js} +1 -1
  7. package/{esm/CalmLensServerClient-BKzn8zmp.d.ts → cjs/CalmLensServerClient-BFt1L_FZ.d.ts} +9 -9
  8. package/cjs/{CalmLensServerClient-3N-gdsxC.js → CalmLensServerClient-BGlhX1Ep.js} +27 -10
  9. package/cjs/{CalmLensTypes-BDKwThbO.d.ts → CalmLensTypes-SmOCgKI3.d.ts} +298 -69
  10. package/cjs/{Classification-Q5zGpR8l-CEWjnE39.d.ts → Classification-CxRedzgH-C9qlYW_J.d.ts} +35 -0
  11. package/{esm/Core-C33pkBmf.d.ts → cjs/Core-Dt_HUNvH.d.ts} +4 -3
  12. package/cjs/{Core-Cm5Z1oJ9.js → Core-zXLf8JKh.js} +3 -3
  13. package/cjs/{ModerationContextLimits-ud1xpZRK.js → ModerationContextLimits-C6Ts1Xhw.js} +4 -11
  14. package/cjs/{ReactUpload-DhF8mm51.d.ts → ReactUpload-Bd7Hea4w.d.ts} +1 -1
  15. package/cjs/{ReactUpload-DQ0BYISX.js → ReactUpload-SaTeZgdA.js} +1 -1
  16. package/{esm/TestTriggers-D0pYHbkr-D5T0VdSn.d.ts → cjs/TestTriggers-BJ4B-MXR-D1tGifPU.d.ts} +7 -5
  17. package/cjs/{TestTriggers-D29T_R0M-D6Bu-Mln.js → TestTriggers-CiFcTHX3-BmfH4J3f.js} +22 -9
  18. package/cjs/{UploadController-l8fZM2qT.js → UploadController-Bh2bqt8N.js} +2 -2
  19. package/{esm/WebhookPayload-Dt6DttS0.d.ts → cjs/WebhookPayload-C7KAk3iR.d.ts} +1 -1
  20. package/cjs/app.d.ts +6 -6
  21. package/cjs/app.js +2 -2
  22. package/cjs/elements.d.ts +4 -4
  23. package/cjs/elements.js +4 -4
  24. package/cjs/{index-Bde1wjiw.d.ts → index-BJf0y_Uk.d.ts} +3 -3
  25. package/cjs/index.d.ts +5 -5
  26. package/cjs/index.js +1 -1
  27. package/cjs/react-native.d.ts +2 -2
  28. package/cjs/react-native.js +4 -4
  29. package/cjs/react.d.ts +3 -3
  30. package/cjs/react.js +5 -5
  31. package/cjs/server.d.ts +6 -6
  32. package/cjs/server.js +2 -2
  33. package/cjs/test-inputs.d.ts +1 -1
  34. package/cjs/test-inputs.js +13 -13
  35. package/cjs/testing.d.ts +16 -7
  36. package/cjs/testing.js +98 -34
  37. package/cjs/{ui-BRA4HQ8r.js → ui-CbqSrVlT.js} +3 -3
  38. package/cjs/{ui-YQuvbidU.d.ts → ui-DNXPuzha.d.ts} +2 -2
  39. package/cjs/ui.d.ts +2 -2
  40. package/cjs/ui.js +3 -3
  41. package/cjs/vue.d.ts +5 -5
  42. package/cjs/vue.js +4 -4
  43. package/esm/{BrowserUpload-BWjZ9ntu.d.ts → BrowserUpload-B2kmc3Y_.d.ts} +2 -2
  44. package/esm/{BrowserUpload-GRZVB0G_.js → BrowserUpload-QwdUnq0H.js} +1 -1
  45. package/{cjs/CalmLensAppClient-BaW3ddUR.d.ts → esm/CalmLensAppClient-CMVh0y5w.d.ts} +1 -1
  46. package/esm/{CalmLensAppClient-B5QIJ6KS.js → CalmLensAppClient-Dih1prcq.js} +2 -2
  47. package/esm/{CalmLensOptionKeys-BG7Qrh8-.js → CalmLensOptionKeys-C6R-4Zvh.js} +1 -1
  48. package/{cjs/CalmLensServerClient-BKzn8zmp.d.ts → esm/CalmLensServerClient-BFt1L_FZ.d.ts} +9 -9
  49. package/esm/{CalmLensServerClient-bRUAebi-.js → CalmLensServerClient-CVF5_FfH.js} +27 -10
  50. package/esm/{CalmLensTypes-BDKwThbO.d.ts → CalmLensTypes-SmOCgKI3.d.ts} +298 -69
  51. package/esm/{Classification-Q5zGpR8l-CEWjnE39.d.ts → Classification-CxRedzgH-C9qlYW_J.d.ts} +35 -0
  52. package/{cjs/Core-C33pkBmf.d.ts → esm/Core-Dt_HUNvH.d.ts} +4 -3
  53. package/esm/{Core-BvQe4moS.js → Core-tfQsge01.js} +3 -3
  54. package/esm/{ModerationContextLimits-CrxSnVZ3.js → ModerationContextLimits-B8f4ukBB.js} +4 -11
  55. package/esm/{ReactUpload-DhF8mm51.d.ts → ReactUpload-Bd7Hea4w.d.ts} +1 -1
  56. package/esm/{ReactUpload-BMO8saxT.js → ReactUpload-DRW08-Kt.js} +1 -1
  57. package/{cjs/TestTriggers-D0pYHbkr-D5T0VdSn.d.ts → esm/TestTriggers-BJ4B-MXR-D1tGifPU.d.ts} +7 -5
  58. package/esm/{TestTriggers-D29T_R0M-Ztc74ucs.js → TestTriggers-CiFcTHX3-BK2-sgOC.js} +22 -9
  59. package/esm/{UploadController-DnJrWiE4.js → UploadController-DEwR1AxP.js} +2 -2
  60. package/{cjs/WebhookPayload-Dt6DttS0.d.ts → esm/WebhookPayload-C7KAk3iR.d.ts} +1 -1
  61. package/esm/app.d.ts +6 -6
  62. package/esm/app.js +2 -2
  63. package/esm/elements.d.ts +4 -4
  64. package/esm/elements.js +4 -4
  65. package/esm/{index-Bde1wjiw.d.ts → index-BJf0y_Uk.d.ts} +3 -3
  66. package/esm/index.d.ts +5 -5
  67. package/esm/index.js +1 -1
  68. package/esm/react-native.d.ts +2 -2
  69. package/esm/react-native.js +4 -4
  70. package/esm/react.d.ts +3 -3
  71. package/esm/react.js +5 -5
  72. package/esm/server.d.ts +6 -6
  73. package/esm/server.js +2 -2
  74. package/esm/test-inputs.d.ts +1 -1
  75. package/esm/test-inputs.js +1 -1
  76. package/esm/testing.d.ts +16 -7
  77. package/esm/testing.js +92 -28
  78. package/esm/{ui-YQuvbidU.d.ts → ui-DNXPuzha.d.ts} +2 -2
  79. package/esm/{ui-heryDd6g.js → ui-ndvNkmb_.js} +3 -3
  80. package/esm/ui.d.ts +2 -2
  81. package/esm/ui.js +3 -3
  82. package/esm/vue.d.ts +5 -5
  83. package/esm/vue.js +4 -4
  84. package/package.json +1 -1
package/bin/calmlens.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import { readFile as readFile2 } from "node:fs/promises";
4
4
  import { parseArgs } from "node:util";
5
5
  // package.json
6
- var version = "0.22.0";
6
+ var version = "0.23.1";
7
7
 
8
8
  // src/contract/ModerationCategories-CHFRoeWV.js
9
9
  var CLASSIFICATION_CATEGORIES = [
@@ -743,20 +743,6 @@ var TRANSFORM_OPTIONS_SCHEMA = {
743
743
  blur: {
744
744
  type: "number"
745
745
  },
746
- redact: {
747
- type: "object",
748
- properties: {
749
- text: {
750
- type: "boolean"
751
- },
752
- personalInformation: {
753
- type: "boolean"
754
- },
755
- faces: {
756
- type: "boolean"
757
- }
758
- }
759
- },
760
746
  border: {
761
747
  type: "object",
762
748
  properties: {
@@ -972,6 +958,9 @@ var validateServerClientOptions = (options) => {
972
958
  if (!options.apiKey || typeof options.apiKey !== "string") {
973
959
  throw invalidConfig("API key is required");
974
960
  }
961
+ if (!/^[\x21-\x7e]+$/.test(options.apiKey)) {
962
+ throw invalidConfig("API key must be printable ASCII without spaces");
963
+ }
975
964
  if (!options.projectId)
976
965
  throw invalidConfig("Project ID is required");
977
966
  configPathSegment(options.projectId, "Project ID");
@@ -2140,7 +2129,7 @@ var getEnsureLensCacheKey = (options) => stringifyJsonCanonical({
2140
2129
  name: options.name,
2141
2130
  description: options.description ?? null,
2142
2131
  type: options.type,
2143
- active: options.active,
2132
+ active: options.active ?? true,
2144
2133
  transform: options.transform ?? null
2145
2134
  });
2146
2135
  var requireId = (value, name) => encodePathSegment(value, name);
@@ -2161,6 +2150,22 @@ var assertNewCursor = (sent, cursor) => {
2161
2150
  sent.add(cursor);
2162
2151
  };
2163
2152
  var inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
2153
+ var writableCdnResponse = (response, metadata = response) => {
2154
+ if (response.status < 200)
2155
+ return response;
2156
+ const writable = new Response(response.body, response);
2157
+ const { url, redirected, type } = metadata;
2158
+ return Object.defineProperties(writable, {
2159
+ url: { value: url },
2160
+ redirected: { value: redirected },
2161
+ type: { value: type },
2162
+ clone: {
2163
+ value() {
2164
+ return writableCdnResponse(Response.prototype.clone.call(this), { url, redirected, type });
2165
+ }
2166
+ }
2167
+ });
2168
+ };
2164
2169
 
2165
2170
  class CalmLensServerClient {
2166
2171
  #apiKey;
@@ -2265,7 +2270,7 @@ class CalmLensServerClient {
2265
2270
  deadline: "headers",
2266
2271
  fetch: this.#settings.cdnFetch
2267
2272
  }, { allowHttpErrors: true });
2268
- return response;
2273
+ return writableCdnResponse(response);
2269
2274
  }
2270
2275
  };
2271
2276
  }
@@ -7328,7 +7333,7 @@ function superRefine(fn, params) {
7328
7333
  return _superRefine(fn, params);
7329
7334
  }
7330
7335
 
7331
- // src/contract/Jurisdiction-LWQvqyxL.js
7336
+ // src/contract/Jurisdiction-CtB_d_2M.js
7332
7337
  var JURISDICTIONS = {
7333
7338
  global: {
7334
7339
  name: "Global",
@@ -7381,10 +7386,10 @@ var VIEWER_REGION_SCHEMA = _enum([...COUNTRIES]).describe("Viewer's ISO 3166-1 a
7381
7386
  var EU_COUNTRIES2 = new Set("AT BE BG HR CY CZ DK EE FI FR DE GR HU IE IT LV LT LU MT NL PL PT RO SK SI ES SE".split(" "));
7382
7387
  var VIEWER_CLAIMS_SCHEMA = object({
7383
7388
  region: VIEWER_REGION_SCHEMA.optional().describe("Viewer country. Defaults to the country of the connection reaching CalmLens; proxies should forward the viewer country explicitly."),
7384
- ageConfirmed: boolean2().optional().describe("Your platform's confirmation that the viewer passed its age check, so age-restricted content may be delivered. Defaults to false. Your platform confirms the viewer's age; CalmLens does not verify this claim. Anyone requesting an asset's URL, public or signed, can set it: a signed URL's signature does not cover viewer claims, so the claim is not an access control. To restrict who can load an age-restricted asset, make it private and issue signed URLs only to viewers who passed your age check.")
7389
+ ageConfirmed: boolean2().optional().describe("Your platform's confirmation that the viewer passed its age check, so age-restricted content may be delivered. Defaults to false. Your platform confirms the viewer's age. Viewer claims are assertions from your application; CalmLens doesn't verify them. To restrict who can load an age-restricted asset, make it private and issue signed URLs only to viewers who passed your age check.")
7385
7390
  }).strict();
7386
7391
 
7387
- // src/contract/TestRegionalActions-C2mw3ntb.js
7392
+ // src/contract/TestRegionalActions-DUzwPr1a.js
7388
7393
  var msg = (text) => text;
7389
7394
  var MODERATION_QUALIFIER_INFO = {
7390
7395
  "sexual-pornographic-media": {
@@ -7794,6 +7799,13 @@ var MODERATION_QUALIFIER_INFO = {
7794
7799
  description: msg("Qualifying content clearly attributed to an invented character, fictional story, game, illustration, generated image or reenacted scene."),
7795
7800
  exclusions: "Unclear fictional context, and a real-world threat or actionable harmful request presented as fiction."
7796
7801
  },
7802
+ "sexual-artistic": {
7803
+ category: "sexual",
7804
+ kind: "context",
7805
+ displayName: msg("Artwork"),
7806
+ description: msg("Qualifying content that is a work of art presented as art, such as a painting, sculpture, print, poem or stage or film scene, or a critic, guide or lecturer talking about one, and not made to arouse."),
7807
+ exclusions: "Content meant to arouse, whatever it is called; pornography, erotic illustration, hentai and generated images; photographs labelled as art; adult content promotion."
7808
+ },
7797
7809
  "sexual-support-prevention": {
7798
7810
  category: "sexual",
7799
7811
  kind: "context",
@@ -8402,7 +8414,7 @@ var TEST_REGIONAL_ACTIONS_SCHEMA = array(object({
8402
8414
  ])
8403
8415
  }).strict()).max(7).refine((entries) => new Set(entries.map((entry) => entry.region)).size === entries.length, "Choose each region once");
8404
8416
 
8405
- // src/contract/TestTriggers-D29T_R0M.js
8417
+ // src/contract/TestTriggers-CiFcTHX3.js
8406
8418
  var TEST_IMAGE_GRID_LEVELS = [
8407
8419
  72,
8408
8420
  128,
@@ -8449,7 +8461,10 @@ function testInputForSignal(signal, kind = "text") {
8449
8461
  case "sexual.adult":
8450
8462
  return kind === "image" ? TEST_INPUT_PRESETS.adultImage : TEST_INPUT_PRESETS.adultText;
8451
8463
  case "hate.regional-symbol":
8452
- return TEST_INPUT_PRESETS.germany;
8464
+ return { instances: [{
8465
+ category: "hate",
8466
+ qualifiers: ["hate-symbol", "hate-nazi-symbols-public-display"]
8467
+ }] };
8453
8468
  case "sexual.involving-minors":
8454
8469
  return { instances: [{
8455
8470
  category: "sexual",
@@ -8558,10 +8573,13 @@ var TEST_INPUT_PRESETS = {
8558
8573
  }
8559
8574
  ]
8560
8575
  },
8561
- germany: { instances: [{
8562
- category: "hate",
8563
- qualifiers: ["hate-symbol", "hate-nazi-symbols-public-display"]
8564
- }] },
8576
+ germany: {
8577
+ instances: [],
8578
+ regionalActions: [{
8579
+ region: "DE",
8580
+ action: "block"
8581
+ }]
8582
+ },
8565
8583
  mixed: { instances: [{
8566
8584
  category: "harassment",
8567
8585
  qualifiers: ["harassment-abuse", "harassment-documentary"]
@@ -1,5 +1,5 @@
1
- import { F as UploadItem$1, I as UploadSnapshot$1, M as UploadController, N as UploadControllerOptions$1, O as CalmLensUpload$1, P as UploadFile, h as UploaderProps$1 } from "./Core-C33pkBmf.js";
2
- import { t as UseCalmLensUploadResult$1 } from "./ReactUpload-DhF8mm51.js";
1
+ import { F as UploadItem$1, I as UploadSnapshot$1, M as UploadController, N as UploadControllerOptions$1, O as CalmLensUpload$1, P as UploadFile, h as UploaderProps$1 } from "./Core-Dt_HUNvH.js";
2
+ import { t as UseCalmLensUploadResult$1 } from "./ReactUpload-Bd7Hea4w.js";
3
3
  type UploadItem<F extends UploadFile = File> = UploadItem$1<F>;
4
4
  type CalmLensUpload<F extends UploadFile = File> = CalmLensUpload$1<F>;
5
5
  type UploadSnapshot<F extends UploadFile = File> = UploadSnapshot$1<F>;
@@ -1,4 +1,4 @@
1
- const require_UploadController = require("./UploadController-l8fZM2qT.js");
1
+ const require_UploadController = require("./UploadController-Bh2bqt8N.js");
2
2
  // src/ui/BrowserUpload.ts
3
3
  /** Creates an upload queue for the browser components, such as one a form starts on submit. */
4
4
  const createUploadController = (options) => require_UploadController.createUploadController(options);
@@ -1,4 +1,4 @@
1
- import { D as CalmLensAppClientOptions, Lt as RetrieveAssetOptions, an as UploadedAsset, en as UploadAssetPartOptions, in as UploadPresetSubmitAssetOptions, j as CdnAssetUrlOptions } from "./CalmLensTypes-BDKwThbO.js";
1
+ import { D as CalmLensAppClientOptions, Lt as RetrieveAssetOptions, an as UploadedAsset, en as UploadAssetPartOptions, in as UploadPresetSubmitAssetOptions, j as CdnAssetUrlOptions } from "./CalmLensTypes-SmOCgKI3.js";
2
2
  declare const inspectSymbol: unique symbol;
3
3
  /**
4
4
  * The CalmLens client for browsers and React Native apps. It uploads through an upload preset,
@@ -1,5 +1,5 @@
1
- const require_ModerationContextLimits = require("./ModerationContextLimits-ud1xpZRK.js");
2
- const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-YvgV995V.js");
1
+ const require_ModerationContextLimits = require("./ModerationContextLimits-C6Ts1Xhw.js");
2
+ const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-B4gAOSbY.js");
3
3
  // src/client/CalmLensAppClient.ts
4
4
  const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
5
5
  /** `options`, once `checkOptionKeys` finds only keys `operation` takes. */
@@ -1,4 +1,4 @@
1
- const require_ModerationContextLimits = require("./ModerationContextLimits-ud1xpZRK.js");
1
+ const require_ModerationContextLimits = require("./ModerationContextLimits-C6Ts1Xhw.js");
2
2
  // src/contract/AssetPayload.js
3
3
  const bufferInputToBytes = (value) => {
4
4
  if (value instanceof ArrayBuffer) return new Uint8Array(value);
@@ -1,6 +1,6 @@
1
- import { d as HashListEntry, u as HashList } from "./Classification-Q5zGpR8l-CEWjnE39.js";
2
- import { $ as GetAssetInfoOptions, $t as UpgradePolicyOptions, Bt as SetPolicyAutomaticUpdatesOptions, Ct as ListHashListEntriesOptions, Dt as ListUploadPresetsOptions, E as BatchAssetsResponse, En as ProjectSettingsResource, Et as ListPoliciesOptions, F as ClassifyTextOptions, Ft as RequestOptions, G as EnsureLensOptions, H as DecideAssetOptions, Ht as SignUploadTokenOptions, It as ResetPolicyOptions, J as EnsureUploadPresetsOptions, Jt as UpdateFolderOptions, K as EnsureLensesOptions, Kt as SubmitAssetOptions, L as CreateFolderOptions, Ln as Policy, Lt as RetrieveAssetOptions, Mt as PolicyIdOptions, N as CdnServeOptions, Nt as PolicyPage, O as CalmLensServerClientOptions, On as UploadPreset, Ot as MoveAssetOptions, Pt as RemoveAssetContentOptions, Q as FolderPage, Qt as UpdateProjectSettingsOptions, R as CreateHashListOptions, Rt as RetryAssetOptions, St as ListFoldersOptions, T as BatchAssetsOptions, Tn as MetadataFieldsResource, Tt as ListLensesOptions, U as DeleteAssetOptions, Un as AssetInfo, Ut as SignedAssetUrl, V as CreatePolicyOptions, Vn as AssetSearchQuery, Vt as SignAssetUrlOptions, W as DeleteMetadataFieldOptions, Wt as SignedUploadToken, X as ExplainAssetOptions, Xt as UpdateLensOptions, Y as EnsureUploadPresetsResponse, Yt as UpdateHashListOptions, Z as FolderIdOptions, Zt as UpdatePolicyOptions, _ as AssetSearchResponse, _t as LensPage, a as AssetChildrenPage, bt as ListAssetsOptions, cn as WaitForAssetDecisionOptions, ct as IterateAssetsOptions, dt as IterateHashListsOptions, en as UploadAssetPartOptions, et as HashListEntryIdOptions, ft as IterateLensesOptions, g as AssetPage, gt as LensIdOptions, ht as Lens, j as CdnAssetUrlOptions, kt as MoveFolderOptions, lt as IterateFoldersOptions, mt as IterateUploadPresetsOptions, n as Asset, nn as UploadPresetIdOptions, nt as HashListIdOptions, on as VerifyWebhookSignatureOptions, ot as IterateAssetChildrenOptions, pn as GetEventsResponse, pt as IteratePoliciesOptions, q as EnsureMetadataFieldsOptions, qt as UpdateAssetOptions, rn as UploadPresetPage, rt as HashListPage, st as IterateAssetTimelineOptions, t as AddHashListEntryOptions, tt as HashListEntryPage, ut as IterateHashListEntriesOptions, vt as ListAssetChildrenOptions, w as AssignPolicyOptions, wn as Folder, wt as ListHashListsOptions, xt as ListEventsOptions, y as AssetTimelinePage, yt as ListAssetTimelineOptions, z as CreateLensOptions } from "./CalmLensTypes-BDKwThbO.js";
3
- import "./WebhookPayload-Dt6DttS0.js";
1
+ import { d as HashListEntry, u as HashList } from "./Classification-CxRedzgH-C9qlYW_J.js";
2
+ import { $ as GetAssetInfoOptions, $t as UpgradePolicyOptions, Bt as SetPolicyAutomaticUpdatesOptions, Ct as ListHashListEntriesOptions, Dt as ListUploadPresetsOptions, E as BatchAssetsResponse, En as ProjectSettingsResource, Et as ListPoliciesOptions, F as ClassifyTextOptions, Ft as RequestOptions, G as EnsureLensOptions, H as DecideAssetOptions, Ht as SignUploadTokenOptions, It as ResetPolicyOptions, J as EnsureUploadPresetsOptions, Jt as UpdateFolderOptions, K as EnsureLensesOptions, Kt as SubmitAssetOptions, L as CreateFolderOptions, Ln as Policy, Lt as RetrieveAssetOptions, Mt as PolicyIdOptions, N as CdnServeOptions, Nt as PolicyPage, O as CalmLensServerClientOptions, On as UploadPreset, Ot as MoveAssetOptions, Pt as RemoveAssetContentOptions, Q as FolderPage, Qt as UpdateProjectSettingsOptions, R as CreateHashListOptions, Rt as RetryAssetOptions, St as ListFoldersOptions, T as BatchAssetsOptions, Tn as MetadataFieldsResource, Tt as ListLensesOptions, U as DeleteAssetOptions, Un as AssetInfo, Ut as SignedAssetUrl, V as CreatePolicyOptions, Vn as AssetSearchQuery, Vt as SignAssetUrlOptions, W as DeleteMetadataFieldOptions, Wt as SignedUploadToken, X as ExplainAssetOptions, Xt as UpdateLensOptions, Y as EnsureUploadPresetsResponse, Yt as UpdateHashListOptions, Z as FolderIdOptions, Zt as UpdatePolicyOptions, _ as AssetSearchResponse, _t as LensPage, a as AssetChildrenPage, bt as ListAssetsOptions, cn as WaitForAssetDecisionOptions, ct as IterateAssetsOptions, dt as IterateHashListsOptions, en as UploadAssetPartOptions, et as HashListEntryIdOptions, ft as IterateLensesOptions, g as AssetPage, gt as LensIdOptions, ht as Lens, j as CdnAssetUrlOptions, kt as MoveFolderOptions, lt as IterateFoldersOptions, mt as IterateUploadPresetsOptions, n as Asset, nn as UploadPresetIdOptions, nt as HashListIdOptions, on as VerifyWebhookSignatureOptions, ot as IterateAssetChildrenOptions, pn as GetEventsResponse, pt as IteratePoliciesOptions, q as EnsureMetadataFieldsOptions, qt as UpdateAssetOptions, rn as UploadPresetPage, rt as HashListPage, st as IterateAssetTimelineOptions, t as AddHashListEntryOptions, tt as HashListEntryPage, ut as IterateHashListEntriesOptions, vt as ListAssetChildrenOptions, w as AssignPolicyOptions, wn as Folder, wt as ListHashListsOptions, xt as ListEventsOptions, y as AssetTimelinePage, yt as ListAssetTimelineOptions, z as CreateLensOptions } from "./CalmLensTypes-SmOCgKI3.js";
3
+ import "./WebhookPayload-C7KAk3iR.js";
4
4
  interface LensCache {
5
5
  readonly ensuredLenses: Map<string, Lens>;
6
6
  readonly pendingEnsureLenses: Map<string, Promise<void>>;
@@ -51,8 +51,7 @@ declare class CalmLensServerClient {
51
51
  * Builds an asset's CDN URL without a request: the asset URL, which every resource is a path
52
52
  * beneath, or a resource URL when `resource` is given, with its lens or transform and the
53
53
  * viewer claims. Use it for public assets; private ones need `cdn.signAssetUrl`. Viewer
54
- * claims are your app's unsigned assertions: CalmLens does not verify an age confirmation,
55
- * and anyone holding the URL can add it.
54
+ * claims are assertions from your app; CalmLens doesn't verify them.
56
55
  */
57
56
  getAssetUrl: (urlOptions: CdnAssetUrlOptions) => string;
58
57
  /**
@@ -72,8 +71,8 @@ declare class CalmLensServerClient {
72
71
  getAssetInfo: (url: string, options?: Omit<GetAssetInfoOptions, "fetch">) => Promise<AssetInfo>;
73
72
  /**
74
73
  * Fetches asset content or a preview from the CDN with the client's API key, and returns
75
- * the `Response` as soon as headers arrive, so the body streams. Non-2xx responses are
76
- * returned, not thrown; `timeoutMs` covers only the wait for headers.
74
+ * a `Response` with writable headers as soon as headers arrive, so the body streams.
75
+ * Non-2xx responses are returned, not thrown; `timeoutMs` covers only the wait for headers.
77
76
  */
78
77
  serve: (options: CdnServeOptions) => Promise<Response>;
79
78
  };
@@ -118,8 +117,9 @@ declare class CalmLensServerClient {
118
117
  */
119
118
  create: (options: SubmitAssetOptions) => Promise<Asset>;
120
119
  /**
121
- * Uploads an asset and waits for its moderation decision. Audio and video still finish
122
- * in the background. Retried safely with an `Idempotency-Key`.
120
+ * Uploads an asset and waits for its moderation decision. Documents, websites, audio, video
121
+ * and files over 20 MiB sent in parts still finish in the background and return `pending`.
122
+ * Retried safely with an `Idempotency-Key`.
123
123
  */
124
124
  classify: (classifyOptions: SubmitAssetOptions) => Promise<Asset>;
125
125
  /**
@@ -1,5 +1,5 @@
1
- const require_ModerationContextLimits = require("./ModerationContextLimits-ud1xpZRK.js");
2
- const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-YvgV995V.js");
1
+ const require_ModerationContextLimits = require("./ModerationContextLimits-C6Ts1Xhw.js");
2
+ const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-B4gAOSbY.js");
3
3
  const require_CryptoUtils_B_x8lMIx = require("./CryptoUtils-B_x8lMIx-YBW1-bvL.js");
4
4
  // src/contract/JsonUtils.js
5
5
  const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
@@ -189,7 +189,7 @@ const getEnsureLensCacheKey = (options) => stringifyJsonCanonical({
189
189
  name: options.name,
190
190
  description: options.description ?? null,
191
191
  type: options.type,
192
- active: options.active,
192
+ active: options.active ?? true,
193
193
  transform: options.transform ?? null
194
194
  });
195
195
  const requireId = (value, name) => require_ModerationContextLimits.encodePathSegment(value, name);
@@ -215,6 +215,23 @@ const assertNewCursor = (sent, cursor) => {
215
215
  sent.add(cursor);
216
216
  };
217
217
  const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
218
+ const writableCdnResponse = (response, metadata = response) => {
219
+ if (response.status < 200) return response;
220
+ const writable = new Response(response.body, response);
221
+ const { url, redirected, type } = metadata;
222
+ return Object.defineProperties(writable, {
223
+ url: { value: url },
224
+ redirected: { value: redirected },
225
+ type: { value: type },
226
+ clone: { value() {
227
+ return writableCdnResponse(Response.prototype.clone.call(this), {
228
+ url,
229
+ redirected,
230
+ type
231
+ });
232
+ } }
233
+ });
234
+ };
218
235
  /**
219
236
  * The CalmLens API client for your server, authenticated with a project API key. Create one per
220
237
  * project and reuse it; it holds no connections. Every method takes one options object and
@@ -318,8 +335,7 @@ var CalmLensServerClient = class CalmLensServerClient {
318
335
  * Builds an asset's CDN URL without a request: the asset URL, which every resource is a path
319
336
  * beneath, or a resource URL when `resource` is given, with its lens or transform and the
320
337
  * viewer claims. Use it for public assets; private ones need `cdn.signAssetUrl`. Viewer
321
- * claims are your app's unsigned assertions: CalmLens does not verify an age confirmation,
322
- * and anyone holding the URL can add it.
338
+ * claims are assertions from your app; CalmLens doesn't verify them.
323
339
  */
324
340
  getAssetUrl: (urlOptions) => {
325
341
  const { projectId, ...options } = checked("cdn.getAssetUrl", urlOptions);
@@ -360,8 +376,8 @@ var CalmLensServerClient = class CalmLensServerClient {
360
376
  }),
361
377
  /**
362
378
  * Fetches asset content or a preview from the CDN with the client's API key, and returns
363
- * the `Response` as soon as headers arrive, so the body streams. Non-2xx responses are
364
- * returned, not thrown; `timeoutMs` covers only the wait for headers.
379
+ * a `Response` with writable headers as soon as headers arrive, so the body streams.
380
+ * Non-2xx responses are returned, not thrown; `timeoutMs` covers only the wait for headers.
365
381
  */
366
382
  serve: async (options) => {
367
383
  const { init, resource = "rendered", ...urlOptions } = checked("cdn.serve", options);
@@ -378,7 +394,7 @@ var CalmLensServerClient = class CalmLensServerClient {
378
394
  deadline: "headers",
379
395
  fetch: this.#settings.cdnFetch
380
396
  }, { allowHttpErrors: true });
381
- return response;
397
+ return writableCdnResponse(response);
382
398
  }
383
399
  };
384
400
  }
@@ -473,8 +489,9 @@ sign: async (options) => {
473
489
  */
474
490
  create: async (options) => this.submitAsset(checked("assets.create", options), false),
475
491
  /**
476
- * Uploads an asset and waits for its moderation decision. Audio and video still finish
477
- * in the background. Retried safely with an `Idempotency-Key`.
492
+ * Uploads an asset and waits for its moderation decision. Documents, websites, audio, video
493
+ * and files over 20 MiB sent in parts still finish in the background and return `pending`.
494
+ * Retried safely with an `Idempotency-Key`.
478
495
  */
479
496
  classify: async (classifyOptions) => {
480
497
  const options = checked("assets.classify", classifyOptions);