calmlens 0.25.0 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +14 -14
  2. package/bin/calmlens.js +2202 -521
  3. package/cjs/{BrowserUpload-AO2-2U5Z.js → BrowserUpload-DdkcoZLH.js} +1 -1
  4. package/{esm/BrowserUpload-D2lemMIU.d.ts → cjs/BrowserUpload-zYWKtFSs.d.ts} +2 -2
  5. package/cjs/{CalmLensAppClient-nv6qwja0.js → CalmLensAppClient-Gu9mU_66.js} +22 -15
  6. package/{esm/CalmLensAppClient-Dt0t9Bk6.d.ts → cjs/CalmLensAppClient-mTTjqpRc.d.ts} +5 -11
  7. package/cjs/{CalmLensOptionKeys-BvCac9NO.js → CalmLensOptionKeys-BCITGsr9.js} +138 -90
  8. package/cjs/CalmLensServerClient-D5-njsNk.d.ts +357 -0
  9. package/cjs/{CalmLensServerClient-B60kCBCR.js → CalmLensServerClient-DHmAPT1u.js} +283 -303
  10. package/cjs/{CalmLensTypes-BhR7LFDu.d.ts → CalmLensTypes-Df8eBgWB.d.ts} +127 -59
  11. package/cjs/{Core-DSMxC2GL.d.ts → Core-CREGGR0L.d.ts} +10 -3
  12. package/cjs/{Core-Cw4IxFUq.js → Core-DAf9lqe2.js} +30 -12
  13. package/{esm/ModerationContextLimits-Bqr0duav.js → cjs/ModerationContextLimits-D4iwqoN_.js} +858 -28
  14. package/cjs/{ReactUpload--oDFltw2.js → ReactUpload-BNIbpxIH.js} +38 -2
  15. package/cjs/ReactUpload-D4htIz8X.d.ts +27 -0
  16. package/cjs/{UploadController-ObdgTaBl.js → UploadController-B_lKxvpM.js} +16 -3
  17. package/cjs/{WebhookPayload-DLGGOGW6.d.ts → WebhookPayload-DMa6ihHr.d.ts} +152 -3
  18. package/cjs/app.d.ts +5 -5
  19. package/cjs/app.js +20 -2
  20. package/cjs/elements.d.ts +5 -5
  21. package/cjs/elements.js +102 -67
  22. package/cjs/{index-AAWuerkU.d.ts → index-CtpQldn_.d.ts} +2 -2
  23. package/cjs/index.d.ts +4 -4
  24. package/cjs/index.js +19 -1
  25. package/cjs/react-native.d.ts +3 -3
  26. package/cjs/react-native.js +6 -4
  27. package/cjs/react.d.ts +5 -4
  28. package/cjs/react.js +10 -14
  29. package/cjs/server.d.ts +5 -5
  30. package/cjs/server.js +20 -2
  31. package/cjs/testing.d.ts +11 -9
  32. package/cjs/testing.js +72 -41
  33. package/cjs/{ui-CcuGKTcL.d.ts → ui-BwFPFrno.d.ts} +2 -2
  34. package/cjs/{ui-CA16jyfZ.js → ui-CvlJmRYM.js} +6 -4
  35. package/cjs/ui.d.ts +3 -3
  36. package/cjs/ui.js +4 -3
  37. package/cjs/vue.d.ts +15 -8
  38. package/cjs/vue.js +29 -16
  39. package/esm/{BrowserUpload-Co4T6uGk.js → BrowserUpload-BAWYEBd7.js} +1 -1
  40. package/{cjs/BrowserUpload-D2lemMIU.d.ts → esm/BrowserUpload-zYWKtFSs.d.ts} +2 -2
  41. package/esm/{CalmLensAppClient-BRzy4dwn.js → CalmLensAppClient-DNkIZb6x.js} +22 -15
  42. package/{cjs/CalmLensAppClient-Dt0t9Bk6.d.ts → esm/CalmLensAppClient-mTTjqpRc.d.ts} +5 -11
  43. package/esm/{CalmLensOptionKeys-bE3rb5PN.js → CalmLensOptionKeys-CYHJo3nV.js} +133 -91
  44. package/esm/{CalmLensServerClient-_PRi90wI.js → CalmLensServerClient-B1AiR4nv.js} +283 -303
  45. package/esm/CalmLensServerClient-D5-njsNk.d.ts +357 -0
  46. package/esm/{CalmLensTypes-BhR7LFDu.d.ts → CalmLensTypes-Df8eBgWB.d.ts} +127 -59
  47. package/esm/{Core-DSMxC2GL.d.ts → Core-CREGGR0L.d.ts} +10 -3
  48. package/esm/{Core-CtbYmeXG.js → Core-xNBQxZWH.js} +30 -12
  49. package/{cjs/ModerationContextLimits-Cn9RvnZH.js → esm/ModerationContextLimits-DxuPP4uM.js} +475 -285
  50. package/esm/{ReactUpload-B5itHBSF.js → ReactUpload-BWifQdLv.js} +34 -4
  51. package/esm/ReactUpload-D4htIz8X.d.ts +27 -0
  52. package/esm/{UploadController-C7fL3Iz9.js → UploadController-jlJdddyI.js} +11 -4
  53. package/esm/{WebhookPayload-DLGGOGW6.d.ts → WebhookPayload-DMa6ihHr.d.ts} +152 -3
  54. package/esm/app.d.ts +5 -5
  55. package/esm/app.js +3 -3
  56. package/esm/elements.d.ts +5 -5
  57. package/esm/elements.js +102 -68
  58. package/esm/{index-AAWuerkU.d.ts → index-CtpQldn_.d.ts} +2 -2
  59. package/esm/index.d.ts +4 -4
  60. package/esm/index.js +1 -1
  61. package/esm/react-native.d.ts +3 -3
  62. package/esm/react-native.js +5 -5
  63. package/esm/react.d.ts +5 -4
  64. package/esm/react.js +9 -15
  65. package/esm/server.d.ts +5 -5
  66. package/esm/server.js +3 -3
  67. package/esm/styles.css +28 -10
  68. package/esm/svelte/CalmLensUploader.svelte +17 -17
  69. package/esm/svelte/context.js +21 -0
  70. package/esm/svelte/index.d.ts +12 -0
  71. package/esm/svelte/index.js +1 -0
  72. package/esm/testing.d.ts +11 -9
  73. package/esm/testing.js +72 -41
  74. package/esm/{ui-B98AucZA.js → ui-BXzzqh7M.js} +6 -4
  75. package/esm/{ui-CcuGKTcL.d.ts → ui-BwFPFrno.d.ts} +2 -2
  76. package/esm/ui.d.ts +3 -3
  77. package/esm/ui.js +4 -4
  78. package/esm/vue.d.ts +15 -8
  79. package/esm/vue.js +29 -18
  80. package/package.json +16 -6
  81. package/cjs/CalmLensServerClient-7XjQaeKu.d.ts +0 -353
  82. package/cjs/ReactUpload-CW4NzAsh.d.ts +0 -17
  83. package/esm/CalmLensServerClient-7XjQaeKu.d.ts +0 -353
  84. package/esm/ReactUpload-CW4NzAsh.d.ts +0 -17
