@aouda/client 0.1.7 → 0.1.9
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/cli/index.cjs +133 -24
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +133 -24
- package/dist/cli/index.js.map +1 -1
- package/dist/{client-BbyXG5AL.d.cts → client-CxP9Vnc8.d.cts} +154 -8
- package/dist/{client-BbyXG5AL.d.ts → client-CxP9Vnc8.d.ts} +154 -8
- package/dist/index.cjs +135 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +134 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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-
|
|
2
|
-
export { n as AGGREGATE_FUNCTIONS, o as AOUDA_DATA_TYPES, p as AddColumnRequest, q as AdminApi, r as AdminBackupConfig, s as AdminBackupPatch, t as AdminConfigPatchRequest, u as AdminConfigResponse, v as AdminConfigSchemaResponse, w as AdminLoggingConfig, x as AdminLoggingPatch, y as AdminMemoryConfig, z as AdminMemoryPatch, E as AggregateFunctionName, G as
|
|
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-CxP9Vnc8.cjs';
|
|
2
|
+
export { n as AGGREGATE_FUNCTIONS, o as AOUDA_DATA_TYPES, p as AddColumnRequest, q as AdminApi, r as AdminBackupConfig, s as AdminBackupPatch, t as AdminConfigPatchRequest, u as AdminConfigResponse, v as AdminConfigSchemaResponse, w as AdminLoggingConfig, x as AdminLoggingPatch, y as AdminMemoryConfig, z as AdminMemoryPatch, E as AggregateFunctionName, G as AlterColumnRequest, I as AoudaClientOptions, K as AoudaDataType, M as AppAuthOptions, O as AuthClient, Q as AuthResult, U as AuthUserInfo, V as AuthorizationMode, W as BackupAdminApi, X as BackupMetrics, Y as BackupSummary, Z as BatchMutationResult, _ as BatchOperationInput, $ as BloomFilterMetrics, a0 as BranchInfo, a1 as BranchesApi, a2 as BulkLoadForceAbortRequest, a3 as BulkLoadForceAbortResponse, a4 as BulkLoadListResponse, a5 as BulkLoadProgress, a6 as BulkLoadReplicaProgress, a7 as BulkLoadReplicaProgressDto, a8 as BulkLoadStatusResponse, a9 as CircuitBreakerPolicy, aa as ClusterAdminApi, ab as ClusterMemberEntry, ac as ClusterThisNodeEntry, ad as ColumnSchema, ae as ColumnSummaryForErd, af as ColumnarResponse, ag as ComponentHealthEntry, ah as ComputedColumnDef, ai as ConfigAdminApi, aj as CreateBranchRequest, ak as CreateColumnRequest, al as CreateDatabaseOptions, am as CreatePartitionGrantRequest, an as CreateRlsResolverRequest, ao as CreateTableRequest, ap as DatabaseCoverageEntry, aq as DatabaseInfo, ar as DatabaseMemoryMetrics, as as DatabaseMemoryUsage, at as DatabaseMetricsDto, au as DatabaseOptionsInfo, av as DatabasesApi, aw as DeleteOptions, ax as DiffSummary, ay as FILTER_OPERATORS, az as FilterOperator, aA as HealthAdminApi, aB as IndexInfo, aC as InsertOptions, aD as InsertResult, aE as IoMetrics, aF as JobsApi, aG as LatencyPercentiles, aH as MaterializedQueriesApi, aI as MaterializedQueryDefinition, aJ as MaterializedQueryExecuteOptions, aK as MaterializedQueryExecuteResult, aL as MaterializedQueryMetrics, aM as MaterializedQueryRefreshOptions, aN as MaterializedQueryState, aO as MaterializedQueryStateNumber, aP as MaterializedQueryStatus, aQ as MaterializedQueryType, aR as MaterializedQueryTypeNumber, aS as MemberInfo, aT as MemoryMetrics, aU as MergeBranchOptions, aV as MergeConflict, aW as MergeExecutionResult, aX as MergeResult, aY as MetricsAdminApi, aZ as MetricsHistory, a_ as MetricsHistoryOptions, a$ as MetricsSnapshot, b0 as MetricsSummary, b1 as MutationResult, b2 as NodeAdminApi, b3 as NodeLogEntry, b4 as NodeLogLevel, b5 as NodeLogStreamOptions, b6 as NodeLogsQuery, b7 as NodeLogsResponse, b8 as OpenWriteStreamOptions, b9 as PageCacheMetrics, ba as PartitionFunction, bb as PartitionGrant, bc as PartitionGrantsListResponse, bd as PartitioningMetrics, be as PendingJobListResponse, bf as PendingJobResponse, bg as PerDatabaseLagEntry, bh as PerDatabaseMetrics, bi as PerDatabaseStatusEntry, bj as QueryMetrics, bk as QueryResult, bl as QueryStats, bm as ReferenceInfo, bn as RelationshipEndpoint, bo as RelationshipInfo, bp as RenameColumnRequest, bq as RenameTableRequest, br as ReorderColumnsRequest, bs as ReplicationAdminApi, bt as ReplicationMetrics, bu as ResidencyConfig, bv as RetryPolicy, bw as RlsResolver, bx as RlsResolverRule, by as RlsResolverRuleInput, bz as RlsResolversListResponse, bA as SchemaChange, bB as SchemaChangeType, bC as SchemaDiffResult, bD as SchemaRelationshipsResponse, bE as SeedApplyResult, bF as SeedTableApplyResult, bG as ServerAdminApi, bH as ServerAuthOptions, bI as ServerMemoryResponse, bJ as ServerMetricsResponse, bK as ServiceInfo, bL as SimdMetrics, bM as SingleDatabaseMetricsResponse, bN as SortDirection, bO as StorageMetrics, bP as SubscribeOptions, bQ as Subscription, bR as SubscriptionChangeEvent, bS as SubscriptionEvent, bT as SubscriptionInfo, bU as SubscriptionSnapshotEvent, bV as TIME_BUCKET_FUNCTIONS, bW as TableCoverageEntry, bX as TableNameFromSchema, bY as TablePolicy, bZ as TableQuery, b_ as TableSchema, b$ as TableSchemaResponse, c0 as TableSummary, c1 as TableSummaryForErd, c2 as TablesApi, c3 as TimeBucketFunction, c4 as TimeSeriesMetrics, c5 as TransactionMetrics, c6 as TypeGenerationOptions, c7 as UpdateOptions, c8 as UpdateRlsResolverRequest, c9 as UpdateTableOptionsRequest, ca as UpdateTablePolicyRequest, cb as UserProfile, cc as WalMetrics, cd as WhereGroupBuilder, ce as WhereOperator, cf as WriteStream, cg as coerceColumnarValue, ch as createAoudaClient } from './client-CxP9Vnc8.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @aouda/client error types.
|
|
@@ -42,7 +42,8 @@ declare class AoudaApiError extends AoudaError {
|
|
|
42
42
|
readonly statusCode: number;
|
|
43
43
|
readonly details?: string | undefined;
|
|
44
44
|
readonly requestId?: string | undefined;
|
|
45
|
-
|
|
45
|
+
readonly retryAfterSeconds?: number | undefined;
|
|
46
|
+
constructor(message: string, code: string, statusCode: number, details?: string | undefined, requestId?: string | undefined, retryAfterSeconds?: number | undefined);
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
48
49
|
* Thrown for TABLE_NOT_FOUND, COLUMN_NOT_FOUND (404).
|
|
@@ -66,7 +67,7 @@ declare class AoudaValidationError extends AoudaApiError {
|
|
|
66
67
|
* Thrown for INTERNAL_ERROR, SERVICE_UNAVAILABLE, etc. (5xx).
|
|
67
68
|
*/
|
|
68
69
|
declare class AoudaServerError extends AoudaApiError {
|
|
69
|
-
constructor(message: string, code: string, statusCode: number, details?: string, requestId?: string);
|
|
70
|
+
constructor(message: string, code: string, statusCode: number, details?: string, requestId?: string, retryAfterSeconds?: number);
|
|
70
71
|
}
|
|
71
72
|
/**
|
|
72
73
|
* Thrown for 401 authentication errors (AUTH_TOKEN_EXPIRED, AUTH_TOKEN_INVALID, etc.).
|
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-
|
|
2
|
-
export { n as AGGREGATE_FUNCTIONS, o as AOUDA_DATA_TYPES, p as AddColumnRequest, q as AdminApi, r as AdminBackupConfig, s as AdminBackupPatch, t as AdminConfigPatchRequest, u as AdminConfigResponse, v as AdminConfigSchemaResponse, w as AdminLoggingConfig, x as AdminLoggingPatch, y as AdminMemoryConfig, z as AdminMemoryPatch, E as AggregateFunctionName, G as
|
|
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-CxP9Vnc8.js';
|
|
2
|
+
export { n as AGGREGATE_FUNCTIONS, o as AOUDA_DATA_TYPES, p as AddColumnRequest, q as AdminApi, r as AdminBackupConfig, s as AdminBackupPatch, t as AdminConfigPatchRequest, u as AdminConfigResponse, v as AdminConfigSchemaResponse, w as AdminLoggingConfig, x as AdminLoggingPatch, y as AdminMemoryConfig, z as AdminMemoryPatch, E as AggregateFunctionName, G as AlterColumnRequest, I as AoudaClientOptions, K as AoudaDataType, M as AppAuthOptions, O as AuthClient, Q as AuthResult, U as AuthUserInfo, V as AuthorizationMode, W as BackupAdminApi, X as BackupMetrics, Y as BackupSummary, Z as BatchMutationResult, _ as BatchOperationInput, $ as BloomFilterMetrics, a0 as BranchInfo, a1 as BranchesApi, a2 as BulkLoadForceAbortRequest, a3 as BulkLoadForceAbortResponse, a4 as BulkLoadListResponse, a5 as BulkLoadProgress, a6 as BulkLoadReplicaProgress, a7 as BulkLoadReplicaProgressDto, a8 as BulkLoadStatusResponse, a9 as CircuitBreakerPolicy, aa as ClusterAdminApi, ab as ClusterMemberEntry, ac as ClusterThisNodeEntry, ad as ColumnSchema, ae as ColumnSummaryForErd, af as ColumnarResponse, ag as ComponentHealthEntry, ah as ComputedColumnDef, ai as ConfigAdminApi, aj as CreateBranchRequest, ak as CreateColumnRequest, al as CreateDatabaseOptions, am as CreatePartitionGrantRequest, an as CreateRlsResolverRequest, ao as CreateTableRequest, ap as DatabaseCoverageEntry, aq as DatabaseInfo, ar as DatabaseMemoryMetrics, as as DatabaseMemoryUsage, at as DatabaseMetricsDto, au as DatabaseOptionsInfo, av as DatabasesApi, aw as DeleteOptions, ax as DiffSummary, ay as FILTER_OPERATORS, az as FilterOperator, aA as HealthAdminApi, aB as IndexInfo, aC as InsertOptions, aD as InsertResult, aE as IoMetrics, aF as JobsApi, aG as LatencyPercentiles, aH as MaterializedQueriesApi, aI as MaterializedQueryDefinition, aJ as MaterializedQueryExecuteOptions, aK as MaterializedQueryExecuteResult, aL as MaterializedQueryMetrics, aM as MaterializedQueryRefreshOptions, aN as MaterializedQueryState, aO as MaterializedQueryStateNumber, aP as MaterializedQueryStatus, aQ as MaterializedQueryType, aR as MaterializedQueryTypeNumber, aS as MemberInfo, aT as MemoryMetrics, aU as MergeBranchOptions, aV as MergeConflict, aW as MergeExecutionResult, aX as MergeResult, aY as MetricsAdminApi, aZ as MetricsHistory, a_ as MetricsHistoryOptions, a$ as MetricsSnapshot, b0 as MetricsSummary, b1 as MutationResult, b2 as NodeAdminApi, b3 as NodeLogEntry, b4 as NodeLogLevel, b5 as NodeLogStreamOptions, b6 as NodeLogsQuery, b7 as NodeLogsResponse, b8 as OpenWriteStreamOptions, b9 as PageCacheMetrics, ba as PartitionFunction, bb as PartitionGrant, bc as PartitionGrantsListResponse, bd as PartitioningMetrics, be as PendingJobListResponse, bf as PendingJobResponse, bg as PerDatabaseLagEntry, bh as PerDatabaseMetrics, bi as PerDatabaseStatusEntry, bj as QueryMetrics, bk as QueryResult, bl as QueryStats, bm as ReferenceInfo, bn as RelationshipEndpoint, bo as RelationshipInfo, bp as RenameColumnRequest, bq as RenameTableRequest, br as ReorderColumnsRequest, bs as ReplicationAdminApi, bt as ReplicationMetrics, bu as ResidencyConfig, bv as RetryPolicy, bw as RlsResolver, bx as RlsResolverRule, by as RlsResolverRuleInput, bz as RlsResolversListResponse, bA as SchemaChange, bB as SchemaChangeType, bC as SchemaDiffResult, bD as SchemaRelationshipsResponse, bE as SeedApplyResult, bF as SeedTableApplyResult, bG as ServerAdminApi, bH as ServerAuthOptions, bI as ServerMemoryResponse, bJ as ServerMetricsResponse, bK as ServiceInfo, bL as SimdMetrics, bM as SingleDatabaseMetricsResponse, bN as SortDirection, bO as StorageMetrics, bP as SubscribeOptions, bQ as Subscription, bR as SubscriptionChangeEvent, bS as SubscriptionEvent, bT as SubscriptionInfo, bU as SubscriptionSnapshotEvent, bV as TIME_BUCKET_FUNCTIONS, bW as TableCoverageEntry, bX as TableNameFromSchema, bY as TablePolicy, bZ as TableQuery, b_ as TableSchema, b$ as TableSchemaResponse, c0 as TableSummary, c1 as TableSummaryForErd, c2 as TablesApi, c3 as TimeBucketFunction, c4 as TimeSeriesMetrics, c5 as TransactionMetrics, c6 as TypeGenerationOptions, c7 as UpdateOptions, c8 as UpdateRlsResolverRequest, c9 as UpdateTableOptionsRequest, ca as UpdateTablePolicyRequest, cb as UserProfile, cc as WalMetrics, cd as WhereGroupBuilder, ce as WhereOperator, cf as WriteStream, cg as coerceColumnarValue, ch as createAoudaClient } from './client-CxP9Vnc8.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @aouda/client error types.
|
|
@@ -42,7 +42,8 @@ declare class AoudaApiError extends AoudaError {
|
|
|
42
42
|
readonly statusCode: number;
|
|
43
43
|
readonly details?: string | undefined;
|
|
44
44
|
readonly requestId?: string | undefined;
|
|
45
|
-
|
|
45
|
+
readonly retryAfterSeconds?: number | undefined;
|
|
46
|
+
constructor(message: string, code: string, statusCode: number, details?: string | undefined, requestId?: string | undefined, retryAfterSeconds?: number | undefined);
|
|
46
47
|
}
|
|
47
48
|
/**
|
|
48
49
|
* Thrown for TABLE_NOT_FOUND, COLUMN_NOT_FOUND (404).
|
|
@@ -66,7 +67,7 @@ declare class AoudaValidationError extends AoudaApiError {
|
|
|
66
67
|
* Thrown for INTERNAL_ERROR, SERVICE_UNAVAILABLE, etc. (5xx).
|
|
67
68
|
*/
|
|
68
69
|
declare class AoudaServerError extends AoudaApiError {
|
|
69
|
-
constructor(message: string, code: string, statusCode: number, details?: string, requestId?: string);
|
|
70
|
+
constructor(message: string, code: string, statusCode: number, details?: string, requestId?: string, retryAfterSeconds?: number);
|
|
70
71
|
}
|
|
71
72
|
/**
|
|
72
73
|
* Thrown for 401 authentication errors (AUTH_TOKEN_EXPIRED, AUTH_TOKEN_INVALID, etc.).
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@aouda/client",
|
|
4
|
-
version: "0.1.
|
|
4
|
+
version: "0.1.9",
|
|
5
5
|
description: "Official TypeScript/JavaScript client library for Aouda",
|
|
6
6
|
type: "module",
|
|
7
7
|
main: "./dist/index.cjs",
|
|
@@ -133,12 +133,13 @@ var AoudaResponseError = class extends AoudaError {
|
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
var AoudaApiError = class extends AoudaError {
|
|
136
|
-
constructor(message, code, statusCode, details, requestId) {
|
|
136
|
+
constructor(message, code, statusCode, details, requestId, retryAfterSeconds) {
|
|
137
137
|
super(message);
|
|
138
138
|
this.code = code;
|
|
139
139
|
this.statusCode = statusCode;
|
|
140
140
|
this.details = details;
|
|
141
141
|
this.requestId = requestId;
|
|
142
|
+
this.retryAfterSeconds = retryAfterSeconds;
|
|
142
143
|
this.name = "AoudaApiError";
|
|
143
144
|
}
|
|
144
145
|
};
|
|
@@ -161,8 +162,8 @@ var AoudaValidationError = class extends AoudaApiError {
|
|
|
161
162
|
}
|
|
162
163
|
};
|
|
163
164
|
var AoudaServerError = class extends AoudaApiError {
|
|
164
|
-
constructor(message, code, statusCode, details, requestId) {
|
|
165
|
-
super(message, code, statusCode, details, requestId);
|
|
165
|
+
constructor(message, code, statusCode, details, requestId, retryAfterSeconds) {
|
|
166
|
+
super(message, code, statusCode, details, requestId, retryAfterSeconds);
|
|
166
167
|
this.name = "AoudaServerError";
|
|
167
168
|
}
|
|
168
169
|
};
|
|
@@ -1117,6 +1118,8 @@ var ERROR_CODE_MAP = {
|
|
|
1117
1118
|
SERVICE_UNAVAILABLE: AoudaServerError,
|
|
1118
1119
|
TIMEOUT: AoudaServerError,
|
|
1119
1120
|
OVERLOADED: AoudaServerError,
|
|
1121
|
+
MEMORY_BUDGET_EXCEEDED: AoudaServerError,
|
|
1122
|
+
WAL_CAPACITY_EXCEEDED: AoudaServerError,
|
|
1120
1123
|
AUTH_TOKEN_MISSING: AoudaAuthenticationError,
|
|
1121
1124
|
AUTH_TOKEN_EXPIRED: AoudaAuthenticationError,
|
|
1122
1125
|
AUTH_TOKEN_INVALID: AoudaAuthenticationError,
|
|
@@ -1144,13 +1147,22 @@ function createComposedAbortController(...signals) {
|
|
|
1144
1147
|
}
|
|
1145
1148
|
return controller;
|
|
1146
1149
|
}
|
|
1147
|
-
function
|
|
1150
|
+
function parseRetryAfterSeconds(header) {
|
|
1151
|
+
if (header == null || header.trim() === "") return void 0;
|
|
1152
|
+
const trimmed = header.trim();
|
|
1153
|
+
if (!/^\d+$/.test(trimmed)) return void 0;
|
|
1154
|
+
const n = Number.parseInt(trimmed, 10);
|
|
1155
|
+
if (!Number.isFinite(n) || n < 0) return void 0;
|
|
1156
|
+
return n;
|
|
1157
|
+
}
|
|
1158
|
+
function createApiError(statusCode, statusText, body, retryAfterHeader) {
|
|
1148
1159
|
const message = body.error ?? `${statusCode} ${statusText}`;
|
|
1149
1160
|
const code = body.code ?? "UNKNOWN";
|
|
1150
1161
|
const details = body.details;
|
|
1151
1162
|
const requestId = body.requestId;
|
|
1163
|
+
const retryAfterSeconds = parseRetryAfterSeconds(retryAfterHeader ?? null);
|
|
1152
1164
|
const Ctor = ERROR_CODE_MAP[code] ?? AoudaApiError;
|
|
1153
|
-
return new Ctor(message, code, statusCode, details, requestId);
|
|
1165
|
+
return new Ctor(message, code, statusCode, details, requestId, retryAfterSeconds);
|
|
1154
1166
|
}
|
|
1155
1167
|
var HttpTransport = class {
|
|
1156
1168
|
constructor(options) {
|
|
@@ -1243,7 +1255,8 @@ var HttpTransport = class {
|
|
|
1243
1255
|
throw createApiError(
|
|
1244
1256
|
response.status,
|
|
1245
1257
|
response.statusText,
|
|
1246
|
-
errorBody
|
|
1258
|
+
errorBody,
|
|
1259
|
+
response.headers.get("Retry-After")
|
|
1247
1260
|
);
|
|
1248
1261
|
}
|
|
1249
1262
|
throw new AoudaResponseError(
|
|
@@ -1353,7 +1366,8 @@ var HttpTransport = class {
|
|
|
1353
1366
|
throw createApiError(
|
|
1354
1367
|
response.status,
|
|
1355
1368
|
response.statusText,
|
|
1356
|
-
errorBody
|
|
1369
|
+
errorBody,
|
|
1370
|
+
response.headers.get("Retry-After")
|
|
1357
1371
|
);
|
|
1358
1372
|
}
|
|
1359
1373
|
throw new AoudaResponseError(
|
|
@@ -1699,6 +1713,17 @@ var CIRCUIT_BREAKER_POLICY_DISABLED = {
|
|
|
1699
1713
|
|
|
1700
1714
|
// src/resilience/resilient-transport.ts
|
|
1701
1715
|
var REQUEST_ID_HEADER3 = "X-Request-Id";
|
|
1716
|
+
function isCapacityBackPressure(error) {
|
|
1717
|
+
return error instanceof AoudaApiError && (error.code === "MEMORY_BUDGET_EXCEEDED" || error.code === "WAL_CAPACITY_EXCEEDED");
|
|
1718
|
+
}
|
|
1719
|
+
function retryDelayMs(retryPolicy, attempt, error) {
|
|
1720
|
+
const backoff = calculateDelay(retryPolicy, attempt);
|
|
1721
|
+
if (!isCapacityBackPressure(error) || !(error instanceof AoudaApiError)) {
|
|
1722
|
+
return backoff;
|
|
1723
|
+
}
|
|
1724
|
+
const headerMs = error.retryAfterSeconds != null ? error.retryAfterSeconds * 1e3 : 0;
|
|
1725
|
+
return Math.max(backoff, headerMs);
|
|
1726
|
+
}
|
|
1702
1727
|
function delayMs(ms, signal) {
|
|
1703
1728
|
if (ms <= 0) return Promise.resolve();
|
|
1704
1729
|
return new Promise((resolve, reject) => {
|
|
@@ -1753,7 +1778,7 @@ var ResilientTransport = class {
|
|
|
1753
1778
|
} catch (error) {
|
|
1754
1779
|
lastError = error;
|
|
1755
1780
|
const retryable = isRetryable(error);
|
|
1756
|
-
if (retryable) {
|
|
1781
|
+
if (retryable && !isCapacityBackPressure(error)) {
|
|
1757
1782
|
this.circuitBreaker.recordFailure(error);
|
|
1758
1783
|
}
|
|
1759
1784
|
if (!retryable) {
|
|
@@ -1763,7 +1788,7 @@ var ResilientTransport = class {
|
|
|
1763
1788
|
if (attempt > this.retryPolicy.maxRetries) {
|
|
1764
1789
|
throw error;
|
|
1765
1790
|
}
|
|
1766
|
-
const delay =
|
|
1791
|
+
const delay = retryDelayMs(this.retryPolicy, attempt, error);
|
|
1767
1792
|
try {
|
|
1768
1793
|
await delayMs(delay, config.signal);
|
|
1769
1794
|
} catch {
|
|
@@ -1799,7 +1824,7 @@ var ResilientTransport = class {
|
|
|
1799
1824
|
} catch (error) {
|
|
1800
1825
|
lastError = error;
|
|
1801
1826
|
const retryable = isRetryable(error);
|
|
1802
|
-
if (retryable) {
|
|
1827
|
+
if (retryable && !isCapacityBackPressure(error)) {
|
|
1803
1828
|
this.circuitBreaker.recordFailure(error);
|
|
1804
1829
|
}
|
|
1805
1830
|
if (!retryable) {
|
|
@@ -1809,7 +1834,7 @@ var ResilientTransport = class {
|
|
|
1809
1834
|
if (attempt > this.retryPolicy.maxRetries) {
|
|
1810
1835
|
throw error;
|
|
1811
1836
|
}
|
|
1812
|
-
const delay =
|
|
1837
|
+
const delay = retryDelayMs(this.retryPolicy, attempt, error);
|
|
1813
1838
|
try {
|
|
1814
1839
|
await delayMs(delay, config.signal);
|
|
1815
1840
|
} catch {
|
|
@@ -3566,23 +3591,68 @@ var TablesApi = class {
|
|
|
3566
3591
|
);
|
|
3567
3592
|
}
|
|
3568
3593
|
/**
|
|
3569
|
-
*
|
|
3594
|
+
* Alters a column (type, nullable, encoder, autoIncrement, references, and/or rename).
|
|
3595
|
+
* PATCH /api/databases/{db}/tables/{t}/columns/{c}.
|
|
3596
|
+
* Omit a property to leave it unchanged. For `references`, omit unchanged; `""` or `null` clears.
|
|
3570
3597
|
* @param tableName - Table name.
|
|
3571
3598
|
* @param columnName - Current column name.
|
|
3572
|
-
* @param body -
|
|
3573
|
-
* @returns
|
|
3574
|
-
* @throws AoudaNotFoundError if table or column does not exist; AoudaApiError for WRITE_NOT_ALLOWED, etc.
|
|
3599
|
+
* @param body - Fields to change. `database` is injected from the client scope when omitted.
|
|
3600
|
+
* @returns Updated column detail.
|
|
3575
3601
|
*/
|
|
3576
|
-
async
|
|
3602
|
+
async alterColumn(tableName, columnName, body) {
|
|
3577
3603
|
validateNonEmptyString(tableName, "Table name");
|
|
3578
3604
|
validateNonEmptyString(columnName, "Column name");
|
|
3579
|
-
|
|
3605
|
+
const hasField = body.newName !== void 0 || body.type !== void 0 || body.nullable !== void 0 || body.encoder !== void 0 || body.autoIncrement !== void 0 || body.references !== void 0;
|
|
3606
|
+
if (!hasField) {
|
|
3607
|
+
throw new Error(
|
|
3608
|
+
"AlterColumnRequest must set at least one of: newName, type, nullable, encoder, autoIncrement, references"
|
|
3609
|
+
);
|
|
3610
|
+
}
|
|
3580
3611
|
const prefix = databasePath2(this.database);
|
|
3581
3612
|
const encodedTable = encodeURIComponent(tableName);
|
|
3582
3613
|
const encodedColumn = encodeURIComponent(columnName);
|
|
3614
|
+
const requestBody = {
|
|
3615
|
+
database: this.database,
|
|
3616
|
+
...body
|
|
3617
|
+
};
|
|
3583
3618
|
return this.transport.patch(
|
|
3584
3619
|
`${prefix}/tables/${encodedTable}/columns/${encodedColumn}`,
|
|
3585
|
-
|
|
3620
|
+
requestBody
|
|
3621
|
+
);
|
|
3622
|
+
}
|
|
3623
|
+
/**
|
|
3624
|
+
* Renames a column (convenience wrapper over {@link alterColumn}).
|
|
3625
|
+
* @param tableName - Table name.
|
|
3626
|
+
* @param columnName - Current column name.
|
|
3627
|
+
* @param body - Request body with newName (database optional; injected when omitted).
|
|
3628
|
+
* @returns 200 response body (column detail).
|
|
3629
|
+
* @throws AoudaNotFoundError if table or column does not exist; AoudaApiError for WRITE_NOT_ALLOWED, etc.
|
|
3630
|
+
*/
|
|
3631
|
+
async renameColumn(tableName, columnName, body) {
|
|
3632
|
+
validateNonEmptyString(body.newName ?? "", "New column name");
|
|
3633
|
+
return this.alterColumn(tableName, columnName, { newName: body.newName });
|
|
3634
|
+
}
|
|
3635
|
+
/**
|
|
3636
|
+
* Reorders columns in a table.
|
|
3637
|
+
* PUT /api/databases/{db}/tables/{t}/columns:order (204 No Content).
|
|
3638
|
+
* @param tableName - Table name.
|
|
3639
|
+
* @param columnsOrBody - Ordered column names, or a request body with `columns`.
|
|
3640
|
+
*/
|
|
3641
|
+
async reorderColumns(tableName, columnsOrBody) {
|
|
3642
|
+
validateNonEmptyString(tableName, "Table name");
|
|
3643
|
+
const columns = Array.isArray(columnsOrBody) ? columnsOrBody : columnsOrBody.columns;
|
|
3644
|
+
if (!columns?.length) {
|
|
3645
|
+
throw new Error("columns array is required and must be non-empty");
|
|
3646
|
+
}
|
|
3647
|
+
const prefix = databasePath2(this.database);
|
|
3648
|
+
const encodedTable = encodeURIComponent(tableName);
|
|
3649
|
+
const requestBody = {
|
|
3650
|
+
database: this.database,
|
|
3651
|
+
columns
|
|
3652
|
+
};
|
|
3653
|
+
await this.transport.put(
|
|
3654
|
+
`${prefix}/tables/${encodedTable}/columns:order`,
|
|
3655
|
+
requestBody
|
|
3586
3656
|
);
|
|
3587
3657
|
}
|
|
3588
3658
|
/**
|
|
@@ -3822,6 +3892,37 @@ var BranchesApi = class {
|
|
|
3822
3892
|
}
|
|
3823
3893
|
};
|
|
3824
3894
|
|
|
3895
|
+
// src/jobs.ts
|
|
3896
|
+
function validateNonEmptyString2(value, name) {
|
|
3897
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
3898
|
+
throw new Error(`${name} must be a non-empty string`);
|
|
3899
|
+
}
|
|
3900
|
+
}
|
|
3901
|
+
var JobsApi = class {
|
|
3902
|
+
constructor(transport, database) {
|
|
3903
|
+
this.transport = transport;
|
|
3904
|
+
this.database = database;
|
|
3905
|
+
}
|
|
3906
|
+
get prefix() {
|
|
3907
|
+
return `${databasePath2(this.database)}/jobs`;
|
|
3908
|
+
}
|
|
3909
|
+
/**
|
|
3910
|
+
* Lists jobs whose params target this database.
|
|
3911
|
+
*/
|
|
3912
|
+
async list() {
|
|
3913
|
+
return this.transport.get(this.prefix);
|
|
3914
|
+
}
|
|
3915
|
+
/**
|
|
3916
|
+
* Gets a single job by id when it belongs to this database.
|
|
3917
|
+
* @param jobId - Job GUID string.
|
|
3918
|
+
*/
|
|
3919
|
+
async get(jobId) {
|
|
3920
|
+
validateNonEmptyString2(jobId, "Job id");
|
|
3921
|
+
const encoded = encodeURIComponent(jobId);
|
|
3922
|
+
return this.transport.get(`${this.prefix}/${encoded}`);
|
|
3923
|
+
}
|
|
3924
|
+
};
|
|
3925
|
+
|
|
3825
3926
|
// src/admin/server.ts
|
|
3826
3927
|
var ServerAdminApi = class {
|
|
3827
3928
|
constructor(transport) {
|
|
@@ -5130,7 +5231,7 @@ var DEFAULT_TIMEOUT_MS = 3e4;
|
|
|
5130
5231
|
function normalizeBaseUrl(url) {
|
|
5131
5232
|
return url.replace(/\/+$/, "");
|
|
5132
5233
|
}
|
|
5133
|
-
function
|
|
5234
|
+
function validateNonEmptyString3(value, name) {
|
|
5134
5235
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
5135
5236
|
throw new Error(`${name} must be a non-empty string`);
|
|
5136
5237
|
}
|
|
@@ -5145,8 +5246,8 @@ var AoudaClient = class {
|
|
|
5145
5246
|
constructor(options) {
|
|
5146
5247
|
this.connected = false;
|
|
5147
5248
|
this._wsTransport = null;
|
|
5148
|
-
|
|
5149
|
-
|
|
5249
|
+
validateNonEmptyString3(options.serverUrl, "serverUrl");
|
|
5250
|
+
validateNonEmptyString3(options.database, "database");
|
|
5150
5251
|
this.baseUrl = normalizeBaseUrl(options.serverUrl);
|
|
5151
5252
|
this.timeout = options.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
5152
5253
|
this.database = options.database.trim();
|
|
@@ -5228,6 +5329,7 @@ var AoudaClient = class {
|
|
|
5228
5329
|
this._authHandler = null;
|
|
5229
5330
|
}
|
|
5230
5331
|
this._tables = new TablesApi(this.transport, this.database);
|
|
5332
|
+
this._jobs = new JobsApi(this.transport, this.database);
|
|
5231
5333
|
this._databases = new DatabasesApi(this.transport);
|
|
5232
5334
|
this._schema = new SchemaApi(this.transport, this.database);
|
|
5233
5335
|
this._branches = new BranchesApi(this.transport, this.database);
|
|
@@ -5321,7 +5423,7 @@ var AoudaClient = class {
|
|
|
5321
5423
|
* ```
|
|
5322
5424
|
*/
|
|
5323
5425
|
table(name) {
|
|
5324
|
-
|
|
5426
|
+
validateNonEmptyString3(name, "Table name");
|
|
5325
5427
|
return new TableQuery(
|
|
5326
5428
|
this.transport,
|
|
5327
5429
|
name,
|
|
@@ -5337,6 +5439,13 @@ var AoudaClient = class {
|
|
|
5337
5439
|
get tables() {
|
|
5338
5440
|
return this._tables;
|
|
5339
5441
|
}
|
|
5442
|
+
/**
|
|
5443
|
+
* Access pending/background jobs for the current database (e.g. ColumnRewrite).
|
|
5444
|
+
* @returns The jobs API.
|
|
5445
|
+
*/
|
|
5446
|
+
get jobs() {
|
|
5447
|
+
return this._jobs;
|
|
5448
|
+
}
|
|
5340
5449
|
/**
|
|
5341
5450
|
* Access server-level database operations (list, create, get, drop).
|
|
5342
5451
|
* @returns The databases API.
|
|
@@ -5433,7 +5542,7 @@ var AoudaClient = class {
|
|
|
5433
5542
|
* ```
|
|
5434
5543
|
*/
|
|
5435
5544
|
bulkLoad(tableName, rows, options) {
|
|
5436
|
-
|
|
5545
|
+
validateNonEmptyString3(tableName, "tableName");
|
|
5437
5546
|
return new BulkLoadCoordinator(this.transport, this.database).run(
|
|
5438
5547
|
[tableName],
|
|
5439
5548
|
rows,
|
|
@@ -5786,6 +5895,7 @@ export {
|
|
|
5786
5895
|
DatabasesApi,
|
|
5787
5896
|
FILTER_OPERATORS,
|
|
5788
5897
|
HealthAdminApi,
|
|
5898
|
+
JobsApi,
|
|
5789
5899
|
MaterializedQueriesApi,
|
|
5790
5900
|
MaterializedQueryState,
|
|
5791
5901
|
MaterializedQueryType,
|