calmlens 0.18.3 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/bin/calmlens.js +5373 -5002
  2. package/cjs/{BrowserUpload-UxIAGNdv.js → BrowserUpload-CJ4Xc9bR.js} +1 -1
  3. package/cjs/{BrowserUpload-BT091eOB.d.ts → BrowserUpload-RkxV_Vv7.d.ts} +2 -2
  4. package/{esm/CalmLensAppClient-CV_K26Ce.d.ts → cjs/CalmLensAppClient-B5gfOB6J.d.ts} +3 -3
  5. package/cjs/{CalmLensAppClient-D6p7MAFz.js → CalmLensAppClient-LHMEQ-UZ.js} +32 -11
  6. package/cjs/{CalmLensConnection-CYoUl5go.js → CalmLensOptionKeys-BUj7v5AG.js} +368 -8
  7. package/cjs/{CalmLensServerClient-p23cl97D.js → CalmLensServerClient-BVOEUT_v.js} +167 -54
  8. package/cjs/{CalmLensServerClient-JtP687a3.d.ts → CalmLensServerClient-DCSbwIBs.d.ts} +53 -29
  9. package/cjs/{CalmLensTypes-9Vt16pc7.d.ts → CalmLensTypes-DpU-hXq2.d.ts} +2677 -30
  10. package/cjs/{ModerationContextLimits-DCLXMxyA.js → ModerationContextLimits-FDpQmw_T.js} +195 -41
  11. package/cjs/{ReactUpload-BcdNWLiU.js → ReactUpload-BvpW4hJi.js} +1 -1
  12. package/cjs/{ReactUpload-CAyCsyG6.d.ts → ReactUpload-huIMnOJ4.d.ts} +1 -1
  13. package/cjs/{TestTriggers-DTc_iMJF-BjMPq4_3.js → TestTriggers-CMwMrbjy-K0YBzu2a.js} +433 -73
  14. package/{esm/TestTriggers-By07LR31-CmK0yTyR.d.ts → cjs/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts} +13 -7
  15. package/cjs/{UploadController-Cxu0bufo.js → UploadController-D4qOZZc3.js} +17 -5
  16. package/{esm/WebhookPayload-2aL31v0J.d.ts → cjs/WebhookPayload-CQg8BBZQ.d.ts} +29 -3
  17. package/cjs/app.d.ts +6 -6
  18. package/cjs/app.js +2 -2
  19. package/cjs/elements.d.ts +3 -3
  20. package/cjs/elements.js +3 -3
  21. package/cjs/{index-CI4BzN4W.d.ts → index-BcDDQJF2.d.ts} +7 -6
  22. package/cjs/index.d.ts +5 -5
  23. package/cjs/index.js +1 -1
  24. package/cjs/react-native.d.ts +3 -3
  25. package/cjs/react-native.js +3 -3
  26. package/cjs/react.d.ts +3 -3
  27. package/cjs/react.js +4 -4
  28. package/cjs/server.d.ts +6 -6
  29. package/cjs/server.js +2 -2
  30. package/cjs/test-inputs.d.ts +1 -1
  31. package/cjs/test-inputs.js +9 -9
  32. package/cjs/testing.d.ts +7 -6
  33. package/cjs/testing.js +189 -29
  34. package/{esm/ui-wIiMfqMB.d.ts → cjs/ui-B23r8BvW.d.ts} +17 -4
  35. package/cjs/{ui-C0XXJS52.js → ui-Dq-cm6Rx.js} +13 -10
  36. package/cjs/ui.d.ts +2 -2
  37. package/cjs/ui.js +2 -2
  38. package/cjs/vue.d.ts +5 -5
  39. package/cjs/vue.js +3 -3
  40. package/esm/{BrowserUpload-BXG2isHV.js → BrowserUpload-DpzS2bbj.js} +1 -1
  41. package/esm/{BrowserUpload-BT091eOB.d.ts → BrowserUpload-RkxV_Vv7.d.ts} +2 -2
  42. package/{cjs/CalmLensAppClient-CV_K26Ce.d.ts → esm/CalmLensAppClient-B5gfOB6J.d.ts} +3 -3
  43. package/esm/{CalmLensAppClient-BMgXamoN.js → CalmLensAppClient-BjlvBweS.js} +28 -7
  44. package/esm/{CalmLensConnection-DBoDh06c.js → CalmLensOptionKeys-BKez0Wiw.js} +351 -9
  45. package/esm/{CalmLensServerClient-JtP687a3.d.ts → CalmLensServerClient-DCSbwIBs.d.ts} +53 -29
  46. package/esm/{CalmLensServerClient-Dt7rCITa.js → CalmLensServerClient-DemxbNMn.js} +159 -46
  47. package/esm/{CalmLensTypes-9Vt16pc7.d.ts → CalmLensTypes-DpU-hXq2.d.ts} +2677 -30
  48. package/esm/{ModerationContextLimits-KMQ8puoa.js → ModerationContextLimits-lLfmyLni.js} +176 -40
  49. package/esm/{ReactUpload-CFy_wETY.js → ReactUpload-6klucehl.js} +1 -1
  50. package/esm/{ReactUpload-CAyCsyG6.d.ts → ReactUpload-huIMnOJ4.d.ts} +1 -1
  51. package/esm/{TestTriggers-DTc_iMJF-HfB533Gx.js → TestTriggers-CMwMrbjy-bdowBBKw.js} +404 -71
  52. package/{cjs/TestTriggers-By07LR31-CmK0yTyR.d.ts → esm/TestTriggers-D-fwfhEP-hlaP1oW2.d.ts} +13 -7
  53. package/esm/{UploadController-Cs-bxUbt.js → UploadController-UxP6gj7A.js} +17 -5
  54. package/{cjs/WebhookPayload-2aL31v0J.d.ts → esm/WebhookPayload-CQg8BBZQ.d.ts} +29 -3
  55. package/esm/app.d.ts +6 -6
  56. package/esm/app.js +2 -2
  57. package/esm/elements.d.ts +3 -3
  58. package/esm/elements.js +3 -3
  59. package/esm/{index-CI4BzN4W.d.ts → index-BcDDQJF2.d.ts} +7 -6
  60. package/esm/index.d.ts +5 -5
  61. package/esm/index.js +1 -1
  62. package/esm/react-native.d.ts +3 -3
  63. package/esm/react-native.js +3 -3
  64. package/esm/react.d.ts +3 -3
  65. package/esm/react.js +4 -4
  66. package/esm/server.d.ts +6 -6
  67. package/esm/server.js +2 -2
  68. package/esm/test-inputs.d.ts +1 -1
  69. package/esm/test-inputs.js +1 -1
  70. package/esm/testing.d.ts +7 -6
  71. package/esm/testing.js +178 -17
  72. package/{cjs/ui-wIiMfqMB.d.ts → esm/ui-B23r8BvW.d.ts} +17 -4
  73. package/esm/{ui-BqYkISSE.js → ui-Bn29rfAi.js} +12 -9
  74. package/esm/ui.d.ts +2 -2
  75. package/esm/ui.js +2 -2
  76. package/esm/vue.d.ts +5 -5
  77. package/esm/vue.js +3 -3
  78. package/package.json +1 -1
  79. package/cjs/Jurisdiction-FusEXb4U-zVs21tDv.js +0 -91
  80. package/esm/Jurisdiction-FusEXb4U-1ov6m5yE.js +0 -46
  81. /package/cjs/{Classification-94kSYWZw-CMnQKW13.d.ts → Classification-D3SkprrQ-CMnQKW13.d.ts} +0 -0
  82. /package/esm/{Classification-94kSYWZw-CMnQKW13.d.ts → Classification-D3SkprrQ-CMnQKW13.d.ts} +0 -0
