@aouda/client 0.1.4 → 0.1.6
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 +50 -2
- 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 +50 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/{client-DXLViyzE.d.cts → client-Bb6UxTA4.d.cts} +18 -0
- package/dist/{client-DXLViyzE.d.ts → client-Bb6UxTA4.d.ts} +18 -0
- package/dist/index.cjs +50 -2
- 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 +50 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -2441,6 +2441,8 @@ interface QueryBuilderState {
|
|
|
2441
2441
|
crossPartitionAccess: boolean;
|
|
2442
2442
|
/** Server-side computed column projections (S7). */
|
|
2443
2443
|
selectExprs: ComputedColumnDef[] | null;
|
|
2444
|
+
/** When true, emit `distinct: true` on the wire (SQL SELECT DISTINCT). */
|
|
2445
|
+
isDistinct: boolean;
|
|
2444
2446
|
}
|
|
2445
2447
|
/**
|
|
2446
2448
|
* Coerces a raw columnar value using the server-declared column type name.
|
|
@@ -2617,6 +2619,21 @@ declare class TableQuery<T = Record<string, unknown>> {
|
|
|
2617
2619
|
* ```
|
|
2618
2620
|
*/
|
|
2619
2621
|
select(...columns: (keyof T & string)[]): TableQuery<T>;
|
|
2622
|
+
/**
|
|
2623
|
+
* Return only distinct (de-duplicated) rows for the given columns — SQL `SELECT DISTINCT`.
|
|
2624
|
+
* Mutually exclusive with `selectExpr()` and joins.
|
|
2625
|
+
*
|
|
2626
|
+
* When T is a specific row type, only keys of T are accepted as column names.
|
|
2627
|
+
*
|
|
2628
|
+
* @param columns - The column names to de-duplicate on.
|
|
2629
|
+
* @returns A new TableQuery with distinct projection set.
|
|
2630
|
+
*
|
|
2631
|
+
* @example
|
|
2632
|
+
* ```typescript
|
|
2633
|
+
* query.distinct('category', 'region')
|
|
2634
|
+
* ```
|
|
2635
|
+
*/
|
|
2636
|
+
distinct(...columns: (keyof T & string)[]): TableQuery<T>;
|
|
2620
2637
|
/**
|
|
2621
2638
|
* Adds server-side computed columns to the query result.
|
|
2622
2639
|
*
|
|
@@ -3044,6 +3061,7 @@ interface DiffSummary {
|
|
|
3044
3061
|
tablesDropped: number;
|
|
3045
3062
|
columnsAdded: number;
|
|
3046
3063
|
columnsDropped: number;
|
|
3064
|
+
columnsAltered?: number;
|
|
3047
3065
|
policiesUpdated: number;
|
|
3048
3066
|
durabilitiesUpdated: number;
|
|
3049
3067
|
settingsUpdated: number;
|
|
@@ -2441,6 +2441,8 @@ interface QueryBuilderState {
|
|
|
2441
2441
|
crossPartitionAccess: boolean;
|
|
2442
2442
|
/** Server-side computed column projections (S7). */
|
|
2443
2443
|
selectExprs: ComputedColumnDef[] | null;
|
|
2444
|
+
/** When true, emit `distinct: true` on the wire (SQL SELECT DISTINCT). */
|
|
2445
|
+
isDistinct: boolean;
|
|
2444
2446
|
}
|
|
2445
2447
|
/**
|
|
2446
2448
|
* Coerces a raw columnar value using the server-declared column type name.
|
|
@@ -2617,6 +2619,21 @@ declare class TableQuery<T = Record<string, unknown>> {
|
|
|
2617
2619
|
* ```
|
|
2618
2620
|
*/
|
|
2619
2621
|
select(...columns: (keyof T & string)[]): TableQuery<T>;
|
|
2622
|
+
/**
|
|
2623
|
+
* Return only distinct (de-duplicated) rows for the given columns — SQL `SELECT DISTINCT`.
|
|
2624
|
+
* Mutually exclusive with `selectExpr()` and joins.
|
|
2625
|
+
*
|
|
2626
|
+
* When T is a specific row type, only keys of T are accepted as column names.
|
|
2627
|
+
*
|
|
2628
|
+
* @param columns - The column names to de-duplicate on.
|
|
2629
|
+
* @returns A new TableQuery with distinct projection set.
|
|
2630
|
+
*
|
|
2631
|
+
* @example
|
|
2632
|
+
* ```typescript
|
|
2633
|
+
* query.distinct('category', 'region')
|
|
2634
|
+
* ```
|
|
2635
|
+
*/
|
|
2636
|
+
distinct(...columns: (keyof T & string)[]): TableQuery<T>;
|
|
2620
2637
|
/**
|
|
2621
2638
|
* Adds server-side computed columns to the query result.
|
|
2622
2639
|
*
|
|
@@ -3044,6 +3061,7 @@ interface DiffSummary {
|
|
|
3044
3061
|
tablesDropped: number;
|
|
3045
3062
|
columnsAdded: number;
|
|
3046
3063
|
columnsDropped: number;
|
|
3064
|
+
columnsAltered?: number;
|
|
3047
3065
|
policiesUpdated: number;
|
|
3048
3066
|
durabilitiesUpdated: number;
|
|
3049
3067
|
settingsUpdated: number;
|
package/dist/index.cjs
CHANGED
|
@@ -82,7 +82,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
82
82
|
// package.json
|
|
83
83
|
var package_default = {
|
|
84
84
|
name: "@aouda/client",
|
|
85
|
-
version: "0.1.
|
|
85
|
+
version: "0.1.6",
|
|
86
86
|
description: "Official TypeScript/JavaScript client library for Aouda",
|
|
87
87
|
type: "module",
|
|
88
88
|
main: "./dist/index.cjs",
|
|
@@ -2542,7 +2542,8 @@ var TableQuery = class _TableQuery {
|
|
|
2542
2542
|
limitValue: null,
|
|
2543
2543
|
offsetValue: null,
|
|
2544
2544
|
crossPartitionAccess: false,
|
|
2545
|
-
selectExprs: null
|
|
2545
|
+
selectExprs: null,
|
|
2546
|
+
isDistinct: false
|
|
2546
2547
|
};
|
|
2547
2548
|
}
|
|
2548
2549
|
where(column, operator, value) {
|
|
@@ -2711,11 +2712,46 @@ var TableQuery = class _TableQuery {
|
|
|
2711
2712
|
* ```
|
|
2712
2713
|
*/
|
|
2713
2714
|
select(...columns) {
|
|
2715
|
+
if (this.state.isDistinct) {
|
|
2716
|
+
throw new Error(
|
|
2717
|
+
"select() cannot be combined with distinct(). Use distinct(columns) instead."
|
|
2718
|
+
);
|
|
2719
|
+
}
|
|
2714
2720
|
return new _TableQuery(this.transport, this.tableName, this.database, {
|
|
2715
2721
|
...this.state,
|
|
2716
2722
|
selectColumns: columns.length > 0 ? columns : null
|
|
2717
2723
|
}, this.getWebSocketTransport);
|
|
2718
2724
|
}
|
|
2725
|
+
/**
|
|
2726
|
+
* Return only distinct (de-duplicated) rows for the given columns — SQL `SELECT DISTINCT`.
|
|
2727
|
+
* Mutually exclusive with `selectExpr()` and joins.
|
|
2728
|
+
*
|
|
2729
|
+
* When T is a specific row type, only keys of T are accepted as column names.
|
|
2730
|
+
*
|
|
2731
|
+
* @param columns - The column names to de-duplicate on.
|
|
2732
|
+
* @returns A new TableQuery with distinct projection set.
|
|
2733
|
+
*
|
|
2734
|
+
* @example
|
|
2735
|
+
* ```typescript
|
|
2736
|
+
* query.distinct('category', 'region')
|
|
2737
|
+
* ```
|
|
2738
|
+
*/
|
|
2739
|
+
distinct(...columns) {
|
|
2740
|
+
if (columns.length === 0) {
|
|
2741
|
+
throw new Error("At least one column is required.");
|
|
2742
|
+
}
|
|
2743
|
+
if (this.state.selectExprs !== null && this.state.selectExprs.length > 0) {
|
|
2744
|
+
throw new Error("distinct() cannot be combined with selectExpr().");
|
|
2745
|
+
}
|
|
2746
|
+
if (this.state.joinClauses.length > 0) {
|
|
2747
|
+
throw new Error("distinct() cannot be combined with joins().");
|
|
2748
|
+
}
|
|
2749
|
+
return new _TableQuery(this.transport, this.tableName, this.database, {
|
|
2750
|
+
...this.state,
|
|
2751
|
+
selectColumns: columns,
|
|
2752
|
+
isDistinct: true
|
|
2753
|
+
}, this.getWebSocketTransport);
|
|
2754
|
+
}
|
|
2719
2755
|
/**
|
|
2720
2756
|
* Adds server-side computed columns to the query result.
|
|
2721
2757
|
*
|
|
@@ -2737,6 +2773,9 @@ var TableQuery = class _TableQuery {
|
|
|
2737
2773
|
if (projections.length === 0) {
|
|
2738
2774
|
throw new Error("selectExpr() requires at least one projection.");
|
|
2739
2775
|
}
|
|
2776
|
+
if (this.state.isDistinct) {
|
|
2777
|
+
throw new Error("selectExpr() cannot be combined with distinct().");
|
|
2778
|
+
}
|
|
2740
2779
|
return new _TableQuery(this.transport, this.tableName, this.database, {
|
|
2741
2780
|
...this.state,
|
|
2742
2781
|
selectExprs: projections
|
|
@@ -2781,6 +2820,9 @@ var TableQuery = class _TableQuery {
|
|
|
2781
2820
|
if (rightTable.trim().length === 0) {
|
|
2782
2821
|
throw new Error("crossJoin() requires a non-empty rightTable");
|
|
2783
2822
|
}
|
|
2823
|
+
if (this.state.isDistinct) {
|
|
2824
|
+
throw new Error("joins() cannot be combined with distinct().");
|
|
2825
|
+
}
|
|
2784
2826
|
return new _TableQuery(
|
|
2785
2827
|
this.transport,
|
|
2786
2828
|
this.tableName,
|
|
@@ -2920,6 +2962,9 @@ var TableQuery = class _TableQuery {
|
|
|
2920
2962
|
if (this.state.selectExprs !== null && this.state.selectExprs.length > 0) {
|
|
2921
2963
|
request.selectExpr = this.state.selectExprs;
|
|
2922
2964
|
}
|
|
2965
|
+
if (this.state.isDistinct) {
|
|
2966
|
+
request.distinct = true;
|
|
2967
|
+
}
|
|
2923
2968
|
return request;
|
|
2924
2969
|
}
|
|
2925
2970
|
buildWhereClause() {
|
|
@@ -2941,6 +2986,9 @@ var TableQuery = class _TableQuery {
|
|
|
2941
2986
|
if (rightTable.trim().length === 0) {
|
|
2942
2987
|
throw new Error("join() requires a non-empty rightTable");
|
|
2943
2988
|
}
|
|
2989
|
+
if (this.state.isDistinct) {
|
|
2990
|
+
throw new Error("joins() cannot be combined with distinct().");
|
|
2991
|
+
}
|
|
2944
2992
|
const joinClause = {
|
|
2945
2993
|
table: rightTable,
|
|
2946
2994
|
type
|