calmlens 0.18.2 → 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-DMUhJ3ts.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-bDysYiDC.js → CalmLensAppClient-LHMEQ-UZ.js} +32 -11
  6. package/cjs/{CalmLensConnection-DYaD8NYq.js → CalmLensOptionKeys-BUj7v5AG.js} +368 -8
  7. package/cjs/{CalmLensServerClient-DC3xl3eZ.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-CBxaVlHR.js → ModerationContextLimits-FDpQmw_T.js} +195 -41
  11. package/cjs/{ReactUpload-DAELJwNe.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-DvS9L1ap.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/cjs/{ui-wIiMfqMB.d.ts → ui-B23r8BvW.d.ts} +17 -4
  35. package/cjs/{ui-Bia1qnXS.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-e-1rPGBJ.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-C2nt3f4z.js → CalmLensAppClient-BjlvBweS.js} +28 -7
  44. package/esm/{CalmLensConnection-CFkiKq6d.js → CalmLensOptionKeys-BKez0Wiw.js} +351 -9
  45. package/esm/{CalmLensServerClient-JtP687a3.d.ts → CalmLensServerClient-DCSbwIBs.d.ts} +53 -29
  46. package/esm/{CalmLensServerClient-dg5Z5Lp-.js → CalmLensServerClient-DemxbNMn.js} +159 -46
  47. package/esm/{CalmLensTypes-9Vt16pc7.d.ts → CalmLensTypes-DpU-hXq2.d.ts} +2677 -30
  48. package/esm/{ModerationContextLimits-DLvGPUiz.js → ModerationContextLimits-lLfmyLni.js} +176 -40
  49. package/esm/{ReactUpload-BklovwBh.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-BQlf16Y0.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/esm/{ui-wIiMfqMB.d.ts → ui-B23r8BvW.d.ts} +17 -4
  73. package/esm/{ui-DKQ4d86a.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
package/esm/testing.js CHANGED
@@ -1,10 +1,10 @@
1
- import { A as invalidArgument, C as MAX_IMAGE_UPLOAD_BYTES, E as isRejectedUploadMimeType, M as API_ERROR_CODES, N as API_ERROR_DEFINITIONS, O as CalmLensError, T as getRejectedUploadMimeTypeError, _ as validateAppClientOptions, b as validateServerClientOptions, f as randomUuid, j as invalidConfig, k as SDK_ERROR_CODES, r as selectModerationContextItems, w as MIN_MULTIPART_IMAGE_UPLOAD_BYTES } from "./ModerationContextLimits-DLvGPUiz.js";
2
- import { a as WEBHOOK_TIMESTAMP_HEADER, l as signUploadTokenWithApiKey, n as WEBHOOK_DELIVERY_HEADER, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient, u as stringifyJsonCanonical } from "./CalmLensServerClient-dg5Z5Lp-.js";
3
- import { d as assetDataToUint8Array, f as assetToData, n as MOCK_HOOKS, p as validateAssetPayload, u as sleep } from "./CalmLensConnection-CFkiKq6d.js";
1
+ import { E as MAX_IMAGE_UPLOAD_BYTES, F as API_ERROR_CODES, I as API_ERROR_DEFINITIONS, M as SDK_ERROR_CODES, N as invalidArgument, O as getRejectedUploadMimeTypeError, P as invalidConfig, j as CalmLensError, k as isRejectedUploadMimeType, p as randomUuid, r as selectModerationContextItems, v as validateAppClientOptions, x as validateServerClientOptions } from "./ModerationContextLimits-lLfmyLni.js";
2
+ import { a as WEBHOOK_TIMESTAMP_HEADER, l as signUploadTokenWithApiKey, n as WEBHOOK_DELIVERY_HEADER, r as WEBHOOK_SIGNATURE_HEADER, t as CalmLensServerClient, u as stringifyJsonCanonical } from "./CalmLensServerClient-DemxbNMn.js";
3
+ import { g as validateAssetPayload, h as assetToData, i as MOCK_HOOKS, m as assetDataToUint8Array, p as sleep } from "./CalmLensOptionKeys-BKez0Wiw.js";
4
4
  import { t as hmacSha256Hex } from "./CryptoUtils-B_x8lMIx-DhuWGzqn.js";
5
- import { t as CalmLensAppClient } from "./CalmLensAppClient-C2nt3f4z.js";
6
- import { a as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-BQlf16Y0.js";
7
- import { s as getTestInputTag, u as CLASSIFICATION_CATEGORIES } from "./TestTriggers-DTc_iMJF-HfB533Gx.js";
5
+ import { t as CalmLensAppClient } from "./CalmLensAppClient-BjlvBweS.js";
6
+ import { a as placeholderHashToDataURL, r as isFileAccepted } from "./UploadController-UxP6gj7A.js";
7
+ import { s as getTestInputTag, u as CLASSIFICATION_CATEGORIES } from "./TestTriggers-CMwMrbjy-bdowBBKw.js";
8
8
  import * as zod from "zod";
9
9
  // src/contract/MediaTestTriggers.js
10
10
  const MEDIA_TEST_SIGNALS = [...CLASSIFICATION_CATEGORIES, "violence.graphic"];
@@ -31,7 +31,7 @@ async function generateMediaTestCode(signal, testInputKey) {
31
31
  if (!MEDIA_TEST_SIGNALS.includes(signal)) throw new RangeError("Unsupported media test signal");
32
32
  return `Calm Lens test ${[...await getTestInputTag("media", signal, testInputKey)].map((character) => HEX_WORDS[Number.parseInt(character, 16)]).join(" ")} ${signal.replace(/[.-]/g, " ")} end test`;
33
33
  }
34
- // src/contract/Ids-aHyP9ZcF.js
34
+ // src/contract/Ids-D2XfVlL6.js
35
35
  var __defProp = Object.defineProperty;
36
36
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
37
37
  var __exportAll = (all, no_symbols) => {
@@ -7906,6 +7906,7 @@ const ID_PREFIXES = {
7906
7906
  user: "user",
7907
7907
  member: "mem",
7908
7908
  invitation: "inv",
7909
+ transfer: "xfer",
7909
7910
  supportTicket: "tkt",
7910
7911
  supportTicketMessage: "msg",
7911
7912
  humanReview: "rev",
@@ -7966,6 +7967,7 @@ const EXAMPLE_IDS = {
7966
7967
  user: "user_4Rk9Xm2Lq7Vt3Wb8Np6C",
7967
7968
  mem: "mem_9Xm4Rk7Lq2Vt8Wb3Np5C",
7968
7969
  inv: "inv_3Qk8Xm2Rt9Lv4Wb7Np6C",
7970
+ xfer: "xfer_6Lq2Xm8Rk4Vt9Wb3Np7C",
7969
7971
  tkt: "tkt_6Xm2Rk9Lq4Vt7Wb3Np8C",
7970
7972
  msg: "msg_2Rk7Xm4Lq9Vt3Wb8Np5C",
7971
7973
  rev: "rev_8Xm3Rk2Lq7Vt9Wb4Np6C",
@@ -7982,8 +7984,8 @@ const EXAMPLE_IDS = {
7982
7984
  * every stored model's IDs by prefix is a separate change (it surfaces about a thousand call sites
7983
7985
  * across the packages that build records from plain strings).
7984
7986
  */
7985
- const idField = (prefix) => zod.string().regex(idPattern(prefix), { message: `Must be an ID starting with "${prefix}_"` }).meta({ examples: [EXAMPLE_IDS[prefix]] });
7986
- // src/contract/Permissions-DjKQmOVp.js
7987
+ const idField = (prefix) => zod.string().regex(idPattern(prefix), { message: `Must be a valid ID: "${prefix}_" followed by 20 letters or digits` }).meta({ examples: [EXAMPLE_IDS[prefix]] });
7988
+ // src/contract/Permissions-C2KeOlab.js
7987
7989
  const ACTION_SCHEMA = zod.enum([
7988
7990
  "assets:read",
7989
7991
  "assets:download",
@@ -8011,6 +8013,8 @@ const ACTION_SCHEMA = zod.enum([
8011
8013
  "upload-presets:write",
8012
8014
  "hash-lists:read",
8013
8015
  "hash-lists:write",
8016
+ "policies:read",
8017
+ "policies:write",
8014
8018
  "reviews:read",
8015
8019
  "reviews:write",
8016
8020
  "project:manage"
@@ -8024,6 +8028,7 @@ const PROJECT_ACTIONS = [...[
8024
8028
  "lenses",
8025
8029
  "upload-presets",
8026
8030
  "hash-lists",
8031
+ "policies",
8027
8032
  "reviews"
8028
8033
  ].flatMap((feature) => [`${feature}:read`, `${feature}:write`]), "project:manage"];
8029
8034
  const isProjectAction = (action) => PROJECT_ACTIONS.includes(action);
@@ -8656,6 +8661,13 @@ var ApiFailure = class {
8656
8661
  const fail = (code, { message, details } = {}) => new ApiFailure(API_ERROR_DEFINITIONS[code].status, code, message ?? API_ERROR_DEFINITIONS[code].message, details);
8657
8662
  /** A request the API's schema refuses: `validation/<zod issue>` with HTTP 400 and the field. */
8658
8663
  const invalidField = (code, path) => new ApiFailure(400, code, `Invalid ${path}`, { path });
8664
+ /** The built-in presets the mock knows, by display name. */
8665
+ const MOCK_PRESET_NAMES = {
8666
+ "general-community": "General",
8667
+ "children-platform": "Kids",
8668
+ "education-support": "Learning and support",
8669
+ "wholesome-community": "Teen-safe"
8670
+ };
8659
8671
  /** The client methods that send a request, the one it is recorded under first. */
8660
8672
  const operationsOf = (request) => {
8661
8673
  const { method, segments, query, cdn } = request;
@@ -8667,6 +8679,8 @@ const operationsOf = (request) => {
8667
8679
  case "lenses": return ["ensureLenses", "ensureLens"];
8668
8680
  case "folders": return method === "GET" ? ["folders.list"] : ["folders.create"];
8669
8681
  case "hash-lists": return method === "GET" ? ["hashLists.list"] : ["hashLists.create"];
8682
+ case "policies": return method === "GET" ? ["policies.list"] : ["policies.create"];
8683
+ case "policy": return ["policies.assign"];
8670
8684
  case "assets/search": return ["assets.search"];
8671
8685
  case "assets/batch": return ["assets.batch"];
8672
8686
  case "assets":
@@ -8674,6 +8688,11 @@ const operationsOf = (request) => {
8674
8688
  if (query.get("queue") === "true") return ["assets.create"];
8675
8689
  return isTextUpload(request) ? ["assets.classify", "text.classify"] : ["assets.classify"];
8676
8690
  }
8691
+ if (segments[2] === "policies" && segments[3] !== void 0) {
8692
+ if (segments[4] === "preset") return ["policies.applyPreset"];
8693
+ if (segments[4] === "automatic-updates") return ["policies.setAutomaticUpdates"];
8694
+ return method === "GET" ? ["policies.retrieve"] : method === "PATCH" ? ["policies.update"] : ["policies.delete"];
8695
+ }
8677
8696
  return [];
8678
8697
  }
8679
8698
  if (root === "upload-presets") {
@@ -8710,6 +8729,7 @@ const isTextUpload = (request) => request.headers.get("x-calmlens-upload") === "
8710
8729
  const SUCCESS_STATUS = {
8711
8730
  "folders.create": 201,
8712
8731
  "hashLists.create": 201,
8732
+ "policies.create": 201,
8713
8733
  "assets.batch": 202
8714
8734
  };
8715
8735
  const decodeSegment = (segment) => {
@@ -8740,6 +8760,7 @@ var MockCalmLensApi = class {
8740
8760
  this.pendingFailures = [];
8741
8761
  this.requestCount = 0;
8742
8762
  this.waitedMs = 0;
8763
+ this.policies = /* @__PURE__ */ new Map();
8743
8764
  this.hashLists = /* @__PURE__ */ new Map();
8744
8765
  this.hashListEntries = /* @__PURE__ */ new Map();
8745
8766
  this.pageFailure = (code, path) => code === "validation/invalid-cursor" ? fail(API_ERROR_CODES.INVALID_CURSOR) : invalidField(code, path ?? "pageSize");
@@ -9074,6 +9095,17 @@ var MockCalmLensApi = class {
9074
9095
  case "GET hash-lists": return [200, this.listHashLists(request.query)];
9075
9096
  case "POST hash-lists": return [201, this.createHashList(this.json(request))];
9076
9097
  case "PUT lenses": return [200, this.ensureLenses(this.json(request))];
9098
+ case "GET policies": return [200, this.listPolicies()];
9099
+ case "POST policies": return [201, this.createPolicy(this.json(request))];
9100
+ case "PUT policy": return [200, this.assignPolicy(this.json(request))];
9101
+ }
9102
+ const [, , collection, policyId, policyAction, ...more] = segments;
9103
+ if (collection === "policies" && policyId !== void 0 && more.length === 0) switch (`${method} ${policyAction ?? ""}`) {
9104
+ case "GET ": return [200, this.toPolicy(this.findPolicy(policyId))];
9105
+ case "PATCH ": return [200, this.updatePolicy(policyId, this.json(request))];
9106
+ case "DELETE ": return [200, this.deletePolicy(policyId)];
9107
+ case "POST preset": return [200, this.applyPolicyPreset(policyId, this.json(request))];
9108
+ case "PUT automatic-updates": return [200, this.setPolicyAutomaticUpdates(policyId, this.json(request))];
9077
9109
  }
9078
9110
  }
9079
9111
  if (root === "upload-presets" && id !== void 0 && action === "assets") return [200, await this.presetRoute(request, id, rest, session)];
@@ -9109,6 +9141,134 @@ var MockCalmLensApi = class {
9109
9141
  }
9110
9142
  throw fail(API_ERROR_CODES.ROUTE_NOT_FOUND, { message: `No route for ${method} /${segments.join("/")}` });
9111
9143
  }
9144
+ ensurePolicies() {
9145
+ if (this.projectPolicyId) return;
9146
+ const now = this.now();
9147
+ const general = this.newPolicy({
9148
+ name: MOCK_PRESET_NAMES["general-community"],
9149
+ settings: { categorySettings: {} },
9150
+ automaticUpdates: true,
9151
+ preset: {
9152
+ id: "general-community",
9153
+ version: 1,
9154
+ projectId: this.projectId
9155
+ },
9156
+ createdAt: now
9157
+ });
9158
+ this.projectPolicyId = general.id;
9159
+ }
9160
+ newPolicy(values) {
9161
+ const policy = {
9162
+ id: this.createId("pol"),
9163
+ name: values.name,
9164
+ description: values.description ?? "",
9165
+ settings: values.settings,
9166
+ revision: 1,
9167
+ automaticUpdates: values.automaticUpdates ?? false,
9168
+ preset: values.preset ?? null,
9169
+ baseline: structuredClone(values.settings),
9170
+ createdAt: values.createdAt,
9171
+ updatedAt: values.createdAt
9172
+ };
9173
+ this.policies.set(policy.id, policy);
9174
+ return policy;
9175
+ }
9176
+ toPolicy(policy) {
9177
+ const { baseline: _baseline, preset, ...rest } = policy;
9178
+ return {
9179
+ ...structuredClone(rest),
9180
+ preset: preset && {
9181
+ ...preset,
9182
+ latestVersion: 1
9183
+ },
9184
+ projectIds: policy.id === this.projectPolicyId ? [this.projectId] : []
9185
+ };
9186
+ }
9187
+ findPolicy(policyId) {
9188
+ this.ensurePolicies();
9189
+ const policy = this.policies.get(policyId);
9190
+ if (!policy) throw fail(API_ERROR_CODES.POLICY_NOT_FOUND);
9191
+ return policy;
9192
+ }
9193
+ listPolicies() {
9194
+ this.ensurePolicies();
9195
+ return {
9196
+ policies: [...this.policies.values()].map((policy) => this.toPolicy(policy)),
9197
+ projectPolicyId: this.projectPolicyId
9198
+ };
9199
+ }
9200
+ createPolicy(body) {
9201
+ this.ensurePolicies();
9202
+ const { name, description, settings, presetId } = body;
9203
+ const preset = typeof presetId === "string" ? presetId : void 0;
9204
+ if (settings === void 0 === (preset === void 0) || preset !== void 0 && !(preset in MOCK_PRESET_NAMES) || preset === void 0 && (typeof name !== "string" || !name.trim())) throw fail(API_ERROR_CODES.INVALID_VALUE, { message: "Send settings with a name, or presetId" });
9205
+ const policy = this.newPolicy({
9206
+ name: typeof name === "string" && name.trim() ? name.trim() : MOCK_PRESET_NAMES[preset],
9207
+ ...typeof description === "string" ? { description } : {},
9208
+ settings: preset ? { categorySettings: {} } : settings,
9209
+ ...preset ? { preset: {
9210
+ id: preset,
9211
+ version: 1,
9212
+ projectId: null
9213
+ } } : {},
9214
+ createdAt: this.now()
9215
+ });
9216
+ return this.toPolicy(policy);
9217
+ }
9218
+ /** Saves new values under the next revision, once `revision` is the current one. */
9219
+ savePolicy(policy, revision, values) {
9220
+ if (revision !== policy.revision) throw fail(API_ERROR_CODES.POLICY_REVISION_CONFLICT);
9221
+ const saved = {
9222
+ ...policy,
9223
+ ...values,
9224
+ revision: policy.revision + 1,
9225
+ updatedAt: this.now()
9226
+ };
9227
+ this.policies.set(policy.id, saved);
9228
+ return this.toPolicy(saved);
9229
+ }
9230
+ updatePolicy(policyId, body) {
9231
+ const policy = this.findPolicy(policyId);
9232
+ return this.savePolicy(policy, body.revision, {
9233
+ ...typeof body.name === "string" ? { name: body.name.trim() } : {},
9234
+ ...typeof body.description === "string" ? { description: body.description } : {},
9235
+ ...body.settings !== void 0 ? { settings: body.settings } : {},
9236
+ automaticUpdates: false
9237
+ });
9238
+ }
9239
+ applyPolicyPreset(policyId, body) {
9240
+ const policy = this.findPolicy(policyId);
9241
+ if (!policy.preset || policy.automaticUpdates) throw fail(API_ERROR_CODES.POLICY_NO_PRESET);
9242
+ if (body.presetVersion !== policy.preset.version) throw fail(API_ERROR_CODES.POLICY_PRESET_VERSION_CONFLICT);
9243
+ if (body.operation === "update") throw fail(API_ERROR_CODES.POLICY_PRESET_UPDATE_UNAVAILABLE);
9244
+ return this.savePolicy(policy, body.revision, { settings: structuredClone(policy.baseline) });
9245
+ }
9246
+ setPolicyAutomaticUpdates(policyId, body) {
9247
+ const policy = this.findPolicy(policyId);
9248
+ const enabled = body.enabled === true;
9249
+ if (policy.preset?.projectId !== this.projectId || policy.automaticUpdates === enabled) throw fail(API_ERROR_CODES.POLICY_AUTOMATIC_UPDATES_UNAVAILABLE);
9250
+ if (body.revision !== policy.revision) throw fail(API_ERROR_CODES.POLICY_REVISION_CONFLICT);
9251
+ if (body.presetVersion !== 1) throw fail(API_ERROR_CODES.POLICY_PRESET_VERSION_CONFLICT);
9252
+ return this.savePolicy(policy, body.revision, {
9253
+ automaticUpdates: enabled,
9254
+ ...enabled ? {
9255
+ name: MOCK_PRESET_NAMES[policy.preset.id],
9256
+ description: "",
9257
+ settings: structuredClone(policy.baseline)
9258
+ } : {}
9259
+ });
9260
+ }
9261
+ deletePolicy(policyId) {
9262
+ const policy = this.findPolicy(policyId);
9263
+ if (policy.id === this.projectPolicyId) throw fail(API_ERROR_CODES.POLICY_IN_USE);
9264
+ this.policies.delete(policy.id);
9265
+ return {};
9266
+ }
9267
+ assignPolicy(body) {
9268
+ const policy = this.findPolicy(String(body.policyId));
9269
+ this.projectPolicyId = policy.id;
9270
+ return this.toPolicy(policy);
9271
+ }
9112
9272
  createHashList(body) {
9113
9273
  const { name, description, action } = body;
9114
9274
  if (typeof name !== "string" || !name.trim() || action !== "flag" && action !== "block") throw fail(API_ERROR_CODES.INVALID_UPLOAD_PAYLOAD, { message: "A hash list needs a name and an action of flag or block" });
@@ -9487,7 +9647,7 @@ var MockCalmLensApi = class {
9487
9647
  if (part) {
9488
9648
  if (part.partNumber > 1) throw fail(API_ERROR_CODES.USE_UPLOAD_PART);
9489
9649
  const partSize = bytes.byteLength;
9490
- const sizeError = (part.totalSizeInBytes === void 0 ? void 0 : this.multipartImageSizeError(type, part.totalSizeInBytes, true)) ?? (part.isFinal ? this.multipartTotalSizeError(part.totalSizeInBytes, partSize, true) ?? this.multipartImageSizeError(type, partSize, true) : void 0);
9650
+ const sizeError = (part.totalSizeInBytes === void 0 ? void 0 : this.multipartImageSizeError(type, part.totalSizeInBytes)) ?? (part.isFinal ? this.multipartTotalSizeError(part.totalSizeInBytes, partSize, true) ?? this.multipartImageSizeError(type, partSize) : void 0);
9491
9651
  if (sizeError) throw fail(sizeError);
9492
9652
  const validation = validateAssetPayload({ uint8Array: bytes }, {
9493
9653
  multipart: true,
@@ -9599,7 +9759,7 @@ var MockCalmLensApi = class {
9599
9759
  });
9600
9760
  const received = (asset.content.sizeInBytes ?? 0) + bytes.byteLength;
9601
9761
  const upload = this.openUploads.get(assetId);
9602
- const sizeError = this.multipartImageSizeError(asset.type, received, isFinal) ?? this.multipartTotalSizeError(upload?.totalSizeInBytes, received, isFinal);
9762
+ const sizeError = this.multipartImageSizeError(asset.type, received) ?? this.multipartTotalSizeError(upload?.totalSizeInBytes, received, isFinal);
9603
9763
  if (sizeError) throw fail(sizeError);
9604
9764
  const validation = validateAssetPayload({ uint8Array: bytes }, {
9605
9765
  multipart: true,
@@ -9636,11 +9796,10 @@ var MockCalmLensApi = class {
9636
9796
  this.recordProcessingEvents(stored, decision);
9637
9797
  return stored;
9638
9798
  }
9639
- /** Like the API: image uploads in parts total 10 MiB (checked at the last part) to 20 MiB. */
9640
- multipartImageSizeError(type, sizeInBytes, isFinal) {
9799
+ /** Like the API: image uploads in parts total at most 20 MiB, at any size below that. */
9800
+ multipartImageSizeError(type, sizeInBytes) {
9641
9801
  if (type !== "image") return void 0;
9642
9802
  if (sizeInBytes > MAX_IMAGE_UPLOAD_BYTES) return API_ERROR_CODES.MULTIPART_IMAGE_TOO_LARGE;
9643
- if (isFinal && sizeInBytes < MIN_MULTIPART_IMAGE_UPLOAD_BYTES) return API_ERROR_CODES.MULTIPART_IMAGE_TOO_SMALL;
9644
9803
  }
9645
9804
  /** Like the API: the parts may not overshoot a declared total, and must reach it at the end. */
9646
9805
  multipartTotalSizeError(totalSizeInBytes, receivedSizeInBytes, isFinal) {
@@ -9912,7 +10071,8 @@ var MockCalmLensApi = class {
9912
10071
  if (!cursor) return {
9913
10072
  items: [],
9914
10073
  nextCursor: `mock_${this.eventFeed.length}`,
9915
- hasMore: false
10074
+ hasMore: false,
10075
+ excludedTypes: []
9916
10076
  };
9917
10077
  const match = /^mock_(\d+)$/.exec(cursor);
9918
10078
  const position = match ? Number(match[1]) : NaN;
@@ -9922,7 +10082,8 @@ var MockCalmLensApi = class {
9922
10082
  return {
9923
10083
  items,
9924
10084
  nextCursor: `mock_${next}`,
9925
- hasMore: next < this.eventFeed.length
10085
+ hasMore: next < this.eventFeed.length,
10086
+ excludedTypes: []
9926
10087
  };
9927
10088
  }
9928
10089
  /**
@@ -10067,7 +10228,7 @@ var MockCalmLensApi = class {
10067
10228
  this.lenses.set(lens.identifier, lens);
10068
10229
  return lens;
10069
10230
  }
10070
- if (existing.name === options.name && (existing.description ?? null) === (options.description ?? null) && existing.type === options.type && existing.active === options.active && stringifyJsonCanonical(existing.transforms ?? null) === stringifyJsonCanonical(options.transforms ?? null) && existing.version === options.version) return existing;
10231
+ if (existing.name === options.name && (existing.description ?? null) === (options.description ?? null) && existing.type === options.type && existing.active === options.active && stringifyJsonCanonical(existing.transform ?? null) === stringifyJsonCanonical(options.transform ?? null) && existing.version === options.version) return existing;
10071
10232
  if (options.version > existing.version) {
10072
10233
  const lens = {
10073
10234
  ...existing,
@@ -1,5 +1,5 @@
1
- import { Dt as ViewerClaims, k as CdnTransform, m as AssetModerationStatus, w as CalmLensAppClientOptions } from "./CalmLensTypes-9Vt16pc7.js";
2
- import { t as CalmLensAppClient } from "./CalmLensAppClient-CV_K26Ce.js";
1
+ import { E as CalmLensAppClientOptions, Mt as ViewerClaims, h as AssetModerationStatus, j as CdnTransform } from "./CalmLensTypes-DpU-hXq2.js";
2
+ import { t as CalmLensAppClient } from "./CalmLensAppClient-B5gfOB6J.js";
3
3
  /**
4
4
  * The parts of an asset, as the API or a webhook returns it, that the media component reads.
5
5
  * Assets from `CalmLensServerClient` fit as they are.
@@ -469,13 +469,26 @@ declare const ICON_ATTRIBUTES: {
469
469
  readonly "stroke-linejoin": "round";
470
470
  readonly "aria-hidden": "true";
471
471
  };
472
+ interface ProgressFetchOptions {
473
+ /**
474
+ * The size of everything this fetch will send, such as the file's size. An upload larger than
475
+ * the client's `partSizeBytes` goes in several requests, and only this total keeps the
476
+ * reported share of the file from restarting with each part.
477
+ */
478
+ totalBytes?: number;
479
+ }
472
480
  /**
473
481
  * A `fetch` that reports how many bytes of the request body have been sent, which `fetch` itself
474
482
  * can't do. It sends through `XMLHttpRequest`, so the upload components pass it to
475
483
  * `CalmLensAppClient` as `uploadFetch`. Without `XMLHttpRequest` it falls back to `fetch` and
476
484
  * reports nothing.
485
+ *
486
+ * The count runs across the requests sent through it: `sentBytes` adds the bodies of earlier
487
+ * requests that succeeded, so a file uploaded in parts keeps counting up. `totalBytes` is
488
+ * `options.totalBytes` when given, otherwise those earlier bodies plus the current one. Create
489
+ * one for each file.
477
490
  */
478
- declare const createProgressFetch: (onProgress: (sentBytes: number, totalBytes: number) => void) => ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>);
491
+ declare const createProgressFetch: (onProgress: (sentBytes: number, totalBytes: number) => void, { totalBytes }?: ProgressFetchOptions) => ((input: RequestInfo | URL, init?: RequestInit) => Promise<Response>);
479
492
  /**
480
493
  * The components' stylesheet, also shipped as `calmlens/styles.css`. The React components
481
494
  * render it themselves (React hoists it into the head, on the server too); with Vue, Svelte or
@@ -523,4 +536,4 @@ declare const CALMLENS_THEME: {
523
536
  * as the stylesheet mixes them from the page's text colour.
524
537
  */
525
538
  declare const resolveTheme: (overrides?: Partial<CalmLensTheme>) => CalmLensTheme;
526
- export { CustomUploadResult as A, MediaAsset as B, getDropzoneHint as C, resolveMessages as D, getUploadItemOutcome as E, UploadItem as F, MediaState as G, MediaOptions as H, UploadSnapshot as I, resolveMediaProps as J, getMediaState as K, UploadStage as L, UploadController as M, UploadControllerOptions as N, CalmLensUpload as O, UploadFile as P, createUploadController as R, formatMessage as S, getUploadItemMessage as T, MediaSettings as U, MediaImageSource as V, MediaSource as W, UploadItemView as _, createProgressFetch as a, describeUploader as b, IconName as c, UploaderDisplayOptions as d, UploaderProps as f, DEFAULT_MESSAGES as g, CalmLensMessages as h, CALMLENS_STYLES as i, UploadClient as j, CustomUploadContext as k, MediaDisplayOptions as l, getMediaLoadKey as m, CalmLensTheme as n, ICONS as o, getMediaAspectRatio as p, pickMediaSource as q, resolveTheme as r, ICON_ATTRIBUTES as s, CALMLENS_THEME as t, MediaProps as u, UploaderView as v, getMediaUnavailableMessage as w, formatBytes as x, describeUploadItem as y, isFileAccepted as z };
539
+ export { CustomUploadContext as A, isFileAccepted as B, formatMessage as C, getUploadItemOutcome as D, getUploadItemMessage as E, UploadFile as F, MediaSource as G, MediaImageSource as H, UploadItem as I, pickMediaSource as J, MediaState as K, UploadSnapshot as L, UploadClient as M, UploadController as N, resolveMessages as O, UploadControllerOptions as P, UploadStage as R, formatBytes as S, getMediaUnavailableMessage as T, MediaOptions as U, MediaAsset as V, MediaSettings as W, resolveMediaProps as Y, DEFAULT_MESSAGES as _, ProgressFetchOptions as a, describeUploadItem as b, ICON_ATTRIBUTES as c, MediaProps as d, UploaderDisplayOptions as f, CalmLensMessages as g, getMediaLoadKey as h, CALMLENS_STYLES as i, CustomUploadResult as j, CalmLensUpload as k, IconName as l, getMediaAspectRatio as m, CalmLensTheme as n, createProgressFetch as o, UploaderProps as p, getMediaState as q, resolveTheme as r, ICONS as s, CALMLENS_THEME as t, MediaDisplayOptions as u, UploadItemView as v, getDropzoneHint as w, describeUploader as x, UploaderView as y, createUploadController as z };
@@ -1,6 +1,5 @@
1
- import { g as transformSelector, p as serializeTransform, u as getAssetUrl } from "./ModerationContextLimits-DLvGPUiz.js";
2
- import { t as EU_COUNTRIES } from "./Jurisdiction-FusEXb4U-1ov6m5yE.js";
3
- import { a as placeholderHashToDataURL } from "./UploadController-BQlf16Y0.js";
1
+ import { C as EU_COUNTRIES, _ as transformSelector, d as getAssetUrl, m as serializeTransform } from "./ModerationContextLimits-lLfmyLni.js";
2
+ import { a as placeholderHashToDataURL } from "./UploadController-UxP6gj7A.js";
4
3
  import { a as getFileIcon, c as renderFileIconSvg } from "./FileIcons-M6dzjFxd.js";
5
4
  // src/ui/Icons.ts
6
5
  /** Path data for the components' 24×24 stroke icons, so every framework draws the same ones. */
@@ -47,7 +46,14 @@ const decodePlaceholderHash = (hash) => {
47
46
  }
48
47
  return decodedPlaceholders.get(hash);
49
48
  };
50
- const joinTransforms = (base, extra) => [transformSelector(base), extra && serializeTransform(extra)].filter(Boolean).join(",") || void 0;
49
+ const withWidth = (base, width) => {
50
+ if (width === void 0) return base;
51
+ if (base === void 0 || typeof base !== "string") return {
52
+ ...base,
53
+ width
54
+ };
55
+ return [transformSelector(base), serializeTransform({ width })].filter(Boolean).join(",");
56
+ };
51
57
  /**
52
58
  * Fills the props left unset from `asset`, if there is one: the project and ID, its moderation
53
59
  * status, `video` or `audio` for those asset types, and its stored preview's ThumbHash, average
@@ -126,7 +132,7 @@ const buildMediaState = ({ projectId, assetId, status = "allowed", contentRemove
126
132
  ...asset,
127
133
  resource: chosen,
128
134
  lens: rendered ? lens : void 0,
129
- transform: rendered ? joinTransforms(transform, options.extra) : void 0
135
+ transform: rendered ? withWidth(transform, options.width) : void 0
130
136
  });
131
137
  };
132
138
  if (type === "audio") return {
@@ -144,10 +150,7 @@ const buildMediaState = ({ projectId, assetId, status = "allowed", contentRemove
144
150
  placeholderUrl
145
151
  };
146
152
  const sources = [...new Set(widths ?? [])].filter((width) => Number.isSafeInteger(width) && width > 0).sort((a, b) => a - b).map((width) => ({
147
- src: build({ extra: {
148
- type: "imageTransform",
149
- options: { width }
150
- } }),
153
+ src: build({ width }),
151
154
  width
152
155
  }));
153
156
  return {
package/esm/ui.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as CustomUploadResult, B as MediaAsset, C as getDropzoneHint, D as resolveMessages, E as getUploadItemOutcome, F as UploadItem, G as MediaState, H as MediaOptions, I as UploadSnapshot, J as resolveMediaProps, K as getMediaState, L as UploadStage, M as UploadController, N as UploadControllerOptions, O as CalmLensUpload, P as UploadFile, R as createUploadController, S as formatMessage, T as getUploadItemMessage, U as MediaSettings, V as MediaImageSource, W as MediaSource, _ as UploadItemView, a as createProgressFetch, b as describeUploader, c as IconName, d as UploaderDisplayOptions, f as UploaderProps, g as DEFAULT_MESSAGES, h as CalmLensMessages, i as CALMLENS_STYLES, j as UploadClient, k as CustomUploadContext, l as MediaDisplayOptions, m as getMediaLoadKey, n as CalmLensTheme, o as ICONS, p as getMediaAspectRatio, q as pickMediaSource, r as resolveTheme, s as ICON_ATTRIBUTES, t as CALMLENS_THEME, u as MediaProps, v as UploaderView, w as getMediaUnavailableMessage, x as formatBytes, y as describeUploadItem, z as isFileAccepted } from "./ui-wIiMfqMB.js";
2
- export { CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, type IconName, type MediaAsset, type MediaDisplayOptions, type MediaImageSource, type MediaOptions, type MediaProps, type MediaSettings, type MediaSource, type MediaState, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getDropzoneHint, getMediaAspectRatio, getMediaLoadKey, getMediaState, getMediaUnavailableMessage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickMediaSource, resolveMediaProps, resolveMessages, resolveTheme };
1
+ import { A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as getUploadItemOutcome, E as getUploadItemMessage, F as UploadFile, G as MediaSource, H as MediaImageSource, I as UploadItem, J as pickMediaSource, K as MediaState, L as UploadSnapshot, M as UploadClient, N as UploadController, O as resolveMessages, P as UploadControllerOptions, R as UploadStage, S as formatBytes, T as getMediaUnavailableMessage, U as MediaOptions, V as MediaAsset, W as MediaSettings, Y as resolveMediaProps, _ as DEFAULT_MESSAGES, a as ProgressFetchOptions, b as describeUploadItem, c as ICON_ATTRIBUTES, d as MediaProps, f as UploaderDisplayOptions, g as CalmLensMessages, h as getMediaLoadKey, i as CALMLENS_STYLES, j as CustomUploadResult, k as CalmLensUpload, l as IconName, m as getMediaAspectRatio, n as CalmLensTheme, o as createProgressFetch, p as UploaderProps, q as getMediaState, r as resolveTheme, s as ICONS, t as CALMLENS_THEME, u as MediaDisplayOptions, v as UploadItemView, w as getDropzoneHint, x as describeUploader, y as UploaderView, z as createUploadController } from "./ui-B23r8BvW.js";
2
+ export { CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, type IconName, type MediaAsset, type MediaDisplayOptions, type MediaImageSource, type MediaOptions, type MediaProps, type MediaSettings, type MediaSource, type MediaState, type ProgressFetchOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getDropzoneHint, getMediaAspectRatio, getMediaLoadKey, getMediaState, getMediaUnavailableMessage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickMediaSource, resolveMediaProps, resolveMessages, resolveTheme };
package/esm/ui.js CHANGED
@@ -1,3 +1,3 @@
1
- import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-DKQ4d86a.js";
2
- import { i as createProgressFetch, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-BQlf16Y0.js";
1
+ import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-Bn29rfAi.js";
2
+ import { i as createProgressFetch, n as createUploadController, r as isFileAccepted, t as UploadController } from "./UploadController-UxP6gj7A.js";
3
3
  export { CALMLENS_STYLES, CALMLENS_THEME, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, UploadController, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getDropzoneHint, getMediaAspectRatio, getMediaLoadKey, getMediaState, getMediaUnavailableMessage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickMediaSource, resolveMediaProps, resolveMessages, resolveTheme };
package/esm/vue.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Dt as ViewerClaims, k as CdnTransform, m as AssetModerationStatus, w as CalmLensAppClientOptions } from "./CalmLensTypes-9Vt16pc7.js";
2
- import "./index-CI4BzN4W.js";
3
- import { A as CustomUploadResult, B as MediaAsset, C as getDropzoneHint, D as resolveMessages, E as getUploadItemOutcome, G as MediaState, H as MediaOptions, J as resolveMediaProps, K as getMediaState, L as UploadStage, M as UploadController, P as UploadFile, S as formatMessage, T as getUploadItemMessage, U as MediaSettings, V as MediaImageSource, W as MediaSource, _ as UploadItemView, a as createProgressFetch, b as describeUploader, c as IconName, d as UploaderDisplayOptions, g as DEFAULT_MESSAGES, h as CalmLensMessages, i as CALMLENS_STYLES, j as UploadClient, k as CustomUploadContext, l as MediaDisplayOptions, m as getMediaLoadKey, n as CalmLensTheme, o as ICONS, p as getMediaAspectRatio, q as pickMediaSource, r as resolveTheme, s as ICON_ATTRIBUTES, t as CALMLENS_THEME, u as MediaProps, v as UploaderView, w as getMediaUnavailableMessage, x as formatBytes, y as describeUploadItem, z as isFileAccepted } from "./ui-wIiMfqMB.js";
4
- import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-BT091eOB.js";
1
+ import { E as CalmLensAppClientOptions, Mt as ViewerClaims, h as AssetModerationStatus, j as CdnTransform } from "./CalmLensTypes-DpU-hXq2.js";
2
+ import "./index-BcDDQJF2.js";
3
+ import { A as CustomUploadContext, B as isFileAccepted, C as formatMessage, D as getUploadItemOutcome, E as getUploadItemMessage, F as UploadFile, G as MediaSource, H as MediaImageSource, J as pickMediaSource, K as MediaState, M as UploadClient, N as UploadController, O as resolveMessages, R as UploadStage, S as formatBytes, T as getMediaUnavailableMessage, U as MediaOptions, V as MediaAsset, W as MediaSettings, Y as resolveMediaProps, _ as DEFAULT_MESSAGES, a as ProgressFetchOptions, b as describeUploadItem, c as ICON_ATTRIBUTES, d as MediaProps, f as UploaderDisplayOptions, g as CalmLensMessages, h as getMediaLoadKey, i as CALMLENS_STYLES, j as CustomUploadResult, l as IconName, m as getMediaAspectRatio, n as CalmLensTheme, o as createProgressFetch, q as getMediaState, r as resolveTheme, s as ICONS, t as CALMLENS_THEME, u as MediaDisplayOptions, v as UploadItemView, w as getDropzoneHint, x as describeUploader, y as UploaderView } from "./ui-B23r8BvW.js";
4
+ import { a as UploaderProps, i as UploadSnapshot, n as UploadControllerOptions, r as UploadItem, s as createUploadController, t as CalmLensUpload } from "./BrowserUpload-RkxV_Vv7.js";
5
5
  import { MaybeRefOrGetter, PropType, ShallowRef } from "vue";
6
6
  export interface UseCalmLensUploadResult<F extends UploadFile = File> {
7
7
  snapshot: Readonly<ShallowRef<UploadSnapshot<F>>>;
@@ -487,4 +487,4 @@ export declare const CalmLensMedia: import("vue").DefineComponent<import("vue").
487
487
  messages: Partial<CalmLensMessages>;
488
488
  onReveal: () => void;
489
489
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
490
- export { CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, type IconName, type MediaAsset, type MediaDisplayOptions, type MediaImageSource, type MediaOptions, type MediaProps, type MediaSettings, type MediaSource, type MediaState, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getDropzoneHint, getMediaAspectRatio, getMediaLoadKey, getMediaState, getMediaUnavailableMessage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickMediaSource, resolveMediaProps, resolveMessages, resolveTheme };
490
+ export { CALMLENS_STYLES, CALMLENS_THEME, type CalmLensMessages, type CalmLensTheme, type CalmLensUpload, type CustomUploadContext, type CustomUploadResult, DEFAULT_MESSAGES, ICONS, ICON_ATTRIBUTES, type IconName, type MediaAsset, type MediaDisplayOptions, type MediaImageSource, type MediaOptions, type MediaProps, type MediaSettings, type MediaSource, type MediaState, type ProgressFetchOptions, type UploadClient, UploadController, type UploadControllerOptions, type UploadFile, type UploadItem, type UploadItemView, type UploadSnapshot, type UploadStage, type UploaderDisplayOptions, type UploaderProps, type UploaderView, createProgressFetch, createUploadController, describeUploadItem, describeUploader, formatBytes, formatMessage, getDropzoneHint, getMediaAspectRatio, getMediaLoadKey, getMediaState, getMediaUnavailableMessage, getUploadItemMessage, getUploadItemOutcome, isFileAccepted, pickMediaSource, resolveMediaProps, resolveMessages, resolveTheme };
package/esm/vue.js CHANGED
@@ -1,6 +1,6 @@
1
- import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-DKQ4d86a.js";
2
- import { i as createProgressFetch, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-BQlf16Y0.js";
3
- import { t as createUploadController } from "./BrowserUpload-e-1rPGBJ.js";
1
+ import { _ as getMediaState, a as getMediaAspectRatio, b as ICONS, c as describeUploadItem, d as formatMessage, f as getDropzoneHint, g as resolveMessages, h as getUploadItemOutcome, i as resolveTheme, l as describeUploader, m as getUploadItemMessage, o as getMediaLoadKey, p as getMediaUnavailableMessage, r as CALMLENS_THEME, s as DEFAULT_MESSAGES, t as CALMLENS_STYLES, u as formatBytes, v as pickMediaSource, x as ICON_ATTRIBUTES, y as resolveMediaProps } from "./ui-Bn29rfAi.js";
2
+ import { i as createProgressFetch, n as createUploadController$1, r as isFileAccepted, t as UploadController } from "./UploadController-UxP6gj7A.js";
3
+ import { t as createUploadController } from "./BrowserUpload-DpzS2bbj.js";
4
4
  import { computed, defineComponent, h, onMounted, onScopeDispose, ref, shallowRef, toValue, watch, watchEffect } from "vue";
5
5
  // src/vue.ts
6
6
  const icon = (name) => h("svg", ICON_ATTRIBUTES, [h("path", { d: ICONS[name] })]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "calmlens",
3
- "version": "0.18.2",
3
+ "version": "0.19.0",
4
4
  "description": "Official CalmLens SDK for JavaScript and TypeScript: content moderation, asset storage and CDN delivery.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://calmlens.com/docs/sdk/javascript",
@@ -1,91 +0,0 @@
1
- // \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
- let zod = require("zod");
23
- zod = __toESM(zod, 1);
24
- // src/contract/Jurisdiction-FusEXb4U.js
25
- const JURISDICTION_SCHEMA = zod.enum(Object.keys({
26
- global: {
27
- name: "Global",
28
- ageCheckStandard: "any"
29
- },
30
- DE: {
31
- name: "Germany",
32
- ageCheckStandard: "any"
33
- },
34
- AT: {
35
- name: "Austria",
36
- ageCheckStandard: "any"
37
- },
38
- FR: {
39
- name: "France",
40
- ageCheckStandard: "any"
41
- },
42
- GB: {
43
- name: "United Kingdom",
44
- ageCheckStandard: "verified"
45
- },
46
- EU: {
47
- name: "European Union",
48
- ageCheckStandard: "verified"
49
- },
50
- AU: {
51
- name: "Australia",
52
- ageCheckStandard: "verified"
53
- },
54
- BR: {
55
- name: "Brazil",
56
- ageCheckStandard: "verified"
57
- }
58
- }));
59
- JURISDICTION_SCHEMA.array().min(1).refine((regions) => regions.includes("global") && new Set(regions).size === regions.length, { message: "jurisdiction/global-required-or-duplicate" });
60
- const COUNTRIES = new Set("AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW".split(" "));
61
- const VIEWER_REGION_SCHEMA = zod.enum([...COUNTRIES]).describe("Viewer's ISO 3166-1 alpha-2 country, supplied by your integration; not the proxy server's country. EU is not a viewer country.");
62
- const EU_COUNTRIES = new Set("AT BE BG HR CY CZ DK EE FI FR DE GR HU IE IT LV LT LU MT NL PL PT RO SK SI ES SE".split(" "));
63
- /** Customer assertions used only for this CDN request. */
64
- const VIEWER_CLAIMS_SCHEMA = zod.object({
65
- region: VIEWER_REGION_SCHEMA.optional().describe("Viewer country. Defaults to the country of the connection reaching CalmLens; proxies should forward the viewer country explicitly."),
66
- ageConfirmed: zod.boolean().optional().describe("Customer confirmation that age-restricted content may be delivered. Defaults to false; CalmLens does not verify the assertion.")
67
- }).strict();
68
- Object.defineProperty(exports, "EU_COUNTRIES", {
69
- enumerable: true,
70
- get: function() {
71
- return EU_COUNTRIES;
72
- }
73
- });
74
- Object.defineProperty(exports, "JURISDICTION_SCHEMA", {
75
- enumerable: true,
76
- get: function() {
77
- return JURISDICTION_SCHEMA;
78
- }
79
- });
80
- Object.defineProperty(exports, "VIEWER_CLAIMS_SCHEMA", {
81
- enumerable: true,
82
- get: function() {
83
- return VIEWER_CLAIMS_SCHEMA;
84
- }
85
- });
86
- Object.defineProperty(exports, "__toESM", {
87
- enumerable: true,
88
- get: function() {
89
- return __toESM;
90
- }
91
- });
@@ -1,46 +0,0 @@
1
- import * as z from "zod";
2
- // src/contract/Jurisdiction-FusEXb4U.js
3
- const JURISDICTION_SCHEMA = z.enum(Object.keys({
4
- global: {
5
- name: "Global",
6
- ageCheckStandard: "any"
7
- },
8
- DE: {
9
- name: "Germany",
10
- ageCheckStandard: "any"
11
- },
12
- AT: {
13
- name: "Austria",
14
- ageCheckStandard: "any"
15
- },
16
- FR: {
17
- name: "France",
18
- ageCheckStandard: "any"
19
- },
20
- GB: {
21
- name: "United Kingdom",
22
- ageCheckStandard: "verified"
23
- },
24
- EU: {
25
- name: "European Union",
26
- ageCheckStandard: "verified"
27
- },
28
- AU: {
29
- name: "Australia",
30
- ageCheckStandard: "verified"
31
- },
32
- BR: {
33
- name: "Brazil",
34
- ageCheckStandard: "verified"
35
- }
36
- }));
37
- JURISDICTION_SCHEMA.array().min(1).refine((regions) => regions.includes("global") && new Set(regions).size === regions.length, { message: "jurisdiction/global-required-or-duplicate" });
38
- const COUNTRIES = new Set("AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW".split(" "));
39
- const VIEWER_REGION_SCHEMA = z.enum([...COUNTRIES]).describe("Viewer's ISO 3166-1 alpha-2 country, supplied by your integration; not the proxy server's country. EU is not a viewer country.");
40
- const EU_COUNTRIES = new Set("AT BE BG HR CY CZ DK EE FI FR DE GR HU IE IT LV LT LU MT NL PL PT RO SK SI ES SE".split(" "));
41
- /** Customer assertions used only for this CDN request. */
42
- const VIEWER_CLAIMS_SCHEMA = z.object({
43
- region: VIEWER_REGION_SCHEMA.optional().describe("Viewer country. Defaults to the country of the connection reaching CalmLens; proxies should forward the viewer country explicitly."),
44
- ageConfirmed: z.boolean().optional().describe("Customer confirmation that age-restricted content may be delivered. Defaults to false; CalmLens does not verify the assertion.")
45
- }).strict();
46
- export { JURISDICTION_SCHEMA as n, VIEWER_CLAIMS_SCHEMA as r, EU_COUNTRIES as t };