calmlens 0.23.1 → 0.24.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0707eda417af2a9021104b813fecc82ca3a4cddbcc420d92fcd22642f844d61f
4
- data.tar.gz: c834ec6d48c5815e93d1af413efbd2c8cab0b4fb67071d2da17ac9d97ffab018
3
+ metadata.gz: 977f88cea877f294fefbc6259eef7e99c7327ba3e90333540da37c86ad74b599
4
+ data.tar.gz: 1ac90ad7c9fa1a7c11bf1abce6595efffb58b0cbdbd2a93035f1f1bc8f0c5ab9
5
5
  SHA512:
6
- metadata.gz: cfa54ba17a0a73abea37f1b34a76df43a2172ffa93e6801f0ae1cd671b40970516675fdcca7014fed69a8acf686a542f78e101fc7000580cc1c11f31c07ac095
7
- data.tar.gz: 71a628e67b7887807d5c241913b4125836bf5493b6bb54558d9321bb47a4331ea54079dd94d4161dcb02dcc79c798d5653bd891f9c1b3ff3d8848f7cebac9bbd
6
+ metadata.gz: 6654f2b874569fd13005016adc0a7efbec542db6bf378fa04d5ebfe4f3bb43c7cd85b04c504ac6110966d826f9a92c1e1d9a82aa796e19ed01b3f00920cc1179
7
+ data.tar.gz: 26e933bc44b4577d13be2e01907c9578cd84ebe3ec3dd2e51d969da5b6f990254466a3728dccb0ecd6e1a2c74699769ed5d5bfd0f8ab90a36ce8224bcf171e9b
data/lib/calmlens/cdn.rb CHANGED
@@ -54,8 +54,8 @@ module CalmLens
54
54
  # client accepts, a PDF, or browser-safe video or audio), `original` (the exact upload), `preview` (a
55
55
  # still image for the asset), `hls` (the HLS master playlist of audio or video, at `hls/index.m3u8`,
56
56
  # once `content.hls.status` is `ready`), `embed` (an HTML page that shows the asset, a viewer for its type, for an
57
- # iframe), `placeholder` (a small blurred PNG that the CDN serves publicly for every asset whatever its
58
- # visibility or moderation status, without age confirmation) or `info` (the asset's display info, as
57
+ # iframe), `placeholder` (a small blurred PNG, without age confirmation; private or blocked assets
58
+ # require a signed URL or download permission) or `info` (the asset's display info, as
59
59
  # {#get_asset_info} reads it). Without it, the URL is the asset URL itself. Lenses and transforms
60
60
  # apply to `preview`, and to `rendered` when it is an image; the CDN refuses them on rendered PDFs,
61
61
  # video and audio with `transform/invalid`, and the SDK refuses them on the other resources and
@@ -14,7 +14,7 @@ module CalmLens
14
14
  IDEMPOTENCY_KEY = /\A[^\r\n\0]+\z/
15
15
  HEADER_VALUE = /\A[^\r\n\0]*\z/
16
16
  # The CDN resources that take no lens or transform: the exact upload, the adaptive stream, the embed page,
17
- # the public placeholder and the display info.
17
+ # the placeholder and the display info.
18
18
  UNSELECTABLE_CDN_RESOURCES = %w[original hls embed placeholder info].freeze
19
19
 
20
20
  module_function
@@ -730,7 +730,8 @@ module CalmLens
730
730
  end
731
731
 
732
732
  def show_project_settings
