@aouda/client 0.1.9 → 0.1.10

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.
@@ -305,6 +305,18 @@ interface AoudaClientOptions {
305
305
  */
306
306
  longPollWaitMs?: number;
307
307
  };
308
+ /**
309
+ * Invoked when a named query or named mutation result carries a deprecation warning.
310
+ * Defaults to `console.warn`. The call still succeeds (D-5).
311
+ */
312
+ onNamedArtifactWarning?: (warning: NamedArtifactWarning) => void;
313
+ }
314
+ /** Deprecation (or similar) warning from a named query or named mutation. */
315
+ interface NamedArtifactWarning {
316
+ code: string;
317
+ hash?: string;
318
+ sunsetAt?: string;
319
+ message: string;
308
320
  }
309
321
  /**
310
322
  * Health status response from the Aouda server.
@@ -430,6 +442,14 @@ interface QueryResult<T = Record<string, unknown>> {
430
442
  rows: T[];
431
443
  /** Query execution statistics. */
432
444
  stats: QueryStats;
445
+ /** Additive warnings (e.g. named-query deprecation). */
446
+ warnings?: ResultWarning[];
447
+ }
448
+ /** Additive result warning from the server. */
449
+ interface ResultWarning {
450
+ code: string;
451
+ hash?: string;
452
+ sunsetAt?: string;
433
453
  }
434
454
  /**
435
455
  * Wire protocol comparison operators.
@@ -505,6 +525,7 @@ interface ColumnarResponse {
505
525
  data: unknown[][];
506
526
  rowCount: number;
507
527
  stats: QueryStats;
528
+ warnings?: ResultWarning[];
508
529
  }
509
530
  /**
510
531
  * Summary of a table returned by list().
@@ -2453,6 +2474,18 @@ interface SnapshotMessage {
2453
2474
  rows: unknown[];
2454
2475
  version: number;
2455
2476
  }
2477
+ interface SnapshotCompleteMessage {
2478
+ type: "snapshot_complete";
2479
+ id: string;
2480
+ version: number;
2481
+ row_count: number;
2482
+ }
2483
+ interface GapMessage {
2484
+ type: "gap";
2485
+ id: string;
2486
+ last_seq: number;
2487
+ discarded: number;
2488
+ }
2456
2489
  interface ChangeMessage {
2457
2490
  type: "change";
2458
2491
  id: string;
@@ -2488,7 +2521,7 @@ interface ServerErrorMessage {
2488
2521
  interface PongMessage {
2489
2522
  type: "pong";
2490
2523
  }
2491
- type ServerMessage = AuthOkMessage | AuthErrorMessage | SnapshotMessage | ChangeMessage | StreamAckMessage | StreamReadyMessage | StreamClosedMessage | HeartbeatMessage | ServerErrorMessage | PongMessage;
2524
+ type ServerMessage = AuthOkMessage | AuthErrorMessage | SnapshotMessage | SnapshotCompleteMessage | GapMessage | ChangeMessage | StreamAckMessage | StreamReadyMessage | StreamClosedMessage | HeartbeatMessage | ServerErrorMessage | PongMessage;
2492
2525
 
2493
2526
  type StreamingMessageHandler = (message: ServerMessage) => void;
2494
2527
  interface StreamingTransport {
@@ -2614,6 +2647,13 @@ interface QueryBuilderState {
2614
2647
  * All other types: passed through unchanged.
2615
2648
  */
2616
2649
  declare function coerceColumnarValue(value: unknown, typeName: string): unknown;
