@aouda/client 0.1.3 → 0.1.5

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.
@@ -1,4 +1,4 @@
1
- import { A as AoudaClient } from '../client-B9a2zoUU.cjs';
1
+ import { A as AoudaClient } from '../client-CD9Ew5sO.cjs';
2
2
 
3
3
  /**
4
4
  * CLI for @aouda/client.
@@ -1,4 +1,4 @@
1
- import { A as AoudaClient } from '../client-B9a2zoUU.js';
1
+ import { A as AoudaClient } from '../client-CD9Ew5sO.js';
2
2
 
3
3
  /**
4
4
  * CLI for @aouda/client.
package/dist/cli/index.js CHANGED
@@ -392,7 +392,7 @@ import { fileURLToPath } from "url";
392
392
  // package.json
393
393
  var package_default = {
394
394
  name: "@aouda/client",
395
- version: "0.1.3",
395
+ version: "0.1.5",
396
396
  description: "Official TypeScript/JavaScript client library for Aouda",
397
397
  type: "module",
398
398
  main: "./dist/index.cjs",
@@ -2819,7 +2819,8 @@ var TableQuery = class _TableQuery {
2819
2819
  limitValue: null,
2820
2820
  offsetValue: null,
2821
2821
  crossPartitionAccess: false,
2822
- selectExprs: null
2822
+ selectExprs: null,
2823
+ isDistinct: false
2823
2824
  };
2824
2825
  }
2825
2826
  where(column, operator, value) {
@@ -2988,11 +2989,46 @@ var TableQuery = class _TableQuery {
2988
2989
  * ```
2989
2990
  */
2990
2991
  select(...columns) {
2992
+ if (this.state.isDistinct) {
2993
+ throw new Error(
2994
+ "select() cannot be combined with distinct(). Use distinct(columns) instead."
2995
+ );
2996
+ }
2991
2997
  return new _TableQuery(this.transport, this.tableName, this.database, {
2992
2998
  ...this.state,
2993
2999
  selectColumns: columns.length > 0 ? columns : null
2994
3000
  }, this.getWebSocketTransport);
2995
3001
  }
3002
+ /**
3003
+ * Return only distinct (de-duplicated) rows for the given columns — SQL `SELECT DISTINCT`.
3004
+ * Mutually exclusive with `selectExpr()` and joins.
3005
+ *
3006
+ * When T is a specific row type, only keys of T are accepted as column names.
3007
+ *
3008
+ * @param columns - The column names to de-duplicate on.
3009
+ * @returns A new TableQuery with distinct projection set.
3010
+ *
3011
+ * @example
3012
+ * ```typescript
3013
+ * query.distinct('category', 'region')
3014
+ * ```
3015
+ */
3016
+ distinct(...columns) {
3017
+ if (columns.length === 0) {
3018
+ throw new Error("At least one column is required.");
3019
+ }
3020
+ if (this.state.selectExprs !== null && this.state.selectExprs.length > 0) {
3021
+ throw new Error("distinct() cannot be combined with selectExpr().");
3022
+ }
3023
+ if (this.state.joinClauses.length > 0) {
3024
+ throw new Error("distinct() cannot be combined with joins().");
3025
+ }
3026
+ return new _TableQuery(this.transport, this.tableName, this.database, {
3027
+ ...this.state,
3028
+ selectColumns: columns,
3029
+ isDistinct: true
3030
+ }, this.getWebSocketTransport);
3031
+ }
2996
3032
  /**
2997
3033
  * Adds server-side computed columns to the query result.
2998
3034
  *
@@ -3014,6 +3050,9 @@ var TableQuery = class _TableQuery {
3014
3050
  if (projections.length === 0) {
3015
3051
  throw new Error("selectExpr() requires at least one projection.");
3016
3052
  }
3053
+ if (this.state.isDistinct) {
3054
+ throw new Error("selectExpr() cannot be combined with distinct().");
3055
+ }
3017
3056
  return new _TableQuery(this.transport, this.tableName, this.database, {
3018
3057
  ...this.state,
3019
3058
  selectExprs: projections
@@ -3058,6 +3097,9 @@ var TableQuery = class _TableQuery {
3058
3097
  if (rightTable.trim().length === 0) {
3059
3098
  throw new Error("crossJoin() requires a non-empty rightTable");
3060
3099
  }
3100
+ if (this.state.isDistinct) {
3101
+ throw new Error("joins() cannot be combined with distinct().");
3102
+ }
3061
3103
  return new _TableQuery(
3062
3104
  this.transport,
3063
3105
  this.tableName,
@@ -3197,6 +3239,9 @@ var TableQuery = class _TableQuery {
3197
3239
  if (this.state.selectExprs !== null && this.state.selectExprs.length > 0) {
3198
3240
  request.selectExpr = this.state.selectExprs;
3199
3241
  }
3242
+ if (this.state.isDistinct) {
3243
+ request.distinct = true;
3244
+ }
3200
3245
  return request;
3201
3246
  }
3202
3247
  buildWhereClause() {
@@ -3218,6 +3263,9 @@ var TableQuery = class _TableQuery {
3218
3263
  if (rightTable.trim().length === 0) {
3219
3264
  throw new Error("join() requires a non-empty rightTable");
3220
3265
  }
3266
+ if (this.state.isDistinct) {
3267
+ throw new Error("joins() cannot be combined with distinct().");
3268
+ }
3221
3269
  const joinClause = {
3222
3270
  table: rightTable,
3223
3271
  type