calmlens 0.18.3 → 0.19.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 (82) hide show
  1. package/bin/calmlens.js +5373 -5002
  2. package/cjs/{BrowserUpload-UxIAGNdv.js → BrowserUpload-CJ4Xc9bR.js} +1 -1
  3. package/cjs/{BrowserUpload-BT091eOB.d.ts → BrowserUpload-RkxV_Vv7.d.ts} +2 -2
  4. package/{esm/CalmLensAppClient-CV_K26Ce.d.ts → cjs/CalmLensAppClient-B5gfOB6J.d.ts} +3 -3
  5. package/cjs/{CalmLensAppClient-D6p7MAFz.js → CalmLensAppClient-LHMEQ-UZ.js} +32 -11
  6. package/cjs/{CalmLensConnection-CYoUl5go.js → CalmLensOptionKeys-BUj7v5AG.js} +368 -8
  7. package/cjs/{CalmLensServerClient-p23cl97D.js → CalmLensServerClient-BVOEUT_v.js} +167 -54
  8. package/cjs/{CalmLensServerClient-JtP687a3.d.ts → CalmLensServerClient-DCSbwIBs.d.ts} +53 -29
  9. package/cjs/{CalmLensTypes-9Vt16pc7.d.ts → CalmLensTypes-DpU-hXq2.d.ts} +2677 -30
  10. package/cjs/{ModerationContextLimits-DCLXMxyA.js → ModerationContextLimits-FDpQmw_T.js} +195 -41
  11. package/cjs/{ReactUpload-BcdNWLiU.js → ReactUpload-BvpW4hJi.js} +1 -1
  12. package/cjs/{ReactUpload-CAyCsyG6.d.ts → ReactUpload-huIMnOJ4.d.ts} +1 -1
  13. package/cjs/{TestTriggers-DTc_iMJF-BjMPq4_3.js → TestTriggers-CMwMrbjy-K0YBzu2a.js} +433 -73
  14. package/{esm/TestTriggers-By07LR31-CmK0yTyR.d.ts → cjs/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts} +13 -7
  15. package/cjs/{UploadController-Cxu0bufo.js → UploadController-D4qOZZc3.js} +17 -5
  16. package/{esm/WebhookPayload-2aL31v0J.d.ts → cjs/WebhookPayload-CQg8BBZQ.d.ts} +29 -3
  17. package/cjs/app.d.ts +6 -6
  18. package/cjs/app.js +2 -2
  19. package/cjs/elements.d.ts +3 -3
  20. package/cjs/elements.js +3 -3
  21. package/cjs/{index-CI4BzN4W.d.ts → index-BcDDQJF2.d.ts} +7 -6
  22. package/cjs/index.d.ts +5 -5
  23. package/cjs/index.js +1 -1
  24. package/cjs/react-native.d.ts +3 -3
  25. package/cjs/react-native.js +3 -3
  26. package/cjs/react.d.ts +3 -3
  27. package/cjs/react.js +4 -4
  28. package/cjs/server.d.ts +6 -6
  29. package/cjs/server.js +2 -2
  30. package/cjs/test-inputs.d.ts +1 -1
  31. package/cjs/test-inputs.js +9 -9
  32. package/cjs/testing.d.ts +7 -6
  33. package/cjs/testing.js +189 -29
  34. package/{esm/ui-wIiMfqMB.d.ts → cjs/ui-B23r8BvW.d.ts} +17 -4
  35. package/cjs/{ui-C0XXJS52.js → ui-Dq-cm6Rx.js} +13 -10
  36. package/cjs/ui.d.ts +2 -2
  37. package/cjs/ui.js +2 -2
  38. package/cjs/vue.d.ts +5 -5
  39. package/cjs/vue.js +3 -3
  40. package/esm/{BrowserUpload-BXG2isHV.js → BrowserUpload-DpzS2bbj.js} +1 -1
  41. package/esm/{BrowserUpload-BT091eOB.d.ts → BrowserUpload-RkxV_Vv7.d.ts} +2 -2
  42. package/{cjs/CalmLensAppClient-CV_K26Ce.d.ts → esm/CalmLensAppClient-B5gfOB6J.d.ts} +3 -3
  43. package/esm/{CalmLensAppClient-BMgXamoN.js → CalmLensAppClient-BjlvBweS.js} +28 -7
  44. package/esm/{CalmLensConnection-DBoDh06c.js → CalmLensOptionKeys-BKez0Wiw.js} +351 -9
  45. package/esm/{CalmLensServerClient-JtP687a3.d.ts → CalmLensServerClient-DCSbwIBs.d.ts} +53 -29
  46. package/esm/{CalmLensServerClient-Dt7rCITa.js → CalmLensServerClient-DemxbNMn.js} +159 -46
  47. package/esm/{CalmLensTypes-9Vt16pc7.d.ts → CalmLensTypes-DpU-hXq2.d.ts} +2677 -30
  48. package/esm/{ModerationContextLimits-KMQ8puoa.js → ModerationContextLimits-lLfmyLni.js} +176 -40
  49. package/esm/{ReactUpload-CFy_wETY.js → ReactUpload-6klucehl.js} +1 -1
  50. package/esm/{ReactUpload-CAyCsyG6.d.ts → ReactUpload-huIMnOJ4.d.ts} +1 -1
  51. package/esm/{TestTriggers-DTc_iMJF-HfB533Gx.js → TestTriggers-CMwMrbjy-bdowBBKw.js} +404 -71
  52. package/{cjs/TestTriggers-By07LR31-CmK0yTyR.d.ts → esm/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts} +13 -7
  53. package/esm/{UploadController-Cs-bxUbt.js → UploadController-UxP6gj7A.js} +17 -5
  54. package/{cjs/WebhookPayload-2aL31v0J.d.ts → esm/WebhookPayload-CQg8BBZQ.d.ts} +29 -3
  55. package/esm/app.d.ts +6 -6
  56. package/esm/app.js +2 -2
  57. package/esm/elements.d.ts +3 -3
  58. package/esm/elements.js +3 -3
  59. package/esm/{index-CI4BzN4W.d.ts → index-BcDDQJF2.d.ts} +7 -6
  60. package/esm/index.d.ts +5 -5
  61. package/esm/index.js +1 -1
  62. package/esm/react-native.d.ts +3 -3
  63. package/esm/react-native.js +3 -3
  64. package/esm/react.d.ts +3 -3
  65. package/esm/react.js +4 -4
  66. package/esm/server.d.ts +6 -6
  67. package/esm/server.js +2 -2
  68. package/esm/test-inputs.d.ts +1 -1
  69. package/esm/test-inputs.js +1 -1
  70. package/esm/testing.d.ts +7 -6
  71. package/esm/testing.js +178 -17
  72. package/{cjs/ui-wIiMfqMB.d.ts → esm/ui-B23r8BvW.d.ts} +17 -4
  73. package/esm/{ui-BqYkISSE.js → ui-Bn29rfAi.js} +12 -9
  74. package/esm/ui.d.ts +2 -2
  75. package/esm/ui.js +2 -2
  76. package/esm/vue.d.ts +5 -5
  77. package/esm/vue.js +3 -3
  78. package/package.json +1 -1
  79. package/cjs/Jurisdiction-FusEXb4U-zVs21tDv.js +0 -91
  80. package/esm/Jurisdiction-FusEXb4U-1ov6m5yE.js +0 -46
  81. /package/cjs/{Classification-94kSYWZw-CMnQKW13.d.ts → Classification-D3SkprrQ-CMnQKW13.d.ts} +0 -0
  82. /package/esm/{Classification-94kSYWZw-CMnQKW13.d.ts → Classification-D3SkprrQ-CMnQKW13.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
- const require_ModerationContextLimits = require("./ModerationContextLimits-DCLXMxyA.js");
2
- const require_CalmLensConnection = require("./CalmLensConnection-CYoUl5go.js");
1
+ const require_ModerationContextLimits = require("./ModerationContextLimits-FDpQmw_T.js");
2
+ const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-BUj7v5AG.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) => {
@@ -142,10 +142,15 @@ const getEnsureLensCacheKey = (options) => stringifyJsonCanonical({
142
142
  description: options.description ?? null,
143
143
  type: options.type,
144
144
  active: options.active,
145
- transforms: options.transforms ?? null,
145
+ transform: options.transform ?? null,
146
146
  version: options.version
147
147
  });
148
148
  const requireId = (value, name) => require_ModerationContextLimits.encodePathSegment(value, name);
149
+ /** `options`, once `checkOptionKeys` finds only keys `operation` takes. */
150
+ const checked = (operation, options) => {
151
+ require_ModerationContextLimits.checkOptionKeys(options, operation, require_CalmLensOptionKeys.SERVER_OPTION_KEYS);
152
+ return options;
153
+ };
149
154
  /**
150
155
  * Iterators stop rather than loop: a page that says more follow must not hand back a cursor this
151
156
  * iteration has already sent, which would repeat the same pages forever.
@@ -193,14 +198,14 @@ var CalmLensServerClient = class CalmLensServerClient {
193
198
  const { apiKey, ...rest } = options;
194
199
  this.#apiKey = apiKey;
195
200
  this.#settings = {
196
- ...require_CalmLensConnection.resolveConnectionOptions(rest),
197
- cdnBaseUrl: (rest.cdnBaseUrl ?? require_CalmLensConnection.getMockHooks(rest)?.defaultCdnBaseUrl ?? require_ModerationContextLimits.DEFAULT_CDN_BASE_URL).replace(/\/+$/, "")
201
+ ...require_CalmLensOptionKeys.resolveConnectionOptions(rest),
202
+ cdnBaseUrl: (rest.cdnBaseUrl ?? require_CalmLensOptionKeys.getMockHooks(rest)?.defaultCdnBaseUrl ?? require_ModerationContextLimits.DEFAULT_CDN_BASE_URL).replace(/\/+$/, "")
198
203
  };
199
204
  this.#lenses = lenses ?? {
200
205
  ensuredLenses: /* @__PURE__ */ new Map(),
201
206
  pendingEnsureLenses: /* @__PURE__ */ new Map()
202
207
  };
