axhub-sdk 0.3.0 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87c5676568c02cbf7dd18a197c0f44931632dcf9e22facb4911b066fdd7ceb6d
4
- data.tar.gz: 8a1558e6f13a915c471efdaacff64d856a4616e25a875e88c51193faf10d3204
3
+ metadata.gz: 85d987bf30aef83087acd96efae5f26be3edb75bab6db845b2b03e20855e022f
4
+ data.tar.gz: 9a9f21590240febb36affc2af156007840ccb0d273a279a89bd520544fa5c97c
5
5
  SHA512:
6
- metadata.gz: 783981a17b4e57b815ae92c33a867953ad05151c1cfb4266f5c258531c4b9461eaa34f4e0be6b10711a03dcfabd1fbb64e7d48835f06ee4388722de72463413a
7
- data.tar.gz: eae4cb33b36bb93274710c0510915251d9824b950bc7213b374d2d9d449a1931300321a026afb2f48de7df843a99b202828b1b4b08199cfc84d7ca1e0bb9bdb3
6
+ metadata.gz: ff15d439f50d8b4b28f79307c951f52b4581a234c7d50c58735153d090ceb8a44885852a37ec03760254a92ade0362633780641df75b1e3e5fbaf6279984a8b2
7
+ data.tar.gz: 8b0ec9cf0a69d1b702e859ee033f1b2d35eb3df213434f8acaceb5f208206b043300e526f60134f5f1274bbfb6cc3a21592c3fa432ca431b8c25e07aa8120269
@@ -93,16 +93,6 @@ module AxHub
93
93
  Data._reject_legacy_page_options(after, before, direction, @table_name)
94
94
  resolved_page = Data._resolve_offset_page(cursor, page, @table_name)
95
95
  per_page = Data._clamp_per_page(page_size.nil? ? limit : page_size)
96
- # The AxHub data ring rejects an unfiltered list with HTTP 400
97
- # ("최소 1개의 WHERE 필터가 필요해요") as a deliberate mass-scan guard —
98
- # confirmed live 2026-06, mirrored by the `axhub data` CLI. Checked after
99
- # cursor/page validation so a malformed cursor still surfaces first.
100
- if where.nil?
101
- raise ValidationError.new(
102
- 'AxHub data list requires at least one WHERE filter (the backend rejects unfiltered scans). Pass `where:`.',
103
- 'where_required'
104
- )
105
- end
106
96
  query = Data.serialize_where(where).dup
107
97
  query['per_page'] = per_page unless per_page.nil?
108
98
  query['page'] = resolved_page if resolved_page != 1
@@ -110,7 +100,7 @@ module AxHub
110
100
  query['sort'] = sort if sort && sort != ''
111
101
  serialized_select = Data.serialize_select(select)
112
102
  query['_select'] = serialized_select unless serialized_select.nil?
113
- raw = @client.request_raw('GET', _path, query: query) || {}
103
+ raw = Data.map_where_required('list') { @client.request_raw('GET', _path, query: query) } || {}
114
104
  items = Data.project_rows(raw['items'] || [], select)
115
105
  # mirrors node: current_page falls back to the requested page, has_next
116
106
  # reads the backend `has_more` flag verbatim, has_prev derives client-side.
@@ -140,14 +130,7 @@ module AxHub
140
130
  end
141
131
 
142
132
  def count(where: nil)
143
- # Same mass-scan guard as list() the backend 400s an unfiltered count.
144
- if where.nil?
145
- raise ValidationError.new(
146
- 'AxHub data count requires at least one WHERE filter (the backend rejects unfiltered scans). Pass `where:`.',
147
- 'where_required'
148
- )
149
- end
150
- raw = @client.request_raw('GET', "#{_path}/_count", query: Data.serialize_where(where)) || {}
133
+ raw = Data.map_where_required('count') { @client.request_raw('GET', "#{_path}/_count", query: Data.serialize_where(where)) } || {}
151
134
  raw['count']
152
135
  end
153
136
 
@@ -44,5 +44,25 @@ module AxHub
44
44
  super(category: 'internal', code: 'scan_limit_exceeded', message: message, status: 0, retryable: false, request_id: request_id)
45
45
  end
46
46
  end
47
+ # The backend 400s an unfiltered list/count on NON-owner-scoped tables
48
+ # ("최소 1개의 WHERE 필터가 필요해요") but ACCEPTS it on owner-scoped tables
49
+ # (rows auto-scope to the caller) — both confirmed live 2026-06. A client
50
+ # pre-check cannot tell them apart (0.3.0 regression), so the request goes
51
+ # through and only the backend 400 is normalized.
52
+ def self.map_where_required(op)
53
+ yield
54
+ rescue StandardError => e
55
+ code = e.respond_to?(:code) ? e.code : nil
56
+ status = e.respond_to?(:status) ? e.status : nil
57
+ if code.to_s == 'required' && status.to_i == 400
58
+ raise ValidationError.new(
59
+ "AxHub data #{op} requires at least one WHERE filter on this table " \
60
+ '(the backend rejects unfiltered scans on non-owner-scoped tables). Pass `where:`.',
61
+ 'where_required'
62
+ )
63
+ end
64
+ raise
65
+ end
66
+
47
67
  end
48
68
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AxHub
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: axhub-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jocoding AX Partners
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-09 00:00:00.000000000 Z
11
+ date: 2026-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest