@aouda/client 0.0.2 → 0.0.3

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
@@ -1,5 +1,5 @@
1
- import { T as Transport, B as BulkLoadOptions, a as BulkLoadJobHandle, R as ReplicationStatusResponse, b as TopologyResponse, C as CoverageResponse, H as HealthStatus, c as ReadinessResponse, D as DetailedHealthResponse, N as NodeInfoResponse, d as TriggerBackupRequest, e as TriggerBackupResponse, L as ListBackupsResponse, f as RestoreBackupResponse, g as BackupSchedule, J as JoinClusterRequest, h as JoinClusterResponse, i as LeaveClusterResponse, P as PromoteClusterResponse, F as FailoverClusterResponse, j as DrainClusterResponse, k as ClusterConfigResponse, l as ClusterConfigPatchRequest, S as SchemaLike, m as DefaultSchema, A as AoudaClient } from './client-otKeBYQG.cjs';
2
- export { n as AOUDA_DATA_TYPES, o as AddColumnRequest, p as AdminApi, q as AdminBackupConfig, r as AdminBackupPatch, s as AdminConfigPatchRequest, t as AdminConfigResponse, u as AdminConfigSchemaResponse, v as AdminLoggingConfig, w as AdminLoggingPatch, x as AdminMemoryConfig, y as AdminMemoryPatch, z as AoudaClientOptions, E as AoudaDataType, G as AppAuthOptions, I as AuthClient, K as AuthResult, M as AuthUserInfo, O as AuthorizationMode, Q as BackupAdminApi, U as BackupMetrics, V as BackupSummary, W as BatchMutationResult, X as BatchOperationInput, Y as BloomFilterMetrics, Z as BranchInfo, _ as BranchesApi, $ as BulkLoadForceAbortRequest, a0 as BulkLoadForceAbortResponse, a1 as BulkLoadListResponse, a2 as BulkLoadProgress, a3 as BulkLoadReplicaProgress, a4 as BulkLoadReplicaProgressDto, a5 as BulkLoadStatusResponse, a6 as CircuitBreakerPolicy, a7 as ClusterAdminApi, a8 as ClusterMemberEntry, a9 as ClusterThisNodeEntry, aa as ColumnSchema, ab as ColumnSummaryForErd, ac as ColumnarResponse, ad as ComponentHealthEntry, ae as ComputedColumnDef, af as ConfigAdminApi, ag as CreateBranchRequest, ah as CreateColumnRequest, ai as CreateDatabaseOptions, aj as CreatePartitionGrantRequest, ak as CreateRlsResolverRequest, al as CreateTableRequest, am as DatabaseCoverageEntry, an as DatabaseInfo, ao as DatabaseMemoryMetrics, ap as DatabaseMemoryUsage, aq as DatabaseMetricsDto, ar as DatabaseOptionsInfo, as as DatabasesApi, at as DeleteOptions, au as DiffSummary, av as HealthAdminApi, aw as IndexInfo, ax as InsertResult, ay as IoMetrics, az as LatencyPercentiles, aA as MaterializedQueriesApi, aB as MaterializedQueryDefinition, aC as MaterializedQueryExecuteOptions, aD as MaterializedQueryExecuteResult, aE as MaterializedQueryMetrics, aF as MaterializedQueryRefreshOptions, aG as MaterializedQueryState, aH as MaterializedQueryStateNumber, aI as MaterializedQueryStatus, aJ as MaterializedQueryType, aK as MaterializedQueryTypeNumber, aL as MemberInfo, aM as MemoryMetrics, aN as MergeBranchOptions, aO as MergeConflict, aP as MergeExecutionResult, aQ as MergeResult, aR as MetricsAdminApi, aS as MetricsHistory, aT as MetricsHistoryOptions, aU as MetricsSnapshot, aV as MetricsSummary, aW as MutationResult, aX as NodeAdminApi, aY as NodeLogEntry, aZ as NodeLogLevel, a_ as NodeLogStreamOptions, a$ as NodeLogsQuery, b0 as NodeLogsResponse, b1 as OpenWriteStreamOptions, b2 as PageCacheMetrics, b3 as PartitionGrant, b4 as PartitionGrantsListResponse, b5 as PartitioningMetrics, b6 as PerDatabaseLagEntry, b7 as PerDatabaseMetrics, b8 as PerDatabaseStatusEntry, b9 as QueryMetrics, ba as QueryResult, bb as QueryStats, bc as ReferenceInfo, bd as RelationshipEndpoint, be as RelationshipInfo, bf as RenameColumnRequest, bg as RenameTableRequest, bh as ReplicationAdminApi, bi as ReplicationMetrics, bj as ResidencyConfig, bk as RetryPolicy, bl as RlsResolver, bm as RlsResolverRule, bn as RlsResolverRuleInput, bo as RlsResolversListResponse, bp as SchemaChange, bq as SchemaDiffResult, br as SchemaRelationshipsResponse, bs as SeedApplyResult, bt as SeedTableApplyResult, bu as ServerAdminApi, bv as ServerAuthOptions, bw as ServerMemoryResponse, bx as ServerMetricsResponse, by as ServiceInfo, bz as SimdMetrics, bA as SingleDatabaseMetricsResponse, bB as SortDirection, bC as StorageMetrics, bD as SubscribeOptions, bE as Subscription, bF as SubscriptionChangeEvent, bG as SubscriptionEvent, bH as SubscriptionInfo, bI as SubscriptionSnapshotEvent, bJ as TableCoverageEntry, bK as TableNameFromSchema, bL as TablePolicy, bM as TableQuery, bN as TableSchema, bO as TableSchemaResponse, bP as TableSummary, bQ as TableSummaryForErd, bR as TablesApi, bS as TimeSeriesMetrics, bT as TransactionMetrics, bU as TypeGenerationOptions, bV as UpdateOptions, bW as UpdateRlsResolverRequest, bX as UpdateTablePolicyRequest, bY as UserProfile, bZ as WhereGroupBuilder, b_ as WhereOperator, b$ as WriteStream, c0 as coerceColumnarValue, c1 as createAoudaClient } from './client-otKeBYQG.cjs';
1
+ import { T as Transport, B as BulkLoadOptions, a as BulkLoadJobHandle, R as ReplicationStatusResponse, b as TopologyResponse, C as CoverageResponse, H as HealthStatus, c as ReadinessResponse, D as DetailedHealthResponse, N as NodeInfoResponse, d as TriggerBackupRequest, e as TriggerBackupResponse, L as ListBackupsResponse, f as RestoreBackupResponse, g as BackupSchedule, J as JoinClusterRequest, h as JoinClusterResponse, i as LeaveClusterResponse, P as PromoteClusterResponse, F as FailoverClusterResponse, j as DrainClusterResponse, k as ClusterConfigResponse, l as ClusterConfigPatchRequest, S as SchemaLike, m as DefaultSchema, A as AoudaClient } from './client-Bvs1yerF.cjs';
2
+ export { n as AOUDA_DATA_TYPES, o as AddColumnRequest, p as AdminApi, q as AdminBackupConfig, r as AdminBackupPatch, s as AdminConfigPatchRequest, t as AdminConfigResponse, u as AdminConfigSchemaResponse, v as AdminLoggingConfig, w as AdminLoggingPatch, x as AdminMemoryConfig, y as AdminMemoryPatch, z as AoudaClientOptions, E as AoudaDataType, G as AppAuthOptions, I as AuthClient, K as AuthResult, M as AuthUserInfo, O as AuthorizationMode, Q as BackupAdminApi, U as BackupMetrics, V as BackupSummary, W as BatchMutationResult, X as BatchOperationInput, Y as BloomFilterMetrics, Z as BranchInfo, _ as BranchesApi, $ as BulkLoadForceAbortRequest, a0 as BulkLoadForceAbortResponse, a1 as BulkLoadListResponse, a2 as BulkLoadProgress, a3 as BulkLoadReplicaProgress, a4 as BulkLoadReplicaProgressDto, a5 as BulkLoadStatusResponse, a6 as CircuitBreakerPolicy, a7 as ClusterAdminApi, a8 as ClusterMemberEntry, a9 as ClusterThisNodeEntry, aa as ColumnSchema, ab as ColumnSummaryForErd, ac as ColumnarResponse, ad as ComponentHealthEntry, ae as ComputedColumnDef, af as ConfigAdminApi, ag as CreateBranchRequest, ah as CreateColumnRequest, ai as CreateDatabaseOptions, aj as CreatePartitionGrantRequest, ak as CreateRlsResolverRequest, al as CreateTableRequest, am as DatabaseCoverageEntry, an as DatabaseInfo, ao as DatabaseMemoryMetrics, ap as DatabaseMemoryUsage, aq as DatabaseMetricsDto, ar as DatabaseOptionsInfo, as as DatabasesApi, at as DeleteOptions, au as DiffSummary, av as HealthAdminApi, aw as IndexInfo, ax as InsertResult, ay as IoMetrics, az as LatencyPercentiles, aA as MaterializedQueriesApi, aB as MaterializedQueryDefinition, aC as MaterializedQueryExecuteOptions, aD as MaterializedQueryExecuteResult, aE as MaterializedQueryMetrics, aF as MaterializedQueryRefreshOptions, aG as MaterializedQueryState, aH as MaterializedQueryStateNumber, aI as MaterializedQueryStatus, aJ as MaterializedQueryType, aK as MaterializedQueryTypeNumber, aL as MemberInfo, aM as MemoryMetrics, aN as MergeBranchOptions, aO as MergeConflict, aP as MergeExecutionResult, aQ as MergeResult, aR as MetricsAdminApi, aS as MetricsHistory, aT as MetricsHistoryOptions, aU as MetricsSnapshot, aV as MetricsSummary, aW as MutationResult, aX as NodeAdminApi, aY as NodeLogEntry, aZ as NodeLogLevel, a_ as NodeLogStreamOptions, a$ as NodeLogsQuery, b0 as NodeLogsResponse, b1 as OpenWriteStreamOptions, b2 as PageCacheMetrics, b3 as PartitionGrant, b4 as PartitionGrantsListResponse, b5 as PartitioningMetrics, b6 as PerDatabaseLagEntry, b7 as PerDatabaseMetrics, b8 as PerDatabaseStatusEntry, b9 as QueryMetrics, ba as QueryResult, bb as QueryStats, bc as ReferenceInfo, bd as RelationshipEndpoint, be as RelationshipInfo, bf as RenameColumnRequest, bg as RenameTableRequest, bh as ReplicationAdminApi, bi as ReplicationMetrics, bj as ResidencyConfig, bk as RetryPolicy, bl as RlsResolver, bm as RlsResolverRule, bn as RlsResolverRuleInput, bo as RlsResolversListResponse, bp as SchemaChange, bq as SchemaDiffResult, br as SchemaRelationshipsResponse, bs as SeedApplyResult, bt as SeedTableApplyResult, bu as ServerAdminApi, bv as ServerAuthOptions, bw as ServerMemoryResponse, bx as ServerMetricsResponse, by as ServiceInfo, bz as SimdMetrics, bA as SingleDatabaseMetricsResponse, bB as SortDirection, bC as StorageMetrics, bD as SubscribeOptions, bE as Subscription, bF as SubscriptionChangeEvent, bG as SubscriptionEvent, bH as SubscriptionInfo, bI as SubscriptionSnapshotEvent, bJ as TableCoverageEntry, bK as TableNameFromSchema, bL as TablePolicy, bM as TableQuery, bN as TableSchema, bO as TableSchemaResponse, bP as TableSummary, bQ as TableSummaryForErd, bR as TablesApi, bS as TimeSeriesMetrics, bT as TransactionMetrics, bU as TypeGenerationOptions, bV as UpdateOptions, bW as UpdateRlsResolverRequest, bX as UpdateTablePolicyRequest, bY as UserProfile, bZ as WhereGroupBuilder, b_ as WhereOperator, b$ as WriteStream, c0 as coerceColumnarValue, c1 as createAoudaClient } from './client-Bvs1yerF.cjs';
3
3
 