package/README.md CHANGED
@@ -17,9 +17,9 @@ The package has two clients, each with its own import:
17
17
  | `calmlens/server` | `CalmLensServerClient` | On your server: Node.js 22 or later, Bun, Deno, Cloudflare Workers | A project API key |
18
18
  | `calmlens/app` | `CalmLensAppClient` | In browsers and React Native apps | An upload preset, with an optional upload token from your server |
19
19
 
20
- API keys are secret, so `CalmLensServerClient` refuses to start in a web page or app. Upload from browsers and apps with `CalmLensAppClient`, and serve private content to them with signed URLs. The package ships ES modules and CommonJS with type declarations. The main, `/server` and `/app` entry points load no other packages at runtime. The package depends on `zod`, which its type declarations and testing helpers use, and on `pdfjs-dist` and `hls.js`, which the UI viewers load only when they show a document or a stream.
20
+ API keys are secret, so `CalmLensServerClient` refuses to start in a web page or app. Upload from browsers and apps with `CalmLensAppClient`, and serve private content to them with signed URLs. The package ships ES modules and CommonJS with type declarations. The main, `/server` and `/app` entry points load no other packages at runtime. The package depends only on `zod`, which its type declarations and testing helpers use. The browser UI also needs `hls.js` and `pdfjs-dist` (`npm install calmlens hls.js pdfjs-dist`), optional peer dependencies it loads only when it plays a stream or shows a document, so a server install leaves them out.
21
21
 