2650
+ /**
2651
+ * Converts columnar response data to an array of row objects.
2652
+ * Uses `response.types` to apply type-aware coercions (e.g. Timestamp ticks → ISO string).
2653
+ * @param response - The columnar response from the server.
2654
+ * @returns Array of row objects.
2655
+ */
2656
+ declare function columnarToRows<T>(response: ColumnarResponse): T[];
2617
2657
  /**
2618
2658
  * Fluent query builder for Aouda tables.
2619
2659
  *
@@ -3552,6 +3592,46 @@ declare class MaterializedQueriesApi {
3552
3592
  query(name: string, _options?: MaterializedQueryExecuteOptions): Promise<MaterializedQueryExecuteResult>;
3553
3593
  }
3554
3594
 
3595
+ /**
3596
+ * Hash-only named-query / named-mutation client API (D-5, D-28).
3597
+ */
3598
+
3599
+ interface NamedQueryExecuteOptions {
3600
+ signal?: AbortSignal;
3601
+ }
3602
+ interface NamedQueryBatchItem {
3603
+ hash: string;
3604
+ args?: Record<string, unknown>;
3605
+ }
3606
+ interface NamedQueryBatchSlotResult<T = Record<string, unknown>> {
3607
+ isError: boolean;
3608
+ code?: string;
3609
+ error?: string;
3610
+ result?: QueryResult<T>;
3611
+ }
3612
+ interface NamedMutationResult {
3613
+ op: string;
3614
+ rowsAffected: number;
3615
+ returning?: QueryResult<Record<string, unknown>>;
3616
+ warnings?: ResultWarning[];
3617
+ }
3618
+ type NamedArtifactWarningSink = (warning: NamedArtifactWarning) => void;
3619
+ declare class NamedQueriesApi {
3620
+ private readonly transport;
3621
+ private readonly database;
3622
+ private readonly onWarning;
3623
+ constructor(transport: Transport, database: string, onWarning: NamedArtifactWarningSink);
3624
+ execute<T = Record<string, unknown>>(hash: string, args?: Record<string, unknown>, options?: NamedQueryExecuteOptions): Promise<QueryResult<T>>;
3625
+ batch<T = Record<string, unknown>>(items: NamedQueryBatchItem[], options?: NamedQueryExecuteOptions): Promise<NamedQueryBatchSlotResult<T>[]>;
3626
+ }
3627
+ declare class NamedMutationsApi {
3628
+ private readonly transport;
3629
+ private readonly database;
3630
+ private readonly onWarning;
3631
+ constructor(transport: Transport, database: string, onWarning: NamedArtifactWarningSink);
3632
+ execute(hash: string, args?: Record<string, unknown>): Promise<NamedMutationResult>;
3633
+ }
3634
+
3555
3635
  /**
3556
3636
  * @aouda/client — AoudaClient implementation.
3557
3637
  */
@@ -3587,6 +3667,8 @@ declare class AoudaClient<S extends SchemaLike = DefaultSchema> {
3587
3667
  private readonly _branches;
3588
3668
  private readonly _admin;
3589
3669
  private readonly _materializedQueries;
3670
+ private readonly _namedQueries;
3671
+ private readonly _namedMutations;
3590
3672
  private readonly _auth;
3591
3673
  private readonly _authHandler;
3592
3674
  private readonly _streamingEnableCompression;
@@ -3694,6 +3776,14 @@ declare class AoudaClient<S extends SchemaLike = DefaultSchema> {
3694
3776
  * Materialized query lifecycle (list, create, drop, status, query).
3695
3777
  */
3696
3778
  get materializedQueries(): MaterializedQueriesApi;
3779
+ /**
3780
+ * Hash-only named-query execute and batch. Names are codegen aliases (D-5).
3781
+ */
3782
+ get namedQueries(): NamedQueriesApi;
3783
+ /**
3784
+ * Hash-only named-mutation execute. No batch.
3785
+ */
3786
+ get namedMutations(): NamedMutationsApi;
3697
3787
  /**
3698
3788
  * Access auth operations (signUp, signIn, signOut, refresh, me, changePassword).
3699
3789
  * @returns The auth API.
@@ -3794,4 +3884,4 @@ declare class AoudaClient<S extends SchemaLike = DefaultSchema> {
3794
3884
  */
3795
3885
  declare function createAoudaClient<S extends SchemaLike = DefaultSchema>(options: AoudaClientOptions): AoudaClient<S>;
3796
3886
 
3797
- 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, type WalMetrics as cc, WhereGroupBuilder as cd, type WhereOperator as ce, type WriteStream as cf, coerceColumnarValue as cg, createAoudaClient as ch, 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 };
3887
+ 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 SubscriptionInfo as b$, type MetricsSummary as b0, type MutationResult as b1, type NamedArtifactWarning as b2, type NamedMutationResult as b3, NamedMutationsApi as b4, NamedQueriesApi as b5, type NamedQueryBatchItem as b6, type NamedQueryBatchSlotResult as b7, type NamedQueryExecuteOptions as b8, NodeAdminApi as b9, type ReplicationMetrics as bA, type ResidencyConfig as bB, type ResultWarning as bC, RetryPolicy as bD, type RlsResolver as bE, type RlsResolverRule as bF, type RlsResolverRuleInput as bG, type RlsResolversListResponse as bH, type SchemaChange as bI, type SchemaChangeType as bJ, type SchemaDiffResult as bK, type SchemaRelationshipsResponse as bL, type SeedApplyResult as bM, type SeedTableApplyResult as bN, ServerAdminApi as bO, type ServerAuthOptions as bP, type ServerMemoryResponse as bQ, type ServerMetricsResponse as bR, type ServiceInfo as bS, type SimdMetrics as bT, type SingleDatabaseMetricsResponse as bU, type SortDirection as bV, type StorageMetrics as bW, type SubscribeOptions as bX, type Subscription as bY, type SubscriptionChangeEvent as bZ, type SubscriptionEvent as b_, type NodeLogEntry as ba, type NodeLogLevel as bb, type NodeLogStreamOptions as bc, type NodeLogsQuery as bd, type NodeLogsResponse as be, type OpenWriteStreamOptions as bf, type PageCacheMetrics as bg, type PartitionFunction as bh, type PartitionGrant as bi, type PartitionGrantsListResponse as bj, type PartitioningMetrics as bk, type PendingJobListResponse as bl, type PendingJobResponse as bm, type PerDatabaseLagEntry as bn, type PerDatabaseMetrics as bo, type PerDatabaseStatusEntry as bp, type QueryMetrics as bq, type QueryResult as br, type QueryStats as bs, type ReferenceInfo as bt, type RelationshipEndpoint as bu, type RelationshipInfo as bv, type RenameColumnRequest as bw, type RenameTableRequest as bx, type ReorderColumnsRequest as by, ReplicationAdminApi as bz, type ReadinessResponse as c, type SubscriptionSnapshotEvent as c0, TIME_BUCKET_FUNCTIONS as c1, type TableCoverageEntry as c2, type TableNameFromSchema as c3, type TablePolicy as c4, TableQuery as c5, type TableSchema as c6, type TableSchemaResponse as c7, type TableSummary as c8, type TableSummaryForErd as c9, TablesApi as ca, type TimeBucketFunction as cb, type TimeSeriesMetrics as cc, type TransactionMetrics as cd, type TypeGenerationOptions as ce, type UpdateOptions as cf, type UpdateRlsResolverRequest as cg, type UpdateTableOptionsRequest as ch, type UpdateTablePolicyRequest as ci, type UserProfile as cj, type WalMetrics as ck, WhereGroupBuilder as cl, type WhereOperator as cm, type WriteStream as cn, coerceColumnarValue as co, columnarToRows as cp, createAoudaClient as cq, 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 };
@@ -305,6 +305,18 @@ interface AoudaClientOptions {
305
305
  */
306
306
  longPollWaitMs?: number;
307
307
  };