4
4
  /**
5
5
  * @aouda/client error types.
@@ -85,6 +85,37 @@ declare class AoudaCircuitBreakerOpenError extends AoudaError {
85
85
  constructor(message: string, openedAt: Date, retryAfter: Date, cause?: Error | undefined);
86
86
  }
87
87
 
88
+ /**
89
+ * Chrome Local Network Access (LNA) support for browser clients.
90
+ *
91
+ * When a public HTTPS origin (e.g. studio.aouda.com) calls http://localhost,
92
+ * Chrome blocks the request unless fetch is annotated with targetAddressSpace.
93
+ * See: https://developer.chrome.com/blog/local-network-access
94
+ */
95
+ type TargetAddressSpace = "loopback" | "local";
96
+ /** RequestInit extended with the LNA hint (not yet in all TS lib.dom versions). */
97
+ interface LocalNetworkRequestInit extends RequestInit {
98
+ targetAddressSpace?: TargetAddressSpace | "public";
99
+ }
100
+ /**
101
+ * Returns the LNA address space for a URL, or undefined for ordinary public hosts.
102
+ */
103
+ declare function resolveTargetAddressSpace(url: string): TargetAddressSpace | undefined;
104
+ /**
105
+ * Merges targetAddressSpace into a RequestInit when the URL is loopback/local.
106
+ */
107
+ declare function applyLocalNetworkAccess(url: string, init?: RequestInit): LocalNetworkRequestInit;
108
+ /**
109
+ * fetch() wrapper that annotates loopback/local destinations for Chrome LNA.
110
+ */
111
+ declare function localNetworkFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
112
+ /**
113
+ * Patches global fetch once so direct fetch() calls to loopback/local URLs
114
+ * include targetAddressSpace (required for hosted Studio → localhost).
115
+ * No-op outside browser environments.
116
+ */
117
+ declare function installLocalNetworkFetch(): void;
118
+
88
119
  /**
89
120
  * Bulk-load coordinator for @aouda/client.
90
121
  * Implements the :begin / :append × N / :commit HTTP sequence.
@@ -191,6 +222,6 @@ declare function createAoudaClusterMcpToolSet<S extends SchemaLike = DefaultSche
191
222
  * await client.disconnect();
192
223
  * ```
193
224
  */
