axhub-sdk 0.6.0 → 0.7.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/README.md +16 -29
- data/lib/axhub_sdk/version.rb +1 -1
- data/lib/axhub_sdk.rb +0 -15
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af207a4a3d83fa1b8f8fb7f66baa8a6f880877f0971ad6228ab65a9daede4e5e
|
|
4
|
+
data.tar.gz: 478545d4c9b51589fd403141e578f38e2f1189b0dfce8361a4963daae52eea0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f503acb2c6d7b6daae9bac7d9311be9e5fa9e0e5cb51f089a2309be1c01cfa17803c52824d96b039158439c6c9d5c17d3b89789992804797c8599d3ebcb10b38
|
|
7
|
+
data.tar.gz: 39cf39bda82f472d156b6c10a575b3e6c88881b9610e349eb61000949b55c23e9a311b9f564931d35ba3260d2016c984bed9039c5cc8fc7975789d27c277fd79
|
data/README.md
CHANGED
|
@@ -25,7 +25,7 @@ export AXHUB_TENANT_SLUG="test"
|
|
|
25
25
|
|
|
26
26
|
PAT mode is explicit: `token_type: :pat` sends `X-Api-Key`. JWT mode is `token_type: :jwt` and sends `Authorization: Bearer`.
|
|
27
27
|
|
|
28
|
-
## Agent quickstart: create a disposable app and
|
|
28
|
+
## Agent quickstart: create a disposable app and enable its database
|
|
29
29
|
|
|
30
30
|
```ruby
|
|
31
31
|
require 'axhub_sdk'
|
|
@@ -44,7 +44,6 @@ raise 'authGetApiV1Me did not return a user id' if user_id.nil? || user_id.empty
|
|
|
44
44
|
|
|
45
45
|
suffix = (Time.now.to_f * 1000).to_i.to_s[-8, 8]
|
|
46
46
|
slug = "agent-rb-#{suffix}"
|
|
47
|
-
table = "items#{suffix[-6, 6]}"
|
|
48
47
|
|
|
49
48
|
app = client.apps.create(
|
|
50
49
|
slug: slug,
|
|
@@ -57,28 +56,22 @@ app = client.apps.create(
|
|
|
57
56
|
)
|
|
58
57
|
app_id = app['id']
|
|
59
58
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
{ name: 'owner_id', type: 'uuid', nullable: false },
|
|
68
|
-
{ name: 'title', type: 'text', nullable: false },
|
|
69
|
-
{ name: 'status', type: 'text', nullable: false }
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
)
|
|
59
|
+
# Enable raw DB mode: a dedicated Postgres role is issued and DATABASE_URL is
|
|
60
|
+
# injected into the app on its next deploy. The app then does row CRUD over
|
|
61
|
+
# direct SQL with its own pg driver.
|
|
62
|
+
client.request('appsPostApiV1AppsByAppIDRawDb', path_params: { appID: app_id }, body: {})
|
|
63
|
+
|
|
64
|
+
# Admin introspection/browse of the physical DB.
|
|
65
|
+
tables = client.request('schemaGetApiV1AppsByAppIDDbTables', path_params: { appID: app_id })
|
|
73
66
|
|
|
74
|
-
puts "created #{app_id} #{
|
|
67
|
+
puts "created #{app_id} #{tables}"
|
|
75
68
|
```
|
|
76
69
|
|
|
77
70
|
## How to call the full API surface
|
|
78
71
|
|
|
79
72
|
- High-level app create: `client.apps.create(**body)` uses `default_tenant_id`.
|
|
80
73
|
- Any route by operation id: `client.request(operation_id, path_params: {}, query: {}, body: nil)`.
|
|
81
|
-
- Generated facade: `client.data.
|
|
74
|
+
- Generated facade: `client.data.schema_get_api_v1_apps_by_app_id_db_tables(path_params: {})`.
|
|
82
75
|
- Route inventory: `AxHub::ROUTES`, `AxHub::CONTEXT_ROUTES`, `AxHub::ERROR_CODES`, and `AxHub::OPERATION_METHODS`.
|
|
83
76
|
- Errors: catch `AxHub::Error` and branch on `code`, `category`, `status`, and `retryable`.
|
|
84
77
|
|
|
@@ -90,21 +83,15 @@ Use the high-level `apps.create` helper for the first app, then use generated op
|
|
|
90
83
|
|------|--------------|----------------------|-------------------|
|
|
91
84
|
| Create env var | `appsPostApiV1AppsByAppIDEnvVars` | `appID` | `env.list` includes `key` |
|
|
92
85
|
| Delete env var | `appsDeleteApiV1AppsByAppIDEnvVarsByKey` | `appID`, `key` | `env.list` no longer includes `key` |
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
| Add table grant | `schemaPostApiV1AppsByAppIDTablesByTableNameGrants` | `appID`, `tableName` | response has grant `id` |
|
|
98
|
-
| List grants | `schemaGetApiV1AppsByAppIDTablesByTableNameGrants` | `appID`, `tableName` | list contains grant `id` |
|
|
99
|
-
| Revoke/delete grant | `schemaDeleteApiV1AppsByAppIDTablesByTableNameGrantsByGrantID` | `appID`, `tableName`, `grantID` | list still contains grant with `revokedAt` set |
|
|
100
|
-
| Browse admin rows | `schemaGetApiV1AppsByAppIDTablesByTableNameRows` | `appID`, `tableName` | response has `rows` and `columns` arrays |
|
|
101
|
-
| Delete table | `schemaDeleteApiV1AppsByAppIDTablesByTableName` | `appID`, `tableName` | follow-up inspect returns `404` or `410` |
|
|
86
|
+
| Enable raw DB | `appsPostApiV1AppsByAppIDRawDb` | `appID` | dedicated Postgres role issued; `DATABASE_URL` injected on next deploy |
|
|
87
|
+
| Disable raw DB | `appsDeleteApiV1AppsByAppIDRawDb` | `appID` | raw DB mode turned off (data preserved) |
|
|
88
|
+
| List DB tables | `schemaGetApiV1AppsByAppIDDbTables` | `appID` | response lists physical `information_schema` tables |
|
|
89
|
+
| Browse DB rows | `schemaGetApiV1AppsByAppIDDbTablesByTableRows` | `appID`, `table` | response has `rows` array |
|
|
102
90
|
| Delete app | `appsDeleteApiV1AppsByAppID`, then `appsDeleteApiV1AppsByAppIDPermanent` | `appID` | app is soft-deleted, then permanently deleted |
|
|
103
91
|
|
|
104
92
|
Important semantics from live QA:
|
|
105
93
|
|
|
106
|
-
-
|
|
107
|
-
- Table grant delete is a soft revoke: the grant can remain in `listGrants`, but the same grant id must have `revokedAt` set. Do not assert disappearance.
|
|
94
|
+
- App database access is raw: `appsPostApiV1AppsByAppIDRawDb` issues a dedicated Postgres role and injects `DATABASE_URL` on the next deploy (the connection string is never returned). The app does its own row CRUD via direct SQL; the SDK exposes admin introspection/browse only (`schemaGetApiV1AppsByAppIDDbTables` / `...DbTablesByTableRows`).
|
|
108
95
|
- Deployment creation without a connected git/bootstrap source can return a precondition-style 4xx. That verifies SDK error handling, not a deploy bug.
|
|
109
96
|
|
|
110
97
|
|
|
@@ -114,7 +101,7 @@ The SDK behavior documented here reflects live production QA against the AX Hub
|
|
|
114
101
|
|
|
115
102
|
- Tenant used for destructive QA: slug `test`, id `cc1e58f1-8e46-4ac7-96c1-190c4cdd5b70`.
|
|
116
103
|
- Go, Java, Kotlin, Python, and Ruby each ran the generated all-operation sweep against 189 backend routes: SDK exceptions `0`, backend 5xx `0`.
|
|
117
|
-
- Go, Java, Kotlin, Python, and Ruby each passed strict destructive DB QA:
|
|
104
|
+
- Go, Java, Kotlin, Python, and Ruby each passed strict destructive DB QA: the flow exercised the raw-DB enable/reset lifecycle (instead of the removed dynamic-table flow), then deleted the app and re-read to prove deletion semantics.
|
|
118
105
|
- Node ran the full production mutation suite and a real app bootstrap/deploy wait. Deployment id `d3a48ce3-0f9c-4bab-aa07-863c31c44460` finished `succeeded`, then the app was deleted permanently.
|
|
119
106
|
|
|
120
107
|
Do not print tokens. Use short-lived PATs for agent QA and revoke them after the run.
|
data/lib/axhub_sdk/version.rb
CHANGED
data/lib/axhub_sdk.rb
CHANGED
|
@@ -74,21 +74,6 @@ module AxHub
|
|
|
74
74
|
{ 'method' => "DELETE", 'path' => "/api/v1/apps/{appID}/staging", 'tag' => "Deploy", 'operationId' => "deployDeleteApiV1AppsByAppIDStaging" },
|
|
75
75
|
{ 'method' => "PUT", 'path' => "/api/v1/apps/{appID}/staging", 'tag' => "Deploy", 'operationId' => "deployPutApiV1AppsByAppIDStaging" },
|
|
76
76
|
{ 'method' => "POST", 'path' => "/api/v1/apps/{appID}/suspend", 'tag' => "Apps", 'operationId' => "appsPostApiV1AppsByAppIDSuspend" },
|
|
77
|
-
{ 'method' => "GET", 'path' => "/api/v1/apps/{appID}/tables", 'tag' => "Schema", 'operationId' => "schemaGetApiV1AppsByAppIDTables" },
|
|
78
|
-
{ 'method' => "POST", 'path' => "/api/v1/apps/{appID}/tables", 'tag' => "Schema", 'operationId' => "schemaPostApiV1AppsByAppIDTables" },
|
|
79
|
-
{ 'method' => "DELETE", 'path' => "/api/v1/apps/{appID}/tables/{tableName}", 'tag' => "Schema", 'operationId' => "schemaDeleteApiV1AppsByAppIDTablesByTableName" },
|
|
80
|
-
{ 'method' => "GET", 'path' => "/api/v1/apps/{appID}/tables/{tableName}", 'tag' => "Schema", 'operationId' => "schemaGetApiV1AppsByAppIDTablesByTableName" },
|
|
81
|
-
{ 'method' => "POST", 'path' => "/api/v1/apps/{appID}/tables/{tableName}/columns", 'tag' => "Schema", 'operationId' => "schemaPostApiV1AppsByAppIDTablesByTableNameColumns" },
|
|
82
|
-
{ 'method' => "DELETE", 'path' => "/api/v1/apps/{appID}/tables/{tableName}/columns/{columnName}", 'tag' => "Schema", 'operationId' => "schemaDeleteApiV1AppsByAppIDTablesByTableNameColumnsByColumnName" },
|
|
83
|
-
{ 'method' => "GET", 'path' => "/api/v1/apps/{appID}/tables/{tableName}/grants", 'tag' => "Schema", 'operationId' => "schemaGetApiV1AppsByAppIDTablesByTableNameGrants" },
|
|
84
|
-
{ 'method' => "POST", 'path' => "/api/v1/apps/{appID}/tables/{tableName}/grants", 'tag' => "Schema", 'operationId' => "schemaPostApiV1AppsByAppIDTablesByTableNameGrants" },
|
|
85
|
-
{ 'method' => "DELETE", 'path' => "/api/v1/apps/{appID}/tables/{tableName}/grants/{grantID}", 'tag' => "Schema", 'operationId' => "schemaDeleteApiV1AppsByAppIDTablesByTableNameGrantsByGrantID" },
|
|
86
|
-
{ 'method' => "GET", 'path' => "/api/v1/apps/{appID}/tables/{tableName}/rows", 'tag' => "Schema", 'operationId' => "schemaGetApiV1AppsByAppIDTablesByTableNameRows" },
|
|
87
|
-
{ 'method' => "POST", 'path' => "/api/v1/apps/{appID}/tables/{tableName}/rows", 'tag' => "Schema", 'operationId' => "schemaPostApiV1AppsByAppIDTablesByTableNameRows" },
|
|
88
|
-
{ 'method' => "DELETE", 'path' => "/api/v1/apps/{appID}/tables/{tableName}/rows/{id}", 'tag' => "Schema", 'operationId' => "schemaDeleteApiV1AppsByAppIDTablesByTableNameRowsById" },
|
|
89
|
-
{ 'method' => "PATCH", 'path' => "/api/v1/apps/{appID}/tables/{tableName}/rows/{id}", 'tag' => "Schema", 'operationId' => "schemaPatchApiV1AppsByAppIDTablesByTableNameRowsById" },
|
|
90
|
-
{ 'method' => "GET", 'path' => "/api/v1/apps/{appID}/tables/check-availability", 'tag' => "Schema", 'operationId' => "schemaGetApiV1AppsByAppIDTablesCheckAvailability" },
|
|
91
|
-
{ 'method' => "GET", 'path' => "/api/v1/apps/{appID}/tables/column-types", 'tag' => "Schema", 'operationId' => "schemaGetApiV1AppsByAppIDTablesColumnTypes" },
|
|
92
77
|
{ 'method' => "GET", 'path' => "/api/v1/apps/discover", 'tag' => "Apps", 'operationId' => "appsGetApiV1AppsDiscover" },
|
|
93
78
|
{ 'method' => "GET", 'path' => "/api/v1/apps/search", 'tag' => "Apps", 'operationId' => "appsGetApiV1AppsSearch" },
|
|
94
79
|
{ 'method' => "DELETE", 'path' => "/api/v1/comments/{commentID}", 'tag' => "Apps", 'operationId' => "appsDeleteApiV1CommentsByCommentID" },
|