calmlens 0.18.3 → 0.20.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 +5682 -5036
  2. package/cjs/{BrowserUpload-BT091eOB.d.ts → BrowserUpload-C07aL9Vq.d.ts} +2 -2
  3. package/cjs/{BrowserUpload-UxIAGNdv.js → BrowserUpload-CjSHjx3C.js} +1 -1
  4. package/{esm/CalmLensAppClient-CV_K26Ce.d.ts → cjs/CalmLensAppClient-DDLojj0P.d.ts} +3 -3
  5. package/cjs/{CalmLensAppClient-D6p7MAFz.js → CalmLensAppClient-NaCxOVlM.js} +32 -11
  6. package/cjs/{CalmLensConnection-CYoUl5go.js → CalmLensOptionKeys-p2QK687A.js} +430 -9
  7. package/cjs/{CalmLensServerClient-p23cl97D.js → CalmLensServerClient-BDzTthxE.js} +173 -55
  8. package/cjs/{CalmLensServerClient-JtP687a3.d.ts → CalmLensServerClient-C-jsjn8m.d.ts} +54 -30
  9. package/cjs/{CalmLensTypes-9Vt16pc7.d.ts → CalmLensTypes-COJbOuiv.d.ts} +2677 -30
  10. package/cjs/{ModerationContextLimits-DCLXMxyA.js → ModerationContextLimits-2nIv7Zh3.js} +495 -49
  11. package/cjs/{ReactUpload-BcdNWLiU.js → ReactUpload-BdTRCTGA.js} +1 -1
  12. package/cjs/{ReactUpload-CAyCsyG6.d.ts → ReactUpload-CRJNPB5T.d.ts} +1 -1
  13. package/{esm/TestTriggers-By07LR31-CmK0yTyR.d.ts → cjs/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts} +13 -7
  14. package/cjs/{TestTriggers-DTc_iMJF-BjMPq4_3.js → TestTriggers-DbhsNPdg-DjvVuc2h.js} +434 -74
  15. package/cjs/{UploadController-Cxu0bufo.js → UploadController-MLVs97Zt.js} +17 -5
  16. package/{esm/WebhookPayload-2aL31v0J.d.ts → cjs/WebhookPayload-DkukERKE.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-DxbJ_Xaa.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 +12 -8
  33. package/cjs/testing.js +298 -35
  34. package/{esm/ui-wIiMfqMB.d.ts → cjs/ui-BSqPGKrZ.d.ts} +17 -4
  35. package/cjs/{ui-C0XXJS52.js → ui-CX1z2pD9.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-BT091eOB.d.ts → BrowserUpload-C07aL9Vq.d.ts} +2 -2
  41. package/esm/{BrowserUpload-BXG2isHV.js → BrowserUpload-CAVkRotw.js} +1 -1
  42. package/{cjs/CalmLensAppClient-CV_K26Ce.d.ts → esm/CalmLensAppClient-DDLojj0P.d.ts} +3 -3
  43. package/esm/{CalmLensAppClient-BMgXamoN.js → CalmLensAppClient-PQ9VBvlW.js} +28 -7
  44. package/esm/{CalmLensConnection-DBoDh06c.js → CalmLensOptionKeys-Do2mPP6w.js} +407 -10
  45. package/esm/{CalmLensServerClient-JtP687a3.d.ts → CalmLensServerClient-C-jsjn8m.d.ts} +54 -30
  46. package/esm/{CalmLensServerClient-Dt7rCITa.js → CalmLensServerClient-C_H5aAsV.js} +165 -47
  47. package/esm/{CalmLensTypes-9Vt16pc7.d.ts → CalmLensTypes-COJbOuiv.d.ts} +2677 -30
  48. package/esm/{ModerationContextLimits-KMQ8puoa.js → ModerationContextLimits-Chw-AzgL.js} +462 -46
  49. package/esm/{ReactUpload-CFy_wETY.js → ReactUpload-CMmL0R5Q.js} +1 -1
  50. package/esm/{ReactUpload-CAyCsyG6.d.ts → ReactUpload-CRJNPB5T.d.ts} +1 -1
  51. package/{cjs/TestTriggers-By07LR31-CmK0yTyR.d.ts → esm/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts} +13 -7
  52. package/esm/{TestTriggers-DTc_iMJF-HfB533Gx.js → TestTriggers-DbhsNPdg-CUdrv8Nm.js} +405 -72
  53. package/esm/{UploadController-Cs-bxUbt.js → UploadController-BJZghJpg.js} +17 -5
  54. package/{cjs/WebhookPayload-2aL31v0J.d.ts → esm/WebhookPayload-DkukERKE.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-DxbJ_Xaa.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 +12 -8
  71. package/esm/testing.js +287 -23
  72. package/{cjs/ui-wIiMfqMB.d.ts → esm/ui-BSqPGKrZ.d.ts} +17 -4
  73. package/esm/{ui-BqYkISSE.js → ui-CXH7xJpb.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-2nIv7Zh3.js");
2
+ const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-p2QK687A.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,11 +142,21 @@ 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
149
  /**
150
+ * `options`, once `checkOptionKeys` finds only keys `operation` takes, without the options given as
151
+ * `null` that the API refuses as `null`: those are left out, as if omitted.
152
+ */
153
+ const checked = (operation, options) => {
154
+ require_ModerationContextLimits.checkOptionKeys(options, operation, require_CalmLensOptionKeys.SERVER_OPTION_KEYS);
155
+ if (!options || typeof options !== "object" || Array.isArray(options)) return options;
156
+ const nullable = require_CalmLensOptionKeys.NULLABLE_OPTION_KEYS[operation] ?? [];
157
+ return Object.fromEntries(Object.entries(options).filter(([key, value]) => value !== null || nullable.includes(key)));
158
+ };
159
+ /**
150
160
  * Iterators stop rather than loop: a page that says more follow must not hand back a cursor this
151
161
  * iteration has already sent, which would repeat the same pages forever.
152
162
  */
@@ -193,14 +203,14 @@ var CalmLensServerClient = class CalmLensServerClient {
193
203
  const { apiKey, ...rest } = options;
194
204
  this.#apiKey = apiKey;
195
205
  this.#settings = {
196
- ...require_CalmLensConnection.resolveConnectionOptions(rest),
197
- cdnBaseUrl: (rest.cdnBaseUrl ?? require_CalmLensConnection.getMockHooks(rest)?.defaultCdnBaseUrl ?? require_ModerationContextLimits.DEFAULT_CDN_BASE_URL).replace(/\/+$/, "")
206
+ ...require_CalmLensOptionKeys.resolveConnectionOptions(rest),
207
+ cdnBaseUrl: (rest.cdnBaseUrl ?? require_CalmLensOptionKeys.getMockHooks(rest)?.defaultCdnBaseUrl ?? require_ModerationContextLimits.DEFAULT_CDN_BASE_URL).replace(/\/+$/, "")
198
208
  };
199
209
  this.#lenses = lenses ?? {
200
210
  ensuredLenses: /* @__PURE__ */ new Map(),
201
211
  pendingEnsureLenses: /* @__PURE__ */ new Map()
202
212
  };
203
- this.#connection = new require_CalmLensConnection.CalmLensConnection(this.#settings, apiKey);
213
+ this.#connection = new require_CalmLensOptionKeys.CalmLensConnection(this.#settings, apiKey);
204
214
  }
205
215
  /**
206
216
  * A client with different cancellation, deadlines or retries for the calls made through it,
@@ -234,25 +244,35 @@ var CalmLensServerClient = class CalmLensServerClient {
234
244
  return this.#connection.json(method, path, options);
235
245
  }
236
246
  async submitAsset(options, queue) {
237
- const body = require_CalmLensConnection.prepareSubmitAssetOptions(options, { deferUploadChecks: this.#connection.deferUploadChecks });
247
+ const body = require_CalmLensOptionKeys.prepareSubmitAssetOptions(options, {
248
+ deferUploadChecks: this.#connection.deferUploadChecks,
249
+ partSizeBytes: this.#connection.partSizeBytes
250
+ });
238
251
  const uploadsPath = `${this.projectPath}/assets`;
239
- if ("content" in body || "part" in body) return require_CalmLensConnection.expectAsset(await this.#connection.submitRawUpload(uploadsPath, body, queue));
252
+ if ("content" in body && require_CalmLensOptionKeys.splitsIntoParts(body.content, this.#connection.partSizeBytes)) return require_CalmLensOptionKeys.expectAsset(await this.#connection.submitInParts(uploadsPath, body, queue, {
253
+ partPath: (assetId) => `/assets/${encodeURIComponent(assetId)}/part`,
254
+ retrieve: (assetId) => this.buildAssets().retrieve({ assetId })
255
+ }));
256
+ if ("content" in body || "part" in body) return require_CalmLensOptionKeys.expectAsset(await this.#connection.submitRawUpload(uploadsPath, body, queue));
240
257
  const { idempotencyKey, ...fields } = body;
241
258
  const data = await this.#connection.json("POST", uploadsPath, {
242
259
  query: { queue },
243
260
  body: fields,
244
- idempotencyKey: idempotencyKey ?? require_CalmLensConnection.newIdempotencyKey()
261
+ idempotencyKey: idempotencyKey ?? require_CalmLensOptionKeys.newIdempotencyKey()
245
262
  });
246
- return require_CalmLensConnection.expectAsset(data);
263
+ return require_CalmLensOptionKeys.expectAsset(data);
247
264
  }
248
265
  get cdn() {
249
266
  return {
250
267
  /**
251
268
  * Builds a CDN URL for asset content or a preview, without a request. Private assets
252
269
  * need a signed URL (`assets.createSignedUrl`) or an authenticated request; public
253
- * age-restricted assets additionally require `viewerClaims.ageConfirmed: true`.
270
+ * age-restricted assets additionally require `viewerClaims.ageConfirmed: true`. Your
271
+ * platform confirms the viewer's age; CalmLens does not verify this claim, and anyone can
272
+ * add it to a public URL.
254
273
  */
255
- getAssetUrl: ({ assetIdentifier, ...options }) => {
274
+ getAssetUrl: (urlOptions) => {
275
+ const { assetIdentifier, ...options } = checked("cdn.getAssetUrl", urlOptions);
256
276
  const { projectId, cdnBaseUrl } = this.#settings;
257
277
  return require_ModerationContextLimits.getAssetUrl({
258
278
  projectId,
@@ -266,7 +286,8 @@ var CalmLensServerClient = class CalmLensServerClient {
266
286
  * the `Response` as soon as headers arrive, so the body streams. Non-2xx responses are
267
287
  * returned, not thrown; `timeoutMs` covers only the wait for headers.
268
288
  */
269
- serve: async ({ assetIdentifier, init, ...urlOptions }) => {
289
+ serve: async (options) => {
290
+ const { assetIdentifier, init, ...urlOptions } = checked("cdn.serve", options);
270
291
  const url = this.cdn.getAssetUrl({
271
292
  assetIdentifier,
272
293
  ...urlOptions
@@ -290,7 +311,7 @@ var CalmLensServerClient = class CalmLensServerClient {
290
311
  * Moderates text and waits for the decision. Sends `text` as `text/plain` content named
291
312
  * `text` unless you pass `name`.
292
313
  */
293
- classify: async (options) => this.buildAssets().classify(require_ModerationContextLimits.toTextAssetOptions(options)) };
314
+ classify: async (options) => this.buildAssets().classify(require_ModerationContextLimits.toTextAssetOptions(checked("text.classify", options))) };
294
315
  }
295
316
  /** Assets: uploads, moderation and management. */
296
317
  get assets() {
@@ -307,31 +328,44 @@ classify: async (options) => this.buildAssets().classify(require_ModerationConte
307
328
  * browser or app, which passes it to `CalmLensAppClient` as `token`.
308
329
  */
309
330
  sign: async (options) => {
310
- return signUploadTokenWithApiKey(this.#apiKey, options, this.#connection.hooks?.uploadTokenTime());
331
+ return signUploadTokenWithApiKey(this.#apiKey, checked("uploadTokens.sign", options), this.#connection.hooks?.uploadTokenTime());
311
332
  } };
312
333
  }
313
334
  buildAssets() {
314
335
  return {
315
336
  /** Searches accessible assets by keyword or a natural-language description. */
316
- search: async (options) => this.request("GET", `${this.projectPath}/assets/search`, { query: options }),
337
+ search: async (options) => this.request("GET", `${this.projectPath}/assets/search`, { query: checked("assets.search", options) }),
317
338
  /** 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 }),
339
+ list: async (options = {}) => this.request("GET", `${this.projectPath}/assets`, { query: checked("assets.list", options) }),
319
340
  /**
320
341
  * Yields every asset matching `options`, fetching pages as needed. The cursor keeps the position
321
342
  * stable when other assets are inserted or deleted.
322
343
  */
323
- iterate: (options = {}) => this.iteratePages((cursor) => this.buildAssets().list({
324
- ...options,
325
- cursor
326
- })),
344
+ iterate: (options = {}) => {
345
+ checked("assets.iterate", options);
346
+ return this.iteratePages((cursor) => this.buildAssets().list({
347
+ ...options,
348
+ cursor
349
+ }));
350
+ },
327
351
  /** Retrieves an asset with its status and classification results. */
328
- retrieve: async ({ assetId }) => this.request("GET", `/assets/${requireId(assetId, "Asset ID")}`),
352
+ retrieve: async (options) => {
353
+ const { assetId } = checked("assets.retrieve", options);
354
+ return this.request("GET", `/assets/${requireId(assetId, "Asset ID")}`);
355
+ },
329
356
  /** Updates an asset's editable fields. */
330
- update: async ({ assetId, ...body }) => this.request("PATCH", `/assets/${requireId(assetId, "Asset ID")}`, { body }),
357
+ update: async (options) => {
358
+ const { assetId, ...body } = checked("assets.update", options);
359
+ return this.request("PATCH", `/assets/${requireId(assetId, "Asset ID")}`, { body });
360
+ },
331
361
  /** 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 }),
362
+ listChildren: async (options = {}) => {
363
+ const { assetId, ...query } = checked("assets.listChildren", options);
364
+ return this.request("GET", `/assets/${requireId(assetId, "Asset ID")}/children`, { query });
365
+ },
333
366
  /** Yields every child of an asset, fetching pages as needed. */
334
367
  iterateChildren: (options) => {
368
+ checked("assets.iterateChildren", options);
335
369
  requireId(options?.assetId, "Asset ID");
336
370
  return this.iteratePages((cursor) => this.buildAssets().listChildren({
337
371
  ...options,
@@ -343,28 +377,31 @@ sign: async (options) => {
343
377
  * status `processing` (or `uploading` for the first multipart part). Retried safely with an
344
378
  * `Idempotency-Key`.
345
379
  */
346
- create: async (options) => this.submitAsset(options, true),
380
+ create: async (options) => this.submitAsset(checked("assets.create", options), true),
347
381
  /**
348
382
  * Uploads an asset and waits for its moderation decision. Audio and video still finish
349
383
  * in the background. Retried safely with an `Idempotency-Key`.
350
384
  */
351
- 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");
385
+ classify: async (classifyOptions) => {
386
+ const options = checked("assets.classify", classifyOptions);
387
+ 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
388
  return this.submitAsset(options, false);
354
389
  },
355
390
  /**
356
391
  * Uploads the next part of a multipart upload. The upload's queue mode, chosen when it
357
392
  * started, applies when the final part arrives; pass `queue` to override it.
358
393
  */
359
- uploadPart: async ({ assetId, ...options }) => {
394
+ uploadPart: async (partOptions) => {
395
+ const { assetId, ...options } = checked("assets.uploadPart", partOptions);
360
396
  const encodedAssetId = requireId(assetId, "Asset ID");
361
- return require_CalmLensConnection.expectAsset(await this.#connection.uploadPart(`/assets/${encodedAssetId}/part`, options));
397
+ return require_CalmLensOptionKeys.expectAsset(await this.#connection.uploadPart(`/assets/${encodedAssetId}/part`, options));
362
398
  },
363
399
  /**
364
400
  * Creates a short-lived signed CDN URL, so browsers can load private content without
365
401
  * an API key.
366
402
  */
367
- createSignedUrl: async ({ assetId, ...options }) => {
403
+ createSignedUrl: async (signedUrlOptions) => {
404
+ const { assetId, ...options } = checked("assets.createSignedUrl", signedUrlOptions);
368
405
  const encodedAssetId = requireId(assetId, "Asset ID");
369
406
  require_ModerationContextLimits.validateSignedUrlOptions(options);
370
407
  return this.request("POST", `/assets/${encodedAssetId}/signed-url`, { body: {
@@ -376,20 +413,29 @@ sign: async (options) => {
376
413
  } });
377
414
  },
378
415
  /** 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 } }),
416
+ move: async (options) => {
417
+ const { assetId, folderId } = checked("assets.move", options);
418
+ return this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/move`, { body: { folderId } });
419
+ },
380
420
  /**
381
421
  * Processes an asset that failed (classification status `failed`) again. It returns to
382
422
  * `processing` and is
383
423
  * moderated like a new upload; its content must still be stored.
384
424
  */
385
- retry: async ({ assetId }) => this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/retry`),
425
+ retry: async (options) => {
426
+ const { assetId } = checked("assets.retry", options);
427
+ return this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/retry`);
428
+ },
386
429
  /**
387
430
  * Records a reviewer's decision, replacing the policy's: the asset's moderation status
388
431
  * becomes `decision`, the note joins its review history and the matching `asset.<status>`
389
432
  * event is sent. An asset still pending moderation can only be blocked or purged. Purging
390
433
  * needs `confirmPurge: true` and permanently deletes the stored content.
391
434
  */
392
- decide: async ({ assetId, ...body }) => this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/decision`, { body }),
435
+ decide: async (options) => {
436
+ const { assetId, ...body } = checked("assets.decide", options);
437
+ return this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/decision`, { body });
438
+ },
393
439
  /**
394
440
  * Completes the policy evidence behind a decided asset's moderation decision: the report's
395
441
  * `classification.moderation.evidence` becomes `full` and every action stays as
@@ -397,13 +443,17 @@ sign: async (options) => {
397
443
  * and returns in `processing`; use it when the policy has changed since the decision
398
444
  * (`asset/policy-changed`).
399
445
  */
400
- explain: async ({ assetId, rerun }) => this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/explain`, { body: rerun ? { rerun } : {} }),
446
+ explain: async (options) => {
447
+ const { assetId, rerun } = checked("assets.explain", options);
448
+ return this.request("POST", `/assets/${requireId(assetId, "Asset ID")}/explain`, { body: rerun ? { rerun } : {} });
449
+ },
401
450
  /**
402
451
  * Waits until an asset's `classification.moderation.status` is no longer `pending` (`allowed`,
403
452
  * `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
453
  * decision within `timeoutMs` (default 60000). Webhooks report decisions without polling.
405
454
  */
406
- waitForDecision: async ({ assetId, ...options }) => {
455
+ waitForDecision: async (waitOptions) => {
456
+ const { assetId, ...options } = checked("assets.waitForDecision", waitOptions);
407
457
  requireId(assetId, "Asset ID");
408
458
  const client = options.signal ? this.withRequestOptions({ signal: options.signal }) : this;
409
459
  return require_ModerationContextLimits.pollForDecision(() => client.assets.retrieve({ assetId }), options, this.#connection.sleep, this.#connection.hooks?.now);
@@ -413,9 +463,13 @@ sign: async (options) => {
413
463
  * keeping the asset record, metadata and classification results. The returned asset has
414
464
  * `content.status` set to `removed` and `content.removalReason` to `requested`; the CDN no longer serves it.
415
465
  */
416
- deleteContent: async ({ assetId }) => this.request("DELETE", `/assets/${requireId(assetId, "Asset ID")}/content`),
466
+ deleteContent: async (options) => {
467
+ const { assetId } = checked("assets.deleteContent", options);
468
+ return this.request("DELETE", `/assets/${requireId(assetId, "Asset ID")}/content`);
469
+ },
417
470
  /** Deletes an asset record together with its stored content. */
418
- delete: async ({ assetId }) => {
471
+ delete: async (options) => {
472
+ const { assetId } = checked("assets.delete", options);
419
473
  await this.request("DELETE", `/assets/${requireId(assetId, "Asset ID")}`);
420
474
  },
421
475
  /**
@@ -426,7 +480,8 @@ sign: async (options) => {
426
480
  * `asset.deleted` or `asset.content-removed` for each asset. Assets under a safety hold
427
481
  * are skipped. Not retried: it carries no `Idempotency-Key`.
428
482
  */
429
- batch: async ({ assetIds, operation }) => {
483
+ batch: async (options) => {
484
+ const { assetIds, operation } = checked("assets.batch", options);
430
485
  require_ModerationContextLimits.validateBatchAssetsOptions({
431
486
  assetIds,
432
487
  operation
@@ -445,13 +500,13 @@ sign: async (options) => {
445
500
  * for "now", then poll with each response's `nextCursor`. Webhook deliveries carry the same
446
501
  * events reshaped as `{ id, type, createdAt, projectId, data }`.
447
502
  */
448
- list: async (options = {}) => this.request("GET", `${this.projectPath}/events`, { query: { ...options } }),
503
+ list: async (options = {}) => this.request("GET", `${this.projectPath}/events`, { query: { ...checked("events.list", options) } }),
449
504
  /**
450
505
  * Yields pages of events after `cursor` until no more are waiting. Save each page's
451
506
  * `nextCursor` to resume later. Without `cursor`, yields one empty page whose `nextCursor`
452
507
  * is "now".
453
508
  */
454
- pages: (options = {}) => this.iterateEventPages(options)
509
+ pages: (options = {}) => this.iterateEventPages(checked("events.pages", options))
455
510
  };
456
511
  }
457
512
  async *iterateEventPages(options) {
@@ -486,17 +541,27 @@ sign: async (options) => {
486
541
  * Lists one page of child folders, sorted by name unless `ordering` says otherwise. Pass
487
542
  * `nextCursor` as `cursor` for the next page; fetch a branch when it is opened.
488
543
  */
489
- list: async (options = {}) => this.request("GET", `${this.projectPath}/folders`, { query: options }),
490
- retrieve: async ({ folderId }) => this.request("GET", `/folders/${requireId(folderId, "Folder ID")}`),
544
+ list: async (options = {}) => this.request("GET", `${this.projectPath}/folders`, { query: checked("folders.list", options) }),
545
+ retrieve: async (options) => {
546
+ const { folderId } = checked("folders.retrieve", options);
547
+ return this.request("GET", `/folders/${requireId(folderId, "Folder ID")}`);
548
+ },
491
549
  /** 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 }),
550
+ create: async (options) => this.request("POST", `${this.projectPath}/folders`, { body: checked("folders.create", options) }),
551
+ update: async (options) => {
552
+ const { folderId, ...body } = checked("folders.update", options);
553
+ return this.request("PATCH", `/folders/${requireId(folderId, "Folder ID")}`, { body });
554
+ },
494
555
  /** Deletes an empty folder; throws `folder/not-empty` otherwise. */
495
- delete: async ({ folderId }) => {
556
+ delete: async (options) => {
557
+ const { folderId } = checked("folders.delete", options);
496
558
  await this.request("DELETE", `/folders/${requireId(folderId, "Folder ID")}`);
497
559
  },
498
560
  /** 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 } })
561
+ move: async (options) => {
562
+ const { folderId, parentId } = checked("folders.move", options);
563
+ return this.request("POST", `/folders/${requireId(folderId, "Folder ID")}/move`, { body: { parentId } });
564
+ }
500
565
  };
501
566
  }
502
567
  /**
@@ -506,29 +571,80 @@ sign: async (options) => {
506
571
  get hashLists() {
507
572
  return {
508
573
  /** 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 }),
574
+ list: async (options = {}) => this.request("GET", `${this.projectPath}/hash-lists`, { query: checked("hashLists.list", options) }),
575
+ retrieve: async (options) => {
576
+ const { hashListId } = checked("hashLists.retrieve", options);
577
+ return this.request("GET", `/hash-lists/${requireId(hashListId, "Hash list ID")}`);
578
+ },
579
+ create: async (options) => this.request("POST", `${this.projectPath}/hash-lists`, { body: checked("hashLists.create", options) }),
512
580
  /** 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 }),
581
+ update: async (options) => {
582
+ const { hashListId, ...body } = checked("hashLists.update", options);
583
+ return this.request("PATCH", `/hash-lists/${requireId(hashListId, "Hash list ID")}`, { body });
584
+ },
514
585
  /** Deletes the list and every entry in it. */
515
- delete: async ({ hashListId }) => {
586
+ delete: async (options) => {
587
+ const { hashListId } = checked("hashLists.delete", options);
516
588
  await this.request("DELETE", `/hash-lists/${requireId(hashListId, "Hash list ID")}`);
517
589
  },
518
590
  /** 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 }),
591
+ listEntries: async (options) => {
592
+ const { hashListId, ...query } = checked("hashLists.listEntries", options);
593
+ return this.request("GET", `/hash-lists/${requireId(hashListId, "Hash list ID")}/entries`, { query });
594
+ },
520
595
  /** 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 }) => {
596
+ addEntry: async (options) => {
597
+ const { hashListId, ...body } = checked("hashLists.addEntry", options);
598
+ return this.request("POST", `/hash-lists/${requireId(hashListId, "Hash list ID")}/entries`, { body });
599
+ },
600
+ removeEntry: async (options) => {
601
+ const { entryId } = checked("hashLists.removeEntry", options);
523
602
  await this.request("DELETE", `/hash-list-entries/${requireId(entryId, "Hash list entry ID")}`);
524
603
  }
525
604
  };
526
605
  }
527
606
  /**
607
+ * Moderation policies belong to the project's organisation and its projects share them. Every
608
+ * change sends the policy's `revision`, so a policy changed since is refused. Through a
609
+ * project's key you can change only policies no other project uses or owns.
610
+ */
611
+ get policies() {
612
+ const policyPath = (policyId) => `${this.projectPath}/policies/${requireId(policyId, "Policy ID")}`;
613
+ return {
614
+ /** Lists the organisation's policies and the ID of the one the project uses. */
615
+ list: async () => this.request("GET", `${this.projectPath}/policies`),
616
+ retrieve: async (options) => this.request("GET", policyPath(checked("policies.retrieve", options).policyId)),
617
+ /** Creates a policy from `settings`, or a copy of a built-in preset with `presetId`. */
618
+ create: async (options) => this.request("POST", `${this.projectPath}/policies`, { body: checked("policies.create", options) }),
619
+ /** Changes the name, description or settings; later moderation uses them. */
620
+ update: async (options) => {
621
+ const { policyId, ...body } = checked("policies.update", options);
622
+ return this.request("PATCH", policyPath(policyId), { body });
623
+ },
624
+ /** Resets a preset copy to its pinned version, or updates an unchanged copy to the latest. */
625
+ applyPreset: async (options) => {
626
+ const { policyId, ...body } = checked("policies.applyPreset", options);
627
+ return this.request("POST", `${policyPath(policyId)}/preset`, { body });
628
+ },
629
+ /** Switches automatic updates on or off for the organisation's own preset policy. */
630
+ setAutomaticUpdates: async (options) => {
631
+ const { policyId, ...body } = checked("policies.setAutomaticUpdates", options);
632
+ return this.request("PUT", `${policyPath(policyId)}/automatic-updates`, { body });
633
+ },
634
+ /** Deletes a policy that no project or upload preset uses. */
635
+ delete: async (options) => {
636
+ await this.request("DELETE", policyPath(checked("policies.delete", options).policyId));
637
+ },
638
+ /** Chooses the policy the project moderates with. */
639
+ assign: async (options) => this.request("PUT", `${this.projectPath}/policy`, { body: checked("policies.assign", options) })
640
+ };
641
+ }
642
+ /**
528
643
  * Create a named lens at any positive version, or update it with a greater version.
529
644
  * Supplying the same definition and version is idempotent.
530
645
  */
531
646
  async ensureLens(options) {
647
+ checked("ensureLens", options);
532
648
  if (!options?.identifier) throw require_ModerationContextLimits.invalidArgument("Lens identifier is required");
533
649
  const [lens] = await this.ensureLenses({ lenses: [options] });
534
650
  return lens;
@@ -538,9 +654,11 @@ sign: async (options) => {
538
654
  * consecutive requests of at most {@link ENSURE_LENSES_MAX_PER_REQUEST} definitions, in order.
539
655
  * Each lens follows the same versioning and idempotency rules as ensureLens().
540
656
  */
541
- async ensureLenses({ lenses }) {
657
+ async ensureLenses(options) {
658
+ const { lenses } = checked("ensureLenses", options);
542
659
  if (!Array.isArray(lenses) || lenses.length === 0) throw require_ModerationContextLimits.invalidArgument("At least one lens is required");
543
660
  if (lenses.some((option) => !option?.identifier)) throw require_ModerationContextLimits.invalidArgument("Lens identifier is required");
661
+ for (const lens of lenses) checked("ensureLens", lens);
544
662
  const { ensuredLenses, pendingEnsureLenses } = this.#lenses;
545
663
  const missingOptions = [];
546
664
  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-COJbOuiv.js";
3
+ import "./WebhookPayload-DkukERKE.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
  /**
@@ -98,32 +100,32 @@ declare class CalmLensServerClient {
98
100
  * Uploads an asset and waits for its moderation decision. Audio and video still finish
99
101
  * in the background. Retried safely with an `Idempotency-Key`.
100
102
  */
101
- classify: (options: SubmitAssetOptions) => Promise<Asset>;
103
+ classify: (classifyOptions: SubmitAssetOptions) => Promise<Asset>;
102
104
  /**
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 organisation's own 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
  }