194
- declare const version = "0.0.2";
225
+ declare const version: string;
195
226
 
196
- export { AoudaApiError, AoudaAuthenticationError, AoudaCircuitBreakerOpenError, AoudaClient, type AoudaClusterMcpToolSet, AoudaClusterMcpTools, AoudaConflictError, AoudaConnectionError, AoudaError, AoudaNotFoundError, AoudaResponseError, AoudaServerError, AoudaTimeoutError, AoudaValidationError, type BackupRestoreToolInput, BackupSchedule, type BackupSetScheduleToolInput, type BackupTriggerToolInput, BulkLoadCoordinator, BulkLoadJobHandle, BulkLoadOptions, ClusterConfigPatchRequest, ClusterConfigResponse, type ClusterDrainToolInput, type ClusterHealthToolInput, type ClusterHealthToolOutput, type ClusterPatchConfigToolInput, type ClusterStatusToolInput, type ClusterStatusToolOutput, CoverageResponse, DefaultSchema, DetailedHealthResponse, DrainClusterResponse, FailoverClusterResponse, HealthStatus, JoinClusterRequest, JoinClusterResponse, LeaveClusterResponse, ListBackupsResponse, type McpToolDefinition, type McpToolSchema, NodeInfoResponse, PromoteClusterResponse, ReadinessResponse, ReplicationStatusResponse, RestoreBackupResponse, SchemaLike, TopologyResponse, TriggerBackupRequest, TriggerBackupResponse, createAoudaClusterMcpToolSet, version };
227
+ export { AoudaApiError, AoudaAuthenticationError, AoudaCircuitBreakerOpenError, AoudaClient, type AoudaClusterMcpToolSet, AoudaClusterMcpTools, AoudaConflictError, AoudaConnectionError, AoudaError, AoudaNotFoundError, AoudaResponseError, AoudaServerError, AoudaTimeoutError, AoudaValidationError, type BackupRestoreToolInput, BackupSchedule, type BackupSetScheduleToolInput, type BackupTriggerToolInput, BulkLoadCoordinator, BulkLoadJobHandle, BulkLoadOptions, ClusterConfigPatchRequest, ClusterConfigResponse, type ClusterDrainToolInput, type ClusterHealthToolInput, type ClusterHealthToolOutput, type ClusterPatchConfigToolInput, type ClusterStatusToolInput, type ClusterStatusToolOutput, CoverageResponse, DefaultSchema, DetailedHealthResponse, DrainClusterResponse, FailoverClusterResponse, HealthStatus, JoinClusterRequest, JoinClusterResponse, LeaveClusterResponse, ListBackupsResponse, type LocalNetworkRequestInit, type McpToolDefinition, type McpToolSchema, NodeInfoResponse, PromoteClusterResponse, ReadinessResponse, ReplicationStatusResponse, RestoreBackupResponse, SchemaLike, type TargetAddressSpace, TopologyResponse, TriggerBackupRequest, TriggerBackupResponse, applyLocalNetworkAccess, createAoudaClusterMcpToolSet, installLocalNetworkFetch, localNetworkFetch, resolveTargetAddressSpace, version };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as Transport, B as BulkLoadOptions, a as BulkLoadJobHandle, R as ReplicationStatusResponse, b as TopologyResponse, C as CoverageResponse, H as HealthStatus, c as ReadinessResponse, D as DetailedHealthResponse, N as NodeInfoResponse, d as TriggerBackupRequest, e as TriggerBackupResponse, L as ListBackupsResponse, f as RestoreBackupResponse, g as BackupSchedule, J as JoinClusterRequest, h as JoinClusterResponse, i as LeaveClusterResponse, P as PromoteClusterResponse, F as FailoverClusterResponse, j as DrainClusterResponse, k as ClusterConfigResponse, l as ClusterConfigPatchRequest, S as SchemaLike, m as DefaultSchema, A as AoudaClient } from './client-otKeBYQG.js';
2
- export { n as AOUDA_DATA_TYPES, o as AddColumnRequest, p as AdminApi, q as AdminBackupConfig, r as AdminBackupPatch, s as AdminConfigPatchRequest, t as AdminConfigResponse, u as AdminConfigSchemaResponse, v as AdminLoggingConfig, w as AdminLoggingPatch, x as AdminMemoryConfig, y as AdminMemoryPatch, z as AoudaClientOptions, E as AoudaDataType, G as AppAuthOptions, I as AuthClient, K as AuthResult, M as AuthUserInfo, O as AuthorizationMode, Q as BackupAdminApi, U as BackupMetrics, V as BackupSummary, W as BatchMutationResult, X as BatchOperationInput, Y as BloomFilterMetrics, Z as BranchInfo, _ as BranchesApi, $ as BulkLoadForceAbortRequest, a0 as BulkLoadForceAbortResponse, a1 as BulkLoadListResponse, a2 as BulkLoadProgress, a3 as BulkLoadReplicaProgress, a4 as BulkLoadReplicaProgressDto, a5 as BulkLoadStatusResponse, a6 as CircuitBreakerPolicy, a7 as ClusterAdminApi, a8 as ClusterMemberEntry, a9 as ClusterThisNodeEntry, aa as ColumnSchema, ab as ColumnSummaryForErd, ac as ColumnarResponse, ad as ComponentHealthEntry, ae as ComputedColumnDef, af as ConfigAdminApi, ag as CreateBranchRequest, ah as CreateColumnRequest, ai as CreateDatabaseOptions, aj as CreatePartitionGrantRequest, ak as CreateRlsResolverRequest, al as CreateTableRequest, am as DatabaseCoverageEntry, an as DatabaseInfo, ao as DatabaseMemoryMetrics, ap as DatabaseMemoryUsage, aq as DatabaseMetricsDto, ar as DatabaseOptionsInfo, as as DatabasesApi, at as DeleteOptions, au as DiffSummary, av as HealthAdminApi, aw as IndexInfo, ax as InsertResult, ay as IoMetrics, az as LatencyPercentiles, aA as MaterializedQueriesApi, aB as MaterializedQueryDefinition, aC as MaterializedQueryExecuteOptions, aD as MaterializedQueryExecuteResult, aE as MaterializedQueryMetrics, aF as MaterializedQueryRefreshOptions, aG as MaterializedQueryState, aH as MaterializedQueryStateNumber, aI as MaterializedQueryStatus, aJ as MaterializedQueryType, aK as MaterializedQueryTypeNumber, aL as MemberInfo, aM as MemoryMetrics, aN as MergeBranchOptions, aO as MergeConflict, aP as MergeExecutionResult, aQ as MergeResult, aR as MetricsAdminApi, aS as MetricsHistory, aT as MetricsHistoryOptions, aU as MetricsSnapshot, aV as MetricsSummary, aW as MutationResult, aX as NodeAdminApi, aY as NodeLogEntry, aZ as NodeLogLevel, a_ as NodeLogStreamOptions, a$ as NodeLogsQuery, b0 as NodeLogsResponse, b1 as OpenWriteStreamOptions, b2 as PageCacheMetrics, b3 as PartitionGrant, b4 as PartitionGrantsListResponse, b5 as PartitioningMetrics, b6 as PerDatabaseLagEntry, b7 as PerDatabaseMetrics, b8 as PerDatabaseStatusEntry, b9 as QueryMetrics, ba as QueryResult, bb as QueryStats, bc as ReferenceInfo, bd as RelationshipEndpoint, be as RelationshipInfo, bf as RenameColumnRequest, bg as RenameTableRequest, bh as ReplicationAdminApi, bi as ReplicationMetrics, bj as ResidencyConfig, bk as RetryPolicy, bl as RlsResolver, bm as RlsResolverRule, bn as RlsResolverRuleInput, bo as RlsResolversListResponse, bp as SchemaChange, bq as SchemaDiffResult, br as SchemaRelationshipsResponse, bs as SeedApplyResult, bt as SeedTableApplyResult, bu as ServerAdminApi, bv as ServerAuthOptions, bw as ServerMemoryResponse, bx as ServerMetricsResponse, by as ServiceInfo, bz as SimdMetrics, bA as SingleDatabaseMetricsResponse, bB as SortDirection, bC as StorageMetrics, bD as SubscribeOptions, bE as Subscription, bF as SubscriptionChangeEvent, bG as SubscriptionEvent, bH as SubscriptionInfo, bI as SubscriptionSnapshotEvent, bJ as TableCoverageEntry, bK as TableNameFromSchema, bL as TablePolicy, bM as TableQuery, bN as TableSchema, bO as TableSchemaResponse, bP as TableSummary, bQ as TableSummaryForErd, bR as TablesApi, bS as TimeSeriesMetrics, bT as TransactionMetrics, bU as TypeGenerationOptions, bV as UpdateOptions, bW as UpdateRlsResolverRequest, bX as UpdateTablePolicyRequest, bY as UserProfile, bZ as WhereGroupBuilder, b_ as WhereOperator, b$ as WriteStream, c0 as coerceColumnarValue, c1 as createAoudaClient } from './client-otKeBYQG.js';
1
+ import { T as Transport, B as BulkLoadOptions, a as BulkLoadJobHandle, R as ReplicationStatusResponse, b as TopologyResponse, C as CoverageResponse, H as HealthStatus, c as ReadinessResponse, D as DetailedHealthResponse, N as NodeInfoResponse, d as TriggerBackupRequest, e as TriggerBackupResponse, L as ListBackupsResponse, f as RestoreBackupResponse, g as BackupSchedule, J as JoinClusterRequest, h as JoinClusterResponse, i as LeaveClusterResponse, P as PromoteClusterResponse, F as FailoverClusterResponse, j as DrainClusterResponse, k as ClusterConfigResponse, l as ClusterConfigPatchRequest, S as SchemaLike, m as DefaultSchema, A as AoudaClient } from './client-Bvs1yerF.js';
2
+ export { n as AOUDA_DATA_TYPES, o as AddColumnRequest, p as AdminApi, q as AdminBackupConfig, r as AdminBackupPatch, s as AdminConfigPatchRequest, t as AdminConfigResponse, u as AdminConfigSchemaResponse, v as AdminLoggingConfig, w as AdminLoggingPatch, x as AdminMemoryConfig, y as AdminMemoryPatch, z as AoudaClientOptions, E as AoudaDataType, G as AppAuthOptions, I as AuthClient, K as AuthResult, M as AuthUserInfo, O as AuthorizationMode, Q as BackupAdminApi, U as BackupMetrics, V as BackupSummary, W as BatchMutationResult, X as BatchOperationInput, Y as BloomFilterMetrics, Z as BranchInfo, _ as BranchesApi, $ as BulkLoadForceAbortRequest, a0 as BulkLoadForceAbortResponse, a1 as BulkLoadListResponse, a2 as BulkLoadProgress, a3 as BulkLoadReplicaProgress, a4 as BulkLoadReplicaProgressDto, a5 as BulkLoadStatusResponse, a6 as CircuitBreakerPolicy, a7 as ClusterAdminApi, a8 as ClusterMemberEntry, a9 as ClusterThisNodeEntry, aa as ColumnSchema, ab as ColumnSummaryForErd, ac as ColumnarResponse, ad as ComponentHealthEntry, ae as ComputedColumnDef, af as ConfigAdminApi, ag as CreateBranchRequest, ah as CreateColumnRequest, ai as CreateDatabaseOptions, aj as CreatePartitionGrantRequest, ak as CreateRlsResolverRequest, al as CreateTableRequest, am as DatabaseCoverageEntry, an as DatabaseInfo, ao as DatabaseMemoryMetrics, ap as DatabaseMemoryUsage, aq as DatabaseMetricsDto, ar as DatabaseOptionsInfo, as as DatabasesApi, at as DeleteOptions, au as DiffSummary, av as HealthAdminApi, aw as IndexInfo, ax as InsertResult, ay as IoMetrics, az as LatencyPercentiles, aA as MaterializedQueriesApi, aB as MaterializedQueryDefinition, aC as MaterializedQueryExecuteOptions, aD as MaterializedQueryExecuteResult, aE as MaterializedQueryMetrics, aF as MaterializedQueryRefreshOptions, aG as MaterializedQueryState, aH as MaterializedQueryStateNumber, aI as MaterializedQueryStatus, aJ as MaterializedQueryType, aK as MaterializedQueryTypeNumber, aL as MemberInfo, aM as MemoryMetrics, aN as MergeBranchOptions, aO as MergeConflict, aP as MergeExecutionResult, aQ as MergeResult, aR as MetricsAdminApi, aS as MetricsHistory, aT as MetricsHistoryOptions, aU as MetricsSnapshot, aV as MetricsSummary, aW as MutationResult, aX as NodeAdminApi, aY as NodeLogEntry, aZ as NodeLogLevel, a_ as NodeLogStreamOptions, a$ as NodeLogsQuery, b0 as NodeLogsResponse, b1 as OpenWriteStreamOptions, b2 as PageCacheMetrics, b3 as PartitionGrant, b4 as PartitionGrantsListResponse, b5 as PartitioningMetrics, b6 as PerDatabaseLagEntry, b7 as PerDatabaseMetrics, b8 as PerDatabaseStatusEntry, b9 as QueryMetrics, ba as QueryResult, bb as QueryStats, bc as ReferenceInfo, bd as RelationshipEndpoint, be as RelationshipInfo, bf as RenameColumnRequest, bg as RenameTableRequest, bh as ReplicationAdminApi, bi as ReplicationMetrics, bj as ResidencyConfig, bk as RetryPolicy, bl as RlsResolver, bm as RlsResolverRule, bn as RlsResolverRuleInput, bo as RlsResolversListResponse, bp as SchemaChange, bq as SchemaDiffResult, br as SchemaRelationshipsResponse, bs as SeedApplyResult, bt as SeedTableApplyResult, bu as ServerAdminApi, bv as ServerAuthOptions, bw as ServerMemoryResponse, bx as ServerMetricsResponse, by as ServiceInfo, bz as SimdMetrics, bA as SingleDatabaseMetricsResponse, bB as SortDirection, bC as StorageMetrics, bD as SubscribeOptions, bE as Subscription, bF as SubscriptionChangeEvent, bG as SubscriptionEvent, bH as SubscriptionInfo, bI as SubscriptionSnapshotEvent, bJ as TableCoverageEntry, bK as TableNameFromSchema, bL as TablePolicy, bM as TableQuery, bN as TableSchema, bO as TableSchemaResponse, bP as TableSummary, bQ as TableSummaryForErd, bR as TablesApi, bS as TimeSeriesMetrics, bT as TransactionMetrics, bU as TypeGenerationOptions, bV as UpdateOptions, bW as UpdateRlsResolverRequest, bX as UpdateTablePolicyRequest, bY as UserProfile, bZ as WhereGroupBuilder, b_ as WhereOperator, b$ as WriteStream, c0 as coerceColumnarValue, c1 as createAoudaClient } from './client-Bvs1yerF.js';
3
3
 