308
+ /**
309
+ * Invoked when a named query or named mutation result carries a deprecation warning.
310
+ * Defaults to `console.warn`. The call still succeeds (D-5).
311
+ */
312
+ onNamedArtifactWarning?: (warning: NamedArtifactWarning) => void;
313
+ }
314
+ /** Deprecation (or similar) warning from a named query or named mutation. */
315
+ interface NamedArtifactWarning {
316
+ code: string;
317
+ hash?: string;
318
+ sunsetAt?: string;
319
+ message: string;
308
320
  }
309
321
  /**
310
322
  * Health status response from the Aouda server.
@@ -430,6 +442,14 @@ interface QueryResult<T = Record<string, unknown>> {
430
442
  rows: T[];
431
443
  /** Query execution statistics. */
432
444
  stats: QueryStats;
445
+ /** Additive warnings (e.g. named-query deprecation). */
446
+ warnings?: ResultWarning[];
447
+ }
448
+ /** Additive result warning from the server. */
449
+ interface ResultWarning {
450
+ code: string;
451
+ hash?: string;
452
+ sunsetAt?: string;
433
453
  }
434
454
  /**
435
455
  * Wire protocol comparison operators.
@@ -505,6 +525,7 @@ interface ColumnarResponse {
505
525
  data: unknown[][];
506
526
  rowCount: number;
507
527
  stats: QueryStats;
528
+ warnings?: ResultWarning[];
508
529
  }
509
530
  /**
510
531
  * Summary of a table returned by list().
@@ -2453,6 +2474,18 @@ interface SnapshotMessage {
2453
2474
  rows: unknown[];
2454
2475
  version: number;
2455
2476
  }
2477
+ interface SnapshotCompleteMessage {
2478
+ type: "snapshot_complete";
2479
+ id: string;
2480
+ version: number;
2481
+ row_count: number;
2482
+ }
2483
+ interface GapMessage {
2484
+ type: "gap";
2485
+ id: string;
2486
+ last_seq: number;
2487
+ discarded: number;
2488
+ }
2456
2489
  interface ChangeMessage {
2457
2490
  type: "change";
2458
2491
  id: string;
@@ -2488,7 +2521,7 @@ interface ServerErrorMessage {
2488
2521
  interface PongMessage {
2489
2522
  type: "pong";
2490
2523
  }
2491
- type ServerMessage = AuthOkMessage | AuthErrorMessage | SnapshotMessage | ChangeMessage | StreamAckMessage | StreamReadyMessage | StreamClosedMessage | HeartbeatMessage | ServerErrorMessage | PongMessage;
2524
+ type ServerMessage = AuthOkMessage | AuthErrorMessage | SnapshotMessage | SnapshotCompleteMessage | GapMessage | ChangeMessage | StreamAckMessage | StreamReadyMessage | StreamClosedMessage | HeartbeatMessage | ServerErrorMessage | PongMessage;
2492
2525
 
2493
2526
  type StreamingMessageHandler = (message: ServerMessage) => void;
2494
2527
  interface StreamingTransport {
@@ -2614,6 +2647,13 @@ interface QueryBuilderState {
2614
2647
  * All other types: passed through unchanged.
2615
2648
  */
