@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
|
@@ -566,6 +566,8 @@ interface ColumnSchema {
|
|
|
566
566
|
clusterOrder?: number;
|
|
567
567
|
/** Reference to another table's column (for relationship navigation). */
|
|
568
568
|
reference?: ReferenceInfo;
|
|
569
|
+
/** Preferred encoder name when non-default (e.g. String_Dict). */
|
|
570
|
+
encoder?: string;
|
|
569
571
|
}
|
|
570
572
|
/**
|
|
571
573
|
* Storage policy for a table.
|
|
@@ -756,6 +758,16 @@ interface BatchMutationResult {
|
|
|
756
758
|
/** Server-side execution time in milliseconds. */
|
|
757
759
|
executionMs: number;
|
|
758
760
|
}
|
|
761
|
+
/**
|
|
762
|
+
* Options for {@link TableQuery.insert} / {@link TableQuery.insertMany}.
|
|
763
|
+
*/
|
|
764
|
+
interface InsertOptions {
|
|
765
|
+
/**
|
|
766
|
+
* When true, store explicit autoIncrement values as-is (including 0).
|
|
767
|
+
* Equivalent to Bond `isAutoIncrementDisabled: true`.
|
|
768
|
+
*/
|
|
769
|
+
identityInsert?: boolean;
|
|
770
|
+
}
|
|
759
771
|
/**
|
|
760
772
|
* Literal (constant) value node.
|
|
761
773
|
* @internal
|
|
@@ -914,11 +926,55 @@ interface AddColumnRequest {
|
|
|
914
926
|
type: string;
|
|
915
927
|
}
|
|
916
928
|
/**
|
|
917
|
-
* Request body for
|
|
929
|
+
* Request body for altering a column
|
|
930
|
+
* (PATCH /api/databases/{db}/tables/{name}/columns/{columnName}).
|
|
931
|
+
* Omit a property to leave it unchanged. For `references`, omit to leave unchanged;
|
|
932
|
+
* pass `""` or `null` to clear.
|
|
918
933
|
*/
|
|
919
|
-
interface
|
|
934
|
+
interface AlterColumnRequest {
|
|
935
|
+
database?: string;
|
|
936
|
+
newName?: string;
|
|
937
|
+
type?: string;
|
|
938
|
+
nullable?: boolean;
|
|
939
|
+
encoder?: string;
|
|
940
|
+
autoIncrement?: boolean;
|
|
941
|
+
references?: string | null;
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* @deprecated Use {@link AlterColumnRequest} with `newName`. Kept for rename-only callers.
|
|
945
|
+
*/
|
|
946
|
+
type RenameColumnRequest = Pick<AlterColumnRequest, "database" | "newName"> & {
|
|
920
947
|
database: string;
|
|
921
948
|
newName: string;
|
|
949
|
+
};
|
|
950
|
+
/**
|
|
951
|
+
* Request body for reordering columns
|
|
952
|
+
* (PUT /api/databases/{db}/tables/{name}/columns:order).
|
|
953
|
+
*/
|
|
954
|
+
interface ReorderColumnsRequest {
|
|
955
|
+
database?: string;
|
|
956
|
+
columns: string[];
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Single pending-job projection (GET /api/databases/{db}/jobs).
|
|
960
|
+
*/
|
|
961
|
+
interface PendingJobResponse {
|
|
962
|
+
id: string;
|
|
963
|
+
type: string;
|
|
964
|
+
state: string;
|
|
965
|
+
createdAt: string;
|
|
966
|
+
startedAt?: string | null;
|
|
967
|
+
completedAt?: string | null;
|
|
968
|
+
error?: string | null;
|
|
969
|
+
/** Parsed params object when ParamsJson is JSON; otherwise a string. */
|
|
970
|
+
params?: unknown;
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* List response for GET /api/databases/{db}/jobs.
|
|
974
|
+
*/
|
|
975
|
+
interface PendingJobListResponse {
|
|
976
|
+
database: string;
|
|
977
|
+
jobs: PendingJobResponse[];
|
|
922
978
|
}
|
|
923
979
|
/**
|
|
924
980
|
* Request body for updating a table's storage policy (PUT /api/databases/{db}/tables/{name}/policy).
|
|
@@ -997,6 +1053,12 @@ interface BulkLoadOptions {
|
|
|
997
1053
|
onProgress?: (progress: BulkLoadProgress) => void;
|
|
998
1054
|
/** AbortSignal for cancellation. Issues :abort on the server before throwing. */
|
|
999
1055
|
signal?: AbortSignal;
|
|
1056
|
+
/**
|
|
1057
|
+
* When true, treat this bulk-load as identity-insert (Bond `isAutoIncrementDisabled: true`):
|
|
1058
|
+
* every autoIncrement column must be present/non-null on every row; values (including `0`)
|
|
1059
|
+
* are stored as-is; after successful commit the server advances the counter to max(inserted).
|
|
1060
|
+
*/
|
|
1061
|
+
identityInsert?: boolean;
|
|
1000
1062
|
}
|
|
1001
1063
|
interface BulkLoadProgress {
|
|
1002
1064
|
ivfAssignmentsCompleted: number;
|
|
@@ -1911,8 +1973,11 @@ declare class NodeAdminApi {
|
|
|
1911
1973
|
type NotificationProviderSource = "db" | "env" | "none";
|
|
1912
1974
|
/** Information about one configured notification provider (email or SMS). */
|
|
1913
1975
|
interface NotificationProviderInfo {
|
|
1914
|
-
/**
|
|
1915
|
-
|
|
1976
|
+
/**
|
|
1977
|
+
* Provider identifier, e.g. "sendgrid", "gatewayapi", "capture", "console",
|
|
1978
|
+
* or null when no provider is active.
|
|
1979
|
+
*/
|
|
1980
|
+
provider: string | null;
|
|
1916
1981
|
/**
|
|
1917
1982
|
* Where the provider config was loaded from.
|
|
1918
1983
|
* "db" = persisted in _settings DB; "env" = appsettings/env var; "none" = no provider.
|
|
@@ -1952,6 +2017,11 @@ interface PutEmailProviderRequest {
|
|
|
1952
2017
|
fromName?: string | null;
|
|
1953
2018
|
inviteUrl?: string | null;
|
|
1954
2019
|
passwordResetUrl?: string | null;
|
|
2020
|
+
/**
|
|
2021
|
+
* Required when provider is "capture" and the server is Production.
|
|
2022
|
+
* Confirms OTPs will be visible to server admins via the outbox.
|
|
2023
|
+
*/
|
|
2024
|
+
acknowledgeDevCapture?: boolean;
|
|
1955
2025
|
}
|
|
1956
2026
|
/** Request body for PUT /admin/notifications/sms. */
|
|
1957
2027
|
interface PutSmsProviderRequest {
|
|
@@ -1960,6 +2030,11 @@ interface PutSmsProviderRequest {
|
|
|
1960
2030
|
apiKey?: string | null;
|
|
1961
2031
|
sender?: string | null;
|
|
1962
2032
|
baseUrl?: string | null;
|
|
2033
|
+
/**
|
|
2034
|
+
* Required when provider is "capture" and the server is Production.
|
|
2035
|
+
* Confirms OTPs will be visible to server admins via the outbox.
|
|
2036
|
+
*/
|
|
2037
|
+
acknowledgeDevCapture?: boolean;
|
|
1963
2038
|
}
|
|
1964
2039
|
/** Request body for POST /admin/notifications/email/test. */
|
|
1965
2040
|
interface TestEmailRequest {
|
|
@@ -1977,6 +2052,30 @@ interface TestSendResult {
|
|
|
1977
2052
|
/** Error message if success is false. */
|
|
1978
2053
|
error?: string | null;
|
|
1979
2054
|
}
|
|
2055
|
+
/** Channel for a captured notification. */
|
|
2056
|
+
type NotificationOutboxChannel = "email" | "sms";
|
|
2057
|
+
/** Kind of captured auth notification. */
|
|
2058
|
+
type NotificationOutboxKind = "password_reset" | "invite" | "mfa_otp" | "test";
|
|
2059
|
+
/** One captured outbound auth notification from GET /admin/notifications/outbox. */
|
|
2060
|
+
interface NotificationOutboxEntry {
|
|
2061
|
+
id: string;
|
|
2062
|
+
channel: NotificationOutboxChannel | string;
|
|
2063
|
+
kind: NotificationOutboxKind | string;
|
|
2064
|
+
to: string;
|
|
2065
|
+
subject: string | null;
|
|
2066
|
+
body: string;
|
|
2067
|
+
otp: string;
|
|
2068
|
+
createdAtUtc: string;
|
|
2069
|
+
}
|
|
2070
|
+
/** Response from GET /admin/notifications/outbox. */
|
|
2071
|
+
interface NotificationOutboxResponse {
|
|
2072
|
+
entries: NotificationOutboxEntry[];
|
|
2073
|
+
}
|
|
2074
|
+
/** Query options for GET /admin/notifications/outbox. */
|
|
2075
|
+
interface NotificationOutboxQuery {
|
|
2076
|
+
channel?: NotificationOutboxChannel | string;
|
|
2077
|
+
limit?: number;
|
|
2078
|
+
}
|
|
1980
2079
|
|
|
1981
2080
|
/**
|
|
1982
2081
|
* Admin notification provider settings API.
|
|
@@ -2021,6 +2120,17 @@ declare class NotificationsAdminApi {
|
|
|
2021
2120
|
* POST /admin/notifications/sms/test
|
|
2022
2121
|
*/
|
|
2023
2122
|
testSms(request: TestSmsRequest): Promise<TestSendResult>;
|
|
2123
|
+
/**
|
|
2124
|
+
* Get recent captured auth notifications (newest first).
|
|
2125
|
+
* GET /admin/notifications/outbox?channel=&limit=
|
|
2126
|
+
*/
|
|
2127
|
+
getOutbox(options?: NotificationOutboxQuery): Promise<NotificationOutboxResponse>;
|
|
2128
|
+
/**
|
|
2129
|
+
* Clear the in-memory notification outbox.
|
|
2130
|
+
* DELETE /admin/notifications/outbox
|
|
2131
|
+
*/
|
|
2132
|
+
clearOutbox(): Promise<NotificationOutboxResponse>;
|
|
2133
|
+
private buildOutboxPath;
|
|
2024
2134
|
}
|
|
2025
2135
|
|
|
2026
2136
|
/**
|
|
@@ -2761,6 +2871,8 @@ declare class TableQuery<T = Record<string, unknown>> {
|
|
|
2761
2871
|
* a Promise. It does not use query builder state (where, orderBy, etc.).
|
|
2762
2872
|
*
|
|
2763
2873
|
* @param row - The row data to insert. Keys are column names.
|
|
2874
|
+
* @param row - The row object to insert. Keys are column names.
|
|
2875
|
+
* @param options - Optional insert options (e.g. `identityInsert`).
|
|
2764
2876
|
* @returns The insert result with row count, execution time, and optional generated values.
|
|
2765
2877
|
* @throws Error if `row` is null or undefined.
|
|
2766
2878
|
*
|
|
@@ -2771,9 +2883,12 @@ declare class TableQuery<T = Record<string, unknown>> {
|
|
|
2771
2883
|
*
|
|
2772
2884
|
* console.log(result.rowsInserted); // 1
|
|
2773
2885
|
* console.log(result.generatedValues); // { "0": { id: 42 } }
|
|
2886
|
+
*
|
|
2887
|
+
* // Identity-insert (Bond isAutoIncrementDisabled: true): store explicit IDs including 0
|
|
2888
|
+
* await client.table('orders').insert({ id: 1000, status: 'seeded' }, { identityInsert: true });
|
|
2774
2889
|
* ```
|
|
2775
2890
|
*/
|
|
2776
|
-
insert(row: Partial<T
|
|
2891
|
+
insert(row: Partial<T>, options?: InsertOptions): Promise<InsertResult>;
|
|
2777
2892
|
/**
|
|
2778
2893
|
* Inserts multiple rows into the table in a single request.
|
|
2779
2894
|
*
|
|
@@ -2781,6 +2896,7 @@ declare class TableQuery<T = Record<string, unknown>> {
|
|
|
2781
2896
|
* a Promise. It does not use query builder state (where, orderBy, etc.).
|
|
2782
2897
|
*
|
|
2783
2898
|
* @param rows - Array of row objects to insert. Must contain at least one row.
|
|
2899
|
+
* @param options - Optional insert options (e.g. `identityInsert`).
|
|
2784
2900
|
* @returns The insert result with total row count, execution time, and optional generated values.
|
|
2785
2901
|
* @throws Error if `rows` is empty.
|
|
2786
2902
|
*
|
|
@@ -2793,9 +2909,14 @@ declare class TableQuery<T = Record<string, unknown>> {
|
|
|
2793
2909
|
* ]);
|
|
2794
2910
|
*
|
|
2795
2911
|
* console.log(result.rowsInserted); // 2
|
|
2912
|
+
*
|
|
2913
|
+
* await client.table('orders').insertMany(
|
|
2914
|
+
* [{ id: 10 }, { id: 20 }],
|
|
2915
|
+
* { identityInsert: true },
|
|
2916
|
+
* );
|
|
2796
2917
|
* ```
|
|
2797
2918
|
*/
|
|
2798
|
-
insertMany(rows: Partial<T>[]): Promise<InsertResult>;
|
|
2919
|
+
insertMany(rows: Partial<T>[], options?: InsertOptions): Promise<InsertResult>;
|
|
2799
2920
|
/**
|
|
2800
2921
|
* Updates rows matching the current where predicates.
|
|
2801
2922
|
*
|
|
@@ -2946,14 +3067,31 @@ declare class TablesApi {
|
|
|
2946
3067
|
*/
|
|
2947
3068
|
addColumn(tableName: string, body: AddColumnRequest): Promise<ColumnSchema | undefined>;
|
|
2948
3069
|
/**
|
|
2949
|
-
*
|
|
3070
|
+
* Alters a column (type, nullable, encoder, autoIncrement, references, and/or rename).
|
|
3071
|
+
* PATCH /api/databases/{db}/tables/{t}/columns/{c}.
|
|
3072
|
+
* Omit a property to leave it unchanged. For `references`, omit unchanged; `""` or `null` clears.
|
|
2950
3073
|
* @param tableName - Table name.
|
|
2951
3074
|
* @param columnName - Current column name.
|
|
2952
|
-
* @param body -
|
|
3075
|
+
* @param body - Fields to change. `database` is injected from the client scope when omitted.
|
|
3076
|
+
* @returns Updated column detail.
|
|
3077
|
+
*/
|
|
3078
|
+
alterColumn(tableName: string, columnName: string, body: AlterColumnRequest): Promise<ColumnSchema | undefined>;
|
|
3079
|
+
/**
|
|
3080
|
+
* Renames a column (convenience wrapper over {@link alterColumn}).
|
|
3081
|
+
* @param tableName - Table name.
|
|
3082
|
+
* @param columnName - Current column name.
|
|
3083
|
+
* @param body - Request body with newName (database optional; injected when omitted).
|
|
2953
3084
|
* @returns 200 response body (column detail).
|
|
2954
3085
|
* @throws AoudaNotFoundError if table or column does not exist; AoudaApiError for WRITE_NOT_ALLOWED, etc.
|
|
2955
3086
|
*/
|
|
2956
|
-
renameColumn(tableName: string, columnName: string, body: RenameColumnRequest): Promise<ColumnSchema | undefined>;
|
|
3087
|
+
renameColumn(tableName: string, columnName: string, body: RenameColumnRequest | AlterColumnRequest): Promise<ColumnSchema | undefined>;
|
|
3088
|
+
/**
|
|
3089
|
+
* Reorders columns in a table.
|
|
3090
|
+
* PUT /api/databases/{db}/tables/{t}/columns:order (204 No Content).
|
|
3091
|
+
* @param tableName - Table name.
|
|
3092
|
+
* @param columnsOrBody - Ordered column names, or a request body with `columns`.
|
|
3093
|
+
*/
|
|
3094
|
+
reorderColumns(tableName: string, columnsOrBody: string[] | ReorderColumnsRequest): Promise<void>;
|
|
2957
3095
|
/**
|
|
2958
3096
|
* Drops a column from a table.
|
|
2959
3097
|
* @param tableName - Table name.
|
|
@@ -3038,6 +3176,11 @@ declare class DatabasesApi {
|
|
|
3038
3176
|
* Uses server endpoints under /api/databases/{db}/schema.
|
|
3039
3177
|
*/
|
|
3040
3178
|
|
|
3179
|
+
/**
|
|
3180
|
+
* Schema change classification (matches server `SchemaChangeType` enum names).
|
|
3181
|
+
* Unknown future values may appear as plain strings at runtime.
|
|
3182
|
+
*/
|
|
3183
|
+
type SchemaChangeType = "CreateTable" | "DropTable" | "AddColumn" | "DropColumn" | "UpdatePolicy" | "UpdateDurability" | "UpdatePartitionLevelSecurity" | "UpdateAuthorizationOptions" | "UpdateTableCulture" | "UpdateSettings" | "UpdateColumnAutoIncrement" | "UpdateColumnType" | "UpdateColumnNullable" | "UpdateColumnEncoder" | "RenameColumn" | "ReorderColumns" | "UpdateColumnReferences" | "UpdateColumnDefault" | "UpdateColumnDescription" | "UpdateTablePrimaryKey";
|
|
3041
3184
|
/** Server diff result (matches SchemaDiffResult). */
|
|
3042
3185
|
interface SchemaDiffResult {
|
|
3043
3186
|
changes: SchemaChange[];
|
|
@@ -3045,7 +3188,7 @@ interface SchemaDiffResult {
|
|
|
3045
3188
|
warnings?: SchemaChangeWarning[];
|
|
3046
3189
|
}
|
|
3047
3190
|
interface SchemaChange {
|
|
3048
|
-
type: string;
|
|
3191
|
+
type: SchemaChangeType | (string & {});
|
|
3049
3192
|
tableName?: string | null;
|
|
3050
3193
|
columnName?: string | null;
|
|
3051
3194
|
isDestructive: boolean;
|
|
@@ -3080,7 +3223,7 @@ interface SchemaApplyResult {
|
|
|
3080
3223
|
summary: ApplyResultSummary;
|
|
3081
3224
|
}
|
|
3082
3225
|
interface ApplyResultEntry {
|
|
3083
|
-
changeType: string;
|
|
3226
|
+
changeType: SchemaChangeType | (string & {});
|
|
3084
3227
|
tableName?: string | null;
|
|
3085
3228
|
columnName?: string | null;
|
|
3086
3229
|
status: string;
|
|
@@ -3226,6 +3369,31 @@ declare class BranchesApi {
|
|
|
3226
3369
|
delete(name: string): Promise<void>;
|
|
3227
3370
|
}
|
|
3228
3371
|
|
|
3372
|
+
/**
|
|
3373
|
+
* Pending / background jobs API for @aouda/client.
|
|
3374
|
+
* Projects GET /api/databases/{db}/jobs from the server.
|
|
3375
|
+
*/
|
|
3376
|
+
|
|
3377
|
+
/**
|
|
3378
|
+
* API for listing and inspecting server background jobs (e.g. ColumnRewrite).
|
|
3379
|
+
* Access via `client.jobs`.
|
|
3380
|
+
*/
|
|
3381
|
+
declare class JobsApi {
|
|
3382
|
+
private readonly transport;
|
|
3383
|
+
private readonly database;
|
|
3384
|
+
constructor(transport: Transport, database: string);
|
|
3385
|
+
private get prefix();
|
|
3386
|
+
/**
|
|
3387
|
+
* Lists jobs whose params target this database.
|
|
3388
|
+
*/
|
|
3389
|
+
list(): Promise<PendingJobListResponse>;
|
|
3390
|
+
/**
|
|
3391
|
+
* Gets a single job by id when it belongs to this database.
|
|
3392
|
+
* @param jobId - Job GUID string.
|
|
3393
|
+
*/
|
|
3394
|
+
get(jobId: string): Promise<PendingJobResponse>;
|
|
3395
|
+
}
|
|
3396
|
+
|
|
3229
3397
|
/**
|
|
3230
3398
|
* Materialized query HTTP API (`/api/databases/{db}/materialized-queries`).
|
|
3231
3399
|
*/
|
|
@@ -3366,6 +3534,7 @@ declare class AoudaClient<S extends SchemaLike = DefaultSchema> {
|
|
|
3366
3534
|
private readonly database;
|
|
3367
3535
|
private connected;
|
|
3368
3536
|
private readonly _tables;
|
|
3537
|
+
private readonly _jobs;
|
|
3369
3538
|
private readonly _databases;
|
|
3370
3539
|
private readonly _schema;
|
|
3371
3540
|
private readonly _branches;
|
|
@@ -3449,6 +3618,11 @@ declare class AoudaClient<S extends SchemaLike = DefaultSchema> {
|
|
|
3449
3618
|
* @returns The tables API.
|
|
3450
3619
|
*/
|
|
3451
3620
|
get tables(): TablesApi;
|
|
3621
|
+
/**
|
|
3622
|
+
* Access pending/background jobs for the current database (e.g. ColumnRewrite).
|
|
3623
|
+
* @returns The jobs API.
|
|
3624
|
+
*/
|
|
3625
|
+
get jobs(): JobsApi;
|
|
3452
3626
|
/**
|
|
3453
3627
|
* Access server-level database operations (list, create, get, drop).
|
|
3454
3628
|
* @returns The databases API.
|
|
@@ -3573,4 +3747,4 @@ declare class AoudaClient<S extends SchemaLike = DefaultSchema> {
|
|
|
3573
3747
|
*/
|
|
3574
3748
|
declare function createAoudaClient<S extends SchemaLike = DefaultSchema>(options: AoudaClientOptions): AoudaClient<S>;
|
|
3575
3749
|
|
|
3576
|
-
export { type
|
|
3750
|
+
export { type BloomFilterMetrics as $, AoudaClient as A, type BulkLoadOptions as B, type CoverageResponse as C, type DetailedHealthResponse as D, type AggregateFunctionName as E, type FailoverClusterResponse as F, type AlterColumnRequest as G, type HealthStatus as H, type AoudaClientOptions as I, type JoinClusterRequest as J, type AoudaDataType as K, type ListBackupsResponse as L, type AppAuthOptions as M, type NodeInfoResponse as N, AuthClient as O, type PromoteClusterResponse as P, type AuthResult as Q, type ReplicationStatusResponse as R, type SchemaLike as S, type Transport as T, type AuthUserInfo as U, type AuthorizationMode as V, BackupAdminApi as W, type BackupMetrics as X, type BackupSummary as Y, type BatchMutationResult as Z, type BatchOperationInput as _, type BulkLoadJobHandle as a, type MetricsSnapshot as a$, type BranchInfo as a0, BranchesApi as a1, type BulkLoadForceAbortRequest as a2, type BulkLoadForceAbortResponse as a3, type BulkLoadListResponse as a4, type BulkLoadProgress as a5, type BulkLoadReplicaProgress as a6, type BulkLoadReplicaProgressDto as a7, type BulkLoadStatusResponse as a8, CircuitBreakerPolicy as a9, HealthAdminApi as aA, type IndexInfo as aB, type InsertOptions as aC, type InsertResult as aD, type IoMetrics as aE, JobsApi as aF, type LatencyPercentiles as aG, MaterializedQueriesApi as aH, type MaterializedQueryDefinition as aI, type MaterializedQueryExecuteOptions as aJ, type MaterializedQueryExecuteResult as aK, type MaterializedQueryMetrics as aL, type MaterializedQueryRefreshOptions as aM, MaterializedQueryState as aN, type MaterializedQueryStateNumber as aO, type MaterializedQueryStatus as aP, MaterializedQueryType as aQ, type MaterializedQueryTypeNumber as aR, type MemberInfo as aS, type MemoryMetrics as aT, type MergeBranchOptions as aU, type MergeConflict as aV, type MergeExecutionResult as aW, type MergeResult as aX, MetricsAdminApi as aY, type MetricsHistory as aZ, type MetricsHistoryOptions as a_, ClusterAdminApi as aa, type ClusterMemberEntry as ab, type ClusterThisNodeEntry as ac, type ColumnSchema as ad, type ColumnSummaryForErd as ae, type ColumnarResponse as af, type ComponentHealthEntry as ag, type ComputedColumnDef as ah, ConfigAdminApi as ai, type CreateBranchRequest as aj, type CreateColumnRequest as ak, type CreateDatabaseOptions as al, type CreatePartitionGrantRequest as am, type CreateRlsResolverRequest as an, type CreateTableRequest as ao, type DatabaseCoverageEntry as ap, type DatabaseInfo as aq, type DatabaseMemoryMetrics as ar, type DatabaseMemoryUsage as as, type DatabaseMetricsDto as at, type DatabaseOptionsInfo as au, DatabasesApi as av, type DeleteOptions as aw, type DiffSummary as ax, FILTER_OPERATORS as ay, type FilterOperator as az, type TopologyResponse as b, type TableSchemaResponse as b$, type MetricsSummary as b0, type MutationResult as b1, NodeAdminApi as b2, type NodeLogEntry as b3, type NodeLogLevel as b4, type NodeLogStreamOptions as b5, type NodeLogsQuery as b6, type NodeLogsResponse as b7, type OpenWriteStreamOptions as b8, type PageCacheMetrics as b9, type SchemaChange as bA, type SchemaChangeType as bB, type SchemaDiffResult as bC, type SchemaRelationshipsResponse as bD, type SeedApplyResult as bE, type SeedTableApplyResult as bF, ServerAdminApi as bG, type ServerAuthOptions as bH, type ServerMemoryResponse as bI, type ServerMetricsResponse as bJ, type ServiceInfo as bK, type SimdMetrics as bL, type SingleDatabaseMetricsResponse as bM, type SortDirection as bN, type StorageMetrics as bO, type SubscribeOptions as bP, type Subscription as bQ, type SubscriptionChangeEvent as bR, type SubscriptionEvent as bS, type SubscriptionInfo as bT, type SubscriptionSnapshotEvent as bU, TIME_BUCKET_FUNCTIONS as bV, type TableCoverageEntry as bW, type TableNameFromSchema as bX, type TablePolicy as bY, TableQuery as bZ, type TableSchema as b_, type PartitionFunction as ba, type PartitionGrant as bb, type PartitionGrantsListResponse as bc, type PartitioningMetrics as bd, type PendingJobListResponse as be, type PendingJobResponse as bf, type PerDatabaseLagEntry as bg, type PerDatabaseMetrics as bh, type PerDatabaseStatusEntry as bi, type QueryMetrics as bj, type QueryResult as bk, type QueryStats as bl, type ReferenceInfo as bm, type RelationshipEndpoint as bn, type RelationshipInfo as bo, type RenameColumnRequest as bp, type RenameTableRequest as bq, type ReorderColumnsRequest as br, ReplicationAdminApi as bs, type ReplicationMetrics as bt, type ResidencyConfig as bu, RetryPolicy as bv, type RlsResolver as bw, type RlsResolverRule as bx, type RlsResolverRuleInput as by, type RlsResolversListResponse as bz, type ReadinessResponse as c, type TableSummary as c0, type TableSummaryForErd as c1, TablesApi as c2, type TimeBucketFunction as c3, type TimeSeriesMetrics as c4, type TransactionMetrics as c5, type TypeGenerationOptions as c6, type UpdateOptions as c7, type UpdateRlsResolverRequest as c8, type UpdateTableOptionsRequest as c9, type UpdateTablePolicyRequest as ca, type UserProfile as cb, WhereGroupBuilder as cc, type WhereOperator as cd, type WriteStream as ce, coerceColumnarValue as cf, createAoudaClient as cg, type TriggerBackupRequest as d, type TriggerBackupResponse as e, type RestoreBackupResponse as f, type BackupSchedule as g, type JoinClusterResponse as h, type LeaveClusterResponse as i, type DrainClusterResponse as j, type ClusterConfigResponse as k, type ClusterConfigPatchRequest as l, type DefaultSchema as m, AGGREGATE_FUNCTIONS as n, AOUDA_DATA_TYPES as o, type AddColumnRequest as p, AdminApi as q, type AdminBackupConfig as r, type AdminBackupPatch as s, type AdminConfigPatchRequest as t, type AdminConfigResponse as u, type AdminConfigSchemaResponse as v, type AdminLoggingConfig as w, type AdminLoggingPatch as x, type AdminMemoryConfig as y, type AdminMemoryPatch as z };
|
package/dist/index.cjs
CHANGED
|
@@ -56,6 +56,7 @@ __export(index_exports, {
|
|
|
56
56
|
DatabasesApi: () => DatabasesApi,
|
|
57
57
|
FILTER_OPERATORS: () => FILTER_OPERATORS,
|
|
58
58
|
HealthAdminApi: () => HealthAdminApi,
|
|
59
|
+
JobsApi: () => JobsApi,
|
|
59
60
|
MaterializedQueriesApi: () => MaterializedQueriesApi,
|
|
60
61
|
MaterializedQueryState: () => MaterializedQueryState,
|
|
61
62
|
MaterializedQueryType: () => MaterializedQueryType,
|
|
@@ -82,7 +83,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
82
83
|
// package.json
|
|
83
84
|
var package_default = {
|
|
84
85
|
name: "@aouda/client",
|
|
85
|
-
version: "0.1.
|
|
86
|
+
version: "0.1.8",
|
|
86
87
|
description: "Official TypeScript/JavaScript client library for Aouda",
|
|
87
88
|
type: "module",
|
|
88
89
|
main: "./dist/index.cjs",
|
|
@@ -1119,7 +1120,8 @@ var BulkLoadCoordinator = class {
|
|
|
1119
1120
|
pkUniquenessOverride: options.pkUniquenessOverride,
|
|
1120
1121
|
replicationMode: options.replicationMode,
|
|
1121
1122
|
forceSingleNodeReplicationBypass: options.forceSingleNodeReplicationBypass,
|
|
1122
|
-
postLoadMqBehavior: options.postLoadMqBehavior
|
|
1123
|
+
postLoadMqBehavior: options.postLoadMqBehavior,
|
|
1124
|
+
...options.identityInsert === true ? { identityInsert: true } : {}
|
|
1123
1125
|
}
|
|
1124
1126
|
};
|
|
1125
1127
|
const beginResp = await this.transport.post(
|
|
@@ -3129,6 +3131,8 @@ var TableQuery = class _TableQuery {
|
|
|
3129
3131
|
* a Promise. It does not use query builder state (where, orderBy, etc.).
|
|
3130
3132
|
*
|
|
3131
3133
|
* @param row - The row data to insert. Keys are column names.
|
|
3134
|
+
* @param row - The row object to insert. Keys are column names.
|
|
3135
|
+
* @param options - Optional insert options (e.g. `identityInsert`).
|
|
3132
3136
|
* @returns The insert result with row count, execution time, and optional generated values.
|
|
3133
3137
|
* @throws Error if `row` is null or undefined.
|
|
3134
3138
|
*
|
|
@@ -3139,9 +3143,12 @@ var TableQuery = class _TableQuery {
|
|
|
3139
3143
|
*
|
|
3140
3144
|
* console.log(result.rowsInserted); // 1
|
|
3141
3145
|
* console.log(result.generatedValues); // { "0": { id: 42 } }
|
|
3146
|
+
*
|
|
3147
|
+
* // Identity-insert (Bond isAutoIncrementDisabled: true): store explicit IDs including 0
|
|
3148
|
+
* await client.table('orders').insert({ id: 1000, status: 'seeded' }, { identityInsert: true });
|
|
3142
3149
|
* ```
|
|
3143
3150
|
*/
|
|
3144
|
-
async insert(row) {
|
|
3151
|
+
async insert(row, options) {
|
|
3145
3152
|
if (row == null) {
|
|
3146
3153
|
throw new Error("insert() requires a non-null row object");
|
|
3147
3154
|
}
|
|
@@ -3151,6 +3158,9 @@ var TableQuery = class _TableQuery {
|
|
|
3151
3158
|
database: this.database,
|
|
3152
3159
|
rows: [row]
|
|
3153
3160
|
};
|
|
3161
|
+
if (options?.identityInsert === true) {
|
|
3162
|
+
body.identityInsert = true;
|
|
3163
|
+
}
|
|
3154
3164
|
const response = await this.transport.post(path, body);
|
|
3155
3165
|
const result = {
|
|
3156
3166
|
rowsInserted: response.rowsInserted,
|
|
@@ -3168,6 +3178,7 @@ var TableQuery = class _TableQuery {
|
|
|
3168
3178
|
* a Promise. It does not use query builder state (where, orderBy, etc.).
|
|
3169
3179
|
*
|
|
3170
3180
|
* @param rows - Array of row objects to insert. Must contain at least one row.
|
|
3181
|
+
* @param options - Optional insert options (e.g. `identityInsert`).
|
|
3171
3182
|
* @returns The insert result with total row count, execution time, and optional generated values.
|
|
3172
3183
|
* @throws Error if `rows` is empty.
|
|
3173
3184
|
*
|
|
@@ -3180,9 +3191,14 @@ var TableQuery = class _TableQuery {
|
|
|
3180
3191
|
* ]);
|
|
3181
3192
|
*
|
|
3182
3193
|
* console.log(result.rowsInserted); // 2
|
|
3194
|
+
*
|
|
3195
|
+
* await client.table('orders').insertMany(
|
|
3196
|
+
* [{ id: 10 }, { id: 20 }],
|
|
3197
|
+
* { identityInsert: true },
|
|
3198
|
+
* );
|
|
3183
3199
|
* ```
|
|
3184
3200
|
*/
|
|
3185
|
-
async insertMany(rows) {
|
|
3201
|
+
async insertMany(rows, options) {
|
|
3186
3202
|
if (!Array.isArray(rows) || rows.length === 0) {
|
|
3187
3203
|
throw new Error("insertMany() requires a non-empty array of rows");
|
|
3188
3204
|
}
|
|
@@ -3192,6 +3208,9 @@ var TableQuery = class _TableQuery {
|
|
|
3192
3208
|
database: this.database,
|
|
3193
3209
|
rows
|
|
3194
3210
|
};
|
|
3211
|
+
if (options?.identityInsert === true) {
|
|
3212
|
+
body.identityInsert = true;
|
|
3213
|
+
}
|
|
3195
3214
|
const response = await this.transport.post(path, body);
|
|
3196
3215
|
const result = {
|
|
3197
3216
|
rowsInserted: response.rowsInserted,
|
|
@@ -3629,23 +3648,68 @@ var TablesApi = class {
|
|
|
3629
3648
|
);
|
|
3630
3649
|
}
|
|
3631
3650
|
/**
|
|
3632
|
-
*
|
|
3651
|
+
* Alters a column (type, nullable, encoder, autoIncrement, references, and/or rename).
|
|
3652
|
+
* PATCH /api/databases/{db}/tables/{t}/columns/{c}.
|
|
3653
|
+
* Omit a property to leave it unchanged. For `references`, omit unchanged; `""` or `null` clears.
|
|
3633
3654
|
* @param tableName - Table name.
|
|
3634
3655
|
* @param columnName - Current column name.
|
|
3635
|
-
* @param body -
|
|
3636
|
-
* @returns
|
|
3637
|
-
* @throws AoudaNotFoundError if table or column does not exist; AoudaApiError for WRITE_NOT_ALLOWED, etc.
|
|
3656
|
+
* @param body - Fields to change. `database` is injected from the client scope when omitted.
|
|
3657
|
+
* @returns Updated column detail.
|
|
3638
3658
|
*/
|
|
3639
|
-
async
|
|
3659
|
+
async alterColumn(tableName, columnName, body) {
|
|
3640
3660
|
validateNonEmptyString(tableName, "Table name");
|
|
3641
3661
|
validateNonEmptyString(columnName, "Column name");
|
|
3642
|
-
|
|
3662
|
+
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;
|
|
3663
|
+
if (!hasField) {
|
|
3664
|
+
throw new Error(
|
|
3665
|
+
"AlterColumnRequest must set at least one of: newName, type, nullable, encoder, autoIncrement, references"
|
|
3666
|
+
);
|
|
3667
|
+
}
|
|
3643
3668
|
const prefix = databasePath2(this.database);
|
|
3644
3669
|
const encodedTable = encodeURIComponent(tableName);
|
|
3645
3670
|
const encodedColumn = encodeURIComponent(columnName);
|
|
3671
|
+
const requestBody = {
|
|
3672
|
+
database: this.database,
|
|
3673
|
+
...body
|
|
3674
|
+
};
|
|
3646
3675
|
return this.transport.patch(
|
|
3647
3676
|
`${prefix}/tables/${encodedTable}/columns/${encodedColumn}`,
|
|
3648
|
-
|
|
3677
|
+
requestBody
|
|
3678
|
+
);
|
|
3679
|
+
}
|
|
3680
|
+
/**
|
|
3681
|
+
* Renames a column (convenience wrapper over {@link alterColumn}).
|
|
3682
|
+
* @param tableName - Table name.
|
|
3683
|
+
* @param columnName - Current column name.
|
|
3684
|
+
* @param body - Request body with newName (database optional; injected when omitted).
|
|
3685
|
+
* @returns 200 response body (column detail).
|
|
3686
|
+
* @throws AoudaNotFoundError if table or column does not exist; AoudaApiError for WRITE_NOT_ALLOWED, etc.
|
|
3687
|
+
*/
|
|
3688
|
+
async renameColumn(tableName, columnName, body) {
|
|
3689
|
+
validateNonEmptyString(body.newName ?? "", "New column name");
|
|
3690
|
+
return this.alterColumn(tableName, columnName, { newName: body.newName });
|
|
3691
|
+
}
|
|
3692
|
+
/**
|
|
3693
|
+
* Reorders columns in a table.
|
|
3694
|
+
* PUT /api/databases/{db}/tables/{t}/columns:order (204 No Content).
|
|
3695
|
+
* @param tableName - Table name.
|
|
3696
|
+
* @param columnsOrBody - Ordered column names, or a request body with `columns`.
|
|
3697
|
+
*/
|
|
3698
|
+
async reorderColumns(tableName, columnsOrBody) {
|
|
3699
|
+
validateNonEmptyString(tableName, "Table name");
|
|
3700
|
+
const columns = Array.isArray(columnsOrBody) ? columnsOrBody : columnsOrBody.columns;
|
|
3701
|
+
if (!columns?.length) {
|
|
3702
|
+
throw new Error("columns array is required and must be non-empty");
|
|
3703
|
+
}
|
|
3704
|
+
const prefix = databasePath2(this.database);
|
|
3705
|
+
const encodedTable = encodeURIComponent(tableName);
|
|
3706
|
+
const requestBody = {
|
|
3707
|
+
database: this.database,
|
|
3708
|
+
columns
|
|
3709
|
+
};
|
|
3710
|
+
await this.transport.put(
|
|
3711
|
+
`${prefix}/tables/${encodedTable}/columns:order`,
|
|
3712
|
+
requestBody
|
|
3649
3713
|
);
|
|
3650
3714
|
}
|
|
3651
3715
|
/**
|
|
@@ -3885,6 +3949,37 @@ var BranchesApi = class {
|
|
|
3885
3949
|
}
|
|
3886
3950
|
};
|
|
3887
3951
|
|
|
3952
|
+
// src/jobs.ts
|
|
3953
|
+
function validateNonEmptyString2(value, name) {
|
|
3954
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
3955
|
+
throw new Error(`${name} must be a non-empty string`);
|
|
3956
|
+
}
|
|
3957
|
+
}
|
|
3958
|
+
var JobsApi = class {
|
|
3959
|
+
constructor(transport, database) {
|
|
3960
|
+
this.transport = transport;
|
|
3961
|
+
this.database = database;
|
|
3962
|
+
}
|
|
3963
|
+
get prefix() {
|
|
3964
|
+
return `${databasePath2(this.database)}/jobs`;
|
|
3965
|
+
}
|
|
3966
|
+
/**
|
|
3967
|
+
* Lists jobs whose params target this database.
|
|
3968
|
+
*/
|
|
3969
|
+
async list() {
|
|
3970
|
+
return this.transport.get(this.prefix);
|
|
3971
|
+
}
|
|
3972
|
+
/**
|
|
3973
|
+
* Gets a single job by id when it belongs to this database.
|
|
3974
|
+
* @param jobId - Job GUID string.
|
|
3975
|
+
*/
|
|
3976
|
+
async get(jobId) {
|
|
3977
|
+
validateNonEmptyString2(jobId, "Job id");
|
|
3978
|
+
const encoded = encodeURIComponent(jobId);
|
|
3979
|
+
return this.transport.get(`${this.prefix}/${encoded}`);
|
|
3980
|
+
}
|
|
3981
|
+
};
|
|
3982
|
+
|
|
3888
3983
|
// src/admin/server.ts
|
|
3889
3984
|
var ServerAdminApi = class {
|
|
3890
3985
|
constructor(transport) {
|
|
@@ -4394,6 +4489,35 @@ var NotificationsAdminApi = class {
|
|
|
4394
4489
|
request
|
|
4395
4490
|
);
|
|
4396
4491
|
}
|
|
4492
|
+
/**
|
|
4493
|
+
* Get recent captured auth notifications (newest first).
|
|
4494
|
+
* GET /admin/notifications/outbox?channel=&limit=
|
|
4495
|
+
*/
|
|
4496
|
+
async getOutbox(options) {
|
|
4497
|
+
return this.transport.get(
|
|
4498
|
+
this.buildOutboxPath(options)
|
|
4499
|
+
);
|
|
4500
|
+
}
|
|
4501
|
+
/**
|
|
4502
|
+
* Clear the in-memory notification outbox.
|
|
4503
|
+
* DELETE /admin/notifications/outbox
|
|
4504
|
+
*/
|
|
4505
|
+
async clearOutbox() {
|
|
4506
|
+
return this.transport.delete(
|
|
4507
|
+
`${BASE_PATH7}/outbox`
|
|
4508
|
+
);
|
|
4509
|
+
}
|
|
4510
|
+
buildOutboxPath(options) {
|
|
4511
|
+
const params = new URLSearchParams();
|
|
4512
|
+
if (options?.channel !== void 0 && options.channel.trim().length > 0) {
|
|
4513
|
+
params.set("channel", options.channel);
|
|
4514
|
+
}
|
|
4515
|
+
if (options?.limit !== void 0) {
|
|
4516
|
+
params.set("limit", String(options.limit));
|
|
4517
|
+
}
|
|
4518
|
+
const query = params.toString();
|
|
4519
|
+
return query.length > 0 ? `${BASE_PATH7}/outbox?${query}` : `${BASE_PATH7}/outbox`;
|
|
4520
|
+
}
|
|
4397
4521
|
};
|
|
4398
4522
|
|
|
4399
4523
|
// src/admin/index.ts
|
|
@@ -5164,7 +5288,7 @@ var DEFAULT_TIMEOUT_MS = 3e4;
|
|
|
5164
5288
|
function normalizeBaseUrl(url) {
|
|
5165
5289
|
return url.replace(/\/+$/, "");
|
|
5166
5290
|
}
|
|
5167
|
-
function
|
|
5291
|
+
function validateNonEmptyString3(value, name) {
|
|
5168
5292
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
5169
5293
|
throw new Error(`${name} must be a non-empty string`);
|
|
5170
5294
|
}
|
|
@@ -5179,8 +5303,8 @@ var AoudaClient = class {
|
|
|
5179
5303
|
constructor(options) {
|
|
5180
5304
|
this.connected = false;
|
|
5181
5305
|
this._wsTransport = null;
|
|
5182
|
-
|
|
5183
|
-
|
|
5306
|
+
validateNonEmptyString3(options.serverUrl, "serverUrl");
|
|
5307
|
+
validateNonEmptyString3(options.database, "database");
|
|
5184
5308
|
this.baseUrl = normalizeBaseUrl(options.serverUrl);
|
|
5185
5309
|
this.timeout = options.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
5186
5310
|
this.database = options.database.trim();
|
|
@@ -5262,6 +5386,7 @@ var AoudaClient = class {
|
|
|
5262
5386
|
this._authHandler = null;
|
|
5263
5387
|
}
|
|
5264
5388
|
this._tables = new TablesApi(this.transport, this.database);
|
|
5389
|
+
this._jobs = new JobsApi(this.transport, this.database);
|
|
5265
5390
|
this._databases = new DatabasesApi(this.transport);
|
|
5266
5391
|
this._schema = new SchemaApi(this.transport, this.database);
|
|
5267
5392
|
this._branches = new BranchesApi(this.transport, this.database);
|
|
@@ -5355,7 +5480,7 @@ var AoudaClient = class {
|
|
|
5355
5480
|
* ```
|
|
5356
5481
|
*/
|
|
5357
5482
|
table(name) {
|
|
5358
|
-
|
|
5483
|
+
validateNonEmptyString3(name, "Table name");
|
|
5359
5484
|
return new TableQuery(
|
|
5360
5485
|
this.transport,
|
|
5361
5486
|
name,
|
|
@@ -5371,6 +5496,13 @@ var AoudaClient = class {
|
|
|
5371
5496
|
get tables() {
|
|
5372
5497
|
return this._tables;
|
|
5373
5498
|
}
|
|
5499
|
+
/**
|
|
5500
|
+
* Access pending/background jobs for the current database (e.g. ColumnRewrite).
|
|
5501
|
+
* @returns The jobs API.
|
|
5502
|
+
*/
|
|
5503
|
+
get jobs() {
|
|
5504
|
+
return this._jobs;
|
|
5505
|
+
}
|
|
5374
5506
|
/**
|
|
5375
5507
|
* Access server-level database operations (list, create, get, drop).
|
|
5376
5508
|
* @returns The databases API.
|
|
@@ -5467,7 +5599,7 @@ var AoudaClient = class {
|
|
|
5467
5599
|
* ```
|
|
5468
5600
|
*/
|
|
5469
5601
|
bulkLoad(tableName, rows, options) {
|
|
5470
|
-
|
|
5602
|
+
validateNonEmptyString3(tableName, "tableName");
|
|
5471
5603
|
return new BulkLoadCoordinator(this.transport, this.database).run(
|
|
5472
5604
|
[tableName],
|
|
5473
5605
|
rows,
|
|
@@ -5821,6 +5953,7 @@ var version = package_default.version;
|
|
|
5821
5953
|
DatabasesApi,
|
|
5822
5954
|
FILTER_OPERATORS,
|
|
5823
5955
|
HealthAdminApi,
|
|
5956
|
+
JobsApi,
|
|
5824
5957
|
MaterializedQueriesApi,
|
|
5825
5958
|
MaterializedQueryState,
|
|
5826
5959
|
MaterializedQueryType,
|