4
4
  /**
5
5
  * @aouda/client error types.
@@ -85,6 +85,37 @@ declare class AoudaCircuitBreakerOpenError extends AoudaError {
85
85
  constructor(message: string, openedAt: Date, retryAfter: Date, cause?: Error | undefined);
86
86
  }
87
87
 
88
+ /**
89
+ * Chrome Local Network Access (LNA) support for browser clients.
90
+ *
91
+ * When a public HTTPS origin (e.g. studio.aouda.com) calls http://localhost,
92
+ * Chrome blocks the request unless fetch is annotated with targetAddressSpace.
93
+ * See: https://developer.chrome.com/blog/local-network-access
94
+ */
95
+ type TargetAddressSpace = "loopback" | "local";
96
+ /** RequestInit extended with the LNA hint (not yet in all TS lib.dom versions). */
97
+ interface LocalNetworkRequestInit extends RequestInit {
98
+ targetAddressSpace?: TargetAddressSpace | "public";
99
+ }
100
+ /**
101
+ * Returns the LNA address space for a URL, or undefined for ordinary public hosts.
102
+ */
103
+ declare function resolveTargetAddressSpace(url: string): TargetAddressSpace | undefined;
104
+ /**
105
+ * Merges targetAddressSpace into a RequestInit when the URL is loopback/local.
106
+ */
107
+ declare function applyLocalNetworkAccess(url: string, init?: RequestInit): LocalNetworkRequestInit;
108
+ /**
109
+ * fetch() wrapper that annotates loopback/local destinations for Chrome LNA.
110
+ */
111
+ declare function localNetworkFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
112
+ /**
113
+ * Patches global fetch once so direct fetch() calls to loopback/local URLs
114
+ * include targetAddressSpace (required for hosted Studio → localhost).
115
+ * No-op outside browser environments.
116
+ */
117
+ declare function installLocalNetworkFetch(): void;
118
+
88
119
  /**
89
120
  * Bulk-load coordinator for @aouda/client.
90
121
  * Implements the :begin / :append × N / :commit HTTP sequence.
@@ -191,6 +222,6 @@ declare function createAoudaClusterMcpToolSet<S extends SchemaLike = DefaultSche
191
222
  * await client.disconnect();
192
223
  * ```
193
224
  */
