@aouda/client 0.1.10 → 0.1.12
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 +162 -23
- 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 +162 -23
- package/dist/cli/index.js.map +1 -1
- package/dist/{client-Dgenr-cE.d.cts → client-Q83x0Mz9.d.cts} +53 -7
- package/dist/{client-Dgenr-cE.d.ts → client-Q83x0Mz9.d.ts} +53 -7
- package/dist/index.cjs +162 -23
- 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 +162 -23
- 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 NamedArtifactWarning, b3 as NamedMutationResult, b4 as NamedMutationsApi, b5 as NamedQueriesApi, b6 as NamedQueryBatchItem, b7 as NamedQueryBatchSlotResult, b8 as NamedQueryExecuteOptions, b9 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-Q83x0Mz9.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 NamedQuerySubscribeOptions, ba as NodeAdminApi, bb as NodeLogEntry, bc as NodeLogLevel, bd as NodeLogStreamOptions, be as NodeLogsQuery, bf as NodeLogsResponse, bg as OpenWriteStreamOptions, bh as PageCacheMetrics, bi as PartitionFunction, bj as PartitionGrant, bk as PartitionGrantsListResponse, bl as PartitioningMetrics, bm as PendingJobListResponse, bn as PendingJobResponse, bo as PerDatabaseLagEntry, bp as PerDatabaseMetrics, bq as PerDatabaseStatusEntry, br as QueryMetrics, bs as QueryResult, bt as QueryStats, bu as ReferenceInfo, bv as RelationshipEndpoint, bw as RelationshipInfo, bx as RenameColumnRequest, by as RenameTableRequest, bz as ReorderColumnsRequest, bA as ReplicationAdminApi, bB as ReplicationMetrics, bC as ResidencyConfig, bD as ResultWarning, bE as RetryPolicy, bF as RlsResolver, bG as RlsResolverRule, bH as RlsResolverRuleInput, bI as RlsResolversListResponse, bJ as SchemaChange, bK as SchemaChangeType, bL as SchemaDiffResult, bM as SchemaRelationshipsResponse, bN as SeedApplyResult, bO as SeedTableApplyResult, bP as ServerAdminApi, bQ as ServerAuthOptions, bR as ServerMemoryResponse, bS as ServerMetricsResponse, bT as ServiceInfo, bU as SimdMetrics, bV as SingleDatabaseMetricsResponse, bW as SortDirection, bX as StorageMetrics, bY as SubscribeOptions, bZ as Subscription, b_ as SubscriptionChangeEvent, b$ as SubscriptionEvent, c0 as SubscriptionInfo, c1 as SubscriptionSnapshotEvent, c2 as TIME_BUCKET_FUNCTIONS, c3 as TableCoverageEntry, c4 as TableNameFromSchema, c5 as TablePolicy, c6 as TableQuery, c7 as TableSchema, c8 as TableSchemaResponse, c9 as TableSummary, ca as TableSummaryForErd, cb as TablesApi, cc as TimeBucketFunction, cd as TimeSeriesMetrics, ce as TransactionMetrics, cf as TypeGenerationOptions, cg as UpdateOptions, ch as UpdateRlsResolverRequest, ci as UpdateTableOptionsRequest, cj as UpdateTablePolicyRequest, ck as UserProfile, cl as WalMetrics, cm as WhereGroupBuilder, cn as WhereOperator, co as WriteStream, cp as coerceColumnarValue, cq as columnarToRows, cr as createAoudaClient } from './client-Q83x0Mz9.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 NamedArtifactWarning, b3 as NamedMutationResult, b4 as NamedMutationsApi, b5 as NamedQueriesApi, b6 as NamedQueryBatchItem, b7 as NamedQueryBatchSlotResult, b8 as NamedQueryExecuteOptions, b9 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-Q83x0Mz9.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 NamedQuerySubscribeOptions, ba as NodeAdminApi, bb as NodeLogEntry, bc as NodeLogLevel, bd as NodeLogStreamOptions, be as NodeLogsQuery, bf as NodeLogsResponse, bg as OpenWriteStreamOptions, bh as PageCacheMetrics, bi as PartitionFunction, bj as PartitionGrant, bk as PartitionGrantsListResponse, bl as PartitioningMetrics, bm as PendingJobListResponse, bn as PendingJobResponse, bo as PerDatabaseLagEntry, bp as PerDatabaseMetrics, bq as PerDatabaseStatusEntry, br as QueryMetrics, bs as QueryResult, bt as QueryStats, bu as ReferenceInfo, bv as RelationshipEndpoint, bw as RelationshipInfo, bx as RenameColumnRequest, by as RenameTableRequest, bz as ReorderColumnsRequest, bA as ReplicationAdminApi, bB as ReplicationMetrics, bC as ResidencyConfig, bD as ResultWarning, bE as RetryPolicy, bF as RlsResolver, bG as RlsResolverRule, bH as RlsResolverRuleInput, bI as RlsResolversListResponse, bJ as SchemaChange, bK as SchemaChangeType, bL as SchemaDiffResult, bM as SchemaRelationshipsResponse, bN as SeedApplyResult, bO as SeedTableApplyResult, bP as ServerAdminApi, bQ as ServerAuthOptions, bR as ServerMemoryResponse, bS as ServerMetricsResponse, bT as ServiceInfo, bU as SimdMetrics, bV as SingleDatabaseMetricsResponse, bW as SortDirection, bX as StorageMetrics, bY as SubscribeOptions, bZ as Subscription, b_ as SubscriptionChangeEvent, b$ as SubscriptionEvent, c0 as SubscriptionInfo, c1 as SubscriptionSnapshotEvent, c2 as TIME_BUCKET_FUNCTIONS, c3 as TableCoverageEntry, c4 as TableNameFromSchema, c5 as TablePolicy, c6 as TableQuery, c7 as TableSchema, c8 as TableSchemaResponse, c9 as TableSummary, ca as TableSummaryForErd, cb as TablesApi, cc as TimeBucketFunction, cd as TimeSeriesMetrics, ce as TransactionMetrics, cf as TypeGenerationOptions, cg as UpdateOptions, ch as UpdateRlsResolverRequest, ci as UpdateTableOptionsRequest, cj as UpdateTablePolicyRequest, ck as UserProfile, cl as WalMetrics, cm as WhereGroupBuilder, cn as WhereOperator, co as WriteStream, cp as coerceColumnarValue, cq as columnarToRows, cr as createAoudaClient } from './client-Q83x0Mz9.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.12",
|
|
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;
|
|
@@ -2020,20 +2027,22 @@ var AsyncEventQueue = class {
|
|
|
2020
2027
|
}
|
|
2021
2028
|
};
|
|
2022
2029
|
var TableSubscription = class {
|
|
2023
|
-
constructor(transport,
|
|
2030
|
+
constructor(transport, identity, options = {}, onWarnings) {
|
|
2024
2031
|
this._queue = new AsyncEventQueue();
|
|
2025
2032
|
this._active = true;
|
|
2026
2033
|
this._started = false;
|
|
2027
2034
|
this._startPromise = null;
|
|
2028
2035
|
this._lastVersion = 0;
|
|
2029
2036
|
this._pendingSnapshotRows = [];
|
|
2037
|
+
this._forceFreshSubscribe = false;
|
|
2030
2038
|
this.id = createStreamingId("sub");
|
|
2031
2039
|
this._transport = transport;
|
|
2032
|
-
this.
|
|
2033
|
-
this._baseFilter = baseFilter;
|
|
2040
|
+
this._identity = identity;
|
|
2034
2041
|
this._onSnapshot = options.onSnapshot;
|
|
2035
2042
|
this._onChange = options.onChange;
|
|
2036
2043
|
this._onError = options.onError;
|
|
2044
|
+
this._onWarnings = onWarnings;
|
|
2045
|
+
this._conflate = options.conflate;
|
|
2037
2046
|
this._reconnectHandlerKey = `${this.id}::reconnect`;
|
|
2038
2047
|
}
|
|
2039
2048
|
get lastVersion() {
|
|
@@ -2084,7 +2093,8 @@ var TableSubscription = class {
|
|
|
2084
2093
|
}
|
|
2085
2094
|
try {
|
|
2086
2095
|
this._pendingSnapshotRows = [];
|
|
2087
|
-
const resumeFrom = this._lastVersion
|
|
2096
|
+
const resumeFrom = this._forceFreshSubscribe || this._lastVersion <= 0 ? void 0 : this._lastVersion;
|
|
2097
|
+
this._forceFreshSubscribe = false;
|
|
2088
2098
|
await this._sendSubscribe(resumeFrom);
|
|
2089
2099
|
} catch (error) {
|
|
2090
2100
|
const wrapped = error instanceof Error ? error : new AoudaConnectionError("Subscription reconnect failed");
|
|
@@ -2094,16 +2104,25 @@ var TableSubscription = class {
|
|
|
2094
2104
|
async _sendSubscribe(resumeFrom) {
|
|
2095
2105
|
const message = {
|
|
2096
2106
|
type: "subscribe",
|
|
2097
|
-
id: this.id
|
|
2098
|
-
target: this._tableName
|
|
2107
|
+
id: this.id
|
|
2099
2108
|
};
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2109
|
+
if (this._identity.kind === "named") {
|
|
2110
|
+
message.hash = this._identity.hash;
|
|
2111
|
+
if (this._identity.args !== void 0) {
|
|
2112
|
+
message.args = this._identity.args;
|
|
2113
|
+
}
|
|
2114
|
+
} else {
|
|
2115
|
+
message.target = this._identity.target;
|
|
2116
|
+
if (this._identity.filter !== void 0) {
|
|
2117
|
+
message.filter = this._identity.filter;
|
|
2118
|
+
}
|
|
2103
2119
|
}
|
|
2104
2120
|
if (resumeFrom !== void 0) {
|
|
2105
2121
|
message.resume_from = resumeFrom;
|
|
2106
2122
|
}
|
|
2123
|
+
if (this._conflate !== void 0) {
|
|
2124
|
+
message.conflate = this._conflate;
|
|
2125
|
+
}
|
|
2107
2126
|
await this._transport.send(message);
|
|
2108
2127
|
}
|
|
2109
2128
|
_handleMessage(message) {
|
|
@@ -2135,6 +2154,9 @@ var TableSubscription = class {
|
|
|
2135
2154
|
}
|
|
2136
2155
|
_handleSnapshotComplete(message) {
|
|
2137
2156
|
this._lastVersion = message.version;
|
|
2157
|
+
if (message.warnings != null && message.warnings.length > 0) {
|
|
2158
|
+
this._onWarnings?.(message.warnings);
|
|
2159
|
+
}
|
|
2138
2160
|
const rows = this._pendingSnapshotRows;
|
|
2139
2161
|
this._pendingSnapshotRows = [];
|
|
2140
2162
|
this._onSnapshot?.(rows, message.version);
|
|
@@ -2164,10 +2186,19 @@ var TableSubscription = class {
|
|
|
2164
2186
|
key: message.key,
|
|
2165
2187
|
version: message.version
|
|
2166
2188
|
};
|
|
2189
|
+
if (message.values_skipped !== void 0) {
|
|
2190
|
+
event.values_skipped = message.values_skipped;
|
|
2191
|
+
}
|
|
2167
2192
|
this._onChange?.(event);
|
|
2168
2193
|
this._queue.push(event);
|
|
2169
2194
|
}
|
|
2170
2195
|
_handleServerError(message) {
|
|
2196
|
+
if (message.code === "SLOW_CONSUMER") {
|
|
2197
|
+
this._pendingSnapshotRows = [];
|
|
2198
|
+
this._lastVersion = 0;
|
|
2199
|
+
this._forceFreshSubscribe = true;
|
|
2200
|
+
return;
|
|
2201
|
+
}
|
|
2171
2202
|
this._pendingSnapshotRows = [];
|
|
2172
2203
|
const error = new AoudaConnectionError(
|
|
2173
2204
|
`Subscription error (${message.code}): ${message.message}`
|
|
@@ -2875,16 +2906,16 @@ var TableQuery = class _TableQuery {
|
|
|
2875
2906
|
const whereClause = this.buildWhereClause();
|
|
2876
2907
|
const queryFilter = buildSubscriptionFilter(whereClause);
|
|
2877
2908
|
const mergedFilter = mergeFilterObjects(queryFilter, options.filter);
|
|
2878
|
-
const subscription = new TableSubscription(
|
|
2879
|
-
|
|
2880
|
-
this.tableName,
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
);
|
|
2909
|
+
const subscription = new TableSubscription(wsTransport, {
|
|
2910
|
+
kind: "table",
|
|
2911
|
+
target: this.tableName,
|
|
2912
|
+
filter: mergedFilter
|
|
2913
|
+
}, {
|
|
2914
|
+
onSnapshot: options.onSnapshot,
|
|
2915
|
+
onChange: options.onChange,
|
|
2916
|
+
onError: options.onError,
|
|
2917
|
+
conflate: options.conflate
|
|
2918
|
+
});
|
|
2888
2919
|
subscription.start();
|
|
2889
2920
|
return subscription;
|
|
2890
2921
|
}
|
|
@@ -3470,10 +3501,84 @@ function serializeUpdateValue(col, val) {
|
|
|
3470
3501
|
else: toNode(cond.else)
|
|
3471
3502
|
};
|
|
3472
3503
|
}
|
|
3504
|
+
if ("$upper" in val) {
|
|
3505
|
+
return { type: "call", fn: "upper", args: [unaryCallArg(col, val.$upper)] };
|
|
3506
|
+
}
|
|
3507
|
+
if ("$lower" in val) {
|
|
3508
|
+
return { type: "call", fn: "lower", args: [unaryCallArg(col, val.$lower)] };
|
|
3509
|
+
}
|
|
3510
|
+
if ("$trim" in val) {
|
|
3511
|
+
return { type: "call", fn: "trim", args: [unaryCallArg(col, val.$trim)] };
|
|
3512
|
+
}
|
|
3513
|
+
if ("$concat" in val) {
|
|
3514
|
+
const parts = val.$concat;
|
|
3515
|
+
return {
|
|
3516
|
+
type: "call",
|
|
3517
|
+
fn: "concat",
|
|
3518
|
+
args: parts.map((p) => valueToExprNode(p))
|
|
3519
|
+
};
|
|
3520
|
+
}
|
|
3521
|
+
if ("$substring" in val) {
|
|
3522
|
+
const spec = val.$substring;
|
|
3523
|
+
if (Array.isArray(spec)) {
|
|
3524
|
+
return {
|
|
3525
|
+
type: "call",
|
|
3526
|
+
fn: "substring",
|
|
3527
|
+
args: [{ type: "colRef", col }, ...spec.map((p) => valueToExprNode(p))]
|
|
3528
|
+
};
|
|
3529
|
+
}
|
|
3530
|
+
return {
|
|
3531
|
+
type: "call",
|
|
3532
|
+
fn: "substring",
|
|
3533
|
+
args: [{ type: "colRef", col }, { type: "literal", value: spec }]
|
|
3534
|
+
};
|
|
3535
|
+
}
|
|
3536
|
+
if ("$round" in val) {
|
|
3537
|
+
return {
|
|
3538
|
+
type: "call",
|
|
3539
|
+
fn: "round",
|
|
3540
|
+
args: [
|
|
3541
|
+
{ type: "colRef", col },
|
|
3542
|
+
{ type: "literal", value: val.$round }
|
|
3543
|
+
]
|
|
3544
|
+
};
|
|
3545
|
+
}
|
|
3546
|
+
if ("$roundTo" in val) {
|
|
3547
|
+
return {
|
|
3548
|
+
type: "call",
|
|
3549
|
+
fn: "roundTo",
|
|
3550
|
+
args: [
|
|
3551
|
+
{ type: "colRef", col },
|
|
3552
|
+
{ type: "literal", value: val.$roundTo }
|
|
3553
|
+
]
|
|
3554
|
+
};
|
|
3555
|
+
}
|
|
3556
|
+
if ("$cast" in val) {
|
|
3557
|
+
return {
|
|
3558
|
+
type: "call",
|
|
3559
|
+
fn: "cast",
|
|
3560
|
+
args: [
|
|
3561
|
+
{ type: "colRef", col },
|
|
3562
|
+
{ type: "literal", value: val.$cast }
|
|
3563
|
+
]
|
|
3564
|
+
};
|
|
3565
|
+
}
|
|
3473
3566
|
throw new Error(
|
|
3474
3567
|
`Unknown expression operator in update() for column '${col}': ${JSON.stringify(val)}`
|
|
3475
3568
|
);
|
|
3476
3569
|
}
|
|
3570
|
+
function unaryCallArg(col, operand) {
|
|
3571
|
+
if (operand === true || operand === 1) {
|
|
3572
|
+
return { type: "colRef", col };
|
|
3573
|
+
}
|
|
3574
|
+
return valueToExprNode(operand);
|
|
3575
|
+
}
|
|
3576
|
+
function valueToExprNode(v) {
|
|
3577
|
+
if (typeof v === "string" && v.startsWith("$")) {
|
|
3578
|
+
return { type: "colRef", col: v.slice(1) };
|
|
3579
|
+
}
|
|
3580
|
+
return { type: "literal", value: v };
|
|
3581
|
+
}
|
|
3477
3582
|
|
|
3478
3583
|
// src/tables.ts
|
|
3479
3584
|
function validateNonEmptyString(value, name) {
|
|
@@ -4634,10 +4739,11 @@ function emptyStats() {
|
|
|
4634
4739
|
};
|
|
4635
4740
|
}
|
|
4636
4741
|
var NamedQueriesApi = class {
|
|
4637
|
-
constructor(transport, database, onWarning) {
|
|
4742
|
+
constructor(transport, database, onWarning, getStreamingTransport) {
|
|
4638
4743
|
this.transport = transport;
|
|
4639
4744
|
this.database = database;
|
|
4640
4745
|
this.onWarning = onWarning;
|
|
4746
|
+
this.getStreamingTransport = getStreamingTransport;
|
|
4641
4747
|
}
|
|
4642
4748
|
async execute(hash, args, options) {
|
|
4643
4749
|
if (typeof hash !== "string" || hash.trim().length === 0) {
|
|
@@ -4705,6 +4811,26 @@ var NamedQueriesApi = class {
|
|
|
4705
4811
|
return { isError: false, result };
|
|
4706
4812
|
});
|
|
4707
4813
|
}
|
|
4814
|
+
subscribe(hash, args, options = {}) {
|
|
4815
|
+
if (typeof hash !== "string" || hash.trim().length === 0) {
|
|
4816
|
+
throw new Error("Named query hash must be a non-empty string");
|
|
4817
|
+
}
|
|
4818
|
+
const subscription = new TableSubscription(
|
|
4819
|
+
this.getStreamingTransport(),
|
|
4820
|
+
{ kind: "named", hash, args },
|
|
4821
|
+
{
|
|
4822
|
+
onSnapshot: options.onSnapshot,
|
|
4823
|
+
onChange: options.onChange,
|
|
4824
|
+
onError: options.onError,
|
|
4825
|
+
conflate: options.conflate
|
|
4826
|
+
},
|
|
4827
|
+
(warnings) => {
|
|
4828
|
+
raiseDeprecationWarnings(this.onWarning, warnings);
|
|
4829
|
+
}
|
|
4830
|
+
);
|
|
4831
|
+
subscription.start();
|
|
4832
|
+
return subscription;
|
|
4833
|
+
}
|
|
4708
4834
|
};
|
|
4709
4835
|
var NamedMutationsApi = class {
|
|
4710
4836
|
constructor(transport, database, onWarning) {
|
|
@@ -4772,6 +4898,7 @@ var WebSocketTransport = class {
|
|
|
4772
4898
|
// Resolved/rejected when the auth handshake completes.
|
|
4773
4899
|
this._authResolve = null;
|
|
4774
4900
|
this._authReject = null;
|
|
4901
|
+
this._handshakeComplete = false;
|
|
4775
4902
|
this._serverUrl = serverUrl;
|
|
4776
4903
|
this._database = database;
|
|
4777
4904
|
this._authHandler = options.authHandler;
|
|
@@ -4781,6 +4908,11 @@ var WebSocketTransport = class {
|
|
|
4781
4908
|
this._maxMissedHeartbeats = options.maxMissedHeartbeats ?? DEFAULT_MAX_MISSED_HEARTBEATS;
|
|
4782
4909
|
this._enableCompression = options.enableCompression ?? true;
|
|
4783
4910
|
this._wireMode = options.wireMode ?? "json";
|
|
4911
|
+
this._authHandler?.setOnAccessTokenRefreshed((token) => {
|
|
4912
|
+
if (this._handshakeComplete && this._ws?.readyState === WS_READY_STATE_OPEN) {
|
|
4913
|
+
void this.send({ type: "re_auth", token });
|
|
4914
|
+
}
|
|
4915
|
+
});
|
|
4784
4916
|
}
|
|
4785
4917
|
// ─── Public API ────────────────────────────────────────────────────────────
|
|
4786
4918
|
/** Latest version number from the most recent server `heartbeat` message. */
|
|
@@ -4953,6 +5085,7 @@ var WebSocketTransport = class {
|
|
|
4953
5085
|
const resolve = this._authResolve;
|
|
4954
5086
|
this._authResolve = null;
|
|
4955
5087
|
this._authReject = null;
|
|
5088
|
+
this._handshakeComplete = true;
|
|
4956
5089
|
if (resolve) resolve();
|
|
4957
5090
|
break;
|
|
4958
5091
|
}
|
|
@@ -4979,10 +5112,15 @@ var WebSocketTransport = class {
|
|
|
4979
5112
|
break;
|
|
4980
5113
|
}
|
|
4981
5114
|
const id = "id" in msg ? msg.id : void 0;
|
|
4982
|
-
if (id !== void 0 && id !== null) {
|
|
5115
|
+
if (id !== void 0 && id !== null && id !== "") {
|
|
4983
5116
|
this._handlers.get(id)?.(msg);
|
|
4984
5117
|
} else {
|
|
4985
5118
|
this._handlers.get("__global__")?.(msg);
|
|
5119
|
+
for (const [key, handler] of this._handlers) {
|
|
5120
|
+
if (key !== "__global__") {
|
|
5121
|
+
handler(msg);
|
|
5122
|
+
}
|
|
5123
|
+
}
|
|
4986
5124
|
}
|
|
4987
5125
|
}
|
|
4988
5126
|
// ─── Internal: reconnect ──────────────────────────────────────────────────
|
|
@@ -5516,7 +5654,8 @@ var AoudaClient = class {
|
|
|
5516
5654
|
this._namedQueries = new NamedQueriesApi(
|
|
5517
5655
|
this.transport,
|
|
5518
5656
|
this.database,
|
|
5519
|
-
onNamedArtifactWarning
|
|
5657
|
+
onNamedArtifactWarning,
|
|
5658
|
+
() => this._getOrCreateWebSocketTransport()
|
|
5520
5659
|
);
|
|
5521
5660
|
this._namedMutations = new NamedMutationsApi(
|
|
5522
5661
|
this.transport,
|