733
- settings = { 'optOutJurisdictions' => [], 'blockUnmoderatedAssets' => true, 'storeSensitiveMetadata' => false,
733
+ settings = { 'retainContent' => true, 'optOutJurisdictions' => [], 'blockUnmoderatedAssets' => true,
734
+ 'storeSensitiveMetadata' => false,
734
735
  'streamingEnabled' => false, 'aiMediaSearchEnabled' => false, 'remoteUrlRule' => nil,
735
736
  'websiteSubmissionsPerMinute' => nil }.merge(@project_settings)
736
737
  settings['humanReview'] = { 'allowedSamplePercent' => 0, 'restrictedSamplePercent' => 0, 'uncertaintyMarginPercent' => 0,
@@ -842,8 +843,9 @@ module CalmLens
842
843
  end
843
844
  now = @now.call
844
845
  mime = options['contentType'].to_s
845
- processing = options['processingOptions'] || { 'keepContentAfterProcessing' => false }
846
- keep = processing.is_a?(Hash) && processing['keepContentAfterProcessing'] == true
846
+ processing = (options['processingOptions'] || {}).dup
847
+ processing['retainContent'] = show_project_settings['settings']['retainContent'] if processing['retainContent'].nil?
848
+ keep = processing.is_a?(Hash) && processing['retainContent'] == true
847
849
  context = options['context'].is_a?(Hash) ? ModerationContext.select_items(options['context'].fetch('items', [])) : []
848
850
  # Fields the API returns as null when they are not set.
849
851
  asset = { 'id' => @create_id.call('asset'), 'projectId' => @project_id, 'parentId' => nil, 'parentPages' => [],
@@ -946,8 +948,12 @@ module CalmLens
946
948
  fail!(ErrorCodes::UPLOAD_PRESET_DISABLED) unless preset['enabled']
947
949
  check_preset_fields(preset, fields)
948
950
  check_preset_limits(preset, fields, data)
951
+ retain = fields.dig('processingOptions', 'retainContent')
952
+ retain = preset.dig('processingOptions', 'retainContent') if retain.nil?
949
953
  fields.merge('folderId' => preset['folderId'] || fields['folderId'], 'visibility' => preset['visibility'],
950
- 'processingOptions' => fields['processingOptions'] || deep_copy(preset['processingOptions']))
954
+ 'processingOptions' => (fields['processingOptions'] || deep_copy(preset['processingOptions']) || {}).merge(
955
+ 'retainContent' => retain
956
+ ))
951
957
  end
952
958
 
953
959
  def check_preset_fields(preset, fields)
@@ -17,7 +17,7 @@ module CalmLens
17
17
  # callback decides each upload, retry and rerun with a status or a {MockDecision}, and the events
18
18
  # feed gets the pipeline's `asset.uploaded`, `asset.classified`, `asset.<status>` and `asset.failed`
19
19
  # events. Without it, queued uploads stay `pending` until {#complete_processing} and the rest are
20
- # `allowed`. Content is kept only with `keepContentAfterProcessing: true`; otherwise it is removed
20
+ # `allowed`. Content retention follows upload, preset and project settings; when disabled, content is removed
21
21
  # once classification is `completed`, as in the API.
22
22
  # A `purged` outcome removes the content with reason `policy`. The CDN answers like the real one:
23
23
  # `asset/not-available` (403) for blocked, purged, failed or removed content,
@@ -28,8 +28,8 @@ module CalmLens
28
28
  # `{cdn_base_url}/assets/{project_id}/sig_…`, a readable grant that only the mock's CDN accepts,
29
29
  # which serves `original` only when signed with `original: true`. {#fetch_cdn} loads such a URL
30
30
  # without the API key, as a browser would; without the key or a grant, a private asset answers
31
- # as an unknown one does, `asset/not-found` (404) whatever its state, and only its placeholder is
32
- # public. {#decide} applies a reviewer's decision, and {Assets#wait_for_decision} takes no real
31
+ # as an unknown one does, `asset/not-found` (404) whatever its state, including its placeholder
32
+ # and display info. {#decide} applies a reviewer's decision, and {Assets#wait_for_decision} takes no real
33
33
  # time: a pending asset times out at once.
34
34
  # Filters join comparisons with `;` (and), which binds tighter than `,` (or), and group them with
35
35
  # `( … )`; list cursors resume after the last item returned. {Assets#search} is the API's keyword
@@ -275,7 +275,7 @@ module CalmLens
275
275
  # asset URL from {CDN#sign_asset_url} (with a resource appended), or a public one from
276
276
  # {CDN#get_asset_url}. The request is recorded like any other. Error statuses are returned, not
277
277
  # raised. A private asset without a grant answers `asset/not-found` (404) whatever its state,
278
- # except for its public placeholder.
278
+ # including its placeholder and display info.
279
279
  # @param url [String]
280
280
  # @return [Response] with its body read
281
281
  def fetch_cdn(url)
@@ -2,5 +2,5 @@
2
2
 
3
3
  module CalmLens
4
4
  # The gem version. The gemspec and the User-Agent header read it from here.
5
- VERSION = '0.23.1'
5
+ VERSION = '0.24.0'
6
6
  end
data/sig/types.rbs CHANGED
@@ -70,12 +70,12 @@ module CalmLens
70
70
  ?face_detection: { enabled: bool, ?age_estimation: bool }?,
71
71
  ?link_detection: { enabled: bool }?,
72
72
  # Preview. Prepares an adaptive stream (HLS) of audio or video, served at the `hls` resource and
73
- # played by the `embed` resource; needs `keep_content_after_processing`. Left out, the project's
73
+ # played by the `embed` resource; needs `retain_content`. Left out, the project's
74
74
  # streaming setting decides.
75
75
  ?streaming: { enabled: bool }?
76
76
  }
77
77
  type processing_options_input = {
78
- ?keep_content_after_processing: bool?,
78
+ ?retain_content: bool?,
79
79
  # Overrides the project's `storeSensitiveMetadata` setting: false removes embedded EXIF, XMP and
80
80
  # IPTC metadata before the image is stored; true stores it as uploaded.
81
81
  ?store_sensitive_metadata: bool?,
@@ -658,7 +658,7 @@ module CalmLens
658
658
  type upload_preset_access = "token" | "anyone"
659
659
  # An upload preset's processing options, as the API returns them.
660
660
  type upload_preset_processing_options = {
661
- ?"keepContentAfterProcessing" => bool?,
661
+ ?"retainContent" => bool?,
662
662
  ?"storeSensitiveMetadata" => bool?,
663
663
  ?"features" => {
664
664
  ?"ocr" => { "enabled" => bool }?,
@@ -703,6 +703,7 @@ module CalmLens
703
703
  }
704
704
  type public_project_settings = {
705
705
  "optOutJurisdictions" => Array[String],
706
+ "retainContent" => bool,
706
707
  "blockUnmoderatedAssets" => bool,
707
708
  "storeSensitiveMetadata" => bool,
708
709
  "streamingEnabled" => bool,
@@ -1204,6 +1205,7 @@ module CalmLens
1204
1205
  # The complete settings: those left out return to their defaults.
1205
1206
  type project_settings_input = {
1206
1207
  ?opt_out_jurisdictions: Array[String],
1208
+ ?retain_content: bool,
1207
1209
  ?block_unmoderated_assets: bool,
1208
1210
  ?store_sensitive_metadata: bool,
1209
1211
  ?streaming_enabled: bool,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calmlens
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.1
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CalmLens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-10 00:00:00.000000000 Z
11
+ date: 2026-11-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Server-side client for the CalmLens API: moderation, uploads, events,
14
14
  webhooks and CDN delivery.'
@@ -69,7 +69,7 @@ metadata:
69
69
  homepage_uri: https://calmlens.com
70
70
  documentation_uri: https://calmlens.com/docs/sdk/ruby
71
71
  source_code_uri: https://github.com/CalmLens/sdks/tree/main/ruby
72
- changelog_uri: https://calmlens.com/docs/changelog
72
+ changelog_uri: https://github.com/CalmLens/sdks/blob/main/ruby/CHANGELOG.md
73
73
  rubygems_mfa_required: 'true'
74
74
  post_install_message:
75
75
  rdoc_options: []