194
- declare const version = "0.0.2";
225
+ declare const version: string;
195
226
 
196
- export { AoudaApiError, AoudaAuthenticationError, AoudaCircuitBreakerOpenError, AoudaClient, type AoudaClusterMcpToolSet, AoudaClusterMcpTools, AoudaConflictError, AoudaConnectionError, AoudaError, AoudaNotFoundError, AoudaResponseError, AoudaServerError, AoudaTimeoutError, AoudaValidationError, type BackupRestoreToolInput, BackupSchedule, type BackupSetScheduleToolInput, type BackupTriggerToolInput, BulkLoadCoordinator, BulkLoadJobHandle, BulkLoadOptions, ClusterConfigPatchRequest, ClusterConfigResponse, type ClusterDrainToolInput, type ClusterHealthToolInput, type ClusterHealthToolOutput, type ClusterPatchConfigToolInput, type ClusterStatusToolInput, type ClusterStatusToolOutput, CoverageResponse, DefaultSchema, DetailedHealthResponse, DrainClusterResponse, FailoverClusterResponse, HealthStatus, JoinClusterRequest, JoinClusterResponse, LeaveClusterResponse, ListBackupsResponse, type McpToolDefinition, type McpToolSchema, NodeInfoResponse, PromoteClusterResponse, ReadinessResponse, ReplicationStatusResponse, RestoreBackupResponse, SchemaLike, TopologyResponse, TriggerBackupRequest, TriggerBackupResponse, createAoudaClusterMcpToolSet, version };
227
+ export { AoudaApiError, AoudaAuthenticationError, AoudaCircuitBreakerOpenError, AoudaClient, type AoudaClusterMcpToolSet, AoudaClusterMcpTools, AoudaConflictError, AoudaConnectionError, AoudaError, AoudaNotFoundError, AoudaResponseError, AoudaServerError, AoudaTimeoutError, AoudaValidationError, type BackupRestoreToolInput, BackupSchedule, type BackupSetScheduleToolInput, type BackupTriggerToolInput, BulkLoadCoordinator, BulkLoadJobHandle, BulkLoadOptions, ClusterConfigPatchRequest, ClusterConfigResponse, type ClusterDrainToolInput, type ClusterHealthToolInput, type ClusterHealthToolOutput, type ClusterPatchConfigToolInput, type ClusterStatusToolInput, type ClusterStatusToolOutput, CoverageResponse, DefaultSchema, DetailedHealthResponse, DrainClusterResponse, FailoverClusterResponse, HealthStatus, JoinClusterRequest, JoinClusterResponse, LeaveClusterResponse, ListBackupsResponse, type LocalNetworkRequestInit, type McpToolDefinition, type McpToolSchema, NodeInfoResponse, PromoteClusterResponse, ReadinessResponse, ReplicationStatusResponse, RestoreBackupResponse, SchemaLike, type TargetAddressSpace, TopologyResponse, TriggerBackupRequest, TriggerBackupResponse, applyLocalNetworkAccess, createAoudaClusterMcpToolSet, installLocalNetworkFetch, localNetworkFetch, resolveTargetAddressSpace, version };
package/dist/index.js CHANGED
@@ -1,3 +1,71 @@
1
+ // package.json
2
+ var package_default = {
3
+ name: "@aouda/client",
4
+ version: "0.0.3",
5
+ description: "Official TypeScript/JavaScript client library for Aouda",
6
+ type: "module",
7
+ main: "./dist/index.cjs",
8
+ module: "./dist/index.js",
9
+ types: "./dist/index.d.ts",
10
+ bin: "./dist/cli/index.js",
11
+ exports: {
12
+ ".": {
13
+ types: "./dist/index.d.ts",
14
+ import: "./dist/index.js",
15
+ require: "./dist/index.cjs"
16
+ }
17
+ },
18
+ license: "MIT",
19
+ repository: {
20
+ type: "git",
21
+ url: "https://github.com/aoudadb/aouda-client-ts.git"
22
+ },
23
+ publishConfig: {
24
+ access: "public"
25
+ },
26
+ files: [
27
+ "dist",
28
+ "README.md",
29
+ "LICENSE"
30
+ ],
31
+ scripts: {
32
+ changeset: "changeset",
33
+ "version-packages": "changeset version",
34
+ release: "changeset publish",
35
+ prepublishOnly: "npm run build",
36
+ build: "tsup",
37
+ dev: "tsup --watch",
38
+ test: "vitest run",
39
+ "test:watch": "vitest",
40
+ "test:coverage": "vitest run --coverage",
41
+ lint: "eslint src tests",
42
+ "lint:fix": "eslint src tests --fix",
43
+ format: 'prettier --write "src/**/*.ts" "tests/**/*.ts"',
44
+ typecheck: "tsc --noEmit && tsc -p tsconfig.typecheck.json --noEmit",
45
+ "generate-types": "node dist/cli/index.js generate --server http://localhost:5000 --output ./types/schema.ts"
46
+ },
47
+ engines: {
48
+ node: ">=20"
49
+ },
50
+ devDependencies: {
51
+ "@changesets/cli": "^2.29.8",
52
+ "@eslint/js": "^9.15.0",
53
+ "@types/node": "^25.2.1",
54
+ "@types/ws": "^8.18.1",
55
+ eslint: "^9.15.0",
56
+ "eslint-config-prettier": "^9.1.0",
57
+ prettier: "^3.3.3",
58
+ tsup: "^8.3.5",
59
+ typescript: "^5.6.3",
60
+ "typescript-eslint": "^8.15.0",
61
+ vitest: "^2.1.4"
62
+ },
63
+ dependencies: {
64
+ "@msgpack/msgpack": "^3.1.3",
65
+ ws: "^8.20.0"
66
+ }
67
+ };
68
+
1
69
  // src/types.ts
