The complete public API of @lakeql/fabric-client, generated from the package's TypeScript source.
The entry point is the FabricClient class. It executes T-SQL queries against a Microsoft Fabric SQL endpoint. resolveCredential and the FabricAuth type handle authentication. withRetry wraps calls with configurable retry. The remaining exports are the configuration types and the error classes.
TDS client for Microsoft Fabric SQL endpoints.
Constructor
| Name | Type |
|---|---|
| propsRequired | FabricClientProps |
Connection and authentication configuration. | |
| retryConfig? | RetryConfig |
Optional retry tuning applied to each query. {} | |
Properties
| Name | Type |
|---|---|
| hostRequired | string |
Fabric SQL endpoint hostname. | |
| portRequired | number |
Fabric SQL endpoint port. | |
| catalogRequired | string |
Default catalog (database) for queries. | |
Methods
Executes a SQL statement and returns all result rows as keyed records.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
TRow | — | Record<string, unknown> |
Parameters
| Name | Type |
|---|---|
| propsRequired | QueryProps |
Query text, optional signal, and optional bearer token. | |
Returns
Promise<TRow[]>All rows produced by the query. *
Releases the underlying TDS connection pool.
Returns
Promise<void>Executes an async function, retrying it on transient failures with exponential backoff.
Cancellations (FabricCancellationError and AbortError) are never retried. Non-transient errors are re-thrown immediately.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
T | — | — |
Parameters
| Name | Type |
|---|---|
| fnRequired | () => Promise<T> |
The operation to execute; invoked once per attempt. | |
| config? | RetryConfig |
Optional retry tuning; unset fields use the defaults. {} | |
Returns
Promise<T>The value resolved by fn on the first successful attempt. *
Configuration for automatic retry behavior.
Properties
| Name | Type |
|---|---|
| maxRetries? | number |
Maximum number of retry attempts (in addition to the initial call). 3 | |
| initialDelay? | number |
Initial delay between retries in milliseconds. 1000 | |
| maxDelay? | number |
Maximum delay between retries in milliseconds. 30000 | |
| backoffMultiplier? | number |
Multiplier applied to the delay after each attempt (exponential backoff). 2 | |
Default OAuth2 scope for Azure SQL / Microsoft Fabric SQL endpoints.
Definition
"https://database.windows.net/.default"Resolves a FabricAuth configuration into a TokenCredential.
Parameters
| Name | Type |
|---|---|
| authRequired | FabricAuth |
The authentication configuration from FabricClientProps. | |
Returns
TokenCredentialA token credential the client can use to authenticate the pool. *
A minimal token credential interface compatible with @azure/identity.
Only the TokenCredential.getToken method is required by the client.
Properties
| Name | Type |
|---|---|
| getTokenRequired | ( scope: string ) => Promise<{ token: string; expiresOnTimestamp: number } | null> |
Fetches an access token for the given scope. | |
Base error for Fabric client errors.
Constructor
| Name | Type |
|---|---|
| messageRequired | string |
Human-readable error message. | |
| statusCode? | number |
HTTP status code from the Fabric response. | |
Properties
| Name | Type |
|---|---|
| statusCode? | number |
HTTP status code if available. | |
Error when a query is cancelled via AbortSignal.
Constructor
| Name | Type |
|---|---|
| messageRequired | string |
Human-readable cancellation message. | |
Error during Fabric query execution (the server returned an error).
Constructor
| Name | Type |
|---|---|
| messageRequired | string |
Human-readable error message from Fabric. | |
| errorNumberRequired | number |
Numeric error number from the TDS response. | |
| stateRequired | number |
SQL state code. | |
Properties
| Name | Type |
|---|---|
| errorNumberRequired | number |
Fabric error number from the TDS response. | |
| stateRequired | number |
SQL state code. | |
Error when a query exceeds its timeout.
Constructor
| Name | Type |
|---|---|
| messageRequired | string |
Human-readable timeout error message. | |
Authentication credentials for a Fabric connection.
Definition
| {
/** OAuth2 client credentials flow. */
type: "oauth2"
/** Azure AD tenant ID. */
tenantId: string
/** Azure AD application (client) ID. */
clientId: string
/** Azure AD client secret. */
clientSecret: string
/** Optional scope override. */
scope?: string
}
| {
/** Static bearer token. */
type: "bearer"
/** Bearer token value. */
token: string
}Configuration for creating a FabricClient.
Properties
| Name | Type |
|---|---|
| hostRequired | string |
Fabric SQL endpoint hostname. | |
| portRequired | number |
Fabric SQL endpoint port. | |
| catalogRequired | string |
Default catalog (database) for queries. | |
| authRequired | FabricAuth |
Authentication credentials. | |
| source? | string |
Source identifier for diagnostics. | |
Properties for executing a SQL query.
Properties
| Name | Type |
|---|---|
| sqlRequired | string |
SQL statement to execute. | |
| signal? | AbortSignal |
Optional cancellation signal. | |
| bearerToken? | string |
Optional bearer token for OBO (on-behalf-of) flow. | |