203
- this.#connection = new require_CalmLensConnection.CalmLensConnection(this.#settings, apiKey);
208
+ this.#connection = new require_CalmLensOptionKeys.CalmLensConnection(this.#settings, apiKey);
204
209
  }
205
210
  /**
206
211
  * A client with different cancellation, deadlines or retries for the calls made through it,
@@ -234,25 +239,35 @@ var CalmLensServerClient = class CalmLensServerClient {
234
239
  return this.#connection.json(method, path, options);
235
240
  }
236
241
  async submitAsset(options, queue) {
237
- const body = require_CalmLensConnection.prepareSubmitAssetOptions(options, { deferUploadChecks: this.#connection.deferUploadChecks });
242
+ const body = require_CalmLensOptionKeys.prepareSubmitAssetOptions(options, {
243
+ deferUploadChecks: this.#connection.deferUploadChecks,
244
+ partSizeBytes: this.#connection.partSizeBytes
245
+ });
238
246
  const uploadsPath = `${this.projectPath}/assets`;
239
- if ("content" in body || "part" in body) return require_CalmLensConnection.expectAsset(await this.#connection.submitRawUpload(uploadsPath, body, queue));
247
+ if ("content" in body && require_CalmLensOptionKeys.splitsIntoParts(body.content, this.#connection.partSizeBytes)) return require_CalmLensOptionKeys.expectAsset(await this.#connection.submitInParts(uploadsPath, body, queue, {
248
+ partPath: (assetId) => `/assets/${encodeURIComponent(assetId)}/part`,
249
+ retrieve: (assetId) => this.buildAssets().retrieve({ assetId })
250
+ }));
251
+ if ("content" in body || "part" in body) return require_CalmLensOptionKeys.expectAsset(await this.#connection.submitRawUpload(uploadsPath, body, queue));
240
252
  const { idempotencyKey, ...fields } = body;
241
253
  const data = await this.#connection.json("POST", uploadsPath, {
242
254
  query: { queue },
243
255
  body: fields,
244
- idempotencyKey: idempotencyKey ?? require_CalmLensConnection.newIdempotencyKey()
256
+ idempotencyKey: idempotencyKey ?? require_CalmLensOptionKeys.newIdempotencyKey()
245
257
  });
246
- return require_CalmLensConnection.expectAsset(data);
258
+ return require_CalmLensOptionKeys.expectAsset(data);
247
259
  }
248
260
  get cdn() {
249
261
  return {
250
262
  /**
251
263
  * Builds a CDN URL for asset content or a preview, without a request. Private assets
252
264
  * need a signed URL (`assets.createSignedUrl`) or an authenticated request; public
253
- * age-restricted assets additionally require `viewerClaims.ageConfirmed: true`.
265
+ * age-restricted assets additionally require `viewerClaims.ageConfirmed: true`. Your
266
+ * platform confirms the viewer's age; CalmLens does not verify this claim, and anyone can
267
+ * add it to a public URL.
254
268
  */