2
70
  var RetryPolicy;
3
71
  ((RetryPolicy2) => {
@@ -114,6 +182,70 @@ var AoudaCircuitBreakerOpenError = class extends AoudaError {
114
182
  }
115
183
  };
116
184
 
185
+ // src/local-network-fetch.ts
186
+ function resolveTargetAddressSpace(url) {
187
+ let parsed;
188
+ try {
189
+ parsed = new URL(url);
190
+ } catch {
191
+ return void 0;
192
+ }
193
+ const hostname = parsed.hostname.replace(/^\[|\]$/g, "").toLowerCase();
194
+ if (hostname === "localhost" || hostname === "::1") {
195
+ return "loopback";
196
+ }
197
+ const ipv4 = hostname.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
198
+ if (ipv4) {
199
+ const [first, second] = [Number(ipv4[1]), Number(ipv4[2])];
200
+ if (first === 127) return "loopback";
201
+ if (first === 10) return "local";
202
+ if (first === 172 && second >= 16 && second <= 31) return "local";
203
+ if (first === 192 && second === 168) return "local";
204
+ if (first === 169 && second === 254) return "local";
205
+ }
206
+ if (hostname.endsWith(".local")) {
207
+ return "local";
208
+ }
209
+ return void 0;
210
+ }
211
+ function applyLocalNetworkAccess(url, init) {
212
+ const space = resolveTargetAddressSpace(url);
213
+ if (!space) {
214
+ return init ?? {};
215
+ }
216
+ return { ...init, targetAddressSpace: space };
217
+ }
218
+ function resolveFetchUrl(input) {
219
+ if (typeof input === "string") {
220
+ return input;
221
+ }
222
+ if (input instanceof URL) {
223
+ return input.href;
224
+ }
225
+ return input.url;
226
+ }
227
+ function localNetworkFetch(input, init) {
228
+ const url = resolveFetchUrl(input);
229
+ const merged = applyLocalNetworkAccess(url, init);
230
+ return globalThis.fetch(input, merged);
231
+ }
232
+ var installed = false;
233
+ function installLocalNetworkFetch() {
234
+ if (installed || typeof globalThis.window === "undefined") {
235
+ return;
236
+ }
237
+ installed = true;
238
+ const nativeFetch = globalThis.fetch.bind(globalThis);
239
+ globalThis.fetch = (input, init) => {
240
+ const url = resolveFetchUrl(input);
241
+ const space = resolveTargetAddressSpace(url);
242
+ if (!space) {
243
+ return nativeFetch(input, init);
244
+ }
245
+ return nativeFetch(input, applyLocalNetworkAccess(url, init));
246
+ };
247
+ }
248
+
117
249
  // src/auth/auth-handler.ts
118
250
  var DEFAULT_REFRESH_THRESHOLD_MS = 12e4;
119
251
  var CONTENT_TYPE_JSON = "application/json";
@@ -304,7 +436,7 @@ var AuthHandler = class {
304
436
  headers["Authorization"] = `Bearer ${this._accessToken}`;
305
437
  }
306
438
  try {
307
- await globalThis.fetch(url, {
439
+ await localNetworkFetch(url, {
308
440
  method: "POST",
309
441
  headers,
310
442
  signal: AbortSignal.timeout(this._timeout)
@@ -337,7 +469,7 @@ var AuthHandler = class {
337
469
  if (token) {
338
470
  headers["Authorization"] = `Bearer ${token}`;
339
471
  }
340
- const response = await globalThis.fetch(url, {
472
+ const response = await localNetworkFetch(url, {
341
473
  method: "GET",
342
474
  headers,
343
475
  signal: AbortSignal.timeout(this._timeout)
@@ -364,7 +496,7 @@ var AuthHandler = class {
364
496
  if (token) {
365
497
  headers["Authorization"] = `Bearer ${token}`;
366
498
  }
367
- const response = await globalThis.fetch(url, {
499
+ const response = await localNetworkFetch(url, {
368
500
  method: "PUT",
369
501
  headers,
370
502
  body: JSON.stringify({ currentPassword, newPassword }),
@@ -404,7 +536,7 @@ var AuthHandler = class {
404
536
  if (this._accessToken) {
405
537
  headers["Authorization"] = `Bearer ${this._accessToken}`;
406
538
  }
407
- return globalThis.fetch(url, {
539
+ return localNetworkFetch(url, {
408
540
  method,
409
541
  headers,
410
542
  body: JSON.stringify(body),
@@ -757,7 +889,7 @@ var AuthClient = class {
757
889
  if (token) {
758
890
  headers["Authorization"] = `Bearer ${token}`;
759
891
  }
760
- const response = await globalThis.fetch(endpoint, {
892
+ const response = await localNetworkFetch(endpoint, {
761
893
  method,
762
894
  headers,
763
895
  body: body !== void 0 && method !== "GET" && method !== "DELETE" ? JSON.stringify(body) : void 0,
@@ -1080,7 +1212,7 @@ var HttpTransport = class {
1080
1212
  init.body = JSON.stringify(config.body);
1081
1213
  }
1082
1214
  try {
1083
- const response = await fetch(url, init);
1215
+ const response = await localNetworkFetch(url, init);
1084
1216
  if (!response.ok) {
1085
1217
  const text = await response.text();
1086
1218
  if (config.allowStatuses?.includes(response.status) && text) {
@@ -1194,7 +1326,7 @@ var HttpTransport = class {
1194
1326
  init.body = JSON.stringify(config.body);
1195
1327
  }
1196
1328
  try {
1197
- const response = await fetch(url, init);
1329
+ const response = await localNetworkFetch(url, init);
1198
1330
  if (response.ok || config.allowStatuses?.includes(response.status)) {
1199
1331
  return response;
1200
1332
  }
@@ -4596,7 +4728,7 @@ var LongPollTransport = class {
4596
4728
  this._authHandler = options.authHandler;
4597
4729
  this._onReconnected = options.onReconnected;
4598
4730
  this._waitMs = Math.max(1, options.waitMs ?? DEFAULT_WAIT_MS);
4599
- this._fetch = options.fetchImpl ?? fetch;
4731
+ this._fetch = options.fetchImpl ?? localNetworkFetch;
4600
4732
  }
4601
4733
  get lastVersion() {
4602
4734
  return this._lastVersion;
@@ -5489,7 +5621,7 @@ function createAoudaClusterMcpToolSet(client) {
5489
5621
  }
5490
5622
 
5491
5623
  // src/index.ts
5492
- var version = "0.0.2";
5624
+ var version = package_default.version;
5493
5625
  export {
5494
5626
  AOUDA_DATA_TYPES,
5495
5627
  AdminApi,
@@ -5526,9 +5658,13 @@ export {
5526
5658
  TableQuery,
5527
5659
  TablesApi,
5528
5660
  WhereGroupBuilder,
5661
+ applyLocalNetworkAccess,
5529
5662
  coerceColumnarValue,
5530
5663
  createAoudaClient,
5531
5664
  createAoudaClusterMcpToolSet,
5665
+ installLocalNetworkFetch,
5666
+ localNetworkFetch,
5667
+ resolveTargetAddressSpace,
5532
5668
  version
5533
5669
  };
5534
5670
  //# sourceMappingURL=index.js.map