@aouda/client 0.1.6 → 0.1.8
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 +147 -16
- 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 +147 -16
- package/dist/cli/index.js.map +1 -1
- package/dist/{client-Bb6UxTA4.d.cts → client-TIOp5NUu.d.cts} +186 -12
- package/dist/{client-Bb6UxTA4.d.ts → client-TIOp5NUu.d.ts} +186 -12
- package/dist/index.cjs +149 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +148 -16
- 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-TIOp5NUu.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 WhereGroupBuilder, cd as WhereOperator, ce as WriteStream, cf as coerceColumnarValue, cg as createAoudaClient } from './client-TIOp5NUu.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @aouda/client error types.
|
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-TIOp5NUu.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 WhereGroupBuilder, cd as WhereOperator, ce as WriteStream, cf as coerceColumnarValue, cg as createAoudaClient } from './client-TIOp5NUu.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @aouda/client error types.
|
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.8",
|
|
5
5
|
description: "Official TypeScript/JavaScript client library for Aouda",
|
|
6
6
|
type: "module",
|
|
7
7
|
main: "./dist/index.cjs",
|
|
@@ -1038,7 +1038,8 @@ var BulkLoadCoordinator = class {
|
|
|
1038
1038
|
pkUniquenessOverride: options.pkUniquenessOverride,
|
|
1039
1039
|
replicationMode: options.replicationMode,
|
|
1040
1040
|
forceSingleNodeReplicationBypass: options.forceSingleNodeReplicationBypass,
|
|
1041
|
-
postLoadMqBehavior: options.postLoadMqBehavior
|
|
1041
|
+
postLoadMqBehavior: options.postLoadMqBehavior,
|
|
1042
|
+
...options.identityInsert === true ? { identityInsert: true } : {}
|
|
1042
1043
|
}
|
|
1043
1044
|
};
|
|
1044
1045
|
const beginResp = await this.transport.post(
|
|
@@ -3048,6 +3049,8 @@ var TableQuery = class _TableQuery {
|
|
|
3048
3049
|
* a Promise. It does not use query builder state (where, orderBy, etc.).
|
|
3049
3050
|
*
|
|
3050
3051
|
* @param row - The row data to insert. Keys are column names.
|
|
3052
|
+
* @param row - The row object to insert. Keys are column names.
|
|
3053
|
+
* @param options - Optional insert options (e.g. `identityInsert`).
|
|
3051
3054
|
* @returns The insert result with row count, execution time, and optional generated values.
|
|
3052
3055
|
* @throws Error if `row` is null or undefined.
|
|
3053
3056
|
*
|
|
@@ -3058,9 +3061,12 @@ var TableQuery = class _TableQuery {
|
|
|
3058
3061
|
*
|
|
3059
3062
|
* console.log(result.rowsInserted); // 1
|
|
3060
3063
|
* console.log(result.generatedValues); // { "0": { id: 42 } }
|
|
3064
|
+
*
|
|
3065
|
+
* // Identity-insert (Bond isAutoIncrementDisabled: true): store explicit IDs including 0
|
|
3066
|
+
* await client.table('orders').insert({ id: 1000, status: 'seeded' }, { identityInsert: true });
|
|
3061
3067
|
* ```
|
|
3062
3068
|
*/
|
|
3063
|
-
async insert(row) {
|
|
3069
|
+
async insert(row, options) {
|
|
3064
3070
|
if (row == null) {
|
|
3065
3071
|
throw new Error("insert() requires a non-null row object");
|
|
3066
3072
|
}
|
|
@@ -3070,6 +3076,9 @@ var TableQuery = class _TableQuery {
|
|
|
3070
3076
|
database: this.database,
|
|
3071
3077
|
rows: [row]
|
|
3072
3078
|
};
|
|
3079
|
+
if (options?.identityInsert === true) {
|
|
3080
|
+
body.identityInsert = true;
|
|
3081
|
+
}
|
|
3073
3082
|
const response = await this.transport.post(path, body);
|
|
3074
3083
|
const result = {
|
|
3075
3084
|
rowsInserted: response.rowsInserted,
|
|
@@ -3087,6 +3096,7 @@ var TableQuery = class _TableQuery {
|
|
|
3087
3096
|
* a Promise. It does not use query builder state (where, orderBy, etc.).
|
|
3088
3097
|
*
|
|
3089
3098
|
* @param rows - Array of row objects to insert. Must contain at least one row.
|
|
3099
|
+
* @param options - Optional insert options (e.g. `identityInsert`).
|
|
3090
3100
|
* @returns The insert result with total row count, execution time, and optional generated values.
|
|
3091
3101
|
* @throws Error if `rows` is empty.
|
|
3092
3102
|
*
|
|
@@ -3099,9 +3109,14 @@ var TableQuery = class _TableQuery {
|
|
|
3099
3109
|
* ]);
|
|
3100
3110
|
*
|
|
3101
3111
|
* console.log(result.rowsInserted); // 2
|
|
3112
|
+
*
|
|
3113
|
+
* await client.table('orders').insertMany(
|
|
3114
|
+
* [{ id: 10 }, { id: 20 }],
|
|
3115
|
+
* { identityInsert: true },
|
|
3116
|
+
* );
|
|
3102
3117
|
* ```
|
|
3103
3118
|
*/
|
|
3104
|
-
async insertMany(rows) {
|
|
3119
|
+
async insertMany(rows, options) {
|
|
3105
3120
|
if (!Array.isArray(rows) || rows.length === 0) {
|
|
3106
3121
|
throw new Error("insertMany() requires a non-empty array of rows");
|
|
3107
3122
|
}
|
|
@@ -3111,6 +3126,9 @@ var TableQuery = class _TableQuery {
|
|
|
3111
3126
|
database: this.database,
|
|
3112
3127
|
rows
|
|
3113
3128
|
};
|
|
3129
|
+
if (options?.identityInsert === true) {
|
|
3130
|
+
body.identityInsert = true;
|
|
3131
|
+
}
|
|
3114
3132
|
const response = await this.transport.post(path, body);
|
|
3115
3133
|
const result = {
|
|
3116
3134
|
rowsInserted: response.rowsInserted,
|
|
@@ -3548,23 +3566,68 @@ var TablesApi = class {
|
|
|
3548
3566
|
);
|
|
3549
3567
|
}
|
|
3550
3568
|
/**
|
|
3551
|
-
*
|
|
3569
|
+
* Alters a column (type, nullable, encoder, autoIncrement, references, and/or rename).
|
|
3570
|
+
* PATCH /api/databases/{db}/tables/{t}/columns/{c}.
|
|
3571
|
+
* Omit a property to leave it unchanged. For `references`, omit unchanged; `""` or `null` clears.
|
|
3552
3572
|
* @param tableName - Table name.
|
|
3553
3573
|
* @param columnName - Current column name.
|
|
3554
|
-
* @param body -
|
|
3555
|
-
* @returns
|
|
3556
|
-
* @throws AoudaNotFoundError if table or column does not exist; AoudaApiError for WRITE_NOT_ALLOWED, etc.
|
|
3574
|
+
* @param body - Fields to change. `database` is injected from the client scope when omitted.
|
|
3575
|
+
* @returns Updated column detail.
|
|
3557
3576
|
*/
|
|
3558
|
-
async
|
|
3577
|
+
async alterColumn(tableName, columnName, body) {
|
|
3559
3578
|
validateNonEmptyString(tableName, "Table name");
|
|
3560
3579
|
validateNonEmptyString(columnName, "Column name");
|
|
3561
|
-
|
|
3580
|
+
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;
|
|
3581
|
+
if (!hasField) {
|
|
3582
|
+
throw new Error(
|
|
3583
|
+
"AlterColumnRequest must set at least one of: newName, type, nullable, encoder, autoIncrement, references"
|
|
3584
|
+
);
|
|
3585
|
+
}
|
|
3562
3586
|
const prefix = databasePath2(this.database);
|
|
3563
3587
|
const encodedTable = encodeURIComponent(tableName);
|
|
3564
3588
|
const encodedColumn = encodeURIComponent(columnName);
|
|
3589
|
+
const requestBody = {
|
|
3590
|
+
database: this.database,
|
|
3591
|
+
...body
|
|
3592
|
+
};
|
|
3565
3593
|
return this.transport.patch(
|
|
3566
3594
|
`${prefix}/tables/${encodedTable}/columns/${encodedColumn}`,
|
|
3567
|
-
|
|
3595
|
+
requestBody
|
|
3596
|
+
);
|
|
3597
|
+
}
|
|
3598
|
+
/**
|
|
3599
|
+
* Renames a column (convenience wrapper over {@link alterColumn}).
|
|
3600
|
+
* @param tableName - Table name.
|
|
3601
|
+
* @param columnName - Current column name.
|
|
3602
|
+
* @param body - Request body with newName (database optional; injected when omitted).
|
|
3603
|
+
* @returns 200 response body (column detail).
|
|
3604
|
+
* @throws AoudaNotFoundError if table or column does not exist; AoudaApiError for WRITE_NOT_ALLOWED, etc.
|
|
3605
|
+
*/
|
|
3606
|
+
async renameColumn(tableName, columnName, body) {
|
|
3607
|
+
validateNonEmptyString(body.newName ?? "", "New column name");
|
|
3608
|
+
return this.alterColumn(tableName, columnName, { newName: body.newName });
|
|
3609
|
+
}
|
|
3610
|
+
/**
|
|
3611
|
+
* Reorders columns in a table.
|
|
3612
|
+
* PUT /api/databases/{db}/tables/{t}/columns:order (204 No Content).
|
|
3613
|
+
* @param tableName - Table name.
|
|
3614
|
+
* @param columnsOrBody - Ordered column names, or a request body with `columns`.
|
|
3615
|
+
*/
|
|
3616
|
+
async reorderColumns(tableName, columnsOrBody) {
|
|
3617
|
+
validateNonEmptyString(tableName, "Table name");
|
|
3618
|
+
const columns = Array.isArray(columnsOrBody) ? columnsOrBody : columnsOrBody.columns;
|
|
3619
|
+
if (!columns?.length) {
|
|
3620
|
+
throw new Error("columns array is required and must be non-empty");
|
|
3621
|
+
}
|
|
3622
|
+
const prefix = databasePath2(this.database);
|
|
3623
|
+
const encodedTable = encodeURIComponent(tableName);
|
|
3624
|
+
const requestBody = {
|
|
3625
|
+
database: this.database,
|
|
3626
|
+
columns
|
|
3627
|
+
};
|
|
3628
|
+
await this.transport.put(
|
|
3629
|
+
`${prefix}/tables/${encodedTable}/columns:order`,
|
|
3630
|
+
requestBody
|
|
3568
3631
|
);
|
|
3569
3632
|
}
|
|
3570
3633
|
/**
|
|
@@ -3804,6 +3867,37 @@ var BranchesApi = class {
|
|
|
3804
3867
|
}
|
|
3805
3868
|
};
|
|
3806
3869
|
|
|
3870
|
+
// src/jobs.ts
|
|
3871
|
+
function validateNonEmptyString2(value, name) {
|
|
3872
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
3873
|
+
throw new Error(`${name} must be a non-empty string`);
|
|
3874
|
+
}
|
|
3875
|
+
}
|
|
3876
|
+
var JobsApi = class {
|
|
3877
|
+
constructor(transport, database) {
|
|
3878
|
+
this.transport = transport;
|
|
3879
|
+
this.database = database;
|
|
3880
|
+
}
|
|
3881
|
+
get prefix() {
|
|
3882
|
+
return `${databasePath2(this.database)}/jobs`;
|
|
3883
|
+
}
|
|
3884
|
+
/**
|
|
3885
|
+
* Lists jobs whose params target this database.
|
|
3886
|
+
*/
|
|
3887
|
+
async list() {
|
|
3888
|
+
return this.transport.get(this.prefix);
|
|
3889
|
+
}
|
|
3890
|
+
/**
|
|
3891
|
+
* Gets a single job by id when it belongs to this database.
|
|
3892
|
+
* @param jobId - Job GUID string.
|
|
3893
|
+
*/
|
|
3894
|
+
async get(jobId) {
|
|
3895
|
+
validateNonEmptyString2(jobId, "Job id");
|
|
3896
|
+
const encoded = encodeURIComponent(jobId);
|
|
3897
|
+
return this.transport.get(`${this.prefix}/${encoded}`);
|
|
3898
|
+
}
|
|
3899
|
+
};
|
|
3900
|
+
|
|
3807
3901
|
// src/admin/server.ts
|
|
3808
3902
|
var ServerAdminApi = class {
|
|
3809
3903
|
constructor(transport) {
|
|
@@ -4313,6 +4407,35 @@ var NotificationsAdminApi = class {
|
|
|
4313
4407
|
request
|
|
4314
4408
|
);
|
|
4315
4409
|
}
|
|
4410
|
+
/**
|
|
4411
|
+
* Get recent captured auth notifications (newest first).
|
|
4412
|
+
* GET /admin/notifications/outbox?channel=&limit=
|
|
4413
|
+
*/
|
|
4414
|
+
async getOutbox(options) {
|
|
4415
|
+
return this.transport.get(
|
|
4416
|
+
this.buildOutboxPath(options)
|
|
4417
|
+
);
|
|
4418
|
+
}
|
|
4419
|
+
/**
|
|
4420
|
+
* Clear the in-memory notification outbox.
|
|
4421
|
+
* DELETE /admin/notifications/outbox
|
|
4422
|
+
*/
|
|
4423
|
+
async clearOutbox() {
|
|
4424
|
+
return this.transport.delete(
|
|
4425
|
+
`${BASE_PATH7}/outbox`
|
|
4426
|
+
);
|
|
4427
|
+
}
|
|
4428
|
+
buildOutboxPath(options) {
|
|
4429
|
+
const params = new URLSearchParams();
|
|
4430
|
+
if (options?.channel !== void 0 && options.channel.trim().length > 0) {
|
|
4431
|
+
params.set("channel", options.channel);
|
|
4432
|
+
}
|
|
4433
|
+
if (options?.limit !== void 0) {
|
|
4434
|
+
params.set("limit", String(options.limit));
|
|
4435
|
+
}
|
|
4436
|
+
const query = params.toString();
|
|
4437
|
+
return query.length > 0 ? `${BASE_PATH7}/outbox?${query}` : `${BASE_PATH7}/outbox`;
|
|
4438
|
+
}
|
|
4316
4439
|
};
|
|
4317
4440
|
|
|
4318
4441
|
// src/admin/index.ts
|
|
@@ -5083,7 +5206,7 @@ var DEFAULT_TIMEOUT_MS = 3e4;
|
|
|
5083
5206
|
function normalizeBaseUrl(url) {
|
|
5084
5207
|
return url.replace(/\/+$/, "");
|
|
5085
5208
|
}
|
|
5086
|
-
function
|
|
5209
|
+
function validateNonEmptyString3(value, name) {
|
|
5087
5210
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
5088
5211
|
throw new Error(`${name} must be a non-empty string`);
|
|
5089
5212
|
}
|
|
@@ -5098,8 +5221,8 @@ var AoudaClient = class {
|
|
|
5098
5221
|
constructor(options) {
|
|
5099
5222
|
this.connected = false;
|
|
5100
5223
|
this._wsTransport = null;
|
|
5101
|
-
|
|
5102
|
-
|
|
5224
|
+
validateNonEmptyString3(options.serverUrl, "serverUrl");
|
|
5225
|
+
validateNonEmptyString3(options.database, "database");
|
|
5103
5226
|
this.baseUrl = normalizeBaseUrl(options.serverUrl);
|
|
5104
5227
|
this.timeout = options.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
5105
5228
|
this.database = options.database.trim();
|
|
@@ -5181,6 +5304,7 @@ var AoudaClient = class {
|
|
|
5181
5304
|
this._authHandler = null;
|
|
5182
5305
|
}
|
|
5183
5306
|
this._tables = new TablesApi(this.transport, this.database);
|
|
5307
|
+
this._jobs = new JobsApi(this.transport, this.database);
|
|
5184
5308
|
this._databases = new DatabasesApi(this.transport);
|
|
5185
5309
|
this._schema = new SchemaApi(this.transport, this.database);
|
|
5186
5310
|
this._branches = new BranchesApi(this.transport, this.database);
|
|
@@ -5274,7 +5398,7 @@ var AoudaClient = class {
|
|
|
5274
5398
|
* ```
|
|
5275
5399
|
*/
|
|
5276
5400
|
table(name) {
|
|
5277
|
-
|
|
5401
|
+
validateNonEmptyString3(name, "Table name");
|
|
5278
5402
|
return new TableQuery(
|
|
5279
5403
|
this.transport,
|
|
5280
5404
|
name,
|
|
@@ -5290,6 +5414,13 @@ var AoudaClient = class {
|
|
|
5290
5414
|
get tables() {
|
|
5291
5415
|
return this._tables;
|
|
5292
5416
|
}
|
|
5417
|
+
/**
|
|
5418
|
+
* Access pending/background jobs for the current database (e.g. ColumnRewrite).
|
|
5419
|
+
* @returns The jobs API.
|
|
5420
|
+
*/
|
|
5421
|
+
get jobs() {
|
|
5422
|
+
return this._jobs;
|
|
5423
|
+
}
|
|
5293
5424
|
/**
|
|
5294
5425
|
* Access server-level database operations (list, create, get, drop).
|
|
5295
5426
|
* @returns The databases API.
|
|
@@ -5386,7 +5517,7 @@ var AoudaClient = class {
|
|
|
5386
5517
|
* ```
|
|
5387
5518
|
*/
|
|
5388
5519
|
bulkLoad(tableName, rows, options) {
|
|
5389
|
-
|
|
5520
|
+
validateNonEmptyString3(tableName, "tableName");
|
|
5390
5521
|
return new BulkLoadCoordinator(this.transport, this.database).run(
|
|
5391
5522
|
[tableName],
|
|
5392
5523
|
rows,
|
|
@@ -5739,6 +5870,7 @@ export {
|
|
|
5739
5870
|
DatabasesApi,
|
|
5740
5871
|
FILTER_OPERATORS,
|
|
5741
5872
|
HealthAdminApi,
|
|
5873
|
+
JobsApi,
|
|
5742
5874
|
MaterializedQueriesApi,
|
|
5743
5875
|
MaterializedQueryState,
|
|
5744
5876
|
MaterializedQueryType,
|