255
- getAssetUrl: ({ assetIdentifier, ...options }) => {
269
+ getAssetUrl: (urlOptions) => {
270
+ const { assetIdentifier, ...options } = checked("cdn.getAssetUrl", urlOptions);
256
271
  const { projectId, cdnBaseUrl } = this.#settings;
257
272
  return require_ModerationContextLimits.getAssetUrl({
258
273
  projectId,
@@ -266,7 +281,8 @@ var CalmLensServerClient = class CalmLensServerClient {
266
281
  * the `Response` as soon as headers arrive, so the body streams. Non-2xx responses are
267
282
  * returned, not thrown; `timeoutMs` covers only the wait for headers.
268
283
  */
269
- serve: async ({ assetIdentifier, init, ...urlOptions }) => {
284
+ serve: async (options) => {
285
+ const { assetIdentifier, init, ...urlOptions } = checked("cdn.serve", options);
270
286
  const url = this.cdn.getAssetUrl({
271
287
  assetIdentifier,
272
288
  ...urlOptions
@@ -290,7 +306,7 @@ var CalmLensServerClient = class CalmLensServerClient {
290
306
  * Moderates text and waits for the decision. Sends `text` as `text/plain` content named
291
307
  * `text` unless you pass `name`.
292
308
  */
293
- classify: async (options) => this.buildAssets().classify(require_ModerationContextLimits.toTextAssetOptions(options)) };
309
+ classify: async (options) => this.buildAssets().classify(require_ModerationContextLimits.toTextAssetOptions(checked("text.classify", options))) };
294
310
  }
295
311
  /** Assets: uploads, moderation and management. */
296
312
  get assets() {
@@ -307,31 +323,44 @@ classify: async (options) => this.buildAssets().classify(require_ModerationConte
307
323
  * browser or app, which passes it to `CalmLensAppClient` as `token`.
308
324
  */
309
325
  sign: async (options) => {
310
- return signUploadTokenWithApiKey(this.#apiKey, options, this.#connection.hooks?.uploadTokenTime());
326
+ return signUploadTokenWithApiKey(this.#apiKey, checked("uploadTokens.sign", options), this.#connection.hooks?.uploadTokenTime());
311
327
  } };
312
328
  }
313
329
  buildAssets() {
314
330
  return {
315
331
  /** Searches accessible assets by keyword or a natural-language description. */
316
- search: async (options) => this.request("GET", `${this.projectPath}/assets/search`, { query: options }),
332
+ search: async (options) => this.request("GET", `${this.projectPath}/assets/search`, { query: checked("assets.search", options) }),
317
333
  /** Lists one page of the project's assets, with optional filter and ordering. */
318
- list: async (options = {}) => this.request("GET", `${this.projectPath}/assets`, { query: options }),
334
+ list: async (options = {}) => this.request("GET", `${this.projectPath}/assets`, { query: checked("assets.list", options) }),
319
335
  /**
320
336
  * Yields every asset matching `options`, fetching pages as needed. The cursor keeps the position
321
337
  * stable when other assets are inserted or deleted.
322
338
  */
323
- iterate: (options = {}) => this.iteratePages((cursor) => this.buildAssets().list({
324
- ...options,
325
- cursor
326
- })),
339
+ iterate: (options = {}) => {
340
+ checked("assets.iterate", options);
341
+ return this.iteratePages((cursor) => this.buildAssets().list({
342
+ ...options,
343
+ cursor
344
+ }));
345
+ },
327
346
  /** Retrieves an asset with its status and classification results. */
328
- retrieve: async ({ assetId }) => this.request("GET", `/assets/${requireId(assetId, "Asset ID")}`),
347
+ retrieve: async (options) => {
348
+ const { assetId } = checked("assets.retrieve", options);
349
+ return this.request("GET", `/assets/${requireId(assetId, "Asset ID")}`);
350
+ },
329
351
  /** Updates an asset's editable fields. */
330
- update: async ({ assetId, ...body }) => this.request("PATCH", `/assets/${requireId(assetId, "Asset ID")}`, { body }),
352
+ update: async (options) => {
353
+ const { assetId, ...body } = checked("assets.update", options);
354
+ return this.request("PATCH", `/assets/${requireId(assetId, "Asset ID")}`, { body });
355
+ },
331
356
  /** Lists one page of the assets extracted from a website or multimedia document. */
332
- listChildren: async ({ assetId, ...options } = {}) => this.request("GET", `/assets/${requireId(assetId, "Asset ID")}/children`, { query: options }),
357
+ listChildren: async (options = {}) => {
358
+ const { assetId, ...query } = checked("assets.listChildren", options);
359
+ return this.request("GET", `/assets/${requireId(assetId, "Asset ID")}/children`, { query });
360
+ },
333
361
  /** Yields every child of an asset, fetching pages as needed. */
334
362
  iterateChildren: (options) => {
363
+ checked("assets.iterateChildren", options);
335
364
  requireId(options?.assetId, "Asset ID");
336
365
  return this.iteratePages((cursor) => this.buildAssets().listChildren({
337
366
  ...options,
@@ -343,28 +372,31 @@ sign: async (options) => {
343
372
  * status `processing` (or `uploading` for the first multipart part). Retried safely with an
344
373
  * `Idempotency-Key`.
345
374
  */
346
- create: async (options) => this.submitAsset(options, true),
375
+ create: async (options) => this.submitAsset(checked("assets.create", options), true),
347
376
  /**
348
377
  * Uploads an asset and waits for its moderation decision. Audio and video still finish
349
378
  * in the background. Retried safely with an `Idempotency-Key`.
350
379
  */
351
380
  classify: async (options) => {
352
- if (options && "content" in options && "plainText" in options.content && (typeof options.content.plainText !== "string" || !options.content.plainText.trim())) throw require_CalmLensConnection.invalidPayload("Text to classify must be a non-empty string");
381
+ checked("assets.classify", options);
382
+ if (options && "content" in options && "plainText" in options.content && (typeof options.content.plainText !== "string" || !options.content.plainText.trim())) throw require_CalmLensOptionKeys.invalidPayload("Text to classify must be a non-empty string");
353
383
  return this.submitAsset(options, false);
354
384
  },
355
385
  /**
356
386
  * Uploads the next part of a multipart upload. The upload's queue mode, chosen when it
357
387
  * started, applies when the final part arrives; pass `queue` to override it.
358
388
  */
359
- uploadPart: async ({ assetId, ...options }) => {
389
+ uploadPart: async (partOptions) => {
390
+ const { assetId, ...options } = checked("assets.uploadPart", partOptions);
360
391
  const encodedAssetId = requireId(assetId, "Asset ID");
361
- return require_CalmLensConnection.expectAsset(await this.#connection.uploadPart(`/assets/${encodedAssetId}/part`, options));
392
+ return require_CalmLensOptionKeys.expectAsset(await this.#connection.uploadPart(`/assets/${encodedAssetId}/part`, options));
362
393
  },
363
394
  /**
364
395
  * Creates a short-lived signed CDN URL, so browsers can load private content without
365
396
  * an API key.
366
397
  */
367
- createSignedUrl: async ({ assetId, ...options }) => {
398
+ createSignedUrl: async (signedUrlOptions) => {
399
+ const { assetId, ...options } = checked("assets.createSignedUrl", signedUrlOptions);
368
400
  const encodedAssetId = requireId(assetId, "Asset ID");
369
401
  require_ModerationContextLimits.validateSignedUrlOptions(options);
370
402
  return this.request("POST", `/assets/${encodedAssetId}/signed-url`, { body: {
@@ -376,20 +408,29 @@ sign: async (options) => {
376
408
  } });
377
409
  },
378
410
  /** Moves an asset into a folder, or to the project root with `folderId: null`. */
379
- move: async ({ assetId, folderId }) => this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/move`, { body: { folderId } }),
411
+ move: async (options) => {
412
+ const { assetId, folderId } = checked("assets.move", options);
413
+ return this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/move`, { body: { folderId } });
414
+ },
380
415
  /**
381
416
  * Processes an asset that failed (classification status `failed`) again. It returns to
382
417
  * `processing` and is
383
418
  * moderated like a new upload; its content must still be stored.
384
419
  */
385
- retry: async ({ assetId }) => this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/retry`),
420
+ retry: async (options) => {
421
+ const { assetId } = checked("assets.retry", options);
422
+ return this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/retry`);
423
+ },
386
424
  /**
387
425
  * Records a reviewer's decision, replacing the policy's: the asset's moderation status
388
426
  * becomes `decision`, the note joins its review history and the matching `asset.<status>`
389
427
  * event is sent. An asset still pending moderation can only be blocked or purged. Purging
390
428
  * needs `confirmPurge: true` and permanently deletes the stored content.
391
429
  */
392
- decide: async ({ assetId, ...body }) => this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/decision`, { body }),
430
+ decide: async (options) => {
431
+ const { assetId, ...body } = checked("assets.decide", options);
432
+ return this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/decision`, { body });
433
+ },
393
434
  /**
394
435
  * Completes the policy evidence behind a decided asset's moderation decision: the report's
395
436
  * `classification.moderation.evidence` becomes `full` and every action stays as
@@ -397,13 +438,17 @@ sign: async (options) => {
397
438
  * and returns in `processing`; use it when the policy has changed since the decision
398
439
  * (`asset/policy-changed`).
399
440
  */
400
- explain: async ({ assetId, rerun }) => this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/explain`, { body: rerun ? { rerun } : {} }),
441
+ explain: async (options) => {
442
+ const { assetId, rerun } = checked("assets.explain", options);
443
+ return this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/explain`, { body: rerun ? { rerun } : {} });
444
+ },
401
445
  /**
402
446
  * Waits until an asset's `classification.moderation.status` is no longer `pending` (`allowed`,
403
447
  * `limited`, `age-restricted`, `blocked` or `purged`), or its `classification.status` is `failed`, and returns that asset, checking every few seconds. Rejects with `sdk/timeout` if there is no
404
448
  * decision within `timeoutMs` (default 60000). Webhooks report decisions without polling.
405
449
  */
406
- waitForDecision: async ({ assetId, ...options }) => {
450
+ waitForDecision: async (waitOptions) => {
451
+ const { assetId, ...options } = checked("assets.waitForDecision", waitOptions);
407
452
  requireId(assetId, "Asset ID");
408
453
  const client = options.signal ? this.withRequestOptions({ signal: options.signal }) : this;
409
454
  return require_ModerationContextLimits.pollForDecision(() => client.assets.retrieve({ assetId }), options, this.#connection.sleep, this.#connection.hooks?.now);
@@ -413,9 +458,13 @@ sign: async (options) => {
413
458
  * keeping the asset record, metadata and classification results. The returned asset has
414
459
  * `content.status` set to `removed` and `content.removalReason` to `requested`; the CDN no longer serves it.
415
460
  */
416
- deleteContent: async ({ assetId }) => this.request("DELETE", `/assets/${requireId(assetId, "Asset ID")}/content`),
461
+ deleteContent: async (options) => {
462
+ const { assetId } = checked("assets.deleteContent", options);
463
+ return this.request("DELETE", `/assets/${requireId(assetId, "Asset ID")}/content`);
464
+ },
417
465
  /** Deletes an asset record together with its stored content. */
418
- delete: async ({ assetId }) => {
466
+ delete: async (options) => {
467
+ const { assetId } = checked("assets.delete", options);
419
468
  await this.request("DELETE", `/assets/${requireId(assetId, "Asset ID")}`);
420
469
  },
421
470
  /**
@@ -426,7 +475,8 @@ sign: async (options) => {
426
475
  * `asset.deleted` or `asset.content-removed` for each asset. Assets under a safety hold
427
476
  * are skipped. Not retried: it carries no `Idempotency-Key`.
428
477
  */
429
- batch: async ({ assetIds, operation }) => {
478
+ batch: async (options) => {
479
+ const { assetIds, operation } = checked("assets.batch", options);
430
480
  require_ModerationContextLimits.validateBatchAssetsOptions({
431
481
  assetIds,
432
482
  operation
@@ -445,13 +495,13 @@ sign: async (options) => {
445
495
  * for "now", then poll with each response's `nextCursor`. Webhook deliveries carry the same
446
496
  * events reshaped as `{ id, type, createdAt, projectId, data }`.
447
497
  */
448
- list: async (options = {}) => this.request("GET", `${this.projectPath}/events`, { query: { ...options } }),
498
+ list: async (options = {}) => this.request("GET", `${this.projectPath}/events`, { query: { ...checked("events.list", options) } }),
449
499
  /**
450
500
  * Yields pages of events after `cursor` until no more are waiting. Save each page's
451
501
  * `nextCursor` to resume later. Without `cursor`, yields one empty page whose `nextCursor`
452
502
  * is "now".
453
503
  */
454
- pages: (options = {}) => this.iterateEventPages(options)
504
+ pages: (options = {}) => this.iterateEventPages(checked("events.pages", options))
455
505
  };
456
506
  }
457
507
  async *iterateEventPages(options) {
@@ -486,17 +536,27 @@ sign: async (options) => {
486
536
  * Lists one page of child folders, sorted by name unless `ordering` says otherwise. Pass
487
537
  * `nextCursor` as `cursor` for the next page; fetch a branch when it is opened.
488
538
  */
489
- list: async (options = {}) => this.request("GET", `${this.projectPath}/folders`, { query: options }),
490
- retrieve: async ({ folderId }) => this.request("GET", `/folders/${requireId(folderId, "Folder ID")}`),
539
+ list: async (options = {}) => this.request("GET", `${this.projectPath}/folders`, { query: checked("folders.list", options) }),
540
+ retrieve: async (options) => {
541
+ const { folderId } = checked("folders.retrieve", options);
542
+ return this.request("GET", `/folders/${requireId(folderId, "Folder ID")}`);
543
+ },
491
544
  /** Creates a folder at the project root or inside `parentId`. */
492
- create: async (options) => this.request("POST", `${this.projectPath}/folders`, { body: options }),
493
- update: async ({ folderId, ...body }) => this.request("PATCH", `/folders/${requireId(folderId, "Folder ID")}`, { body }),
545
+ create: async (options) => this.request("POST", `${this.projectPath}/folders`, { body: checked("folders.create", options) }),
546
+ update: async (options) => {
547
+ const { folderId, ...body } = checked("folders.update", options);
548
+ return this.request("PATCH", `/folders/${requireId(folderId, "Folder ID")}`, { body });
549
+ },
494
550
  /** Deletes an empty folder; throws `folder/not-empty` otherwise. */
495
- delete: async ({ folderId }) => {
551
+ delete: async (options) => {
552
+ const { folderId } = checked("folders.delete", options);
496
553
  await this.request("DELETE", `/folders/${requireId(folderId, "Folder ID")}`);
497
554
  },
498
555
  /** Moves a folder under `parentId`, or to the project root with `parentId: null`. */
499
- move: async ({ folderId, parentId }) => this.request("POST", `/folders/${requireId(folderId, "Folder ID")}/move`, { body: { parentId } })
556
+ move: async (options) => {
557
+ const { folderId, parentId } = checked("folders.move", options);
558
+ return this.request("POST", `/folders/${requireId(folderId, "Folder ID")}/move`, { body: { parentId } });
559
+ }
500
560
  };
501
561
  }
502
562
  /**
@@ -506,29 +566,80 @@ sign: async (options) => {
506
566
  get hashLists() {
507
567
  return {
508
568
  /** Lists one page of the project's hash lists, newest first. */
509
- list: async (options = {}) => this.request("GET", `${this.projectPath}/hash-lists`, { query: options }),
510
- retrieve: async ({ hashListId }) => this.request("GET", `/hash-lists/${requireId(hashListId, "Hash list ID")}`),
511
- create: async (options) => this.request("POST", `${this.projectPath}/hash-lists`, { body: options }),
569
+ list: async (options = {}) => this.request("GET", `${this.projectPath}/hash-lists`, { query: checked("hashLists.list", options) }),
570
+ retrieve: async (options) => {
571
+ const { hashListId } = checked("hashLists.retrieve", options);
572
+ return this.request("GET", `/hash-lists/${requireId(hashListId, "Hash list ID")}`);
573
+ },
574
+ create: async (options) => this.request("POST", `${this.projectPath}/hash-lists`, { body: checked("hashLists.create", options) }),
512
575
  /** Renames a list or changes its action; the new action applies to later uploads. */
513
- update: async ({ hashListId, ...body }) => this.request("PATCH", `/hash-lists/${requireId(hashListId, "Hash list ID")}`, { body }),
576
+ update: async (options) => {
577
+ const { hashListId, ...body } = checked("hashLists.update", options);
578
+ return this.request("PATCH", `/hash-lists/${requireId(hashListId, "Hash list ID")}`, { body });
579
+ },
514
580
  /** Deletes the list and every entry in it. */
515
- delete: async ({ hashListId }) => {
581
+ delete: async (options) => {
582
+ const { hashListId } = checked("hashLists.delete", options);
516
583
  await this.request("DELETE", `/hash-lists/${requireId(hashListId, "Hash list ID")}`);
517
584
  },
518
585
  /** Lists one page of a list's entries, newest first. */
519
- listEntries: async ({ hashListId, ...query }) => this.request("GET", `/hash-lists/${requireId(hashListId, "Hash list ID")}/entries`, { query }),
586
+ listEntries: async (options) => {
587
+ const { hashListId, ...query } = checked("hashLists.listEntries", options);
588
+ return this.request("GET", `/hash-lists/${requireId(hashListId, "Hash list ID")}/entries`, { query });
589
+ },
520
590
  /** Adds a hash, or an image asset's hash; a hash already in the list returns its entry. */
521
- addEntry: async ({ hashListId, ...body }) => this.request("POST", `/hash-lists/${requireId(hashListId, "Hash list ID")}/entries`, { body }),
522
- removeEntry: async ({ entryId }) => {
591
+ addEntry: async (options) => {
592
+ const { hashListId, ...body } = checked("hashLists.addEntry", options);
593
+ return this.request("POST", `/hash-lists/${requireId(hashListId, "Hash list ID")}/entries`, { body });
594
+ },
595
+ removeEntry: async (options) => {
596
+ const { entryId } = checked("hashLists.removeEntry", options);
523
597
  await this.request("DELETE", `/hash-list-entries/${requireId(entryId, "Hash list entry ID")}`);
524
598
  }
525
599
  };
526
600
  }
527
601
  /**
602
+ * Moderation policies belong to the project's organisation and its projects share them. Every
603
+ * change sends the policy's `revision`, so a policy changed since is refused. Through a
604
+ * project's key you can change only policies no other project uses or owns.
605
+ */
606
+ get policies() {
607
+ const policyPath = (policyId) => `${this.projectPath}/policies/${requireId(policyId, "Policy ID")}`;
608
+ return {
609
+ /** Lists the organisation's policies and the ID of the one the project uses. */
610
+ list: async () => this.request("GET", `${this.projectPath}/policies`),
611
+ retrieve: async (options) => this.request("GET", policyPath(checked("policies.retrieve", options).policyId)),
612
+ /** Creates a policy from `settings`, or a copy of a built-in preset with `presetId`. */
613
+ create: async (options) => this.request("POST", `${this.projectPath}/policies`, { body: checked("policies.create", options) }),
614
+ /** Changes the name, description or settings; later moderation uses them. */
615
+ update: async (options) => {
616
+ const { policyId, ...body } = checked("policies.update", options);
617
+ return this.request("PATCH", policyPath(policyId), { body });
618
+ },
619
+ /** Resets a preset copy to its pinned version, or updates an unchanged copy to the latest. */
620
+ applyPreset: async (options) => {
621
+ const { policyId, ...body } = checked("policies.applyPreset", options);
622
+ return this.request("POST", `${policyPath(policyId)}/preset`, { body });
623
+ },
624
+ /** Switches automatic updates on or off for the project's preset policy. */
625
+ setAutomaticUpdates: async (options) => {
626
+ const { policyId, ...body } = checked("policies.setAutomaticUpdates", options);
627
+ return this.request("PUT", `${policyPath(policyId)}/automatic-updates`, { body });
628
+ },
629
+ /** Deletes a policy that no project or upload preset uses. */
630
+ delete: async (options) => {
631
+ await this.request("DELETE", policyPath(checked("policies.delete", options).policyId));
632
+ },
633
+ /** Chooses the policy the project moderates with. */
634
+ assign: async (options) => this.request("PUT", `${this.projectPath}/policy`, { body: checked("policies.assign", options) })
635
+ };
636
+ }
637
+ /**
528
638
  * Create a named lens at any positive version, or update it with a greater version.
529
639
  * Supplying the same definition and version is idempotent.
530
640
  */
531
641
  async ensureLens(options) {
642
+ checked("ensureLens", options);
532
643
  if (!options?.identifier) throw require_ModerationContextLimits.invalidArgument("Lens identifier is required");
533
644
  const [lens] = await this.ensureLenses({ lenses: [options] });
534
645
  return lens;
@@ -538,9 +649,11 @@ sign: async (options) => {
538
649
  * consecutive requests of at most {@link ENSURE_LENSES_MAX_PER_REQUEST} definitions, in order.
539
650
  * Each lens follows the same versioning and idempotency rules as ensureLens().
540
651
  */
541
- async ensureLenses({ lenses }) {
652
+ async ensureLenses(options) {
653
+ const { lenses } = checked("ensureLenses", options);
542
654
  if (!Array.isArray(lenses) || lenses.length === 0) throw require_ModerationContextLimits.invalidArgument("At least one lens is required");
543
655
  if (lenses.some((option) => !option?.identifier)) throw require_ModerationContextLimits.invalidArgument("Lens identifier is required");
656
+ for (const lens of lenses) checked("ensureLens", lens);
544
657
  const { ensuredLenses, pendingEnsureLenses } = this.#lenses;
545
658
  const missingOptions = [];
546
659
  const missingKeys = /* @__PURE__ */ new Set();
@@ -1,6 +1,6 @@
1
1
  import { o as HashList, s as HashListEntry } from "./ModerationContext-9lGm-Mna-CcmbRnOy.js";
2
- import { $ as IterateAssetsOptions, A as ClassifyTextOptions, B as EnsureLensesOptions, C as BatchAssetsResponse, Ct as UploadAssetPartOptions, E as CdnAssetUrlOptions, Et as VerifyWebhookSignatureOptions, G as HashListEntryIdOptions, H as FolderIdOptions, I as DecideAssetOptions, J as HashListPage, Jt as AssetSearchQuery, K as HashListEntryPage, L as DeleteAssetContentOptions, M as CreateAssetSignedUrlOptions, Mt as GetEventsResponse, N as CreateFolderOptions, Nt as PostAssetSignedUrlResponse, O as CdnServeOptions, Ot as WaitForAssetDecisionOptions, P as CreateHashListOptions, Q as IterateAssetChildrenOptions, R as DeleteAssetOptions, S as BatchAssetsOptions, St as UpdateHashListOptions, T as CalmLensServerClientOptions, U as FolderPage, Ut as Folder, V as ExplainAssetOptions, _t as SignedUploadToken, at as ListFoldersOptions, bt as UpdateAssetOptions, ct as MoveAssetOptions, et as Lens, ft as RequestOptions, g as AssetSearchResponse, gt as SignUploadTokenOptions, h as AssetPage, i as AssetChildrenPage, it as ListEventsOptions, lt as MoveFolderOptions, mt as RetryAssetOptions, n as Asset, nt as ListAssetChildrenOptions, ot as ListHashListEntriesOptions, pt as RetrieveAssetOptions, q as HashListIdOptions, rt as ListAssetsOptions, st as ListHashListsOptions, t as AddHashListEntryOptions, xt as UpdateFolderOptions, yt as SubmitAssetOptions, z as EnsureLensOptions } from "./CalmLensTypes-9Vt16pc7.js";
3
- import "./WebhookPayload-2aL31v0J.js";
2
+ import { A as CdnServeOptions, B as DeleteAssetContentOptions, C as AssignPolicyOptions, Ct as SubmitAssetOptions, D as CalmLensServerClientOptions, Dt as UpdatePolicyOptions, Et as UpdateHashListOptions, F as CreateFolderOptions, G as FolderIdOptions, H as EnsureLensOptions, I as CreateHashListOptions, J as HashListEntryIdOptions, Jt as Folder, K as FolderPage, Lt as GetEventsResponse, M as ClassifyTextOptions, Nt as WaitForAssetDecisionOptions, O as CdnAssetUrlOptions, Ot as UploadAssetPartOptions, P as CreateAssetSignedUrlOptions, R as CreatePolicyOptions, Rt as PostAssetSignedUrlResponse, T as BatchAssetsResponse, Tt as UpdateFolderOptions, U as EnsureLensesOptions, V as DeleteAssetOptions, W as ExplainAssetOptions, X as HashListIdOptions, Y as HashListEntryPage, Yt as Policy, Z as HashListPage, _ as AssetSearchResponse, _t as RetryAssetOptions, a as AssetChildrenPage, at as ListEventsOptions, bt as SignUploadTokenOptions, ct as ListHashListsOptions, en as AssetSearchQuery, et as IterateAssetChildrenOptions, g as AssetPage, gt as RetrieveAssetOptions, ht as RequestOptions, it as ListAssetsOptions, jt as VerifyWebhookSignatureOptions, lt as MoveAssetOptions, mt as PolicyList, n as ApplyPolicyPresetOptions, nt as Lens, ot as ListFoldersOptions, pt as PolicyIdOptions, r as Asset, rt as ListAssetChildrenOptions, st as ListHashListEntriesOptions, t as AddHashListEntryOptions, tt as IterateAssetsOptions, ut as MoveFolderOptions, w as BatchAssetsOptions, wt as UpdateAssetOptions, xt as SignedUploadToken, yt as SetPolicyAutomaticUpdatesOptions, z as DecideAssetOptions } from "./CalmLensTypes-DpU-hXq2.js";
3
+ import "./WebhookPayload-CQg8BBZQ.js";
4
4
  interface LensCache {
5
5
  readonly ensuredLenses: Map<string, Lens>;
6
6
  readonly pendingEnsureLenses: Map<string, Promise<void>>;
@@ -50,15 +50,17 @@ declare class CalmLensServerClient {
50
50
  /**
51
51
  * Builds a CDN URL for asset content or a preview, without a request. Private assets
52
52
  * need a signed URL (`assets.createSignedUrl`) or an authenticated request; public
53
- * age-restricted assets additionally require `viewerClaims.ageConfirmed: true`.
53
+ * age-restricted assets additionally require `viewerClaims.ageConfirmed: true`. Your
54
+ * platform confirms the viewer's age; CalmLens does not verify this claim, and anyone can
55
+ * add it to a public URL.
54
56
  */
55
- getAssetUrl: ({ assetIdentifier, ...options }: CdnAssetUrlOptions) => string;
57
+ getAssetUrl: (urlOptions: CdnAssetUrlOptions) => string;
56
58
  /**
57
59
  * Fetches asset content or a preview from the CDN with the client's API key, and returns
58
60
  * the `Response` as soon as headers arrive, so the body streams. Non-2xx responses are
59
61
  * returned, not thrown; `timeoutMs` covers only the wait for headers.
60
62
  */
61
- serve: ({ assetIdentifier, init, ...urlOptions }: CdnServeOptions) => Promise<Response>;
63
+ serve: (options: CdnServeOptions) => Promise<Response>;
62
64
  };
63
65
  get text(): {
64
66
  /**
@@ -81,11 +83,11 @@ declare class CalmLensServerClient {
81
83
  */
82
84
  iterate: (options?: IterateAssetsOptions) => AsyncGenerator<Asset, void, undefined>;
83
85
  /** Retrieves an asset with its status and classification results. */
84
- retrieve: ({ assetId }: RetrieveAssetOptions) => Promise<Asset>;
86
+ retrieve: (options: RetrieveAssetOptions) => Promise<Asset>;
85
87
  /** Updates an asset's editable fields. */
86
- update: ({ assetId, ...body }: UpdateAssetOptions) => Promise<Asset>;
88
+ update: (options: UpdateAssetOptions) => Promise<Asset>;
87
89
  /** Lists one page of the assets extracted from a website or multimedia document. */
88
- listChildren: ({ assetId, ...options }?: ListAssetChildrenOptions) => Promise<AssetChildrenPage>;
90
+ listChildren: (options?: ListAssetChildrenOptions) => Promise<AssetChildrenPage>;
89
91
  /** Yields every child of an asset, fetching pages as needed. */
90
92
  iterateChildren: (options: IterateAssetChildrenOptions) => AsyncGenerator<Asset, void, undefined>;
91
93
  /**
@@ -103,27 +105,27 @@ declare class CalmLensServerClient {
103
105
  * Uploads the next part of a multipart upload. The upload's queue mode, chosen when it
104
106
  * started, applies when the final part arrives; pass `queue` to override it.
105
107
  */
106
- uploadPart: ({ assetId, ...options }: UploadAssetPartOptions) => Promise<Asset>;
108
+ uploadPart: (partOptions: UploadAssetPartOptions) => Promise<Asset>;
107
109
  /**
108
110
  * Creates a short-lived signed CDN URL, so browsers can load private content without
109
111
  * an API key.
110
112
  */
111
- createSignedUrl: ({ assetId, ...options }: CreateAssetSignedUrlOptions) => Promise<PostAssetSignedUrlResponse>;
113
+ createSignedUrl: (signedUrlOptions: CreateAssetSignedUrlOptions) => Promise<PostAssetSignedUrlResponse>;
112
114
  /** Moves an asset into a folder, or to the project root with `folderId: null`. */
113
- move: ({ assetId, folderId }: MoveAssetOptions) => Promise<Asset>;
115
+ move: (options: MoveAssetOptions) => Promise<Asset>;
114
116
  /**
115
117
  * Processes an asset that failed (classification status `failed`) again. It returns to
116
118
  * `processing` and is
117
119
  * moderated like a new upload; its content must still be stored.
118
120
  */
119
- retry: ({ assetId }: RetryAssetOptions) => Promise<Asset>;
121
+ retry: (options: RetryAssetOptions) => Promise<Asset>;
120
122
  /**
121
123
  * Records a reviewer's decision, replacing the policy's: the asset's moderation status
122
124
  * becomes `decision`, the note joins its review history and the matching `asset.<status>`
123
125
  * event is sent. An asset still pending moderation can only be blocked or purged. Purging
124
126
  * needs `confirmPurge: true` and permanently deletes the stored content.
125
127
  */
126
- decide: ({ assetId, ...body }: DecideAssetOptions) => Promise<Asset>;
128
+ decide: (options: DecideAssetOptions) => Promise<Asset>;
127
129
  /**
128
130
  * Completes the policy evidence behind a decided asset's moderation decision: the report's
129
131
  * `classification.moderation.evidence` becomes `full` and every action stays as
@@ -131,21 +133,21 @@ declare class CalmLensServerClient {
131
133
  * and returns in `processing`; use it when the policy has changed since the decision
132
134
  * (`asset/policy-changed`).
133
135
  */
134
- explain: ({ assetId, rerun }: ExplainAssetOptions) => Promise<Asset>;
136
+ explain: (options: ExplainAssetOptions) => Promise<Asset>;
135
137
  /**
136
138
  * Waits until an asset's `classification.moderation.status` is no longer `pending` (`allowed`,
137
139
  * `limited`, `age-restricted`, `blocked` or `purged`), or its `classification.status` is `failed`, and returns that asset, checking every few seconds. Rejects with `sdk/timeout` if there is no
138
140
  * decision within `timeoutMs` (default 60000). Webhooks report decisions without polling.
139
141
  */
140
- waitForDecision: ({ assetId, ...options }: WaitForAssetDecisionOptions) => Promise<Asset>;
142
+ waitForDecision: (waitOptions: WaitForAssetDecisionOptions) => Promise<Asset>;
141
143
  /**
142
144
  * Removes an asset's stored content (source, preview and retained extracted text) while
143
145
  * keeping the asset record, metadata and classification results. The returned asset has
144
146
  * `content.status` set to `removed` and `content.removalReason` to `requested`; the CDN no longer serves it.
145
147
  */
146
- deleteContent: ({ assetId }: DeleteAssetContentOptions) => Promise<Asset>;
148
+ deleteContent: (options: DeleteAssetContentOptions) => Promise<Asset>;
147
149
  /** Deletes an asset record together with its stored content. */
148
- delete: ({ assetId }: DeleteAssetOptions) => Promise<void>;
150
+ delete: (options: DeleteAssetOptions) => Promise<void>;
149
151
  /**
150
152
  * Deletes up to 500 assets (`operation: "delete"`) or removes their stored content
151
153
  * (`"remove-content"`) in one request. Every asset must exist in the project and the key
@@ -154,7 +156,7 @@ declare class CalmLensServerClient {
154
156
  * `asset.deleted` or `asset.content-removed` for each asset. Assets under a safety hold
155
157
  * are skipped. Not retried: it carries no `Idempotency-Key`.
156
158
  */
157
- batch: ({ assetIds, operation }: BatchAssetsOptions) => Promise<BatchAssetsResponse>;
159
+ batch: (options: BatchAssetsOptions) => Promise<BatchAssetsResponse>;
158
160
  };
159
161
  /**
160
162
  * Signs upload tokens on your server, so a browser or app can upload through an upload preset
@@ -190,14 +192,14 @@ declare class CalmLensServerClient {
190
192
  * `nextCursor` as `cursor` for the next page; fetch a branch when it is opened.
191
193
  */
192
194
  list: (options?: ListFoldersOptions) => Promise<FolderPage>;
193
- retrieve: ({ folderId }: FolderIdOptions) => Promise<Folder>;
195
+ retrieve: (options: FolderIdOptions) => Promise<Folder>;
194
196
  /** Creates a folder at the project root or inside `parentId`. */
195
197
  create: (options: CreateFolderOptions) => Promise<Folder>;
196
- update: ({ folderId, ...body }: UpdateFolderOptions) => Promise<Folder>;
198
+ update: (options: UpdateFolderOptions) => Promise<Folder>;
197
199
  /** Deletes an empty folder; throws `folder/not-empty` otherwise. */
198
- delete: ({ folderId }: FolderIdOptions) => Promise<void>;
200
+ delete: (options: FolderIdOptions) => Promise<void>;
199
201
  /** Moves a folder under `parentId`, or to the project root with `parentId: null`. */
200
- move: ({ folderId, parentId }: MoveFolderOptions) => Promise<Folder>;
202
+ move: (options: MoveFolderOptions) => Promise<Folder>;
201
203
  };
202
204
  /**
203
205
  * Hash lists hold PDQ hashes of images the project never wants again. Image uploads are
@@ -206,17 +208,39 @@ declare class CalmLensServerClient {
206
208
  get hashLists(): {
207
209
  /** Lists one page of the project's hash lists, newest first. */
208
210
  list: (options?: ListHashListsOptions) => Promise<HashListPage>;
209
- retrieve: ({ hashListId }: HashListIdOptions) => Promise<HashList>;
211
+ retrieve: (options: HashListIdOptions) => Promise<HashList>;
210
212
  create: (options: CreateHashListOptions) => Promise<HashList>;
211
213
  /** Renames a list or changes its action; the new action applies to later uploads. */
212
- update: ({ hashListId, ...body }: UpdateHashListOptions) => Promise<HashList>;
214
+ update: (options: UpdateHashListOptions) => Promise<HashList>;
213
215
  /** Deletes the list and every entry in it. */
214
- delete: ({ hashListId }: HashListIdOptions) => Promise<void>;
216
+ delete: (options: HashListIdOptions) => Promise<void>;
215
217
  /** Lists one page of a list's entries, newest first. */
216
- listEntries: ({ hashListId, ...query }: ListHashListEntriesOptions) => Promise<HashListEntryPage>;
218
+ listEntries: (options: ListHashListEntriesOptions) => Promise<HashListEntryPage>;
217
219
  /** Adds a hash, or an image asset's hash; a hash already in the list returns its entry. */
218
- addEntry: ({ hashListId, ...body }: AddHashListEntryOptions) => Promise<HashListEntry>;
219
- removeEntry: ({ entryId }: HashListEntryIdOptions) => Promise<void>;
220
+ addEntry: (options: AddHashListEntryOptions) => Promise<HashListEntry>;
221
+ removeEntry: (options: HashListEntryIdOptions) => Promise<void>;
222
+ };
223
+ /**
224
+ * Moderation policies belong to the project's organisation and its projects share them. Every
225
+ * change sends the policy's `revision`, so a policy changed since is refused. Through a
226
+ * project's key you can change only policies no other project uses or owns.
227
+ */
228
+ get policies(): {
229
+ /** Lists the organisation's policies and the ID of the one the project uses. */
230
+ list: () => Promise<PolicyList>;
231
+ retrieve: (options: PolicyIdOptions) => Promise<Policy>;
232
+ /** Creates a policy from `settings`, or a copy of a built-in preset with `presetId`. */
233
+ create: (options: CreatePolicyOptions) => Promise<Policy>;
234
+ /** Changes the name, description or settings; later moderation uses them. */
235
+ update: (options: UpdatePolicyOptions) => Promise<Policy>;
236
+ /** Resets a preset copy to its pinned version, or updates an unchanged copy to the latest. */
237
+ applyPreset: (options: ApplyPolicyPresetOptions) => Promise<Policy>;
238
+ /** Switches automatic updates on or off for the project's preset policy. */
239
+ setAutomaticUpdates: (options: SetPolicyAutomaticUpdatesOptions) => Promise<Policy>;
240
+ /** Deletes a policy that no project or upload preset uses. */
241
+ delete: (options: PolicyIdOptions) => Promise<void>;
242
+ /** Chooses the policy the project moderates with. */
243
+ assign: (options: AssignPolicyOptions) => Promise<Policy>;
220
244
  };
221
245
  /**
222
246
  * Create a named lens at any positive version, or update it with a greater version.
@@ -228,7 +252,7 @@ declare class CalmLensServerClient {
228
252
  * consecutive requests of at most {@link ENSURE_LENSES_MAX_PER_REQUEST} definitions, in order.
229
253
  * Each lens follows the same versioning and idempotency rules as ensureLens().
230
254
  */
231
- ensureLenses({ lenses }: EnsureLensesOptions): Promise<Lens[]>;
255
+ ensureLenses(options: EnsureLensesOptions): Promise<Lens[]>;
232
256
  private submitEnsureLenses;
233
257
  private submitEnsureLensesChunk;
234
258
  }