22
- Versions follow semantic versioning: see [Versioning and support](https://calmlens.com/docs/sdk#versioning-and-support).
22
+ The type declarations need TypeScript 5.9 or later; each build checks them with TypeScript 5.9. Versions follow semantic versioning, types included: see [Versioning and support](https://calmlens.com/docs/sdk#versioning-and-support) and [Requirements and type changes](https://calmlens.com/docs/sdk/javascript/reference#requirements-and-type-changes).
23
23
 
24
24
  ## Quick start
25
25
 
@@ -49,20 +49,20 @@ const image = await client.assets.create({
49
49
  content: { data: file, type: "image/jpeg" },
50
50
  externalId: "post-7",
51
51
  });
52
- console.log(image.classification.status, image.classification.moderation.status); // "processing" "pending"
52
+ console.log(image.classification.status, image.classification.moderation.decision); // "processing" null
53
53
  ```
54
54
 
55
- | `classification.status` | `classification.moderation.status` | Meaning |
56
- | ------------------------ | ---------------------------------- | ------------------------------------------------------------------------------------------ |
57
- | `completed` | `allowed` | Safe to show. |
58
- | `completed` | `limited` | Delivered like `allowed`; reduce its reach, such as keeping it out of recommendations. |
59
- | `completed` | `age-restricted` | Delivered only with `viewerClaims.ageConfirmed=true`. Show it only to age-checked viewers. |
60
- | `completed` | `blocked` | Your policy blocked it; the CDN doesn't deliver it. Don't show it. |
61
- | `completed` | `purged` | Your policy blocked it and deleted its content. Don't show it. |
62
- | `queued` or `processing` | `pending` | Still being received or classified. |
63
- | `failed` | `pending` | Processing failed; see `assets.retry`. |
64
-
65
- The latest applied review in `classification.moderation.manualReviews` takes precedence over the automated decision. Treat a status you don't recognise as not allowed. See [How CalmLens works](https://calmlens.com/docs/how-it-works).
55
+ | `classification.status` | `classification.moderation.decision` | Meaning |
56
+ | ------------------------ | ------------------------------------ | ------------------------------------------------------------------------------------------ |
57
+ | `completed` | `allowed` | Safe to show. |
58
+ | `completed` | `limited` | Delivered like `allowed`; reduce its reach, such as keeping it out of recommendations. |
59
+ | `completed` | `age-restricted` | Delivered only with `viewerClaims.ageConfirmed=true`. Show it only to age-checked viewers. |
60
+ | `completed` | `blocked` | Your policy blocked it; the CDN doesn't deliver it. Don't show it. |
61
+ | `completed` | `purged` | Your policy blocked it and deleted its content. Don't show it. |
62
+ | `queued` or `processing` | `null` | Still being received or classified. |
63
+ | `failed` | `null` | Processing failed; see `assets.retry`. |
64
+
65
+ The latest applied review in `classification.moderation.manualReviews` takes precedence over the automated decision. Treat a decision you don't recognise as not allowed. See [How CalmLens works](https://calmlens.com/docs/how-it-works).
66
66
 
67
67
  ## What you can do
68
68