@aouda/client 0.1.9 → 0.1.11
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 +241 -9
- 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 +241 -9
- package/dist/cli/index.js.map +1 -1
- package/dist/{client-CxP9Vnc8.d.cts → client-CT3GdrvA.d.cts} +111 -5
- package/dist/{client-CxP9Vnc8.d.ts → client-CT3GdrvA.d.ts} +111 -5
- package/dist/index.cjs +246 -8
- 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 +243 -8
- 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 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
|
|
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-CT3GdrvA.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 NamedArtifactWarning, b3 as NamedMutationResult, b4 as NamedMutationsApi, b5 as NamedQueriesApi, b6 as NamedQueryBatchItem, b7 as NamedQueryBatchSlotResult, b8 as NamedQueryExecuteOptions, b9 as NodeAdminApi, ba as NodeLogEntry, bb as NodeLogLevel, bc as NodeLogStreamOptions, bd as NodeLogsQuery, be as NodeLogsResponse, bf as OpenWriteStreamOptions, bg as PageCacheMetrics, bh as PartitionFunction, bi as PartitionGrant, bj as PartitionGrantsListResponse, bk as PartitioningMetrics, bl as PendingJobListResponse, bm as PendingJobResponse, bn as PerDatabaseLagEntry, bo as PerDatabaseMetrics, bp as PerDatabaseStatusEntry, bq as QueryMetrics, br as QueryResult, bs as QueryStats, bt as ReferenceInfo, bu as RelationshipEndpoint, bv as RelationshipInfo, bw as RenameColumnRequest, bx as RenameTableRequest, by as ReorderColumnsRequest, bz as ReplicationAdminApi, bA as ReplicationMetrics, bB as ResidencyConfig, bC as ResultWarning, bD as RetryPolicy, bE as RlsResolver, bF as RlsResolverRule, bG as RlsResolverRuleInput, bH as RlsResolversListResponse, bI as SchemaChange, bJ as SchemaChangeType, bK as SchemaDiffResult, bL as SchemaRelationshipsResponse, bM as SeedApplyResult, bN as SeedTableApplyResult, bO as ServerAdminApi, bP as ServerAuthOptions, bQ as ServerMemoryResponse, bR as ServerMetricsResponse, bS as ServiceInfo, bT as SimdMetrics, bU as SingleDatabaseMetricsResponse, bV as SortDirection, bW as StorageMetrics, bX as SubscribeOptions, bY as Subscription, bZ as SubscriptionChangeEvent, b_ as SubscriptionEvent, b$ as SubscriptionInfo, c0 as SubscriptionSnapshotEvent, c1 as TIME_BUCKET_FUNCTIONS, c2 as TableCoverageEntry, c3 as TableNameFromSchema, c4 as TablePolicy, c5 as TableQuery, c6 as TableSchema, c7 as TableSchemaResponse, c8 as TableSummary, c9 as TableSummaryForErd, ca as TablesApi, cb as TimeBucketFunction, cc as TimeSeriesMetrics, cd as TransactionMetrics, ce as TypeGenerationOptions, cf as UpdateOptions, cg as UpdateRlsResolverRequest, ch as UpdateTableOptionsRequest, ci as UpdateTablePolicyRequest, cj as UserProfile, ck as WalMetrics, cl as WhereGroupBuilder, cm as WhereOperator, cn as WriteStream, co as coerceColumnarValue, cp as columnarToRows, cq as createAoudaClient } from './client-CT3GdrvA.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 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
|
|
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-CT3GdrvA.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 NamedArtifactWarning, b3 as NamedMutationResult, b4 as NamedMutationsApi, b5 as NamedQueriesApi, b6 as NamedQueryBatchItem, b7 as NamedQueryBatchSlotResult, b8 as NamedQueryExecuteOptions, b9 as NodeAdminApi, ba as NodeLogEntry, bb as NodeLogLevel, bc as NodeLogStreamOptions, bd as NodeLogsQuery, be as NodeLogsResponse, bf as OpenWriteStreamOptions, bg as PageCacheMetrics, bh as PartitionFunction, bi as PartitionGrant, bj as PartitionGrantsListResponse, bk as PartitioningMetrics, bl as PendingJobListResponse, bm as PendingJobResponse, bn as PerDatabaseLagEntry, bo as PerDatabaseMetrics, bp as PerDatabaseStatusEntry, bq as QueryMetrics, br as QueryResult, bs as QueryStats, bt as ReferenceInfo, bu as RelationshipEndpoint, bv as RelationshipInfo, bw as RenameColumnRequest, bx as RenameTableRequest, by as ReorderColumnsRequest, bz as ReplicationAdminApi, bA as ReplicationMetrics, bB as ResidencyConfig, bC as ResultWarning, bD as RetryPolicy, bE as RlsResolver, bF as RlsResolverRule, bG as RlsResolverRuleInput, bH as RlsResolversListResponse, bI as SchemaChange, bJ as SchemaChangeType, bK as SchemaDiffResult, bL as SchemaRelationshipsResponse, bM as SeedApplyResult, bN as SeedTableApplyResult, bO as ServerAdminApi, bP as ServerAuthOptions, bQ as ServerMemoryResponse, bR as ServerMetricsResponse, bS as ServiceInfo, bT as SimdMetrics, bU as SingleDatabaseMetricsResponse, bV as SortDirection, bW as StorageMetrics, bX as SubscribeOptions, bY as Subscription, bZ as SubscriptionChangeEvent, b_ as SubscriptionEvent, b$ as SubscriptionInfo, c0 as SubscriptionSnapshotEvent, c1 as TIME_BUCKET_FUNCTIONS, c2 as TableCoverageEntry, c3 as TableNameFromSchema, c4 as TablePolicy, c5 as TableQuery, c6 as TableSchema, c7 as TableSchemaResponse, c8 as TableSummary, c9 as TableSummaryForErd, ca as TablesApi, cb as TimeBucketFunction, cc as TimeSeriesMetrics, cd as TransactionMetrics, ce as TypeGenerationOptions, cf as UpdateOptions, cg as UpdateRlsResolverRequest, ch as UpdateTableOptionsRequest, ci as UpdateTablePolicyRequest, cj as UserProfile, ck as WalMetrics, cl as WhereGroupBuilder, cm as WhereOperator, cn as WriteStream, co as coerceColumnarValue, cp as columnarToRows, cq as createAoudaClient } from './client-CT3GdrvA.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.11",
|
|
5
5
|
description: "Official TypeScript/JavaScript client library for Aouda",
|
|
6
6
|
type: "module",
|
|
7
7
|
main: "./dist/index.cjs",
|
|
@@ -272,6 +272,7 @@ var AuthHandler = class {
|
|
|
272
272
|
this._tokenExpiry = null;
|
|
273
273
|
this._authenticated = false;
|
|
274
274
|
this._refreshPromise = null;
|
|
275
|
+
this._onAccessTokenRefreshed = null;
|
|
275
276
|
this._serverUrl = serverUrl.replace(/\/+$/, "");
|
|
276
277
|
this._timeout = timeout;
|
|
277
278
|
this._authBasePath = config.basePath;
|
|
@@ -521,10 +522,16 @@ var AuthHandler = class {
|
|
|
521
522
|
const thresholdSeconds = this._refreshThresholdMs / 1e3;
|
|
522
523
|
return this._tokenExpiry <= nowSeconds + thresholdSeconds;
|
|
523
524
|
}
|
|
525
|
+
setOnAccessTokenRefreshed(handler) {
|
|
526
|
+
this._onAccessTokenRefreshed = handler;
|
|
527
|
+
}
|
|
524
528
|
async _doRefresh() {
|
|
525
529
|
try {
|
|
526
530
|
const result = await this.callRefreshEndpoint();
|
|
527
531
|
this.handleSignInResult(result);
|
|
532
|
+
if (result.accessToken) {
|
|
533
|
+
this._onAccessTokenRefreshed?.(result.accessToken);
|
|
534
|
+
}
|
|
528
535
|
return true;
|
|
529
536
|
} catch {
|
|
530
537
|
return false;
|
|
@@ -1125,7 +1132,15 @@ var ERROR_CODE_MAP = {
|
|
|
1125
1132
|
AUTH_TOKEN_INVALID: AoudaAuthenticationError,
|
|
1126
1133
|
AUTH_TOKEN_REVOKED: AoudaAuthenticationError,
|
|
1127
1134
|
AUTH_API_KEY_INVALID: AoudaAuthenticationError,
|
|
1128
|
-
AUTH_REQUIRED: AoudaAuthenticationError
|
|
1135
|
+
AUTH_REQUIRED: AoudaAuthenticationError,
|
|
1136
|
+
NAMED_QUERY_NOT_FOUND: AoudaNotFoundError,
|
|
1137
|
+
NAMED_MUTATION_NOT_FOUND: AoudaNotFoundError,
|
|
1138
|
+
NAMED_QUERY_BATCH_EMPTY: AoudaValidationError,
|
|
1139
|
+
NAMED_QUERY_BATCH_TOO_LARGE: AoudaValidationError,
|
|
1140
|
+
NAMED_QUERY_BATCH_MUTATION: AoudaValidationError,
|
|
1141
|
+
NAMED_QUERY_BIND_FAILED: AoudaValidationError,
|
|
1142
|
+
NAMED_QUERY_PARAM_REQUIRED: AoudaValidationError,
|
|
1143
|
+
NAMED_MUTATION_BIND_FAILED: AoudaValidationError
|
|
1129
1144
|
};
|
|
1130
1145
|
function createComposedAbortController(...signals) {
|
|
1131
1146
|
const controller = new AbortController();
|
|
@@ -2018,6 +2033,8 @@ var TableSubscription = class {
|
|
|
2018
2033
|
this._started = false;
|
|
2019
2034
|
this._startPromise = null;
|
|
2020
2035
|
this._lastVersion = 0;
|
|
2036
|
+
this._pendingSnapshotRows = [];
|
|
2037
|
+
this._forceFreshSubscribe = false;
|
|
2021
2038
|
this.id = createStreamingId("sub");
|
|
2022
2039
|
this._transport = transport;
|
|
2023
2040
|
this._tableName = tableName;
|
|
@@ -2025,6 +2042,7 @@ var TableSubscription = class {
|
|
|
2025
2042
|
this._onSnapshot = options.onSnapshot;
|
|
2026
2043
|
this._onChange = options.onChange;
|
|
2027
2044
|
this._onError = options.onError;
|
|
2045
|
+
this._conflate = options.conflate;
|
|
2028
2046
|
this._reconnectHandlerKey = `${this.id}::reconnect`;
|
|
2029
2047
|
}
|
|
2030
2048
|
get lastVersion() {
|
|
@@ -2074,7 +2092,9 @@ var TableSubscription = class {
|
|
|
2074
2092
|
return;
|
|
2075
2093
|
}
|
|
2076
2094
|
try {
|
|
2077
|
-
|
|
2095
|
+
this._pendingSnapshotRows = [];
|
|
2096
|
+
const resumeFrom = this._forceFreshSubscribe || this._lastVersion <= 0 ? void 0 : this._lastVersion;
|
|
2097
|
+
this._forceFreshSubscribe = false;
|
|
2078
2098
|
await this._sendSubscribe(resumeFrom);
|
|
2079
2099
|
} catch (error) {
|
|
2080
2100
|
const wrapped = error instanceof Error ? error : new AoudaConnectionError("Subscription reconnect failed");
|
|
@@ -2094,6 +2114,9 @@ var TableSubscription = class {
|
|
|
2094
2114
|
if (resumeFrom !== void 0) {
|
|
2095
2115
|
message.resume_from = resumeFrom;
|
|
2096
2116
|
}
|
|
2117
|
+
if (this._conflate !== void 0) {
|
|
2118
|
+
message.conflate = this._conflate;
|
|
2119
|
+
}
|
|
2097
2120
|
await this._transport.send(message);
|
|
2098
2121
|
}
|
|
2099
2122
|
_handleMessage(message) {
|
|
@@ -2102,7 +2125,13 @@ var TableSubscription = class {
|
|
|
2102
2125
|
}
|
|
2103
2126
|
switch (message.type) {
|
|
2104
2127
|
case "snapshot":
|
|
2105
|
-
this.
|
|
2128
|
+
this._handleSnapshotPage(message);
|
|
2129
|
+
return;
|
|
2130
|
+
case "snapshot_complete":
|
|
2131
|
+
this._handleSnapshotComplete(message);
|
|
2132
|
+
return;
|
|
2133
|
+
case "gap":
|
|
2134
|
+
void this._handleGap(message);
|
|
2106
2135
|
return;
|
|
2107
2136
|
case "change":
|
|
2108
2137
|
this._handleChange(message);
|
|
@@ -2114,9 +2143,13 @@ var TableSubscription = class {
|
|
|
2114
2143
|
return;
|
|
2115
2144
|
}
|
|
2116
2145
|
}
|
|
2117
|
-
|
|
2146
|
+
_handleSnapshotPage(message) {
|
|
2147
|
+
this._pendingSnapshotRows.push(...message.rows);
|
|
2148
|
+
}
|
|
2149
|
+
_handleSnapshotComplete(message) {
|
|
2118
2150
|
this._lastVersion = message.version;
|
|
2119
|
-
const rows =
|
|
2151
|
+
const rows = this._pendingSnapshotRows;
|
|
2152
|
+
this._pendingSnapshotRows = [];
|
|
2120
2153
|
this._onSnapshot?.(rows, message.version);
|
|
2121
2154
|
this._queue.push({
|
|
2122
2155
|
type: "snapshot",
|
|
@@ -2124,6 +2157,16 @@ var TableSubscription = class {
|
|
|
2124
2157
|
version: message.version
|
|
2125
2158
|
});
|
|
2126
2159
|
}
|
|
2160
|
+
async _handleGap(message) {
|
|
2161
|
+
this._pendingSnapshotRows = [];
|
|
2162
|
+
this._lastVersion = message.last_seq;
|
|
2163
|
+
try {
|
|
2164
|
+
await this._sendSubscribe(message.last_seq);
|
|
2165
|
+
} catch (error) {
|
|
2166
|
+
const wrapped = error instanceof Error ? error : new AoudaConnectionError("Subscription gap resume failed");
|
|
2167
|
+
this._notifyError(wrapped);
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
2127
2170
|
_handleChange(message) {
|
|
2128
2171
|
this._lastVersion = message.version;
|
|
2129
2172
|
const event = {
|
|
@@ -2134,10 +2177,20 @@ var TableSubscription = class {
|
|
|
2134
2177
|
key: message.key,
|
|
2135
2178
|
version: message.version
|
|
2136
2179
|
};
|
|
2180
|
+
if (message.values_skipped !== void 0) {
|
|
2181
|
+
event.values_skipped = message.values_skipped;
|
|
2182
|
+
}
|
|
2137
2183
|
this._onChange?.(event);
|
|
2138
2184
|
this._queue.push(event);
|
|
2139
2185
|
}
|
|
2140
2186
|
_handleServerError(message) {
|
|
2187
|
+
if (message.code === "SLOW_CONSUMER") {
|
|
2188
|
+
this._pendingSnapshotRows = [];
|
|
2189
|
+
this._lastVersion = 0;
|
|
2190
|
+
this._forceFreshSubscribe = true;
|
|
2191
|
+
return;
|
|
2192
|
+
}
|
|
2193
|
+
this._pendingSnapshotRows = [];
|
|
2141
2194
|
const error = new AoudaConnectionError(
|
|
2142
2195
|
`Subscription error (${message.code}): ${message.message}`
|
|
2143
2196
|
);
|
|
@@ -2850,7 +2903,8 @@ var TableQuery = class _TableQuery {
|
|
|
2850
2903
|
{
|
|
2851
2904
|
onSnapshot: options.onSnapshot,
|
|
2852
2905
|
onChange: options.onChange,
|
|
2853
|
-
onError: options.onError
|
|
2906
|
+
onError: options.onError,
|
|
2907
|
+
conflate: options.conflate
|
|
2854
2908
|
},
|
|
2855
2909
|
mergedFilter
|
|
2856
2910
|
);
|
|
@@ -4576,6 +4630,147 @@ var MaterializedQueriesApi = class {
|
|
|
4576
4630
|
}
|
|
4577
4631
|
};
|
|
4578
4632
|
|
|
4633
|
+
// src/named-queries.ts
|
|
4634
|
+
var MAX_NAMED_QUERY_BATCH_SIZE = 32;
|
|
4635
|
+
function raiseDeprecationWarnings(sink, warnings) {
|
|
4636
|
+
if (warnings == null) return;
|
|
4637
|
+
for (const warning of warnings) {
|
|
4638
|
+
if (warning.code !== "NAMED_QUERY_DEPRECATED" && warning.code !== "NAMED_MUTATION_DEPRECATED") {
|
|
4639
|
+
continue;
|
|
4640
|
+
}
|
|
4641
|
+
const sunset = warning.sunsetAt != null ? ` sunsetAt=${warning.sunsetAt}` : "";
|
|
4642
|
+
const hash = warning.hash != null && warning.hash.length > 0 ? ` hash=${warning.hash}` : "";
|
|
4643
|
+
sink({
|
|
4644
|
+
code: warning.code,
|
|
4645
|
+
hash: warning.hash,
|
|
4646
|
+
sunsetAt: warning.sunsetAt,
|
|
4647
|
+
message: `${warning.code}:${hash}${sunset}`.trim()
|
|
4648
|
+
});
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
function emptyStats() {
|
|
4652
|
+
return {
|
|
4653
|
+
rowsScanned: 0,
|
|
4654
|
+
rowsReturned: 0,
|
|
4655
|
+
segmentsAccessed: 0,
|
|
4656
|
+
executionMs: 0
|
|
4657
|
+
};
|
|
4658
|
+
}
|
|
4659
|
+
var NamedQueriesApi = class {
|
|
4660
|
+
constructor(transport, database, onWarning) {
|
|
4661
|
+
this.transport = transport;
|
|
4662
|
+
this.database = database;
|
|
4663
|
+
this.onWarning = onWarning;
|
|
4664
|
+
}
|
|
4665
|
+
async execute(hash, args, options) {
|
|
4666
|
+
if (typeof hash !== "string" || hash.trim().length === 0) {
|
|
4667
|
+
throw new Error("Named query hash must be a non-empty string");
|
|
4668
|
+
}
|
|
4669
|
+
const prefix = databasePath2(this.database);
|
|
4670
|
+
const path = `${prefix}/named-queries/${encodeURIComponent(hash)}/query?format=columnar`;
|
|
4671
|
+
const response = await this.transport.post(
|
|
4672
|
+
path,
|
|
4673
|
+
{ args: args ?? {} },
|
|
4674
|
+
{ signal: options?.signal }
|
|
4675
|
+
);
|
|
4676
|
+
const rows = columnarToRows(response);
|
|
4677
|
+
raiseDeprecationWarnings(this.onWarning, response.warnings);
|
|
4678
|
+
return {
|
|
4679
|
+
rows,
|
|
4680
|
+
stats: response.stats,
|
|
4681
|
+
warnings: response.warnings
|
|
4682
|
+
};
|
|
4683
|
+
}
|
|
4684
|
+
async batch(items, options) {
|
|
4685
|
+
if (items.length === 0) {
|
|
4686
|
+
throw new AoudaValidationError(
|
|
4687
|
+
"Named query batch requires a non-empty queries array.",
|
|
4688
|
+
"NAMED_QUERY_BATCH_EMPTY",
|
|
4689
|
+
400
|
|
4690
|
+
);
|
|
4691
|
+
}
|
|
4692
|
+
if (items.length > MAX_NAMED_QUERY_BATCH_SIZE) {
|
|
4693
|
+
throw new AoudaValidationError(
|
|
4694
|
+
`Named query batch exceeds ${MAX_NAMED_QUERY_BATCH_SIZE} elements.`,
|
|
4695
|
+
"NAMED_QUERY_BATCH_TOO_LARGE",
|
|
4696
|
+
400
|
|
4697
|
+
);
|
|
4698
|
+
}
|
|
4699
|
+
const prefix = databasePath2(this.database);
|
|
4700
|
+
const path = `${prefix}/named-queries/batch?format=columnar`;
|
|
4701
|
+
const envelope = await this.transport.post(
|
|
4702
|
+
path,
|
|
4703
|
+
{ queries: items },
|
|
4704
|
+
{ signal: options?.signal }
|
|
4705
|
+
);
|
|
4706
|
+
return (envelope.results ?? []).map((slot) => {
|
|
4707
|
+
if (slot.code != null && slot.code.length > 0) {
|
|
4708
|
+
return {
|
|
4709
|
+
isError: true,
|
|
4710
|
+
code: slot.code,
|
|
4711
|
+
error: slot.error
|
|
4712
|
+
};
|
|
4713
|
+
}
|
|
4714
|
+
const columnar = {
|
|
4715
|
+
columns: slot.columns ?? [],
|
|
4716
|
+
types: slot.types ?? [],
|
|
4717
|
+
data: slot.data ?? [],
|
|
4718
|
+
rowCount: slot.rowCount ?? 0,
|
|
4719
|
+
stats: slot.stats ?? emptyStats(),
|
|
4720
|
+
warnings: slot.warnings
|
|
4721
|
+
};
|
|
4722
|
+
const result = {
|
|
4723
|
+
rows: columnarToRows(columnar),
|
|
4724
|
+
stats: columnar.stats,
|
|
4725
|
+
warnings: slot.warnings
|
|
4726
|
+
};
|
|
4727
|
+
raiseDeprecationWarnings(this.onWarning, slot.warnings);
|
|
4728
|
+
return { isError: false, result };
|
|
4729
|
+
});
|
|
4730
|
+
}
|
|
4731
|
+
};
|
|
4732
|
+
var NamedMutationsApi = class {
|
|
4733
|
+
constructor(transport, database, onWarning) {
|
|
4734
|
+
this.transport = transport;
|
|
4735
|
+
this.database = database;
|
|
4736
|
+
this.onWarning = onWarning;
|
|
4737
|
+
}
|
|
4738
|
+
async execute(hash, args) {
|
|
4739
|
+
if (typeof hash !== "string" || hash.trim().length === 0) {
|
|
4740
|
+
throw new Error("Named mutation hash must be a non-empty string");
|
|
4741
|
+
}
|
|
4742
|
+
const prefix = databasePath2(this.database);
|
|
4743
|
+
const path = `${prefix}/named-mutations/${encodeURIComponent(hash)}/execute`;
|
|
4744
|
+
const wire = await this.transport.post(path, {
|
|
4745
|
+
args: args ?? {}
|
|
4746
|
+
});
|
|
4747
|
+
let op = "unknown";
|
|
4748
|
+
let rowsAffected = 0;
|
|
4749
|
+
if (wire.rowsInserted != null) {
|
|
4750
|
+
op = "insert";
|
|
4751
|
+
rowsAffected = wire.rowsInserted;
|
|
4752
|
+
} else if (wire.rowsUpdated != null) {
|
|
4753
|
+
op = "update";
|
|
4754
|
+
rowsAffected = wire.rowsUpdated;
|
|
4755
|
+
} else if (wire.rowsDeleted != null) {
|
|
4756
|
+
op = "delete";
|
|
4757
|
+
rowsAffected = wire.rowsDeleted;
|
|
4758
|
+
}
|
|
4759
|
+
raiseDeprecationWarnings(this.onWarning, wire.warnings);
|
|
4760
|
+
const returning = wire.rows == null ? void 0 : {
|
|
4761
|
+
rows: columnarToRows(wire.rows),
|
|
4762
|
+
stats: wire.rows.stats,
|
|
4763
|
+
warnings: wire.rows.warnings
|
|
4764
|
+
};
|
|
4765
|
+
return {
|
|
4766
|
+
op,
|
|
4767
|
+
rowsAffected,
|
|
4768
|
+
returning,
|
|
4769
|
+
warnings: wire.warnings
|
|
4770
|
+
};
|
|
4771
|
+
}
|
|
4772
|
+
};
|
|
4773
|
+
|
|
4579
4774
|
// src/streaming/websocket-transport.ts
|
|
4580
4775
|
import { decode as decodeMessagePack, encode as encodeMessagePack } from "@msgpack/msgpack";
|
|
4581
4776
|
var DEFAULT_PING_INTERVAL_MS = 2e4;
|
|
@@ -4600,6 +4795,7 @@ var WebSocketTransport = class {
|
|
|
4600
4795
|
// Resolved/rejected when the auth handshake completes.
|
|
4601
4796
|
this._authResolve = null;
|
|
4602
4797
|
this._authReject = null;
|
|
4798
|
+
this._handshakeComplete = false;
|
|
4603
4799
|
this._serverUrl = serverUrl;
|
|
4604
4800
|
this._database = database;
|
|
4605
4801
|
this._authHandler = options.authHandler;
|
|
@@ -4609,6 +4805,11 @@ var WebSocketTransport = class {
|
|
|
4609
4805
|
this._maxMissedHeartbeats = options.maxMissedHeartbeats ?? DEFAULT_MAX_MISSED_HEARTBEATS;
|
|
4610
4806
|
this._enableCompression = options.enableCompression ?? true;
|
|
4611
4807
|
this._wireMode = options.wireMode ?? "json";
|
|
4808
|
+
this._authHandler?.setOnAccessTokenRefreshed((token) => {
|
|
4809
|
+
if (this._handshakeComplete && this._ws?.readyState === WS_READY_STATE_OPEN) {
|
|
4810
|
+
void this.send({ type: "re_auth", token });
|
|
4811
|
+
}
|
|
4812
|
+
});
|
|
4612
4813
|
}
|
|
4613
4814
|
// ─── Public API ────────────────────────────────────────────────────────────
|
|
4614
4815
|
/** Latest version number from the most recent server `heartbeat` message. */
|
|
@@ -4781,6 +4982,7 @@ var WebSocketTransport = class {
|
|
|
4781
4982
|
const resolve = this._authResolve;
|
|
4782
4983
|
this._authResolve = null;
|
|
4783
4984
|
this._authReject = null;
|
|
4985
|
+
this._handshakeComplete = true;
|
|
4784
4986
|
if (resolve) resolve();
|
|
4785
4987
|
break;
|
|
4786
4988
|
}
|
|
@@ -4807,10 +5009,15 @@ var WebSocketTransport = class {
|
|
|
4807
5009
|
break;
|
|
4808
5010
|
}
|
|
4809
5011
|
const id = "id" in msg ? msg.id : void 0;
|
|
4810
|
-
if (id !== void 0 && id !== null) {
|
|
5012
|
+
if (id !== void 0 && id !== null && id !== "") {
|
|
4811
5013
|
this._handlers.get(id)?.(msg);
|
|
4812
5014
|
} else {
|
|
4813
5015
|
this._handlers.get("__global__")?.(msg);
|
|
5016
|
+
for (const [key, handler] of this._handlers) {
|
|
5017
|
+
if (key !== "__global__") {
|
|
5018
|
+
handler(msg);
|
|
5019
|
+
}
|
|
5020
|
+
}
|
|
4814
5021
|
}
|
|
4815
5022
|
}
|
|
4816
5023
|
// ─── Internal: reconnect ──────────────────────────────────────────────────
|
|
@@ -5338,6 +5545,19 @@ var AoudaClient = class {
|
|
|
5338
5545
|
this.transport,
|
|
5339
5546
|
this.database
|
|
5340
5547
|
);
|
|
5548
|
+
const onNamedArtifactWarning = options.onNamedArtifactWarning ?? ((warning) => {
|
|
5549
|
+
console.warn(warning.message);
|
|
5550
|
+
});
|
|
5551
|
+
this._namedQueries = new NamedQueriesApi(
|
|
5552
|
+
this.transport,
|
|
5553
|
+
this.database,
|
|
5554
|
+
onNamedArtifactWarning
|
|
5555
|
+
);
|
|
5556
|
+
this._namedMutations = new NamedMutationsApi(
|
|
5557
|
+
this.transport,
|
|
5558
|
+
this.database,
|
|
5559
|
+
onNamedArtifactWarning
|
|
5560
|
+
);
|
|
5341
5561
|
}
|
|
5342
5562
|
/**
|
|
5343
5563
|
* Connects to the Aouda server.
|
|
@@ -5480,6 +5700,18 @@ var AoudaClient = class {
|
|
|
5480
5700
|
get materializedQueries() {
|
|
5481
5701
|
return this._materializedQueries;
|
|
5482
5702
|
}
|
|
5703
|
+
/**
|
|
5704
|
+
* Hash-only named-query execute and batch. Names are codegen aliases (D-5).
|
|
5705
|
+
*/
|
|
5706
|
+
get namedQueries() {
|
|
5707
|
+
return this._namedQueries;
|
|
5708
|
+
}
|
|
5709
|
+
/**
|
|
5710
|
+
* Hash-only named-mutation execute. No batch.
|
|
5711
|
+
*/
|
|
5712
|
+
get namedMutations() {
|
|
5713
|
+
return this._namedMutations;
|
|
5714
|
+
}
|
|
5483
5715
|
/**
|
|
5484
5716
|
* Access auth operations (signUp, signIn, signOut, refresh, me, changePassword).
|
|
5485
5717
|
* @returns The auth API.
|
|
@@ -5900,6 +6132,8 @@ export {
|
|
|
5900
6132
|
MaterializedQueryState,
|
|
5901
6133
|
MaterializedQueryType,
|
|
5902
6134
|
MetricsAdminApi,
|
|
6135
|
+
NamedMutationsApi,
|
|
6136
|
+
NamedQueriesApi,
|
|
5903
6137
|
NodeAdminApi,
|
|
5904
6138
|
ReplicationAdminApi,
|
|
5905
6139
|
RetryPolicy,
|
|
@@ -5910,6 +6144,7 @@ export {
|
|
|
5910
6144
|
WhereGroupBuilder,
|
|
5911
6145
|
applyLocalNetworkAccess,
|
|
5912
6146
|
coerceColumnarValue,
|
|
6147
|
+
columnarToRows,
|
|
5913
6148
|
createAoudaClient,
|
|
5914
6149
|
createAoudaClusterMcpToolSet,
|
|
5915
6150
|
installLocalNetworkFetch,
|