@aouda/client 0.1.13 → 0.1.14

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.
@@ -432,6 +432,8 @@ interface QueryStats {
432
432
  segmentsAccessed: number;
433
433
  /** Query execution time in milliseconds. */
434
434
  executionMs: number;
435
+ /** True when DISTINCT was served from the partition directory. Omitted when false. */
436
+ distinctServedFromPartitionMetadata?: boolean;
435
437
  }
436
438
  /**
437
439
  * Result of a query execution.
@@ -444,6 +446,8 @@ interface QueryResult<T = Record<string, unknown>> {
444
446
  stats: QueryStats;
445
447
  /** Additive warnings (e.g. named-query deprecation). */
446
448
  warnings?: ResultWarning[];
449
+ /** Total matching rows when the named query declared `count`. */
450
+ totalMatches?: number;
447
451
  }
448
452
  /** Additive result warning from the server. */
449
453
  interface ResultWarning {
@@ -464,6 +468,8 @@ interface WherePredicate {
464
468
  column: string;
465
469
  op: WireOperator;
466
470
  value: unknown;
471
+ /** When true, bind skips this condition unless the named param is present (D-34). */
472
+ whenParamPresent?: boolean;
467
473
  }
468
474
  /**
469
475
  * Where clause structure for the wire protocol.
@@ -526,6 +532,8 @@ interface ColumnarResponse {
526
532
  rowCount: number;
527
533
  stats: QueryStats;
528
534
  warnings?: ResultWarning[];
535
+ /** Total matching rows when the named query declared `count`. */
536
+ totalMatches?: number;
529
537
  }
530
538
  /**
531
539
  * Summary of a table returned by list().
@@ -2472,6 +2480,8 @@ interface AuthMessage {
2472
2480
  interface ConflateOptions {
2473
2481
  key?: string[];
2474
2482
  interval_ms: number;
2483
+ /** When true, matching inserts are held latest-wins per key (D-32). Default omitted/false. */
2484
+ collapse_inserts?: boolean;
2475
2485
  }