2616
2649
  declare function coerceColumnarValue(value: unknown, typeName: string): unknown;
2650
+ /**
2651
+ * Converts columnar response data to an array of row objects.
2652
+ * Uses `response.types` to apply type-aware coercions (e.g. Timestamp ticks → ISO string).
2653
+ * @param response - The columnar response from the server.
2654
+ * @returns Array of row objects.
2655
+ */
2656
+ declare function columnarToRows<T>(response: ColumnarResponse): T[];
2617
2657
  /**
2618
2658
  * Fluent query builder for Aouda tables.
2619
2659
  *
@@ -3552,6 +3592,46 @@ declare class MaterializedQueriesApi {
3552
3592
  query(name: string, _options?: MaterializedQueryExecuteOptions): Promise<MaterializedQueryExecuteResult>;
3553
3593
  }
3554
3594
 
3595
+ /**
3596
+ * Hash-only named-query / named-mutation client API (D-5, D-28).
3597
+ */
3598
+
3599
+ interface NamedQueryExecuteOptions {
3600
+ signal?: AbortSignal;
3601
+ }
3602
+ interface NamedQueryBatchItem {
3603
+ hash: string;
3604
+ args?: Record<string, unknown>;
3605
+ }
3606
+ interface NamedQueryBatchSlotResult<T = Record<string, unknown>> {
3607
+ isError: boolean;
3608
+ code?: string;
3609
+ error?: string;
3610
+ result?: QueryResult<T>;
3611
+ }
3612
+ interface NamedMutationResult {
3613
+ op: string;
3614
+ rowsAffected: number;
3615
+ returning?: QueryResult<Record<string, unknown>>;
3616
+ warnings?: ResultWarning[];
3617
+ }
3618
+ type NamedArtifactWarningSink = (warning: NamedArtifactWarning) => void;
3619
+ declare class NamedQueriesApi {
3620
+ private readonly transport;
3621
+ private readonly database;
3622
+ private readonly onWarning;
3623
+ constructor(transport: Transport, database: string, onWarning: NamedArtifactWarningSink);
3624
+ execute<T = Record<string, unknown>>(hash: string, args?: Record<string, unknown>, options?: NamedQueryExecuteOptions): Promise<QueryResult<T>>;
3625
+ batch<T = Record<string, unknown>>(items: NamedQueryBatchItem[], options?: NamedQueryExecuteOptions): Promise<NamedQueryBatchSlotResult<T>[]>;
3626
+ }
3627
+ declare class NamedMutationsApi {
3628
+ private readonly transport;
3629
+ private readonly database;
3630
+ private readonly onWarning;
3631
+ constructor(transport: Transport, database: string, onWarning: NamedArtifactWarningSink);
3632
+ execute(hash: string, args?: Record<string, unknown>): Promise<NamedMutationResult>;
3633
+ }
3634
+
3555
3635
  /**
3556
3636
  * @aouda/client — AoudaClient implementation.
3557
3637
  */
