axhub-sdk 0.10.0 → 0.13.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 +4 -4
- data/lib/axhub_sdk/raw_db.rb +88 -0
- data/lib/axhub_sdk/version.rb +1 -1
- data/lib/axhub_sdk.rb +13 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3b10c1b25b0ef95ade74bac6aaf17b6e261a49b0232d7463a8c939d8ad8b7a55
|
|
4
|
+
data.tar.gz: 18491817e76cc76de8b227abbf88910d0fbac1b598c027785b65f6c171e907ba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 00b0df6aa064e8d803e1a9d12638ba0333b8808d2fe74be33bd4377bdce2c354e30bda6fcd88bfbc823cf3088e4064eb62c72db2ff0a6eaa9acf48558bb6ced8
|
|
7
|
+
data.tar.gz: 312dfad9ce25d9b4a1511c792cfa519967f14fb2f2874709e472ec661ee2d4d7d771c293df6e17f84ca7052a7b3baca0f7e3fbbda105b241167c0852dafc5476
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module AxHub
|
|
4
|
+
# Typed, read-only DTOs + facade for an app's raw (physical Postgres) DB,
|
|
5
|
+
# mirroring the Go SDK's client.Apps.RawDb() and the Node SDK's sdk.apps.rawDb.
|
|
6
|
+
#
|
|
7
|
+
# Read-only: table introspection + row reads. Enabling raw DB and writing rows
|
|
8
|
+
# are separate concerns (writes go through the deployed app's DATABASE_URL,
|
|
9
|
+
# not this SDK).
|
|
10
|
+
RawDbColumn = Struct.new(:name, :data_type, :nullable)
|
|
11
|
+
RawDbTable = Struct.new(:name, :managed, :columns)
|
|
12
|
+
RawDbTableRows = Struct.new(:rows, :page, :per_page, :has_more)
|
|
13
|
+
|
|
14
|
+
# RawDbClient is the typed raw-DB read facade. Reach it via client.apps.raw_db.
|
|
15
|
+
# It wraps the generic transport (Client#request), which camelCases response
|
|
16
|
+
# keys, so the DTOs read camelCase wire keys (dataType/perPage/hasMore) and map
|
|
17
|
+
# them onto snake_case Struct fields.
|
|
18
|
+
class RawDbClient
|
|
19
|
+
def initialize(client)
|
|
20
|
+
@client = client
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Lists the raw DB tables for an app, with typed column metadata.
|
|
24
|
+
#
|
|
25
|
+
# F-3 empty semantics: a successful 2xx call that returns an empty array
|
|
26
|
+
# means the app genuinely has no raw DB tables (raw DB is not enabled, or it
|
|
27
|
+
# has zero tables). A 4xx authentication/permission failure raises
|
|
28
|
+
# AxHub::Error instead — so an empty array WITHOUT a raised error means
|
|
29
|
+
# "empty", not "auth failed" (resolving the ambiguity the raw response
|
|
30
|
+
# leaves).
|
|
31
|
+
def tables(app_id)
|
|
32
|
+
raise Error.new(category: 'validation', code: 'required', message: 'appID is required') if app_id.nil? || app_id.empty?
|
|
33
|
+
|
|
34
|
+
resp = @client.request('schemaGetApiV1AppsByAppIDDbTables', path_params: { appID: app_id })
|
|
35
|
+
(field(resp, 'tables') || []).map { |t| parse_table(t) }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Reads one page of rows from a raw DB table. per_page/page are forwarded as
|
|
39
|
+
# query params only when set (non-nil); nil uses the backend default page
|
|
40
|
+
# size.
|
|
41
|
+
def table_rows(app_id, table, per_page: nil, page: nil)
|
|
42
|
+
raise Error.new(category: 'validation', code: 'required', message: 'appID and table are required') if app_id.nil? || app_id.empty? || table.nil? || table.empty?
|
|
43
|
+
|
|
44
|
+
query = {}
|
|
45
|
+
query['per_page'] = per_page unless per_page.nil?
|
|
46
|
+
query['page'] = page unless page.nil?
|
|
47
|
+
resp = @client.request('schemaGetApiV1AppsByAppIDDbTablesByTableRows', path_params: { appID: app_id, table: table }, query: query)
|
|
48
|
+
RawDbTableRows.new(
|
|
49
|
+
field(resp, 'rows') || [],
|
|
50
|
+
field(resp, 'page'),
|
|
51
|
+
field(resp, 'perPage'),
|
|
52
|
+
field(resp, 'hasMore')
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
private
|
|
57
|
+
|
|
58
|
+
# Read a camelCase response key, tolerating string or symbol keys and
|
|
59
|
+
# preserving false/absent values (no ||-defaulting, so `false` survives).
|
|
60
|
+
def field(hash, key)
|
|
61
|
+
return nil unless hash.is_a?(Hash)
|
|
62
|
+
return hash[key] if hash.key?(key)
|
|
63
|
+
|
|
64
|
+
sym = key.to_sym
|
|
65
|
+
hash.key?(sym) ? hash[sym] : nil
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def parse_table(raw)
|
|
69
|
+
RawDbTable.new(
|
|
70
|
+
field(raw, 'name'),
|
|
71
|
+
field(raw, 'managed'),
|
|
72
|
+
(field(raw, 'columns') || []).map { |c| parse_column(c) }
|
|
73
|
+
)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def parse_column(raw)
|
|
77
|
+
RawDbColumn.new(field(raw, 'name'), field(raw, 'dataType'), field(raw, 'nullable'))
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
class AppsClient
|
|
82
|
+
# Typed, read-only raw-DB facade (client.apps.raw_db). Mirrors Go's
|
|
83
|
+
# client.Apps.RawDb() / Node's sdk.apps.rawDb.
|
|
84
|
+
def raw_db
|
|
85
|
+
@raw_db ||= RawDbClient.new(@client)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
data/lib/axhub_sdk/version.rb
CHANGED
data/lib/axhub_sdk.rb
CHANGED
|
@@ -95,6 +95,7 @@ module AxHub
|
|
|
95
95
|
{ 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/me/connectors", 'tag' => "Gateway", 'operationId' => "gatewayGetApiV1TenantsByTenantIDMeConnectors" },
|
|
96
96
|
{ 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/me/connectors/{connectorID}/resources", 'tag' => "Gateway", 'operationId' => "gatewayGetApiV1TenantsByTenantIDMeConnectorsByConnectorIDResources" },
|
|
97
97
|
{ 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/me/grants", 'tag' => "Authorization", 'operationId' => "authorizationGetApiV1TenantsByTenantIDMeGrants" },
|
|
98
|
+
{ 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/members/directory", 'tag' => "Tenants", 'operationId' => "tenantsGetApiV1TenantsByTenantIDMembersDirectory" },
|
|
98
99
|
{ 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/org-directory", 'tag' => "Tenants", 'operationId' => "tenantsGetApiV1TenantsByTenantIDOrgDirectory" },
|
|
99
100
|
{ 'method' => "GET", 'path' => "/api/v1/users/me/apps", 'tag' => "Apps", 'operationId' => "appsGetApiV1UsersMeApps" },
|
|
100
101
|
{ 'method' => "POST", 'path' => "/auth/logout", 'tag' => "Auth", 'operationId' => "authPostAuthLogout" },
|
|
@@ -119,8 +120,10 @@ module AxHub
|
|
|
119
120
|
"already_suspended" => ErrorInfo.new("conflict", 409, false),
|
|
120
121
|
"already_terminal" => ErrorInfo.new("conflict", 409, false),
|
|
121
122
|
"app_archived" => ErrorInfo.new("precondition_failed", 412, false),
|
|
123
|
+
"app_suspended" => ErrorInfo.new("precondition_failed", 412, false),
|
|
122
124
|
"app_unavailable" => ErrorInfo.new("conflict", 409, false),
|
|
123
125
|
"auth_expired" => ErrorInfo.new("unavailable", 503, false),
|
|
126
|
+
"axrouter_disabled" => ErrorInfo.new("conflict", 409, false),
|
|
124
127
|
"bad_request" => ErrorInfo.new("validation", 400, false),
|
|
125
128
|
"build_env_no_override" => ErrorInfo.new("validation", 400, false),
|
|
126
129
|
"cannot_reactivate" => ErrorInfo.new("conflict", 409, false),
|
|
@@ -128,7 +131,10 @@ module AxHub
|
|
|
128
131
|
"confirm_required" => ErrorInfo.new("precondition_failed", 412, false),
|
|
129
132
|
"conflict" => ErrorInfo.new("conflict", 409, false),
|
|
130
133
|
"connector_inactive" => ErrorInfo.new("permission_denied", 403, false),
|
|
134
|
+
"consent_required" => ErrorInfo.new("precondition_failed", 412, false),
|
|
131
135
|
"cross_tenant" => ErrorInfo.new("validation", 400, false),
|
|
136
|
+
"directory_not_ready" => ErrorInfo.new("conflict", 409, true),
|
|
137
|
+
"directory_source_conflict" => ErrorInfo.new("conflict", 409, false),
|
|
132
138
|
"domain_blocked" => ErrorInfo.new("precondition_failed", 422, false),
|
|
133
139
|
"domain_taken" => ErrorInfo.new("conflict", 409, false),
|
|
134
140
|
"duplicate" => ErrorInfo.new("validation", 400, false),
|
|
@@ -140,10 +146,15 @@ module AxHub
|
|
|
140
146
|
"forbidden" => ErrorInfo.new("permission_denied", 403, false),
|
|
141
147
|
"git_connection_required" => ErrorInfo.new("precondition_failed", 412, false),
|
|
142
148
|
"github_device_flow_disabled" => ErrorInfo.new("unavailable", 503, false),
|
|
149
|
+
"google_access_denied" => ErrorInfo.new("validation", 400, false),
|
|
150
|
+
"google_domain_taken" => ErrorInfo.new("conflict", 409, false),
|
|
151
|
+
"google_membership_required" => ErrorInfo.new("validation", 400, false),
|
|
152
|
+
"google_not_registered" => ErrorInfo.new("validation", 400, false),
|
|
143
153
|
"grant_already_terminal" => ErrorInfo.new("conflict", 409, false),
|
|
144
154
|
"grant_conflict" => ErrorInfo.new("conflict", 409, false),
|
|
145
155
|
"grant_expired" => ErrorInfo.new("permission_denied", 403, false),
|
|
146
156
|
"grant_revoked" => ErrorInfo.new("permission_denied", 403, false),
|
|
157
|
+
"group_scim_managed" => ErrorInfo.new("conflict", 409, false),
|
|
147
158
|
"internal_error" => ErrorInfo.new("internal", 500, false),
|
|
148
159
|
"invalid_drive" => ErrorInfo.new("validation", 400, false),
|
|
149
160
|
"invalid_entitlement" => ErrorInfo.new("validation", 400, false),
|
|
@@ -159,6 +170,7 @@ module AxHub
|
|
|
159
170
|
"kind_engine_mismatch" => ErrorInfo.new("validation", 400, false),
|
|
160
171
|
"last_admin" => ErrorInfo.new("conflict", 409, false),
|
|
161
172
|
"link_invalid" => ErrorInfo.new("not_found", 404, false),
|
|
173
|
+
"member_inactive" => ErrorInfo.new("permission_denied", 403, false),
|
|
162
174
|
"no_active_grant" => ErrorInfo.new("not_found", 404, false),
|
|
163
175
|
"no_available_seat" => ErrorInfo.new("conflict", 409, false),
|
|
164
176
|
"no_billing_key" => ErrorInfo.new("CategoryPaymentRequired", 402, false),
|
|
@@ -310,3 +322,4 @@ module AxHub
|
|
|
310
322
|
end
|
|
311
323
|
|
|
312
324
|
require_relative 'axhub_sdk/operations'
|
|
325
|
+
require_relative 'axhub_sdk/raw_db'
|
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.
|
|
4
|
+
version: 0.13.0
|
|
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-07-
|
|
11
|
+
date: 2026-07-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|
|
@@ -51,6 +51,7 @@ files:
|
|
|
51
51
|
- axhub-sdk.gemspec
|
|
52
52
|
- lib/axhub_sdk.rb
|
|
53
53
|
- lib/axhub_sdk/operations.rb
|
|
54
|
+
- lib/axhub_sdk/raw_db.rb
|
|
54
55
|
- lib/axhub_sdk/version.rb
|
|
55
56
|
homepage: https://github.com/jocoding-ax-partners/axhub-sdk-ruby
|
|
56
57
|
licenses:
|