package/cjs/testing.js CHANGED
@@ -1,16 +1,15 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_Jurisdiction_FusEXb4U = require("./Jurisdiction-FusEXb4U-zVs21tDv.js");
3
- const require_ModerationContextLimits = require("./ModerationContextLimits-DCLXMxyA.js");
4
- const require_CalmLensServerClient = require("./CalmLensServerClient-p23cl97D.js");
5
- const require_CalmLensConnection = require("./CalmLensConnection-CYoUl5go.js");
2
+ const require_TestTriggers_CMwMrbjy = require("./TestTriggers-CMwMrbjy-K0YBzu2a.js");
3
+ const require_ModerationContextLimits = require("./ModerationContextLimits-FDpQmw_T.js");
4
+ const require_CalmLensServerClient = require("./CalmLensServerClient-BVOEUT_v.js");
5
+ const require_CalmLensOptionKeys = require("./CalmLensOptionKeys-BUj7v5AG.js");
6
6
  const require_CryptoUtils_B_x8lMIx = require("./CryptoUtils-B_x8lMIx-YBW1-bvL.js");
7
- const require_CalmLensAppClient = require("./CalmLensAppClient-D6p7MAFz.js");
8
- const require_UploadController = require("./UploadController-Cxu0bufo.js");
9
- const require_TestTriggers_DTc_iMJF = require("./TestTriggers-DTc_iMJF-BjMPq4_3.js");
7
+ const require_CalmLensAppClient = require("./CalmLensAppClient-LHMEQ-UZ.js");
8
+ const require_UploadController = require("./UploadController-D4qOZZc3.js");
10
9
  let zod = require("zod");
11
- zod = require_Jurisdiction_FusEXb4U.__toESM(zod, 1);
10
+ zod = require_TestTriggers_CMwMrbjy.__toESM(zod, 1);
12
11
  // src/contract/MediaTestTriggers.js
13
- const MEDIA_TEST_SIGNALS = [...require_TestTriggers_DTc_iMJF.CLASSIFICATION_CATEGORIES, "violence.graphic"];
12
+ const MEDIA_TEST_SIGNALS = [...require_TestTriggers_CMwMrbjy.CLASSIFICATION_CATEGORIES, "violence.graphic"];
14
13
  const HEX_WORDS = [
15
14
  "zero",
16
15
  "one",
@@ -32,9 +31,9 @@ const HEX_WORDS = [
32
31
  /** Read this aloud, or render it as large, high-contrast text in a video frame. */
33
32
  async function generateMediaTestCode(signal, testInputKey) {
34
33
  if (!MEDIA_TEST_SIGNALS.includes(signal)) throw new RangeError("Unsupported media test signal");
35
- return `Calm Lens test ${[...await require_TestTriggers_DTc_iMJF.getTestInputTag("media", signal, testInputKey)].map((character) => HEX_WORDS[Number.parseInt(character, 16)]).join(" ")} ${signal.replace(/[.-]/g, " ")} end test`;
34
+ return `Calm Lens test ${[...await require_TestTriggers_CMwMrbjy.getTestInputTag("media", signal, testInputKey)].map((character) => HEX_WORDS[Number.parseInt(character, 16)]).join(" ")} ${signal.replace(/[.-]/g, " ")} end test`;
36
35
  }
37
- // src/contract/Ids-aHyP9ZcF.js
36
+ // src/contract/Ids-D2XfVlL6.js
38
37
  var __defProp = Object.defineProperty;
39
38
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
40
39
  var __exportAll = (all, no_symbols) => {
@@ -7909,6 +7908,7 @@ const ID_PREFIXES = {
7909
7908
  user: "user",
7910
7909
  member: "mem",
7911
7910
  invitation: "inv",
7911
+ transfer: "xfer",
7912
7912
  supportTicket: "tkt",
7913
7913
  supportTicketMessage: "msg",
7914
7914
  humanReview: "rev",
@@ -7969,6 +7969,7 @@ const EXAMPLE_IDS = {
7969
7969
  user: "user_4Rk9Xm2Lq7Vt3Wb8Np6C",
7970
7970
  mem: "mem_9Xm4Rk7Lq2Vt8Wb3Np5C",
7971
7971
  inv: "inv_3Qk8Xm2Rt9Lv4Wb7Np6C",
7972
+ xfer: "xfer_6Lq2Xm8Rk4Vt9Wb3Np7C",
7972
7973
  tkt: "tkt_6Xm2Rk9Lq4Vt7Wb3Np8C",
7973
7974
  msg: "msg_2Rk7Xm4Lq9Vt3Wb8Np5C",
7974
7975
  rev: "rev_8Xm3Rk2Lq7Vt9Wb4Np6C",
@@ -7985,8 +7986,8 @@ const EXAMPLE_IDS = {
7985
7986
  * every stored model's IDs by prefix is a separate change (it surfaces about a thousand call sites
7986
7987
  * across the packages that build records from plain strings).
7987
7988
  */
7988
- const idField = (prefix) => zod.string().regex(idPattern(prefix), { message: `Must be an ID starting with "${prefix}_"` }).meta({ examples: [EXAMPLE_IDS[prefix]] });
7989
- // src/contract/Permissions-DjKQmOVp.js
7989
+ 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]] });
7990
+ // src/contract/Permissions-C2KeOlab.js
7990
7991
  const ACTION_SCHEMA = zod.enum([
7991
7992
  "assets:read",
7992
7993
  "assets:download",
@@ -8014,6 +8015,8 @@ const ACTION_SCHEMA = zod.enum([
8014
8015
  "upload-presets:write",
8015
8016
  "hash-lists:read",
8016
8017
  "hash-lists:write",
8018
+ "policies:read",
8019
+ "policies:write",
8017
8020
  "reviews:read",
8018
8021
  "reviews:write",
8019
8022
  "project:manage"
@@ -8027,6 +8030,7 @@ const PROJECT_ACTIONS = [...[
8027
8030
  "lenses",
8028
8031
  "upload-presets",
8029
8032
  "hash-lists",
8033
+ "policies",
8030
8034
  "reviews"
8031
8035
  ].flatMap((feature) => [`${feature}:read`, `${feature}:write`]), "project:manage"];
8032
8036
  const isProjectAction = (action) => PROJECT_ACTIONS.includes(action);
@@ -8659,6 +8663,13 @@ var ApiFailure = class {
8659
8663
  const fail = (code, { message, details } = {}) => new ApiFailure(require_ModerationContextLimits.API_ERROR_DEFINITIONS[code].status, code, message ?? require_ModerationContextLimits.API_ERROR_DEFINITIONS[code].message, details);
8660
8664
  /** A request the API's schema refuses: `validation/<zod issue>` with HTTP 400 and the field. */
8661
8665
  const invalidField = (code, path) => new ApiFailure(400, code, `Invalid ${path}`, { path });
8666
+ /** The built-in presets the mock knows, by display name. */
8667
+ const MOCK_PRESET_NAMES = {
8668
+ "general-community": "General",
8669
+ "children-platform": "Kids",
8670
+ "education-support": "Learning and support",
8671
+ "wholesome-community": "Teen-safe"
8672
+ };
8662
8673
  /** The client methods that send a request, the one it is recorded under first. */
8663
8674
  const operationsOf = (request) => {
8664
8675
  const { method, segments, query, cdn } = request;
@@ -8670,6 +8681,8 @@ const operationsOf = (request) => {
8670
8681
  case "lenses": return ["ensureLenses", "ensureLens"];
8671
8682
  case "folders": return method === "GET" ? ["folders.list"] : ["folders.create"];
8672
8683
  case "hash-lists": return method === "GET" ? ["hashLists.list"] : ["hashLists.create"];
8684
+ case "policies": return method === "GET" ? ["policies.list"] : ["policies.create"];
8685
+ case "policy": return ["policies.assign"];
8673
8686
  case "assets/search": return ["assets.search"];
8674
8687
  case "assets/batch": return ["assets.batch"];
8675
8688
  case "assets":
@@ -8677,6 +8690,11 @@ const operationsOf = (request) => {
8677
8690
  if (query.get("queue") === "true") return ["assets.create"];
8678
8691
  return isTextUpload(request) ? ["assets.classify", "text.classify"] : ["assets.classify"];
8679
8692
  }
8693
+ if (segments[2] === "policies" && segments[3] !== void 0) {
8694
+ if (segments[4] === "preset") return ["policies.applyPreset"];
8695
+ if (segments[4] === "automatic-updates") return ["policies.setAutomaticUpdates"];
8696
+ return method === "GET" ? ["policies.retrieve"] : method === "PATCH" ? ["policies.update"] : ["policies.delete"];
8697
+ }
8680
8698
  return [];
8681
8699
  }
8682
8700
  if (root === "upload-presets") {
@@ -8713,6 +8731,7 @@ const isTextUpload = (request) => request.headers.get("x-calmlens-upload") === "
8713
8731
  const SUCCESS_STATUS = {
8714
8732
  "folders.create": 201,
8715
8733
  "hashLists.create": 201,
8734
+ "policies.create": 201,
8716
8735
  "assets.batch": 202
8717
8736
  };
8718
8737
  const decodeSegment = (segment) => {
@@ -8743,6 +8762,7 @@ var MockCalmLensApi = class {
8743
8762
  this.pendingFailures = [];
8744
8763
  this.requestCount = 0;
8745
8764
  this.waitedMs = 0;
8765
+ this.policies = /* @__PURE__ */ new Map();
8746
8766
  this.hashLists = /* @__PURE__ */ new Map();
8747
8767
  this.hashListEntries = /* @__PURE__ */ new Map();
8748
8768
  this.pageFailure = (code, path) => code === "validation/invalid-cursor" ? fail(require_ModerationContextLimits.API_ERROR_CODES.INVALID_CURSOR) : invalidField(code, path ?? "pageSize");
@@ -9077,6 +9097,17 @@ var MockCalmLensApi = class {
9077
9097
  case "GET hash-lists": return [200, this.listHashLists(request.query)];
9078
9098
  case "POST hash-lists": return [201, this.createHashList(this.json(request))];
9079
9099
  case "PUT lenses": return [200, this.ensureLenses(this.json(request))];
9100
+ case "GET policies": return [200, this.listPolicies()];
9101
+ case "POST policies": return [201, this.createPolicy(this.json(request))];
9102
+ case "PUT policy": return [200, this.assignPolicy(this.json(request))];
9103
+ }
9104
+ const [, , collection, policyId, policyAction, ...more] = segments;
9105
+ if (collection === "policies" && policyId !== void 0 && more.length === 0) switch (`${method} ${policyAction ?? ""}`) {
9106
+ case "GET ": return [200, this.toPolicy(this.findPolicy(policyId))];
9107
+ case "PATCH ": return [200, this.updatePolicy(policyId, this.json(request))];
9108
+ case "DELETE ": return [200, this.deletePolicy(policyId)];
9109
+ case "POST preset": return [200, this.applyPolicyPreset(policyId, this.json(request))];
9110
+ case "PUT automatic-updates": return [200, this.setPolicyAutomaticUpdates(policyId, this.json(request))];
9080
9111
  }
9081
9112
  }
9082
9113
  if (root === "upload-presets" && id !== void 0 && action === "assets") return [200, await this.presetRoute(request, id, rest, session)];
@@ -9112,6 +9143,134 @@ var MockCalmLensApi = class {
9112
9143
  }
9113
9144
  throw fail(require_ModerationContextLimits.API_ERROR_CODES.ROUTE_NOT_FOUND, { message: `No route for ${method} /${segments.join("/")}` });
9114
9145
  }
9146
+ ensurePolicies() {
9147
+ if (this.projectPolicyId) return;
9148
+ const now = this.now();
9149
+ const general = this.newPolicy({
9150
+ name: MOCK_PRESET_NAMES["general-community"],
9151
+ settings: { categorySettings: {} },
9152
+ automaticUpdates: true,
9153
+ preset: {
9154
+ id: "general-community",
9155
+ version: 1,
9156
+ projectId: this.projectId
9157
+ },
9158
+ createdAt: now
9159
+ });
9160
+ this.projectPolicyId = general.id;
9161
+ }
9162
+ newPolicy(values) {
9163
+ const policy = {
9164
+ id: this.createId("pol"),
9165
+ name: values.name,
9166
+ description: values.description ?? "",
9167
+ settings: values.settings,
9168
+ revision: 1,
9169
+ automaticUpdates: values.automaticUpdates ?? false,
9170
+ preset: values.preset ?? null,
9171
+ baseline: structuredClone(values.settings),
9172
+ createdAt: values.createdAt,
9173
+ updatedAt: values.createdAt
9174
+ };
9175
+ this.policies.set(policy.id, policy);
9176
+ return policy;
9177
+ }
9178
+ toPolicy(policy) {
9179
+ const { baseline: _baseline, preset, ...rest } = policy;
9180
+ return {
9181
+ ...structuredClone(rest),
9182
+ preset: preset && {
9183
+ ...preset,
9184
+ latestVersion: 1
9185
+ },
9186
+ projectIds: policy.id === this.projectPolicyId ? [this.projectId] : []
9187
+ };
9188
+ }
9189
+ findPolicy(policyId) {
9190
+ this.ensurePolicies();
9191
+ const policy = this.policies.get(policyId);
9192
+ if (!policy) throw fail(require_ModerationContextLimits.API_ERROR_CODES.POLICY_NOT_FOUND);
9193
+ return policy;
9194
+ }
9195
+ listPolicies() {
9196
+ this.ensurePolicies();
9197
+ return {
9198
+ policies: [...this.policies.values()].map((policy) => this.toPolicy(policy)),
9199
+ projectPolicyId: this.projectPolicyId
9200
+ };
9201
+ }
9202
+ createPolicy(body) {
9203
+ this.ensurePolicies();
9204
+ const { name, description, settings, presetId } = body;
9205
+ const preset = typeof presetId === "string" ? presetId : void 0;
9206
+ 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(require_ModerationContextLimits.API_ERROR_CODES.INVALID_VALUE, { message: "Send settings with a name, or presetId" });
9207
+ const policy = this.newPolicy({
9208
+ name: typeof name === "string" && name.trim() ? name.trim() : MOCK_PRESET_NAMES[preset],
9209
+ ...typeof description === "string" ? { description } : {},
9210
+ settings: preset ? { categorySettings: {} } : settings,
9211
+ ...preset ? { preset: {
9212
+ id: preset,
9213
+ version: 1,
9214
+ projectId: null
9215
+ } } : {},
9216
+ createdAt: this.now()
9217
+ });
9218
+ return this.toPolicy(policy);
9219
+ }
9220
+ /** Saves new values under the next revision, once `revision` is the current one. */
9221
+ savePolicy(policy, revision, values) {
9222
+ if (revision !== policy.revision) throw fail(require_ModerationContextLimits.API_ERROR_CODES.POLICY_REVISION_CONFLICT);
9223
+ const saved = {
9224
+ ...policy,
9225
+ ...values,
9226
+ revision: policy.revision + 1,
9227
+ updatedAt: this.now()
9228
+ };
9229
+ this.policies.set(policy.id, saved);
9230
+ return this.toPolicy(saved);
9231
+ }
9232
+ updatePolicy(policyId, body) {
9233
+ const policy = this.findPolicy(policyId);
9234
+ return this.savePolicy(policy, body.revision, {
9235
+ ...typeof body.name === "string" ? { name: body.name.trim() } : {},
9236
+ ...typeof body.description === "string" ? { description: body.description } : {},
9237
+ ...body.settings !== void 0 ? { settings: body.settings } : {},
9238
+ automaticUpdates: false
9239
+ });
9240
+ }
9241
+ applyPolicyPreset(policyId, body) {
9242
+ const policy = this.findPolicy(policyId);
9243
+ if (!policy.preset || policy.automaticUpdates) throw fail(require_ModerationContextLimits.API_ERROR_CODES.POLICY_NO_PRESET);
9244
+ if (body.presetVersion !== policy.preset.version) throw fail(require_ModerationContextLimits.API_ERROR_CODES.POLICY_PRESET_VERSION_CONFLICT);
9245
+ if (body.operation === "update") throw fail(require_ModerationContextLimits.API_ERROR_CODES.POLICY_PRESET_UPDATE_UNAVAILABLE);
9246
+ return this.savePolicy(policy, body.revision, { settings: structuredClone(policy.baseline) });
9247
+ }
9248
+ setPolicyAutomaticUpdates(policyId, body) {
9249
+ const policy = this.findPolicy(policyId);
9250
+ const enabled = body.enabled === true;
9251
+ if (policy.preset?.projectId !== this.projectId || policy.automaticUpdates === enabled) throw fail(require_ModerationContextLimits.API_ERROR_CODES.POLICY_AUTOMATIC_UPDATES_UNAVAILABLE);
9252
+ if (body.revision !== policy.revision) throw fail(require_ModerationContextLimits.API_ERROR_CODES.POLICY_REVISION_CONFLICT);
9253
+ if (body.presetVersion !== 1) throw fail(require_ModerationContextLimits.API_ERROR_CODES.POLICY_PRESET_VERSION_CONFLICT);
9254
+ return this.savePolicy(policy, body.revision, {
9255
+ automaticUpdates: enabled,
9256
+ ...enabled ? {
9257
+ name: MOCK_PRESET_NAMES[policy.preset.id],
9258
+ description: "",
9259
+ settings: structuredClone(policy.baseline)
9260
+ } : {}
9261
+ });
9262
+ }
9263
+ deletePolicy(policyId) {
9264
+ const policy = this.findPolicy(policyId);
9265
+ if (policy.id === this.projectPolicyId) throw fail(require_ModerationContextLimits.API_ERROR_CODES.POLICY_IN_USE);
9266
+ this.policies.delete(policy.id);
9267
+ return {};
9268
+ }
9269
+ assignPolicy(body) {
9270
+ const policy = this.findPolicy(String(body.policyId));
9271
+ this.projectPolicyId = policy.id;
9272
+ return this.toPolicy(policy);
9273
+ }
9115
9274
  createHashList(body) {
9116
9275
  const { name, description, action } = body;
9117
9276
  if (typeof name !== "string" || !name.trim() || action !== "flag" && action !== "block") throw fail(require_ModerationContextLimits.API_ERROR_CODES.INVALID_UPLOAD_PAYLOAD, { message: "A hash list needs a name and an action of flag or block" });
@@ -9490,9 +9649,9 @@ var MockCalmLensApi = class {
9490
9649
  if (part) {
9491
9650
  if (part.partNumber > 1) throw fail(require_ModerationContextLimits.API_ERROR_CODES.USE_UPLOAD_PART);
9492
9651
  const partSize = bytes.byteLength;
9493
- 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);
9652
+ 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);
9494
9653
  if (sizeError) throw fail(sizeError);
9495
- const validation = require_CalmLensConnection.validateAssetPayload({ uint8Array: bytes }, {
9654
+ const validation = require_CalmLensOptionKeys.validateAssetPayload({ uint8Array: bytes }, {
9496
9655
  multipart: true,
9497
9656
  isFinal: part.isFinal
9498
9657
  });
@@ -9602,9 +9761,9 @@ var MockCalmLensApi = class {
9602
9761
  });
9603
9762
  const received = (asset.content.sizeInBytes ?? 0) + bytes.byteLength;
9604
9763
  const upload = this.openUploads.get(assetId);
9605
- const sizeError = this.multipartImageSizeError(asset.type, received, isFinal) ?? this.multipartTotalSizeError(upload?.totalSizeInBytes, received, isFinal);
9764
+ const sizeError = this.multipartImageSizeError(asset.type, received) ?? this.multipartTotalSizeError(upload?.totalSizeInBytes, received, isFinal);
9606
9765
  if (sizeError) throw fail(sizeError);
9607
- const validation = require_CalmLensConnection.validateAssetPayload({ uint8Array: bytes }, {
9766
+ const validation = require_CalmLensOptionKeys.validateAssetPayload({ uint8Array: bytes }, {
9608
9767
  multipart: true,
9609
9768
  isFinal
9610
9769
  });
@@ -9639,11 +9798,10 @@ var MockCalmLensApi = class {
9639
9798
  this.recordProcessingEvents(stored, decision);
9640
9799
  return stored;
9641
9800
  }
9642
- /** Like the API: image uploads in parts total 10 MiB (checked at the last part) to 20 MiB. */
9643
- multipartImageSizeError(type, sizeInBytes, isFinal) {
9801
+ /** Like the API: image uploads in parts total at most 20 MiB, at any size below that. */
9802
+ multipartImageSizeError(type, sizeInBytes) {
9644
9803
  if (type !== "image") return void 0;
9645
9804
  if (sizeInBytes > require_ModerationContextLimits.MAX_IMAGE_UPLOAD_BYTES) return require_ModerationContextLimits.API_ERROR_CODES.MULTIPART_IMAGE_TOO_LARGE;
9646
- if (isFinal && sizeInBytes < require_ModerationContextLimits.MIN_MULTIPART_IMAGE_UPLOAD_BYTES) return require_ModerationContextLimits.API_ERROR_CODES.MULTIPART_IMAGE_TOO_SMALL;
9647
9805
  }
9648
9806
  /** Like the API: the parts may not overshoot a declared total, and must reach it at the end. */
9649
9807
  multipartTotalSizeError(totalSizeInBytes, receivedSizeInBytes, isFinal) {
@@ -9915,7 +10073,8 @@ var MockCalmLensApi = class {
9915
10073
  if (!cursor) return {
9916
10074
  items: [],
9917
10075
  nextCursor: `mock_${this.eventFeed.length}`,
9918
- hasMore: false
10076
+ hasMore: false,
10077
+ excludedTypes: []
9919
10078
  };
9920
10079
  const match = /^mock_(\d+)$/.exec(cursor);
9921
10080
  const position = match ? Number(match[1]) : NaN;
@@ -9925,7 +10084,8 @@ var MockCalmLensApi = class {
9925
10084
  return {
9926
10085
  items,
9927
10086
  nextCursor: `mock_${next}`,
9928
- hasMore: next < this.eventFeed.length
10087
+ hasMore: next < this.eventFeed.length,
10088
+ excludedTypes: []
9929
10089
  };
9930
10090
  }
9931
10091
  /**
@@ -10070,7 +10230,7 @@ var MockCalmLensApi = class {
10070
10230
  this.lenses.set(lens.identifier, lens);
10071
10231
  return lens;
10072
10232
  }
10073
- if (existing.name === options.name && (existing.description ?? null) === (options.description ?? null) && existing.type === options.type && existing.active === options.active && require_CalmLensServerClient.stringifyJsonCanonical(existing.transforms ?? null) === require_CalmLensServerClient.stringifyJsonCanonical(options.transforms ?? null) && existing.version === options.version) return existing;
10233
+ if (existing.name === options.name && (existing.description ?? null) === (options.description ?? null) && existing.type === options.type && existing.active === options.active && require_CalmLensServerClient.stringifyJsonCanonical(existing.transform ?? null) === require_CalmLensServerClient.stringifyJsonCanonical(options.transform ?? null) && existing.version === options.version) return existing;
10074
10234
  if (options.version > existing.version) {
10075
10235
  const lens = {
10076
10236
  ...existing,
@@ -10172,9 +10332,9 @@ var InMemoryMockImageStorage = class {
10172
10332
  this.content = /* @__PURE__ */ new Map();
10173
10333
  }
10174
10334
  async putContent(assetId, content) {
10175
- const validation = require_CalmLensConnection.validateAssetPayload(content);
10335
+ const validation = require_CalmLensOptionKeys.validateAssetPayload(content);
10176
10336
  if (!validation.ok) throw new Error(validation.error);
10177
- const bytes = await require_CalmLensConnection.assetDataToUint8Array(require_CalmLensConnection.assetToData(content));
10337
+ const bytes = await require_CalmLensOptionKeys.assetDataToUint8Array(require_CalmLensOptionKeys.assetToData(content));
10178
10338
  this.content.set(assetId, {
10179
10339
  assetId,
10180
10340
  parts: /* @__PURE__ */ new Map([[1, bytes]]),
@@ -10182,12 +10342,12 @@ var InMemoryMockImageStorage = class {
10182
10342
  });
10183
10343
  }
10184
10344
  async putPart(assetId, part) {
10185
- const validation = require_CalmLensConnection.validateAssetPayload(part, {
10345
+ const validation = require_CalmLensOptionKeys.validateAssetPayload(part, {
10186
10346
  multipart: true,
10187
10347
  isFinal: part.isFinal
10188
10348
  });
10189
10349
  if (!validation.ok) throw new Error(validation.error);
10190
- const bytes = await require_CalmLensConnection.assetDataToUint8Array(require_CalmLensConnection.assetToData(part));
10350
+ const bytes = await require_CalmLensOptionKeys.assetDataToUint8Array(require_CalmLensOptionKeys.assetToData(part));
10191
10351
  const existing = this.content.get(assetId) ?? {
10192
10352
  assetId,
10193
10353
  parts: /* @__PURE__ */ new Map(),
@@ -10260,7 +10420,7 @@ const mockClientOptions = (api, endpoints, session) => {
10260
10420
  const fetch = api.createFetch(endpoints, session);
10261
10421
  const hooks = {
10262
10422
  sleep: async (ms, signal) => {
10263
- await require_CalmLensConnection.sleep(0, signal);
10423
+ await require_CalmLensOptionKeys.sleep(0, signal);
10264
10424
  api.waitedMs += ms;
10265
10425
  },
10266
10426
  now: () => api.waitedMs,
@@ -10275,7 +10435,7 @@ const mockClientOptions = (api, endpoints, session) => {
10275
10435
  fetch,
10276
10436
  uploadFetch: fetch,
10277
10437
  cdnFetch: fetch,
10278
- [require_CalmLensConnection.MOCK_HOOKS]: hooks
10438
+ [require_CalmLensOptionKeys.MOCK_HOOKS]: hooks
10279
10439
  };
10280
10440
  };
10281
10441
  /**
@@ -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
- const require_Jurisdiction_FusEXb4U = require("./Jurisdiction-FusEXb4U-zVs21tDv.js");
2
- const require_ModerationContextLimits = require("./ModerationContextLimits-DCLXMxyA.js");
3
- const require_UploadController = require("./UploadController-Cxu0bufo.js");
1
+ const require_ModerationContextLimits = require("./ModerationContextLimits-FDpQmw_T.js");
2
+ const require_UploadController = require("./UploadController-D4qOZZc3.js");
4
3
  const require_FileIcons = require("./FileIcons-Ob003MdS.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) => [require_ModerationContextLimits.transformSelector(base), extra && require_ModerationContextLimits.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 [require_ModerationContextLimits.transformSelector(base), require_ModerationContextLimits.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
@@ -75,7 +81,7 @@ const resolveMediaProps = (props) => {
75
81
  let status = props.status ?? asset.classification?.moderation?.status ?? "allowed";
76
82
  for (const entry of regionEntries) {
77
83
  const region = props.viewerClaims?.region;
78
- if (region && (entry.region === region || entry.region === "EU" && require_Jurisdiction_FusEXb4U.EU_COUNTRIES.has(region))) {
84
+ if (region && (entry.region === region || entry.region === "EU" && require_ModerationContextLimits.EU_COUNTRIES.has(region))) {
79
85
  const regionalStatus = statuses[entry.action];
80
86
  if (regionalStatus && ranks[regionalStatus] > ranks[status]) status = regionalStatus;
81
87
  }
@@ -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/cjs/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/cjs/ui.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_ui = require("./ui-C0XXJS52.js");
3
- const require_UploadController = require("./UploadController-Cxu0bufo.js");
2
+ const require_ui = require("./ui-Dq-cm6Rx.js");
3
+ const require_UploadController = require("./UploadController-D4qOZZc3.js");
4
4
  exports.CALMLENS_STYLES = require_ui.CALMLENS_STYLES;
5
5
  exports.CALMLENS_THEME = require_ui.CALMLENS_THEME;
6
6
  exports.DEFAULT_MESSAGES = require_ui.DEFAULT_MESSAGES;
package/cjs/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/cjs/vue.js CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_ui = require("./ui-C0XXJS52.js");
3
- const require_UploadController = require("./UploadController-Cxu0bufo.js");
4
- const require_BrowserUpload = require("./BrowserUpload-UxIAGNdv.js");
2
+ const require_ui = require("./ui-Dq-cm6Rx.js");
3
+ const require_UploadController = require("./UploadController-D4qOZZc3.js");
4
+ const require_BrowserUpload = require("./BrowserUpload-CJ4Xc9bR.js");
5
5
  let vue = require("vue");
6
6
  // src/vue.ts
7
7
  const icon = (name) => (0, vue.h)("svg", require_ui.ICON_ATTRIBUTES, [(0, vue.h)("path", { d: require_ui.ICONS[name] })]);
@@ -1,4 +1,4 @@
1
- import { n as createUploadController$1 } from "./UploadController-Cs-bxUbt.js";
1
+ import { n as createUploadController$1 } from "./UploadController-UxP6gj7A.js";
2
2
  // src/ui/BrowserUpload.ts
3
3
  /** Creates an upload queue for the browser components, such as one a form starts on submit. */
4
4
  const createUploadController = (options) => createUploadController$1(options);
@@ -1,5 +1,5 @@
1
- import { F as UploadItem$1, I as UploadSnapshot$1, M as UploadController, N as UploadControllerOptions$1, O as CalmLensUpload$1, P as UploadFile, f as UploaderProps$1 } from "./ui-wIiMfqMB.js";
2
- import { t as UseCalmLensUploadResult$1 } from "./ReactUpload-CAyCsyG6.js";
1
+ import { F as UploadFile, I as UploadItem$1, L as UploadSnapshot$1, N as UploadController, P as UploadControllerOptions$1, k as CalmLensUpload$1, p as UploaderProps$1 } from "./ui-B23r8BvW.js";
2
+ import { t as UseCalmLensUploadResult$1 } from "./ReactUpload-huIMnOJ4.js";
3
3
  type UploadItem<F extends UploadFile = File> = UploadItem$1<F>;
4
4
  type CalmLensUpload<F extends UploadFile = File> = CalmLensUpload$1<F>;
5
5
  type UploadSnapshot<F extends UploadFile = File> = UploadSnapshot$1<F>;
@@ -1,4 +1,4 @@
1
- import { Ct as UploadAssetPartOptions, Tt as UploadedAsset, pt as RetrieveAssetOptions, w as CalmLensAppClientOptions, wt as UploadPresetSubmitAssetOptions } from "./CalmLensTypes-9Vt16pc7.js";
1
+ import { At as UploadedAsset, E as CalmLensAppClientOptions, Ot as UploadAssetPartOptions, gt as RetrieveAssetOptions, kt as UploadPresetSubmitAssetOptions } from "./CalmLensTypes-DpU-hXq2.js";
2
2
  declare const inspectSymbol: unique symbol;
3
3
  /**
4
4
  * The CalmLens client for browsers and React Native apps. It uploads through an upload preset,
@@ -32,9 +32,9 @@ declare class CalmLensAppClient {
32
32
  * Uploads the next part of a multipart upload this client started. The upload's queue
33
33
  * mode, chosen when it started, applies when the final part arrives.
34
34
  */
35
- uploadPart: ({ assetId, ...options }: UploadAssetPartOptions) => Promise<UploadedAsset>;
35
+ uploadPart: (partOptions: UploadAssetPartOptions) => Promise<UploadedAsset>;
36
36
  /** Checks an upload this client made. `status` is present when the preset shows decisions. */
37
- retrieve: ({ assetId }: RetrieveAssetOptions) => Promise<UploadedAsset>;
37
+ retrieve: (options: RetrieveAssetOptions) => Promise<UploadedAsset>;
38
38
  };
39
39
  }
40
40
  export { CalmLensAppClient as t };