@ax-hub/sdk 0.0.6 → 0.1.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.
package/dist/index.d.cts CHANGED
@@ -493,8 +493,11 @@ declare class AuthzClient {
493
493
  scoped(tenantSlug: string): TenantAuthzClient;
494
494
  }
495
495
  declare class TenantAuthzClient {
496
+ /** @adminOnly Tag governance. `list()` requires tenant_admin (v0.1, SPEC 307) — member callers get ForbiddenError (no auto-retry; permission, not transient). Members browse the data catalog via `gateway.catalog`. */
496
497
  readonly tags: Crud<AuthzTag>;
498
+ /** @adminOnly Subject governance. `list()` requires tenant_admin (v0.1) — member callers get ForbiddenError. */
497
499
  readonly subjects: Crud<AuthzSubject>;
500
+ /** @adminOnly Grant governance. `list()` requires tenant_admin (v0.1) — member callers get ForbiddenError. */
498
501
  readonly grants: Crud<AuthzGrant>;
499
502
  readonly evaluator: AuthzEvaluatorClient;
500
503
  constructor(http: HttpClient, tenantSlug: string);
@@ -1962,16 +1965,121 @@ interface GatewayQueryResult<Row = Record<string, unknown>> {
1962
1965
  rowCount: number;
1963
1966
  matchedPolicies?: string[];
1964
1967
  }
1968
+ interface CatalogKindAction {
1969
+ allowedEffects: string[];
1970
+ inputSchema?: unknown;
1971
+ resultSchema?: unknown;
1972
+ }
1973
+ interface CatalogKind {
1974
+ kind: string;
1975
+ engine: string;
1976
+ displayName: string;
1977
+ invokable: boolean;
1978
+ actions: Record<string, CatalogKindAction>;
1979
+ }
1980
+ interface CatalogConnector {
1981
+ id: string;
1982
+ name: string;
1983
+ engine: string;
1984
+ description?: string;
1985
+ url: string;
1986
+ }
1987
+ interface CatalogTag {
1988
+ id: string;
1989
+ name: string;
1990
+ }
1991
+ /** permissions.read on a catalog list item. `allowedColumns`/`columnMasks` are detail-only. */
1992
+ interface CatalogPermissionsReadList {
1993
+ allowed: boolean;
1994
+ denyReason?: string;
1995
+ rowFilter?: string;
1996
+ mask?: string;
1997
+ inputSchema?: unknown;
1998
+ resultSchema?: unknown;
1999
+ }
2000
+ /** permissions.read on a catalog detail (table) — adds the SQL-authoring reference fields. */
2001
+ interface CatalogPermissionsReadDetail extends CatalogPermissionsReadList {
2002
+ /** Columns the caller may SELECT. Present on table detail only — the 1st reference for SQL authoring. */
2003
+ allowedColumns?: string[];
2004
+ /** Per-column mask algorithm (redact/null/hash/partial/last4). */
2005
+ columnMasks?: Record<string, string>;
2006
+ }
2007
+ interface CatalogResourceView {
2008
+ id: string;
2009
+ connector: string;
2010
+ connectorId: string;
2011
+ path: string;
2012
+ url: string;
2013
+ kind?: string;
2014
+ type: string;
2015
+ name: string;
2016
+ attributes: Record<string, unknown>;
2017
+ tags: CatalogTag[];
2018
+ permissions: {
2019
+ read: CatalogPermissionsReadList;
2020
+ };
2021
+ }
2022
+ interface CatalogAncestor {
2023
+ id: string;
2024
+ name: string;
2025
+ type: string;
2026
+ path: string;
2027
+ }
2028
+ interface CatalogResourceDetail {
2029
+ id: string;
2030
+ connector: string;
2031
+ connectorId: string;
2032
+ path: string;
2033
+ url: string;
2034
+ kind?: string;
2035
+ type: string;
2036
+ name: string;
2037
+ attributes: Record<string, unknown>;
2038
+ tags: CatalogTag[];
2039
+ ancestors: CatalogAncestor[];
2040
+ children: CatalogResourceView[];
2041
+ permissions: {
2042
+ read: CatalogPermissionsReadDetail;
2043
+ };
2044
+ }
2045
+ interface CatalogResourceFilter {
2046
+ search?: string;
2047
+ kind?: string;
2048
+ connector?: string;
2049
+ connectorId?: string;
2050
+ limit?: number;
2051
+ }
2052
+ interface InvokeInput {
2053
+ sql: string;
2054
+ params?: unknown[];
2055
+ rowLimit?: number;
2056
+ }
2057
+ /** invoke(...) result. Mirrors GatewayQueryResult + the resolved `action`. Rows are zipped to objects. */
2058
+ interface InvokeResult<Row = Record<string, unknown>> {
2059
+ allowed: boolean;
2060
+ action: string;
2061
+ denyReason?: string;
2062
+ columns: GatewayQueryColumn[];
2063
+ rows: Row[];
2064
+ rowCount: number;
2065
+ matchedPolicies?: string[];
2066
+ }
1965
2067
  declare class GatewayClient {
1966
2068
  private readonly http;
1967
2069
  constructor(http: HttpClient);
1968
2070
  scoped(tenantSlug: string): TenantGatewayClient;
1969
2071
  }
1970
2072
  declare class TenantGatewayClient {
2073
+ /** @adminOnly Global engine catalog. Governance read — requires tenant_admin (v0.1, SPEC 307). */
1971
2074
  readonly engines: GatewayEnginesClient;
2075
+ /** @adminOnly Connector governance (list/create/update/...). Member callers get ForbiddenError (v0.1). Members use `catalog.listConnectors()`. */
1972
2076
  readonly connectors: GatewayConnectorsClient;
2077
+ /** @adminOnly Raw resource governance. Member callers get ForbiddenError (v0.1). Members use `catalog.listResources()`. */
1973
2078
  readonly resources: GatewayResourcesClient;
2079
+ /** Run a parameterized read query. Member OK. See also `catalog.invoke()`. */
1974
2080
  readonly query: GatewayQueryClient;
2081
+ /** Member-facing catalog: discover connectors/resources you can read + invoke. */
2082
+ readonly catalog: GatewayCatalogClient;
1975
2083
  constructor(http: HttpClient, tenantSlug: string);
1976
2084
  }
1977
2085
  declare class GatewayEnginesClient {
@@ -2000,8 +2108,78 @@ declare class GatewayQueryClient {
2000
2108
  private readonly http;
2001
2109
  private readonly base;
2002
2110
  constructor(http: HttpClient, base: string);
2111
+ /**
2112
+ * Run a parameterized read query against a connector resource.
2113
+ *
2114
+ * Policy deny is a normal HTTP 200 response, NOT a throw: branch on `result.allowed`.
2115
+ * When denied, `matchedPolicies` is empty/absent and `denyReason` is generic
2116
+ * ("policy deny") or a `safesql:`-prefixed SQL-format message — use `isPolicyDeny()` /
2117
+ * `isSqlFormatError()` to tell them apart.
2118
+ *
2119
+ * @throws InternalServerError v0.1 — referencing a column outside the catalog's
2120
+ * `allowedColumns` lets the SQL reach the external DB, which answers column-not-found;
2121
+ * the backend surfaces that as 500. Do NOT auto-retry — guide the user to the
2122
+ * resource detail's `allowedColumns` (see `getAccessibleColumns`).
2123
+ * @throws PoolStaleError 401 after a credential refresh retry.
2124
+ */
2003
2125
  run<Row extends Record<string, unknown> = Record<string, unknown>>(input: GatewayQueryInput, opts?: RequestOptions): Promise<GatewayQueryResult<Row>>;
2004
2126
  }
2127
+ /**
2128
+ * Member-facing gateway catalog: connectors/resources the caller can read, plus `invoke`.
2129
+ * Distinct from the `@adminOnly` governance clients (`connectors`/`resources`/`engines`).
2130
+ */
2131
+ declare class GatewayCatalogClient {
2132
+ private readonly http;
2133
+ private readonly base;
2134
+ constructor(http: HttpClient, tenantBase: string);
2135
+ /** ResourceKind capability catalog (global, tenant-independent). Member OK. */
2136
+ listKinds(opts?: RequestOptions): Promise<CatalogKind[]>;
2137
+ /** Connectors the caller has read access to (1+ readable resource). Member OK. */
2138
+ listConnectors(opts?: RequestOptions): Promise<CatalogConnector[]>;
2139
+ /** Search resources the caller can read (across connectors). Member OK. */
2140
+ listResources(filter?: CatalogResourceFilter, opts?: RequestOptions): Promise<CatalogResourceView[]>;
2141
+ /**
2142
+ * Single resource detail (with `allowedColumns` for SQL authoring). Member OK.
2143
+ *
2144
+ * @throws NotFoundError when the caller has no read access to `path` — denied and
2145
+ * non-existent are intentionally indistinguishable (strict zero-trust, v0.1).
2146
+ * Use `hasAccess()` for a boolean check that does not throw.
2147
+ */
2148
+ getResource(connector: string, path: string, opts?: RequestOptions): Promise<CatalogResourceDetail>;
2149
+ /**
2150
+ * Invoke an action on a resource (v1: `read`). Member OK.
2151
+ *
2152
+ * Policy deny is a normal HTTP 200 (`allowed: false`), NOT a throw — branch on the result.
2153
+ * @throws InternalServerError referencing a column outside `allowedColumns` (no auto-retry).
2154
+ */
2155
+ invoke<Row extends Record<string, unknown> = Record<string, unknown>>(connector: string, path: string, input: InvokeInput, opts?: RequestOptions): Promise<InvokeResult<Row>>;
2156
+ /** True if the caller can read `path` (getResource without throwing on denial). Member OK. */
2157
+ hasAccess(connector: string, path: string, opts?: RequestOptions): Promise<boolean>;
2158
+ /**
2159
+ * Catalog list + each resource's detail (with `allowedColumns`) in one call. Member OK.
2160
+ * Issues one detail request per resource (N+1) — avoid over large catalogs / in tight loops.
2161
+ */
2162
+ listResourcesWithDetail(filter?: CatalogResourceFilter, opts?: RequestOptions): Promise<CatalogResourceDetail[]>;
2163
+ }
2164
+ /** True when the response is allowed (typed narrowing convenience). */
2165
+ declare function isAllowed(r: GatewayQueryResult | InvokeResult): boolean;
2166
+ /**
2167
+ * True when a deny is an SQL-format rejection the caller can fix by editing the SQL.
2168
+ *
2169
+ * The live backend wraps these as `"SQL 형식 오류: safesql: only SELECT or WITH allowed
2170
+ * (got \"delete\")"` — a Korean prefix plus the inner `safesql:` marker. Matches either so
2171
+ * it survives wording shifts in the wrapper. String matching is brittle by construction;
2172
+ * branch on this for UX hints only, not control flow that must be exact.
2173
+ */
2174
+ declare function isSqlFormatError(r: GatewayQueryResult | InvokeResult): boolean;
2175
+ /** True when a deny is a policy denial (not an SQL-format error). Editing SQL will not help. */
2176
+ declare function isPolicyDeny(r: GatewayQueryResult | InvokeResult): boolean;
2177
+ /** Columns the caller may SELECT from a resource detail (empty if none/denied). */
2178
+ declare function getAccessibleColumns(detail: CatalogResourceDetail): string[];
2179
+ /** Mask algorithm applied to a column (redact/null/hash/partial/last4), or null if unmasked. */
2180
+ declare function getMaskHint(detail: CatalogResourceDetail, columnName: string): string | null;
2181
+ /** Last path segment for a SQL `FROM` clause ("axhub-qa-mysql/employees" → "employees"). */
2182
+ declare function tableFromPath(path: string): string;
2005
2183
 
2006
2184
  interface IssuePersonalAccessTokenInput {
2007
2185
  name: string;
@@ -2402,4 +2580,4 @@ interface VerifyWebhookResult {
2402
2580
  declare function signWebhook(rawBody: Buffer | Uint8Array | string, secret: string, timestamp?: string): string;
2403
2581
  declare function verifyWebhook(input: VerifyWebhookInput): VerifyWebhookResult;
2404
2582
 
2405
- export { AbortError, AccessDeniedError, type AddColumnInput, type AddCommentInput, type AddGrantInput, AlreadyAccessedError, AlreadyActiveError, AlreadyDeletedError, AlreadyInactiveError, AlreadyMemberError, AlreadyRevokedError, AlreadySettledError, type AnonymizeInput, type AppAccess, type AppCategory, type AppID, type AppId, type AppResponse, AppScopedClient, AppScopedDataClient, type AppSlug, type AppTable, type AppTemplate, AppUnavailableError, AppsClient, AuditClient, type AuditEvent, type AuditEventID, type AuthProvider, type AuthRing, AuthorizationPendingError, AuthzClient, type AuthzGrant, type AuthzSubject, type AuthzTag, AxHubClient, type AxHubClientOptions, AxHubError, type AxHubErrorInit, BadRequestError, type Branded, type BuildLogEvent, type BulkInviteResult, type ColumnType, type Comment, ConfigurationError, ConflictError, type ConnectGitInput, type ConnectorID, type CreateAppInput, type CreateCategoryInput, type CreateDeploymentInput, type CreateOAuthClientInput, type CreateTableInput, type CreateTenantInput, type CursorDirection, DEFAULT_BASE_URL, type DataBulkResult, DataClient, type DataCountOptions, type DataGetOptions, type DataListOptions, type DataOrderBy, DataTableClient, type DataTableSchema, type DecideInput, type DecideResult, DecodeError, type DeploymentID, type DeploymentId, type DeploymentResponse, type DeploymentStatus, DeploymentsClient, type DeviceAuthorizationResponse, DeviceFlowDeniedError, DeviceFlowTimeoutError, type DiscoverAppsOptions, type DiscoverOptions, type DispatchContext, DomainTakenError, DuplicateError, type EmailDomain, type EmitAuditEventInput, EmptyError, type EnvVar, ExpiredTokenError, type FetchLike, type FieldError, ForbiddenError, GatewayClient, type GatewayConnector, type GatewayEngine, type GatewayQueryColumn, type GatewayQueryInput, type GatewayQueryResult, type GatewayResource, type GitConnection, type GitConnectionSetup, type GitConnectionStatus, type GithubInstallStart, type GrantID, type GrantPrincipalType, type GrantScope, IdentityClient, IdentityDeviceCodeClient, IdentityMeClient, IdentityOAuthClient, IdentityOIDCClient, IdentityPATClient, type IdentityProvider, IdentityProviderClient, IdentitySystemOAuthClientsClient, type InferRow, type InstallStartInput, type IntegrityCheckResult, InternalServerError, IntrospectFailedError, InvalidCursorError, InvalidGrantError, InvalidPathError, InvalidStateTransitionError, InvalidValueError, InvitationExpiredError, type InviteTenantMemberInput, type IssuePersonalAccessTokenInput, type IssuePersonalAccessTokenResult, type KeysetCursor, LastAdminError, LegacyCursorError, type LikeResult, type LikeStatus, type ListAllItem, type ListAllOptions, type ListOptions, type Logger, type MeResponse, type MockClientOptions, type MockFixtures, MockInProductionError, type MockRow, type MockSchemas, MockStore, NetworkError, NoAuth, NotAdminError, NotAllowedError, NotDeletedError, NotFoundError, NotMemberError, type OAuthClient, type OAuthClientWithSecret, OAuthError, type OAuthErrorInit, type OAuthTokenResponse, type OrderByField, type PATID, type PATSummary, type PaginatedList, type ParsedFrame, type PatId, PendingExistsError, PermanentlyDeletedError, PermissionDeniedError, type PodEventEvent, type PodLogEvent, PoolStaleError, PreconditionFailedError, type PublicationRequest, type PublicationRequestStatus, PublicationRequestsClient, type QueryExpr, type RateLimitStrategy, RateLimitedError, type RequestId, RequiredError, type ResourceID, type RetryInfo, type SSEStream, ScanLimitExceededError, SchemaCache, type SchemaCacheOptions, SchemaNameTakenError, type SchemaShapeFromRow, type SelectColumns, type SettlePublicationInput, type SignIconUploadInput, type SignIconUploadResult, SlowDownError, SlugTakenError, StaticTokenAuth, StreamConsumedError, type StreamItem, type SubjectID, type SubmitPublicationInput, type SystemOAuthClient, type TableColumn, type TableConstraint, type TableGrant, type TableID, type TableIndex, TableNotFoundError, type TableSchema, type TagID, type Tenant, TenantGatewayClient, type TenantID, type TenantId, type TenantInvitation, type TenantMember, TenantScopedAppsClient, TenantScopedClient, type TenantSlug, TenantSlugRequiredError, TenantsClient, TimeoutError, TokenExpiredError, TokenInvalidError, TokenMissingError, type TokenType, UnauthenticatedError, UnavailableError, type UnlikeResult, type UnpublishInput, type UpdateAppInput, type UpdateGitConnectionInput, type UpdateTenantInput, type UserID, type UserId, ValidationError, type VerifyWebhookInput, type VerifyWebhookResult, WebhookVerificationError, type WebhookVerifyReason, and, asAppId, asAppSlug, asDeploymentId, asPatId, asRequestId, asTenantId, asTenantSlug, asUserId, assertMockModeAllowed, createMockStore, cursorFromRow, decodeCursor, defineSchema, dispatch, encodeCursor, escapeLike, formatErrorMessage, id, isOAuthPath, not, or, orderByFingerprint, parseRetryAfter, raw, schemaCacheKey, signWebhook, verifyWebhook, where };
2583
+ export { AbortError, AccessDeniedError, type AddColumnInput, type AddCommentInput, type AddGrantInput, AlreadyAccessedError, AlreadyActiveError, AlreadyDeletedError, AlreadyInactiveError, AlreadyMemberError, AlreadyRevokedError, AlreadySettledError, type AnonymizeInput, type AppAccess, type AppCategory, type AppID, type AppId, type AppResponse, AppScopedClient, AppScopedDataClient, type AppSlug, type AppTable, type AppTemplate, AppUnavailableError, AppsClient, AuditClient, type AuditEvent, type AuditEventID, type AuthProvider, type AuthRing, AuthorizationPendingError, AuthzClient, type AuthzGrant, type AuthzSubject, type AuthzTag, AxHubClient, type AxHubClientOptions, AxHubError, type AxHubErrorInit, BadRequestError, type Branded, type BuildLogEvent, type BulkInviteResult, type CatalogAncestor, type CatalogConnector, type CatalogKind, type CatalogKindAction, type CatalogPermissionsReadDetail, type CatalogPermissionsReadList, type CatalogResourceDetail, type CatalogResourceFilter, type CatalogResourceView, type CatalogTag, type ColumnType, type Comment, ConfigurationError, ConflictError, type ConnectGitInput, type ConnectorID, type CreateAppInput, type CreateCategoryInput, type CreateDeploymentInput, type CreateOAuthClientInput, type CreateTableInput, type CreateTenantInput, type CursorDirection, DEFAULT_BASE_URL, type DataBulkResult, DataClient, type DataCountOptions, type DataGetOptions, type DataListOptions, type DataOrderBy, DataTableClient, type DataTableSchema, type DecideInput, type DecideResult, DecodeError, type DeploymentID, type DeploymentId, type DeploymentResponse, type DeploymentStatus, DeploymentsClient, type DeviceAuthorizationResponse, DeviceFlowDeniedError, DeviceFlowTimeoutError, type DiscoverAppsOptions, type DiscoverOptions, type DispatchContext, DomainTakenError, DuplicateError, type EmailDomain, type EmitAuditEventInput, EmptyError, type EnvVar, ExpiredTokenError, type FetchLike, type FieldError, ForbiddenError, GatewayCatalogClient, GatewayClient, type GatewayConnector, type GatewayEngine, type GatewayQueryColumn, type GatewayQueryInput, type GatewayQueryResult, type GatewayResource, type GitConnection, type GitConnectionSetup, type GitConnectionStatus, type GithubInstallStart, type GrantID, type GrantPrincipalType, type GrantScope, IdentityClient, IdentityDeviceCodeClient, IdentityMeClient, IdentityOAuthClient, IdentityOIDCClient, IdentityPATClient, type IdentityProvider, IdentityProviderClient, IdentitySystemOAuthClientsClient, type InferRow, type InstallStartInput, type IntegrityCheckResult, InternalServerError, IntrospectFailedError, InvalidCursorError, InvalidGrantError, InvalidPathError, InvalidStateTransitionError, InvalidValueError, InvitationExpiredError, type InviteTenantMemberInput, type InvokeInput, type InvokeResult, type IssuePersonalAccessTokenInput, type IssuePersonalAccessTokenResult, type KeysetCursor, LastAdminError, LegacyCursorError, type LikeResult, type LikeStatus, type ListAllItem, type ListAllOptions, type ListOptions, type Logger, type MeResponse, type MockClientOptions, type MockFixtures, MockInProductionError, type MockRow, type MockSchemas, MockStore, NetworkError, NoAuth, NotAdminError, NotAllowedError, NotDeletedError, NotFoundError, NotMemberError, type OAuthClient, type OAuthClientWithSecret, OAuthError, type OAuthErrorInit, type OAuthTokenResponse, type OrderByField, type PATID, type PATSummary, type PaginatedList, type ParsedFrame, type PatId, PendingExistsError, PermanentlyDeletedError, PermissionDeniedError, type PodEventEvent, type PodLogEvent, PoolStaleError, PreconditionFailedError, type PublicationRequest, type PublicationRequestStatus, PublicationRequestsClient, type QueryExpr, type RateLimitStrategy, RateLimitedError, type RequestId, RequiredError, type ResourceID, type RetryInfo, type SSEStream, ScanLimitExceededError, SchemaCache, type SchemaCacheOptions, SchemaNameTakenError, type SchemaShapeFromRow, type SelectColumns, type SettlePublicationInput, type SignIconUploadInput, type SignIconUploadResult, SlowDownError, SlugTakenError, StaticTokenAuth, StreamConsumedError, type StreamItem, type SubjectID, type SubmitPublicationInput, type SystemOAuthClient, type TableColumn, type TableConstraint, type TableGrant, type TableID, type TableIndex, TableNotFoundError, type TableSchema, type TagID, type Tenant, TenantGatewayClient, type TenantID, type TenantId, type TenantInvitation, type TenantMember, TenantScopedAppsClient, TenantScopedClient, type TenantSlug, TenantSlugRequiredError, TenantsClient, TimeoutError, TokenExpiredError, TokenInvalidError, TokenMissingError, type TokenType, UnauthenticatedError, UnavailableError, type UnlikeResult, type UnpublishInput, type UpdateAppInput, type UpdateGitConnectionInput, type UpdateTenantInput, type UserID, type UserId, ValidationError, type VerifyWebhookInput, type VerifyWebhookResult, WebhookVerificationError, type WebhookVerifyReason, and, asAppId, asAppSlug, asDeploymentId, asPatId, asRequestId, asTenantId, asTenantSlug, asUserId, assertMockModeAllowed, createMockStore, cursorFromRow, decodeCursor, defineSchema, dispatch, encodeCursor, escapeLike, formatErrorMessage, getAccessibleColumns, getMaskHint, id, isAllowed, isOAuthPath, isPolicyDeny, isSqlFormatError, not, or, orderByFingerprint, parseRetryAfter, raw, schemaCacheKey, signWebhook, tableFromPath, verifyWebhook, where };
package/dist/index.d.ts CHANGED
@@ -493,8 +493,11 @@ declare class AuthzClient {
493
493
  scoped(tenantSlug: string): TenantAuthzClient;
494
494
  }
495
495
  declare class TenantAuthzClient {
496
+ /** @adminOnly Tag governance. `list()` requires tenant_admin (v0.1, SPEC 307) — member callers get ForbiddenError (no auto-retry; permission, not transient). Members browse the data catalog via `gateway.catalog`. */
496
497
  readonly tags: Crud<AuthzTag>;
498
+ /** @adminOnly Subject governance. `list()` requires tenant_admin (v0.1) — member callers get ForbiddenError. */
497
499
  readonly subjects: Crud<AuthzSubject>;
500
+ /** @adminOnly Grant governance. `list()` requires tenant_admin (v0.1) — member callers get ForbiddenError. */
498
501
  readonly grants: Crud<AuthzGrant>;
499
502
  readonly evaluator: AuthzEvaluatorClient;
500
503
  constructor(http: HttpClient, tenantSlug: string);
@@ -1962,16 +1965,121 @@ interface GatewayQueryResult<Row = Record<string, unknown>> {
1962
1965
  rowCount: number;
1963
1966
  matchedPolicies?: string[];
1964
1967
  }
1968
+ interface CatalogKindAction {
1969
+ allowedEffects: string[];
1970
+ inputSchema?: unknown;
1971
+ resultSchema?: unknown;
1972
+ }
1973
+ interface CatalogKind {
1974
+ kind: string;
1975
+ engine: string;
1976
+ displayName: string;
1977
+ invokable: boolean;
1978
+ actions: Record<string, CatalogKindAction>;
1979
+ }
1980
+ interface CatalogConnector {
1981
+ id: string;
1982
+ name: string;
1983
+ engine: string;
1984
+ description?: string;
1985
+ url: string;
1986
+ }
1987
+ interface CatalogTag {
1988
+ id: string;
1989
+ name: string;
1990
+ }
1991
+ /** permissions.read on a catalog list item. `allowedColumns`/`columnMasks` are detail-only. */
1992
+ interface CatalogPermissionsReadList {
1993
+ allowed: boolean;
1994
+ denyReason?: string;
1995
+ rowFilter?: string;
1996
+ mask?: string;
1997
+ inputSchema?: unknown;
1998
+ resultSchema?: unknown;
1999
+ }
2000
+ /** permissions.read on a catalog detail (table) — adds the SQL-authoring reference fields. */
2001
+ interface CatalogPermissionsReadDetail extends CatalogPermissionsReadList {
2002
+ /** Columns the caller may SELECT. Present on table detail only — the 1st reference for SQL authoring. */
2003
+ allowedColumns?: string[];
2004
+ /** Per-column mask algorithm (redact/null/hash/partial/last4). */
2005
+ columnMasks?: Record<string, string>;
2006
+ }
2007
+ interface CatalogResourceView {
2008
+ id: string;
2009
+ connector: string;
2010
+ connectorId: string;
2011
+ path: string;
2012
+ url: string;
2013
+ kind?: string;
2014
+ type: string;
2015
+ name: string;
2016
+ attributes: Record<string, unknown>;
2017
+ tags: CatalogTag[];
2018
+ permissions: {
2019
+ read: CatalogPermissionsReadList;
2020
+ };
2021
+ }
2022
+ interface CatalogAncestor {
2023
+ id: string;
2024
+ name: string;
2025
+ type: string;
2026
+ path: string;
2027
+ }
2028
+ interface CatalogResourceDetail {
2029
+ id: string;
2030
+ connector: string;
2031
+ connectorId: string;
2032
+ path: string;
2033
+ url: string;
2034
+ kind?: string;
2035
+ type: string;
2036
+ name: string;
2037
+ attributes: Record<string, unknown>;
2038
+ tags: CatalogTag[];
2039
+ ancestors: CatalogAncestor[];
2040
+ children: CatalogResourceView[];
2041
+ permissions: {
2042
+ read: CatalogPermissionsReadDetail;
2043
+ };
2044
+ }
2045
+ interface CatalogResourceFilter {
2046
+ search?: string;
2047
+ kind?: string;
2048
+ connector?: string;
2049
+ connectorId?: string;
2050
+ limit?: number;
2051
+ }
2052
+ interface InvokeInput {
2053
+ sql: string;
2054
+ params?: unknown[];
2055
+ rowLimit?: number;
2056
+ }
2057
+ /** invoke(...) result. Mirrors GatewayQueryResult + the resolved `action`. Rows are zipped to objects. */
2058
+ interface InvokeResult<Row = Record<string, unknown>> {
2059
+ allowed: boolean;
2060
+ action: string;
2061
+ denyReason?: string;
2062
+ columns: GatewayQueryColumn[];
2063
+ rows: Row[];
2064
+ rowCount: number;
2065
+ matchedPolicies?: string[];
2066
+ }
1965
2067
  declare class GatewayClient {
1966
2068
  private readonly http;
1967
2069
  constructor(http: HttpClient);
1968
2070
  scoped(tenantSlug: string): TenantGatewayClient;
1969
2071
  }
1970
2072
  declare class TenantGatewayClient {
2073
+ /** @adminOnly Global engine catalog. Governance read — requires tenant_admin (v0.1, SPEC 307). */
1971
2074
  readonly engines: GatewayEnginesClient;
2075
+ /** @adminOnly Connector governance (list/create/update/...). Member callers get ForbiddenError (v0.1). Members use `catalog.listConnectors()`. */
1972
2076
  readonly connectors: GatewayConnectorsClient;
2077
+ /** @adminOnly Raw resource governance. Member callers get ForbiddenError (v0.1). Members use `catalog.listResources()`. */
1973
2078
  readonly resources: GatewayResourcesClient;
2079
+ /** Run a parameterized read query. Member OK. See also `catalog.invoke()`. */
1974
2080
  readonly query: GatewayQueryClient;
2081
+ /** Member-facing catalog: discover connectors/resources you can read + invoke. */
2082
+ readonly catalog: GatewayCatalogClient;
1975
2083
  constructor(http: HttpClient, tenantSlug: string);
1976
2084
  }
1977
2085
  declare class GatewayEnginesClient {
@@ -2000,8 +2108,78 @@ declare class GatewayQueryClient {
2000
2108
  private readonly http;
2001
2109
  private readonly base;
2002
2110
  constructor(http: HttpClient, base: string);
2111
+ /**
2112
+ * Run a parameterized read query against a connector resource.
2113
+ *
2114
+ * Policy deny is a normal HTTP 200 response, NOT a throw: branch on `result.allowed`.
2115
+ * When denied, `matchedPolicies` is empty/absent and `denyReason` is generic
2116
+ * ("policy deny") or a `safesql:`-prefixed SQL-format message — use `isPolicyDeny()` /
2117
+ * `isSqlFormatError()` to tell them apart.
2118
+ *
2119
+ * @throws InternalServerError v0.1 — referencing a column outside the catalog's
2120
+ * `allowedColumns` lets the SQL reach the external DB, which answers column-not-found;
2121
+ * the backend surfaces that as 500. Do NOT auto-retry — guide the user to the
2122
+ * resource detail's `allowedColumns` (see `getAccessibleColumns`).
2123
+ * @throws PoolStaleError 401 after a credential refresh retry.
2124
+ */
2003
2125
  run<Row extends Record<string, unknown> = Record<string, unknown>>(input: GatewayQueryInput, opts?: RequestOptions): Promise<GatewayQueryResult<Row>>;
2004
2126
  }
2127
+ /**
2128
+ * Member-facing gateway catalog: connectors/resources the caller can read, plus `invoke`.
2129
+ * Distinct from the `@adminOnly` governance clients (`connectors`/`resources`/`engines`).
2130
+ */
2131
+ declare class GatewayCatalogClient {
2132
+ private readonly http;
2133
+ private readonly base;
2134
+ constructor(http: HttpClient, tenantBase: string);
2135
+ /** ResourceKind capability catalog (global, tenant-independent). Member OK. */
2136
+ listKinds(opts?: RequestOptions): Promise<CatalogKind[]>;
2137
+ /** Connectors the caller has read access to (1+ readable resource). Member OK. */
2138
+ listConnectors(opts?: RequestOptions): Promise<CatalogConnector[]>;
2139
+ /** Search resources the caller can read (across connectors). Member OK. */
2140
+ listResources(filter?: CatalogResourceFilter, opts?: RequestOptions): Promise<CatalogResourceView[]>;
2141
+ /**
2142
+ * Single resource detail (with `allowedColumns` for SQL authoring). Member OK.
2143
+ *
2144
+ * @throws NotFoundError when the caller has no read access to `path` — denied and
2145
+ * non-existent are intentionally indistinguishable (strict zero-trust, v0.1).
2146
+ * Use `hasAccess()` for a boolean check that does not throw.
2147
+ */
2148
+ getResource(connector: string, path: string, opts?: RequestOptions): Promise<CatalogResourceDetail>;
2149
+ /**
2150
+ * Invoke an action on a resource (v1: `read`). Member OK.
2151
+ *
2152
+ * Policy deny is a normal HTTP 200 (`allowed: false`), NOT a throw — branch on the result.
2153
+ * @throws InternalServerError referencing a column outside `allowedColumns` (no auto-retry).
2154
+ */
2155
+ invoke<Row extends Record<string, unknown> = Record<string, unknown>>(connector: string, path: string, input: InvokeInput, opts?: RequestOptions): Promise<InvokeResult<Row>>;
2156
+ /** True if the caller can read `path` (getResource without throwing on denial). Member OK. */
2157
+ hasAccess(connector: string, path: string, opts?: RequestOptions): Promise<boolean>;
2158
+ /**
2159
+ * Catalog list + each resource's detail (with `allowedColumns`) in one call. Member OK.
2160
+ * Issues one detail request per resource (N+1) — avoid over large catalogs / in tight loops.
2161
+ */
2162
+ listResourcesWithDetail(filter?: CatalogResourceFilter, opts?: RequestOptions): Promise<CatalogResourceDetail[]>;
2163
+ }
2164
+ /** True when the response is allowed (typed narrowing convenience). */
2165
+ declare function isAllowed(r: GatewayQueryResult | InvokeResult): boolean;
2166
+ /**
2167
+ * True when a deny is an SQL-format rejection the caller can fix by editing the SQL.
2168
+ *
2169
+ * The live backend wraps these as `"SQL 형식 오류: safesql: only SELECT or WITH allowed
2170
+ * (got \"delete\")"` — a Korean prefix plus the inner `safesql:` marker. Matches either so
2171
+ * it survives wording shifts in the wrapper. String matching is brittle by construction;
2172
+ * branch on this for UX hints only, not control flow that must be exact.
2173
+ */
2174
+ declare function isSqlFormatError(r: GatewayQueryResult | InvokeResult): boolean;
2175
+ /** True when a deny is a policy denial (not an SQL-format error). Editing SQL will not help. */
2176
+ declare function isPolicyDeny(r: GatewayQueryResult | InvokeResult): boolean;
2177
+ /** Columns the caller may SELECT from a resource detail (empty if none/denied). */
2178
+ declare function getAccessibleColumns(detail: CatalogResourceDetail): string[];
2179
+ /** Mask algorithm applied to a column (redact/null/hash/partial/last4), or null if unmasked. */
2180
+ declare function getMaskHint(detail: CatalogResourceDetail, columnName: string): string | null;
2181
+ /** Last path segment for a SQL `FROM` clause ("axhub-qa-mysql/employees" → "employees"). */
2182
+ declare function tableFromPath(path: string): string;
2005
2183
 
2006
2184
  interface IssuePersonalAccessTokenInput {
2007
2185
  name: string;
@@ -2402,4 +2580,4 @@ interface VerifyWebhookResult {
2402
2580
  declare function signWebhook(rawBody: Buffer | Uint8Array | string, secret: string, timestamp?: string): string;
2403
2581
  declare function verifyWebhook(input: VerifyWebhookInput): VerifyWebhookResult;
2404
2582
 
2405
- export { AbortError, AccessDeniedError, type AddColumnInput, type AddCommentInput, type AddGrantInput, AlreadyAccessedError, AlreadyActiveError, AlreadyDeletedError, AlreadyInactiveError, AlreadyMemberError, AlreadyRevokedError, AlreadySettledError, type AnonymizeInput, type AppAccess, type AppCategory, type AppID, type AppId, type AppResponse, AppScopedClient, AppScopedDataClient, type AppSlug, type AppTable, type AppTemplate, AppUnavailableError, AppsClient, AuditClient, type AuditEvent, type AuditEventID, type AuthProvider, type AuthRing, AuthorizationPendingError, AuthzClient, type AuthzGrant, type AuthzSubject, type AuthzTag, AxHubClient, type AxHubClientOptions, AxHubError, type AxHubErrorInit, BadRequestError, type Branded, type BuildLogEvent, type BulkInviteResult, type ColumnType, type Comment, ConfigurationError, ConflictError, type ConnectGitInput, type ConnectorID, type CreateAppInput, type CreateCategoryInput, type CreateDeploymentInput, type CreateOAuthClientInput, type CreateTableInput, type CreateTenantInput, type CursorDirection, DEFAULT_BASE_URL, type DataBulkResult, DataClient, type DataCountOptions, type DataGetOptions, type DataListOptions, type DataOrderBy, DataTableClient, type DataTableSchema, type DecideInput, type DecideResult, DecodeError, type DeploymentID, type DeploymentId, type DeploymentResponse, type DeploymentStatus, DeploymentsClient, type DeviceAuthorizationResponse, DeviceFlowDeniedError, DeviceFlowTimeoutError, type DiscoverAppsOptions, type DiscoverOptions, type DispatchContext, DomainTakenError, DuplicateError, type EmailDomain, type EmitAuditEventInput, EmptyError, type EnvVar, ExpiredTokenError, type FetchLike, type FieldError, ForbiddenError, GatewayClient, type GatewayConnector, type GatewayEngine, type GatewayQueryColumn, type GatewayQueryInput, type GatewayQueryResult, type GatewayResource, type GitConnection, type GitConnectionSetup, type GitConnectionStatus, type GithubInstallStart, type GrantID, type GrantPrincipalType, type GrantScope, IdentityClient, IdentityDeviceCodeClient, IdentityMeClient, IdentityOAuthClient, IdentityOIDCClient, IdentityPATClient, type IdentityProvider, IdentityProviderClient, IdentitySystemOAuthClientsClient, type InferRow, type InstallStartInput, type IntegrityCheckResult, InternalServerError, IntrospectFailedError, InvalidCursorError, InvalidGrantError, InvalidPathError, InvalidStateTransitionError, InvalidValueError, InvitationExpiredError, type InviteTenantMemberInput, type IssuePersonalAccessTokenInput, type IssuePersonalAccessTokenResult, type KeysetCursor, LastAdminError, LegacyCursorError, type LikeResult, type LikeStatus, type ListAllItem, type ListAllOptions, type ListOptions, type Logger, type MeResponse, type MockClientOptions, type MockFixtures, MockInProductionError, type MockRow, type MockSchemas, MockStore, NetworkError, NoAuth, NotAdminError, NotAllowedError, NotDeletedError, NotFoundError, NotMemberError, type OAuthClient, type OAuthClientWithSecret, OAuthError, type OAuthErrorInit, type OAuthTokenResponse, type OrderByField, type PATID, type PATSummary, type PaginatedList, type ParsedFrame, type PatId, PendingExistsError, PermanentlyDeletedError, PermissionDeniedError, type PodEventEvent, type PodLogEvent, PoolStaleError, PreconditionFailedError, type PublicationRequest, type PublicationRequestStatus, PublicationRequestsClient, type QueryExpr, type RateLimitStrategy, RateLimitedError, type RequestId, RequiredError, type ResourceID, type RetryInfo, type SSEStream, ScanLimitExceededError, SchemaCache, type SchemaCacheOptions, SchemaNameTakenError, type SchemaShapeFromRow, type SelectColumns, type SettlePublicationInput, type SignIconUploadInput, type SignIconUploadResult, SlowDownError, SlugTakenError, StaticTokenAuth, StreamConsumedError, type StreamItem, type SubjectID, type SubmitPublicationInput, type SystemOAuthClient, type TableColumn, type TableConstraint, type TableGrant, type TableID, type TableIndex, TableNotFoundError, type TableSchema, type TagID, type Tenant, TenantGatewayClient, type TenantID, type TenantId, type TenantInvitation, type TenantMember, TenantScopedAppsClient, TenantScopedClient, type TenantSlug, TenantSlugRequiredError, TenantsClient, TimeoutError, TokenExpiredError, TokenInvalidError, TokenMissingError, type TokenType, UnauthenticatedError, UnavailableError, type UnlikeResult, type UnpublishInput, type UpdateAppInput, type UpdateGitConnectionInput, type UpdateTenantInput, type UserID, type UserId, ValidationError, type VerifyWebhookInput, type VerifyWebhookResult, WebhookVerificationError, type WebhookVerifyReason, and, asAppId, asAppSlug, asDeploymentId, asPatId, asRequestId, asTenantId, asTenantSlug, asUserId, assertMockModeAllowed, createMockStore, cursorFromRow, decodeCursor, defineSchema, dispatch, encodeCursor, escapeLike, formatErrorMessage, id, isOAuthPath, not, or, orderByFingerprint, parseRetryAfter, raw, schemaCacheKey, signWebhook, verifyWebhook, where };
2583
+ export { AbortError, AccessDeniedError, type AddColumnInput, type AddCommentInput, type AddGrantInput, AlreadyAccessedError, AlreadyActiveError, AlreadyDeletedError, AlreadyInactiveError, AlreadyMemberError, AlreadyRevokedError, AlreadySettledError, type AnonymizeInput, type AppAccess, type AppCategory, type AppID, type AppId, type AppResponse, AppScopedClient, AppScopedDataClient, type AppSlug, type AppTable, type AppTemplate, AppUnavailableError, AppsClient, AuditClient, type AuditEvent, type AuditEventID, type AuthProvider, type AuthRing, AuthorizationPendingError, AuthzClient, type AuthzGrant, type AuthzSubject, type AuthzTag, AxHubClient, type AxHubClientOptions, AxHubError, type AxHubErrorInit, BadRequestError, type Branded, type BuildLogEvent, type BulkInviteResult, type CatalogAncestor, type CatalogConnector, type CatalogKind, type CatalogKindAction, type CatalogPermissionsReadDetail, type CatalogPermissionsReadList, type CatalogResourceDetail, type CatalogResourceFilter, type CatalogResourceView, type CatalogTag, type ColumnType, type Comment, ConfigurationError, ConflictError, type ConnectGitInput, type ConnectorID, type CreateAppInput, type CreateCategoryInput, type CreateDeploymentInput, type CreateOAuthClientInput, type CreateTableInput, type CreateTenantInput, type CursorDirection, DEFAULT_BASE_URL, type DataBulkResult, DataClient, type DataCountOptions, type DataGetOptions, type DataListOptions, type DataOrderBy, DataTableClient, type DataTableSchema, type DecideInput, type DecideResult, DecodeError, type DeploymentID, type DeploymentId, type DeploymentResponse, type DeploymentStatus, DeploymentsClient, type DeviceAuthorizationResponse, DeviceFlowDeniedError, DeviceFlowTimeoutError, type DiscoverAppsOptions, type DiscoverOptions, type DispatchContext, DomainTakenError, DuplicateError, type EmailDomain, type EmitAuditEventInput, EmptyError, type EnvVar, ExpiredTokenError, type FetchLike, type FieldError, ForbiddenError, GatewayCatalogClient, GatewayClient, type GatewayConnector, type GatewayEngine, type GatewayQueryColumn, type GatewayQueryInput, type GatewayQueryResult, type GatewayResource, type GitConnection, type GitConnectionSetup, type GitConnectionStatus, type GithubInstallStart, type GrantID, type GrantPrincipalType, type GrantScope, IdentityClient, IdentityDeviceCodeClient, IdentityMeClient, IdentityOAuthClient, IdentityOIDCClient, IdentityPATClient, type IdentityProvider, IdentityProviderClient, IdentitySystemOAuthClientsClient, type InferRow, type InstallStartInput, type IntegrityCheckResult, InternalServerError, IntrospectFailedError, InvalidCursorError, InvalidGrantError, InvalidPathError, InvalidStateTransitionError, InvalidValueError, InvitationExpiredError, type InviteTenantMemberInput, type InvokeInput, type InvokeResult, type IssuePersonalAccessTokenInput, type IssuePersonalAccessTokenResult, type KeysetCursor, LastAdminError, LegacyCursorError, type LikeResult, type LikeStatus, type ListAllItem, type ListAllOptions, type ListOptions, type Logger, type MeResponse, type MockClientOptions, type MockFixtures, MockInProductionError, type MockRow, type MockSchemas, MockStore, NetworkError, NoAuth, NotAdminError, NotAllowedError, NotDeletedError, NotFoundError, NotMemberError, type OAuthClient, type OAuthClientWithSecret, OAuthError, type OAuthErrorInit, type OAuthTokenResponse, type OrderByField, type PATID, type PATSummary, type PaginatedList, type ParsedFrame, type PatId, PendingExistsError, PermanentlyDeletedError, PermissionDeniedError, type PodEventEvent, type PodLogEvent, PoolStaleError, PreconditionFailedError, type PublicationRequest, type PublicationRequestStatus, PublicationRequestsClient, type QueryExpr, type RateLimitStrategy, RateLimitedError, type RequestId, RequiredError, type ResourceID, type RetryInfo, type SSEStream, ScanLimitExceededError, SchemaCache, type SchemaCacheOptions, SchemaNameTakenError, type SchemaShapeFromRow, type SelectColumns, type SettlePublicationInput, type SignIconUploadInput, type SignIconUploadResult, SlowDownError, SlugTakenError, StaticTokenAuth, StreamConsumedError, type StreamItem, type SubjectID, type SubmitPublicationInput, type SystemOAuthClient, type TableColumn, type TableConstraint, type TableGrant, type TableID, type TableIndex, TableNotFoundError, type TableSchema, type TagID, type Tenant, TenantGatewayClient, type TenantID, type TenantId, type TenantInvitation, type TenantMember, TenantScopedAppsClient, TenantScopedClient, type TenantSlug, TenantSlugRequiredError, TenantsClient, TimeoutError, TokenExpiredError, TokenInvalidError, TokenMissingError, type TokenType, UnauthenticatedError, UnavailableError, type UnlikeResult, type UnpublishInput, type UpdateAppInput, type UpdateGitConnectionInput, type UpdateTenantInput, type UserID, type UserId, ValidationError, type VerifyWebhookInput, type VerifyWebhookResult, WebhookVerificationError, type WebhookVerifyReason, and, asAppId, asAppSlug, asDeploymentId, asPatId, asRequestId, asTenantId, asTenantSlug, asUserId, assertMockModeAllowed, createMockStore, cursorFromRow, decodeCursor, defineSchema, dispatch, encodeCursor, escapeLike, formatErrorMessage, getAccessibleColumns, getMaskHint, id, isAllowed, isOAuthPath, isPolicyDeny, isSqlFormatError, not, or, orderByFingerprint, parseRetryAfter, raw, schemaCacheKey, signWebhook, tableFromPath, verifyWebhook, where };