@@ -3587,6 +3667,8 @@ declare class AoudaClient<S extends SchemaLike = DefaultSchema> {
3587
3667
  private readonly _branches;
3588
3668
  private readonly _admin;
3589
3669
  private readonly _materializedQueries;
3670
+ private readonly _namedQueries;
3671
+ private readonly _namedMutations;
3590
3672
  private readonly _auth;
3591
3673
  private readonly _authHandler;
3592
3674
  private readonly _streamingEnableCompression;
@@ -3694,6 +3776,14 @@ declare class AoudaClient<S extends SchemaLike = DefaultSchema> {
3694
3776
  * Materialized query lifecycle (list, create, drop, status, query).
3695
3777
  */
3696
3778
  get materializedQueries(): MaterializedQueriesApi;
3779
+ /**
3780
+ * Hash-only named-query execute and batch. Names are codegen aliases (D-5).
3781
+ */
3782
+ get namedQueries(): NamedQueriesApi;
3783
+ /**
3784
+ * Hash-only named-mutation execute. No batch.
3785
+ */
3786
+ get namedMutations(): NamedMutationsApi;
3697
3787
  /**
3698
3788
  * Access auth operations (signUp, signIn, signOut, refresh, me, changePassword).
3699
3789
  * @returns The auth API.
@@ -3794,4 +3884,4 @@ declare class AoudaClient<S extends SchemaLike = DefaultSchema> {
3794
3884
  */
3795
3885
  declare function createAoudaClient<S extends SchemaLike = DefaultSchema>(options: AoudaClientOptions): AoudaClient<S>;
3796
3886
 
3797
- 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, type WalMetrics as cc, WhereGroupBuilder as cd, type WhereOperator as ce, type WriteStream as cf, coerceColumnarValue as cg, createAoudaClient as ch, 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 };
3887
+ 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 SubscriptionInfo as b$, type MetricsSummary as b0, type MutationResult as b1, type NamedArtifactWarning as b2, type NamedMutationResult as b3, NamedMutationsApi as b4, NamedQueriesApi as b5, type NamedQueryBatchItem as b6, type NamedQueryBatchSlotResult as b7, type NamedQueryExecuteOptions as b8, NodeAdminApi as b9, type ReplicationMetrics as bA, type ResidencyConfig as bB, type ResultWarning as bC, RetryPolicy as bD, type RlsResolver as bE, type RlsResolverRule as bF, type RlsResolverRuleInput as bG, type RlsResolversListResponse as bH, type SchemaChange as bI, type SchemaChangeType as bJ, type SchemaDiffResult as bK, type SchemaRelationshipsResponse as bL, type SeedApplyResult as bM, type SeedTableApplyResult as bN, ServerAdminApi as bO, type ServerAuthOptions as bP, type ServerMemoryResponse as bQ, type ServerMetricsResponse as bR, type ServiceInfo as bS, type SimdMetrics as bT, type SingleDatabaseMetricsResponse as bU, type SortDirection as bV, type StorageMetrics as bW, type SubscribeOptions as bX, type Subscription as bY, type SubscriptionChangeEvent as bZ, type SubscriptionEvent as b_, type NodeLogEntry as ba, type NodeLogLevel as bb, type NodeLogStreamOptions as bc, type NodeLogsQuery as bd, type NodeLogsResponse as be, type OpenWriteStreamOptions as bf, type PageCacheMetrics as bg, type PartitionFunction as bh, type PartitionGrant as bi, type PartitionGrantsListResponse as bj, type PartitioningMetrics as bk, type PendingJobListResponse as bl, type PendingJobResponse as bm, type PerDatabaseLagEntry as bn, type PerDatabaseMetrics as bo, type PerDatabaseStatusEntry as bp, type QueryMetrics as bq, type QueryResult as br, type QueryStats as bs, type ReferenceInfo as bt, type RelationshipEndpoint as bu, type RelationshipInfo as bv, type RenameColumnRequest as bw, type RenameTableRequest as bx, type ReorderColumnsRequest as by, ReplicationAdminApi as bz, type ReadinessResponse as c, type SubscriptionSnapshotEvent as c0, TIME_BUCKET_FUNCTIONS as c1, type TableCoverageEntry as c2, type TableNameFromSchema as c3, type TablePolicy as c4, TableQuery as c5, type TableSchema as c6, type TableSchemaResponse as c7, type TableSummary as c8, type TableSummaryForErd as c9, TablesApi as ca, type TimeBucketFunction as cb, type TimeSeriesMetrics as cc, type TransactionMetrics as cd, type TypeGenerationOptions as ce, type UpdateOptions as cf, type UpdateRlsResolverRequest as cg, type UpdateTableOptionsRequest as ch, type UpdateTablePolicyRequest as ci, type UserProfile as cj, type WalMetrics as ck, WhereGroupBuilder as cl, type WhereOperator as cm, type WriteStream as cn, coerceColumnarValue as co, columnarToRows as cp, createAoudaClient as cq, 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
@@ -61,6 +61,8 @@ __export(index_exports, {
61
61
  MaterializedQueryState: () => MaterializedQueryState,
62
62
  MaterializedQueryType: () => MaterializedQueryType,
63
63
  MetricsAdminApi: () => MetricsAdminApi,
64
+ NamedMutationsApi: () => NamedMutationsApi,
65
+ NamedQueriesApi: () => NamedQueriesApi,
64
66
  NodeAdminApi: () => NodeAdminApi,
65
67
  ReplicationAdminApi: () => ReplicationAdminApi,
66
68
  RetryPolicy: () => RetryPolicy,
@@ -71,6 +73,7 @@ __export(index_exports, {
71
73
  WhereGroupBuilder: () => WhereGroupBuilder,
72
74
  applyLocalNetworkAccess: () => applyLocalNetworkAccess,
73
75
  coerceColumnarValue: () => coerceColumnarValue,
76
+ columnarToRows: () => columnarToRows,
74
77
  createAoudaClient: () => createAoudaClient,
75
78
  createAoudaClusterMcpToolSet: () => createAoudaClusterMcpToolSet,
76
79
  installLocalNetworkFetch: () => installLocalNetworkFetch,
@@ -83,7 +86,7 @@ module.exports = __toCommonJS(index_exports);
83
86
  // package.json
84
87
  var package_default = {
85
88
  name: "@aouda/client",
86
- version: "0.1.9",
89
+ version: "0.1.10",
87
90
  description: "Official TypeScript/JavaScript client library for Aouda",
88
91
  type: "module",
89
92
  main: "./dist/index.cjs",
@@ -1207,7 +1210,15 @@ var ERROR_CODE_MAP = {
1207
1210
  AUTH_TOKEN_INVALID: AoudaAuthenticationError,
1208
1211
  AUTH_TOKEN_REVOKED: AoudaAuthenticationError,
1209
1212
  AUTH_API_KEY_INVALID: AoudaAuthenticationError,
1210
- AUTH_REQUIRED: AoudaAuthenticationError
1213
+ AUTH_REQUIRED: AoudaAuthenticationError,
1214
+ NAMED_QUERY_NOT_FOUND: AoudaNotFoundError,
1215
+ NAMED_MUTATION_NOT_FOUND: AoudaNotFoundError,
1216
+ NAMED_QUERY_BATCH_EMPTY: AoudaValidationError,
1217
+ NAMED_QUERY_BATCH_TOO_LARGE: AoudaValidationError,
1218
+ NAMED_QUERY_BATCH_MUTATION: AoudaValidationError,
1219
+ NAMED_QUERY_BIND_FAILED: AoudaValidationError,
1220
+ NAMED_QUERY_PARAM_REQUIRED: AoudaValidationError,
1221
+ NAMED_MUTATION_BIND_FAILED: AoudaValidationError
1211
1222
  };
1212
1223
  function createComposedAbortController(...signals) {
1213
1224
  const controller = new AbortController();
@@ -2100,6 +2111,7 @@ var TableSubscription = class {
2100
2111
  this._started = false;
2101
2112
  this._startPromise = null;
2102
2113
  this._lastVersion = 0;
2114
+ this._pendingSnapshotRows = [];
2103
2115
  this.id = createStreamingId("sub");
2104
2116
  this._transport = transport;
2105
2117
  this._tableName = tableName;
@@ -2156,6 +2168,7 @@ var TableSubscription = class {
2156
2168
  return;
2157
2169
  }
2158
2170
  try {
2171
+ this._pendingSnapshotRows = [];
2159
2172
  const resumeFrom = this._lastVersion > 0 ? this._lastVersion : void 0;
2160
2173
  await this._sendSubscribe(resumeFrom);
2161
2174
  } catch (error) {
@@ -2184,7 +2197,13 @@ var TableSubscription = class {
2184
2197
  }
2185
2198
  switch (message.type) {
2186
2199
  case "snapshot":
2187
- this._handleSnapshot(message);
2200
+ this._handleSnapshotPage(message);
2201
+ return;
2202
+ case "snapshot_complete":
2203
+ this._handleSnapshotComplete(message);
2204
+ return;
2205
+ case "gap":
2206
+ void this._handleGap(message);
2188
2207
  return;
2189
2208
  case "change":
2190
2209
  this._handleChange(message);
@@ -2196,9 +2215,13 @@ var TableSubscription = class {
2196
2215
  return;
2197
2216
  }
2198
2217
  }
2199
- _handleSnapshot(message) {
2218
+ _handleSnapshotPage(message) {
2219
+ this._pendingSnapshotRows.push(...message.rows);
2220
+ }
2221
+ _handleSnapshotComplete(message) {
2200
2222
  this._lastVersion = message.version;
2201
- const rows = message.rows;
2223
+ const rows = this._pendingSnapshotRows;
2224
+ this._pendingSnapshotRows = [];
2202
2225
  this._onSnapshot?.(rows, message.version);
2203
2226
  this._queue.push({
2204
2227
  type: "snapshot",
@@ -2206,6 +2229,16 @@ var TableSubscription = class {
2206
2229
  version: message.version
2207
2230
  });
2208
2231
  }
2232
+ async _handleGap(message) {
2233
+ this._pendingSnapshotRows = [];
2234
+ this._lastVersion = message.last_seq;
2235
+ try {
2236
+ await this._sendSubscribe(message.last_seq);
2237
+ } catch (error) {
2238
+ const wrapped = error instanceof Error ? error : new AoudaConnectionError("Subscription gap resume failed");
2239
+ this._notifyError(wrapped);
2240
+ }
2241
+ }
2209
2242
  _handleChange(message) {
2210
2243
  this._lastVersion = message.version;
2211
2244
  const event = {
@@ -2220,6 +2253,7 @@ var TableSubscription = class {
2220
2253
  this._queue.push(event);
2221
2254
  }
2222
2255
  _handleServerError(message) {
2256
+ this._pendingSnapshotRows = [];
2223
2257
  const error = new AoudaConnectionError(
2224
2258
  `Subscription error (${message.code}): ${message.message}`
2225
2259
  );
@@ -4658,6 +4692,147 @@ var MaterializedQueriesApi = class {
4658
4692
  }
4659
4693
  };
4660
4694
 
4695
+ // src/named-queries.ts
4696
+ var MAX_NAMED_QUERY_BATCH_SIZE = 32;
4697
+ function raiseDeprecationWarnings(sink, warnings) {
4698
+ if (warnings == null) return;
4699
+ for (const warning of warnings) {
4700
+ if (warning.code !== "NAMED_QUERY_DEPRECATED" && warning.code !== "NAMED_MUTATION_DEPRECATED") {
4701
+ continue;
4702
+ }
4703
+ const sunset = warning.sunsetAt != null ? ` sunsetAt=${warning.sunsetAt}` : "";
4704
+ const hash = warning.hash != null && warning.hash.length > 0 ? ` hash=${warning.hash}` : "";
4705
+ sink({
4706
+ code: warning.code,
4707
+ hash: warning.hash,
4708
+ sunsetAt: warning.sunsetAt,
4709
+ message: `${warning.code}:${hash}${sunset}`.trim()
4710
+ });
4711
+ }
4712
+ }
4713
+ function emptyStats() {
4714
+ return {
4715
+ rowsScanned: 0,
4716
+ rowsReturned: 0,
4717
+ segmentsAccessed: 0,
4718
+ executionMs: 0
4719
+ };
4720
+ }
4721
+ var NamedQueriesApi = class {
4722
+ constructor(transport, database, onWarning) {
4723
+ this.transport = transport;
4724
+ this.database = database;
4725
+ this.onWarning = onWarning;
4726
+ }
4727
+ async execute(hash, args, options) {
4728
+ if (typeof hash !== "string" || hash.trim().length === 0) {
4729
+ throw new Error("Named query hash must be a non-empty string");
4730
+ }
4731
+ const prefix = databasePath2(this.database);
4732
+ const path = `${prefix}/named-queries/${encodeURIComponent(hash)}/query?format=columnar`;
4733
+ const response = await this.transport.post(
4734
+ path,
4735
+ { args: args ?? {} },
4736
+ { signal: options?.signal }
4737
+ );
4738
+ const rows = columnarToRows(response);
4739
+ raiseDeprecationWarnings(this.onWarning, response.warnings);
4740
+ return {
4741
+ rows,
4742
+ stats: response.stats,
4743
+ warnings: response.warnings
4744
+ };
4745
+ }
4746
+ async batch(items, options) {
4747
+ if (items.length === 0) {
4748
+ throw new AoudaValidationError(
4749
+ "Named query batch requires a non-empty queries array.",
4750
+ "NAMED_QUERY_BATCH_EMPTY",
4751
+ 400
4752
+ );
4753
+ }
4754
+ if (items.length > MAX_NAMED_QUERY_BATCH_SIZE) {
4755
+ throw new AoudaValidationError(
4756
+ `Named query batch exceeds ${MAX_NAMED_QUERY_BATCH_SIZE} elements.`,
4757
+ "NAMED_QUERY_BATCH_TOO_LARGE",
4758
+ 400
4759
+ );
4760
+ }
4761
+ const prefix = databasePath2(this.database);
4762
+ const path = `${prefix}/named-queries/batch?format=columnar`;
4763
+ const envelope = await this.transport.post(
4764
+ path,
4765
+ { queries: items },
4766
+ { signal: options?.signal }
4767
+ );
4768
+ return (envelope.results ?? []).map((slot) => {
4769
+ if (slot.code != null && slot.code.length > 0) {
4770
+ return {
4771
+ isError: true,
4772
+ code: slot.code,
4773
+ error: slot.error
4774
+ };
4775
+ }
4776
+ const columnar = {
4777
+ columns: slot.columns ?? [],
4778
+ types: slot.types ?? [],
4779
+ data: slot.data ?? [],
4780
+ rowCount: slot.rowCount ?? 0,
4781
+ stats: slot.stats ?? emptyStats(),
4782
+ warnings: slot.warnings
4783
+ };
4784
+ const result = {
4785
+ rows: columnarToRows(columnar),
4786
+ stats: columnar.stats,
4787
+ warnings: slot.warnings
4788
+ };
4789
+ raiseDeprecationWarnings(this.onWarning, slot.warnings);
4790
+ return { isError: false, result };
4791
+ });
4792
+ }
4793
+ };
4794
+ var NamedMutationsApi = class {
4795
+ constructor(transport, database, onWarning) {
4796
+ this.transport = transport;
4797
+ this.database = database;
4798
+ this.onWarning = onWarning;
4799
+ }
4800
+ async execute(hash, args) {
4801
+ if (typeof hash !== "string" || hash.trim().length === 0) {
4802
+ throw new Error("Named mutation hash must be a non-empty string");
4803
+ }
4804
+ const prefix = databasePath2(this.database);
4805
+ const path = `${prefix}/named-mutations/${encodeURIComponent(hash)}/execute`;
4806
+ const wire = await this.transport.post(path, {
4807
+ args: args ?? {}
4808
+ });
4809
+ let op = "unknown";
4810
+ let rowsAffected = 0;
4811
+ if (wire.rowsInserted != null) {
4812
+ op = "insert";
4813
+ rowsAffected = wire.rowsInserted;
4814
+ } else if (wire.rowsUpdated != null) {
4815
+ op = "update";
4816
+ rowsAffected = wire.rowsUpdated;
4817
+ } else if (wire.rowsDeleted != null) {
4818
+ op = "delete";
4819
+ rowsAffected = wire.rowsDeleted;
4820
+ }
4821
+ raiseDeprecationWarnings(this.onWarning, wire.warnings);
4822
+ const returning = wire.rows == null ? void 0 : {
4823
+ rows: columnarToRows(wire.rows),
4824
+ stats: wire.rows.stats,
4825
+ warnings: wire.rows.warnings
4826
+ };
4827
+ return {
4828
+ op,
4829
+ rowsAffected,
4830
+ returning,
4831
+ warnings: wire.warnings
4832
+ };
4833
+ }
4834
+ };
4835
+
4661
4836
  // src/streaming/websocket-transport.ts
4662
4837
  var import_msgpack = require("@msgpack/msgpack");
4663
4838
  var DEFAULT_PING_INTERVAL_MS = 2e4;
@@ -5420,6 +5595,19 @@ var AoudaClient = class {
5420
5595
  this.transport,
5421
5596
  this.database
5422
5597
  );
5598
+ const onNamedArtifactWarning = options.onNamedArtifactWarning ?? ((warning) => {
5599
+ console.warn(warning.message);
5600
+ });
5601
+ this._namedQueries = new NamedQueriesApi(
5602
+ this.transport,
5603
+ this.database,
5604
+ onNamedArtifactWarning
5605
+ );
5606
+ this._namedMutations = new NamedMutationsApi(
5607
+ this.transport,
5608
+ this.database,
5609
+ onNamedArtifactWarning
5610
+ );
5423
5611
  }
5424
5612
  /**
5425
5613
  * Connects to the Aouda server.
@@ -5562,6 +5750,18 @@ var AoudaClient = class {
5562
5750
  get materializedQueries() {
5563
5751
  return this._materializedQueries;
5564
5752
  }
5753
+ /**
5754
+ * Hash-only named-query execute and batch. Names are codegen aliases (D-5).
5755
+ */
5756
+ get namedQueries() {
5757
+ return this._namedQueries;
5758
+ }
5759
+ /**
5760
+ * Hash-only named-mutation execute. No batch.
5761
+ */
5762
+ get namedMutations() {
5763
+ return this._namedMutations;
5764
+ }
5565
5765
  /**
5566
5766
  * Access auth operations (signUp, signIn, signOut, refresh, me, changePassword).
5567
5767
  * @returns The auth API.
@@ -5983,6 +6183,8 @@ var version = package_default.version;
5983
6183
  MaterializedQueryState,
5984
6184
  MaterializedQueryType,
5985
6185
  MetricsAdminApi,
6186
+ NamedMutationsApi,
6187
+ NamedQueriesApi,
5986
6188
  NodeAdminApi,
5987
6189
  ReplicationAdminApi,
5988
6190
  RetryPolicy,
@@ -5993,6 +6195,7 @@ var version = package_default.version;
5993
6195
  WhereGroupBuilder,
5994
6196
  applyLocalNetworkAccess,
5995
6197
  coerceColumnarValue,
6198
+ columnarToRows,
5996
6199
  createAoudaClient,
5997
6200
  createAoudaClusterMcpToolSet,
5998
6201
  installLocalNetworkFetch,