2476
2486
  interface SubscribeMessage {
2477
2487
  type: "subscribe";
@@ -2482,6 +2492,7 @@ interface SubscribeMessage {
2482
2492
  hash?: string;
2483
2493
  args?: Record<string, unknown>;
2484
2494
  conflate?: ConflateOptions;
2495
+ orderByIndex?: number;
2485
2496
  }
2486
2497
  interface ReAuthMessage {
2487
2498
  type: "re_auth";
@@ -2533,6 +2544,7 @@ interface SnapshotCompleteMessage {
2533
2544
  id: string;
2534
2545
  version: number;
2535
2546
  row_count: number;
2547
+ total_matches?: number;
2536
2548
  warnings?: Array<{
2537
2549
  code: string;
2538
2550
  hash?: string;
@@ -2599,6 +2611,7 @@ interface SubscriptionSnapshotEvent<T = Record<string, unknown>> {
2599
2611
  type: "snapshot";
2600
2612
  rows: T[];
2601
2613
  version: number;
2614
+ totalMatches?: number;
2602
2615
  }
2603
2616
  interface SubscriptionChangeEvent<T = Record<string, unknown>> {
2604
2617
  type: "change";
@@ -2611,7 +2624,7 @@ interface SubscriptionChangeEvent<T = Record<string, unknown>> {
2611
2624
  }
2612
2625
  type SubscriptionEvent<T = Record<string, unknown>> = SubscriptionSnapshotEvent<T> | SubscriptionChangeEvent<T>;
2613
2626
  interface SubscribeOptions<T = Record<string, unknown>> {
2614
- onSnapshot?: (rows: T[], version: number) => void;
2627
+ onSnapshot?: (rows: T[], version: number, totalMatches?: number) => void;
2615
2628
  onChange?: (event: SubscriptionChangeEvent<T>) => void;
2616
2629
  onError?: (error: Error) => void;
2617
2630
  filter?: Record<string, unknown>;
@@ -3410,7 +3423,9 @@ interface NamedQueryDefinition {
3410
3423
  selectExpr?: ComputedColumnDef[];
3411
3424
  joins?: JoinClause[];
3412
3425
  orderBy?: OrderByClause[];
3426
+ orderByChoices?: OrderByClause[][];
3413
3427
  distinct?: boolean;
3428
+ count?: boolean;
3414
3429
  limit?: number;
3415
3430
  offset?: number;
3416
3431
  limitParam?: string;
@@ -3839,16 +3854,21 @@ declare class MaterializedQueriesApi {
3839
3854
 
3840
3855
  interface NamedQueryExecuteOptions {
3841
3856
  signal?: AbortSignal;
3857
+ /** 0-based index into the definition's `orderByChoices`. Sibling of `args`, not a named-query param. */
3858
+ orderByIndex?: number;
3842
3859
  }
3843
3860
  interface NamedQuerySubscribeOptions<T = Record<string, unknown>> {
3844
- onSnapshot?: (rows: T[], version: number) => void;
3861
+ onSnapshot?: (rows: T[], version: number, totalMatches?: number) => void;
3845
3862
  onChange?: (event: SubscriptionChangeEvent<T>) => void;
3846
3863
  onError?: (error: Error) => void;
3847
3864
  conflate?: ConflateOptions;
3865
+ /** 0-based index into the definition's `orderByChoices`. */
3866
+ orderByIndex?: number;
3848
3867
  }
3849
3868
  interface NamedQueryBatchItem {
3850
3869
  hash: string;
3851
3870
  args?: Record<string, unknown>;
3871
+ orderByIndex?: number;
3852
3872
  }
3853
3873
  interface NamedQueryBatchSlotResult<T = Record<string, unknown>> {
3854
3874
  isError: boolean;
@@ -432,6 +432,8 @@ interface QueryStats {
432
432
  segmentsAccessed: number;
433
433
  /** Query execution time in milliseconds. */
434
434
  executionMs: number;
435
+ /** True when DISTINCT was served from the partition directory. Omitted when false. */
436
+ distinctServedFromPartitionMetadata?: boolean;
435
437
  }
436
438
  /**
437
439
  * Result of a query execution.
@@ -444,6 +446,8 @@ interface QueryResult<T = Record<string, unknown>> {
444
446
  stats: QueryStats;
445
447
  /** Additive warnings (e.g. named-query deprecation). */
446
448
  warnings?: ResultWarning[];
449
+ /** Total matching rows when the named query declared `count`. */
450
+ totalMatches?: number;
447
451
  }
448
452
  /** Additive result warning from the server. */
449
453
  interface ResultWarning {
@@ -464,6 +468,8 @@ interface WherePredicate {
464
468
  column: string;
465
469
  op: WireOperator;
466
470
  value: unknown;
471
+ /** When true, bind skips this condition unless the named param is present (D-34). */
472
+ whenParamPresent?: boolean;
467
473
  }
468
474
  /**
469
475
  * Where clause structure for the wire protocol.
@@ -526,6 +532,8 @@ interface ColumnarResponse {
526
532
  rowCount: number;
527
533
  stats: QueryStats;
528
534
  warnings?: ResultWarning[];
535
+ /** Total matching rows when the named query declared `count`. */
536
+ totalMatches?: number;
529
537
  }
530
538
  /**
531
539
  * Summary of a table returned by list().
@@ -2472,6 +2480,8 @@ interface AuthMessage {
2472
2480
  interface ConflateOptions {
2473
2481
  key?: string[];
2474
2482
  interval_ms: number;
2483
+ /** When true, matching inserts are held latest-wins per key (D-32). Default omitted/false. */
2484
+ collapse_inserts?: boolean;
2475
2485
  }
2476
2486
  interface SubscribeMessage {
2477
2487
  type: "subscribe";
@@ -2482,6 +2492,7 @@ interface SubscribeMessage {
2482
2492
  hash?: string;
2483
2493
  args?: Record<string, unknown>;
2484
2494
  conflate?: ConflateOptions;
2495
+ orderByIndex?: number;
2485
2496
  }
2486
2497
  interface ReAuthMessage {
2487
2498
  type: "re_auth";
@@ -2533,6 +2544,7 @@ interface SnapshotCompleteMessage {
2533
2544
  id: string;
2534
2545
  version: number;
2535
2546
  row_count: number;
2547
+ total_matches?: number;
2536
2548
  warnings?: Array<{
2537
2549
  code: string;
2538
2550
  hash?: string;
@@ -2599,6 +2611,7 @@ interface SubscriptionSnapshotEvent<T = Record<string, unknown>> {
2599
2611
  type: "snapshot";
2600
2612
  rows: T[];
2601
2613
  version: number;
2614
+ totalMatches?: number;
2602
2615
  }
2603
2616
  interface SubscriptionChangeEvent<T = Record<string, unknown>> {
2604
2617
  type: "change";
@@ -2611,7 +2624,7 @@ interface SubscriptionChangeEvent<T = Record<string, unknown>> {
2611
2624
  }
2612
2625
  type SubscriptionEvent<T = Record<string, unknown>> = SubscriptionSnapshotEvent<T> | SubscriptionChangeEvent<T>;
2613
2626
  interface SubscribeOptions<T = Record<string, unknown>> {
2614
- onSnapshot?: (rows: T[], version: number) => void;
2627
+ onSnapshot?: (rows: T[], version: number, totalMatches?: number) => void;
2615
2628
  onChange?: (event: SubscriptionChangeEvent<T>) => void;
2616
2629
  onError?: (error: Error) => void;
2617
2630
  filter?: Record<string, unknown>;
@@ -3410,7 +3423,9 @@ interface NamedQueryDefinition {
3410
3423
  selectExpr?: ComputedColumnDef[];
3411
3424
  joins?: JoinClause[];
3412
3425
  orderBy?: OrderByClause[];
3426
+ orderByChoices?: OrderByClause[][];
3413
3427
  distinct?: boolean;
3428
+ count?: boolean;
3414
3429
  limit?: number;
3415
3430
  offset?: number;
3416
3431
  limitParam?: string;
@@ -3839,16 +3854,21 @@ declare class MaterializedQueriesApi {
3839
3854
 
3840
3855
  interface NamedQueryExecuteOptions {
3841
3856
  signal?: AbortSignal;
3857
+ /** 0-based index into the definition's `orderByChoices`. Sibling of `args`, not a named-query param. */
3858
+ orderByIndex?: number;
3842
3859
  }
3843
3860
  interface NamedQuerySubscribeOptions<T = Record<string, unknown>> {
3844
- onSnapshot?: (rows: T[], version: number) => void;
3861
+ onSnapshot?: (rows: T[], version: number, totalMatches?: number) => void;
3845
3862
  onChange?: (event: SubscriptionChangeEvent<T>) => void;
3846
3863
  onError?: (error: Error) => void;
3847
3864
  conflate?: ConflateOptions;
3865
+ /** 0-based index into the definition's `orderByChoices`. */
3866
+ orderByIndex?: number;
3848
3867
  }
3849
3868
  interface NamedQueryBatchItem {
3850
3869
  hash: string;
3851
3870
  args?: Record<string, unknown>;
3871
+ orderByIndex?: number;
3852
3872
  }
3853
3873
  interface NamedQueryBatchSlotResult<T = Record<string, unknown>> {
3854
3874
  isError: boolean;
package/dist/index.cjs CHANGED
@@ -87,7 +87,7 @@ module.exports = __toCommonJS(index_exports);
87
87
  // package.json
88
88
  var package_default = {
89
89
  name: "@aouda/client",
90
- version: "0.1.13",
90
+ version: "0.1.14",
91
91
  description: "Official TypeScript/JavaScript client library for Aouda",
92
92
  type: "module",
93
93
  main: "./dist/index.cjs",
@@ -2203,6 +2203,9 @@ var TableSubscription = class {
2203
2203
  if (this._identity.args !== void 0) {
2204
2204
  message.args = this._identity.args;
2205
2205
  }
2206
+ if (this._identity.orderByIndex !== void 0) {
2207
+ message.orderByIndex = this._identity.orderByIndex;
2208
+ }
2206
2209
  } else {
2207
2210
  message.target = this._identity.target;
2208
2211
  if (this._identity.filter !== void 0) {
@@ -2251,12 +2254,16 @@ var TableSubscription = class {
2251
2254
  }
2252
2255
  const rows = this._pendingSnapshotRows;
2253
2256
  this._pendingSnapshotRows = [];
2254
- this._onSnapshot?.(rows, message.version);
2255
- this._queue.push({
2257
+ this._onSnapshot?.(rows, message.version, message.total_matches);
2258
+ const snapshot = {
2256
2259
  type: "snapshot",
2257
2260
  rows,
2258
2261
  version: message.version
2259
- });
2262
+ };
2263
+ if (message.total_matches !== void 0) {
2264
+ snapshot.totalMatches = message.total_matches;
2265
+ }
2266
+ this._queue.push(snapshot);
2260
2267
  }
2261
2268
  async _handleGap(message) {
2262
2269
  this._pendingSnapshotRows = [];
@@ -4843,9 +4850,15 @@ var NamedQueriesApi = class {
4843
4850
  }
4844
4851
  const prefix = databasePath2(this.database);
4845
4852
  const path = `${prefix}/named-queries/${encodeURIComponent(hash)}/query?format=columnar`;
4853
+ const body = {
4854
+ args: args ?? {}
4855
+ };
4856
+ if (options?.orderByIndex !== void 0) {
4857
+ body.orderByIndex = options.orderByIndex;
4858
+ }
4846
4859
  const response = await this.transport.post(
4847
4860
  path,
4848
- { args: args ?? {} },
4861
+ body,
4849
4862
  { signal: options?.signal }
4850
4863
  );
4851
4864
  const rows = columnarToRows(response);
@@ -4853,7 +4866,8 @@ var NamedQueriesApi = class {
4853
4866
  return {
4854
4867
  rows,
4855
4868
  stats: response.stats,
4856
- warnings: response.warnings
4869
+ warnings: response.warnings,
4870
+ totalMatches: response.totalMatches
4857
4871
  };
4858
4872
  }
4859
4873
  async batch(items, options) {
@@ -4892,12 +4906,14 @@ var NamedQueriesApi = class {
4892
4906
  data: slot.data ?? [],
4893
4907
  rowCount: slot.rowCount ?? 0,
4894
4908
  stats: slot.stats ?? emptyStats(),
4895
- warnings: slot.warnings
4909
+ warnings: slot.warnings,
4910
+ totalMatches: slot.totalMatches
4896
4911
  };
4897
4912
  const result = {
4898
4913
  rows: columnarToRows(columnar),
4899
4914
  stats: columnar.stats,
4900
- warnings: slot.warnings
4915
+ warnings: slot.warnings,
4916
+ totalMatches: slot.totalMatches
4901
4917
  };
4902
4918
  raiseDeprecationWarnings(this.onWarning, slot.warnings);
4903
4919
  return { isError: false, result };
@@ -4909,7 +4925,7 @@ var NamedQueriesApi = class {
4909
4925
  }
4910
4926
  const subscription = new TableSubscription(
4911
4927
  this.getStreamingTransport(),
4912
- { kind: "named", hash, args },
4928
+ { kind: "named", hash, args, orderByIndex: options.orderByIndex },
4913
4929
  {
4914
4930
  onSnapshot: options.onSnapshot,
4915
4931
  onChange: options.onChange,