@dbsp/adapter-pgsql 1.5.0 → 1.6.0
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/index.d.ts +19 -13
- package/dist/index.js +456 -186
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExpressionRef, IndexInfo, TruncateOptions, VacuumOptions, AlterColumnOptions, CreateIndexOptions, DropIndexOptions, ModelIR as ModelIR$1 } from '@dbsp/core';
|
|
2
2
|
export { normalizeSQL } from '@dbsp/core';
|
|
3
3
|
import * as _dbsp_types from '@dbsp/types';
|
|
4
|
-
import { ParamIntent, DialectCapabilities, ModelIR, DbCasing, ColumnIR, HierarchyIR, WhereIntent, Adapter, AdapterLogger, AdapterCapabilities, PlanReport, CompiledNqlQuery, CompileOptions, CompiledQuery, CompileResultWithIncludes, SubqueryIncludeInfo, ExpressionIntent, InsertIntent, InsertFromIntent, UpdateIntent, BatchUpdateIntent, DeleteIntent, UpsertIntent, UpsertFromIntent, RecursivePlanReport, CteQueryIntent, SetOperationIntent, DumpMeta, Dump, AdapterStreamOptions, CompileOnlyAdapter, QueryIntent } from '@dbsp/types';
|
|
4
|
+
import { ColumnListInput, ParamIntent, JsonAggOrderByEntry, DialectCapabilities, ModelIR, DbCasing, ColumnIR, HierarchyIR, WhereIntent, Adapter, AdapterLogger, AdapterCapabilities, PlanReport, CompiledNqlQuery, CompileOptions, CompiledQuery, CompileResultWithIncludes, SubqueryIncludeInfo, ExpressionIntent, InsertIntent, InsertFromIntent, UpdateIntent, BatchUpdateIntent, DeleteIntent, UpsertIntent, UpsertFromIntent, RecursivePlanReport, CteQueryIntent, SetOperationIntent, DumpMeta, Dump, AdapterStreamOptions, CompileOnlyAdapter, QueryIntent } from '@dbsp/types';
|
|
5
5
|
import * as _pgsql_types from '@pgsql/types';
|
|
6
6
|
import { Node, OnConflictClause, ParamRef } from '@pgsql/types';
|
|
7
7
|
import { Pool, PoolClient } from 'pg';
|
|
@@ -99,6 +99,10 @@ declare function getNamingPluginForDbCasing(casing: 'snake_case' | 'camelCase' |
|
|
|
99
99
|
|
|
100
100
|
type BindingNameRegistry = ReadonlySet<string>;
|
|
101
101
|
|
|
102
|
+
type PlanExpressionOrderBy = readonly {
|
|
103
|
+
field: string;
|
|
104
|
+
direction?: 'asc' | 'desc';
|
|
105
|
+
}[];
|
|
102
106
|
/**
|
|
103
107
|
* Simplified PlanDecision for the spike
|
|
104
108
|
* (In production, import from @dbsp/core)
|
|
@@ -115,8 +119,8 @@ interface PlanDecision {
|
|
|
115
119
|
readonly direction?: 'ASC' | 'DESC';
|
|
116
120
|
readonly nulls?: 'FIRST' | 'LAST';
|
|
117
121
|
readonly joinType?: 'inner' | 'left';
|
|
118
|
-
readonly sourceColumn?:
|
|
119
|
-
readonly targetColumn?:
|
|
122
|
+
readonly sourceColumn?: ColumnListInput;
|
|
123
|
+
readonly targetColumn?: ColumnListInput;
|
|
120
124
|
readonly targetTable?: string;
|
|
121
125
|
readonly function?: string;
|
|
122
126
|
readonly args?: readonly unknown[];
|
|
@@ -134,18 +138,17 @@ interface PlanDecision {
|
|
|
134
138
|
paramIndex: number;
|
|
135
139
|
};
|
|
136
140
|
readonly partitionBy?: readonly string[];
|
|
137
|
-
readonly orderBy?: readonly
|
|
138
|
-
field: string;
|
|
139
|
-
direction?: 'asc' | 'desc';
|
|
140
|
-
}[];
|
|
141
|
+
readonly orderBy?: PlanExpressionOrderBy | readonly JsonAggOrderByEntry[];
|
|
141
142
|
readonly dataType?: string;
|
|
142
143
|
readonly sourceTable?: string;
|
|
143
144
|
readonly relationName?: string;
|
|
144
145
|
readonly relationPath?: string;
|
|
145
146
|
readonly hydrationPrefix?: string;
|
|
146
147
|
readonly relationType?: 'belongsTo' | 'hasMany' | 'hasOne';
|
|
147
|
-
readonly foreignKey?:
|
|
148
|
-
readonly parentKey?:
|
|
148
|
+
readonly foreignKey?: ColumnListInput;
|
|
149
|
+
readonly parentKey?: ColumnListInput;
|
|
150
|
+
readonly targetPrimaryKey?: readonly JsonAggOrderByEntry[];
|
|
151
|
+
readonly orderByFallback?: boolean;
|
|
149
152
|
readonly children?: readonly PlanDecision[];
|
|
150
153
|
readonly intentPath?: string;
|
|
151
154
|
readonly choice?: string;
|
|
@@ -350,6 +353,7 @@ declare class PlanCompiler {
|
|
|
350
353
|
private createHandlerState;
|
|
351
354
|
private schemaForRangeVar;
|
|
352
355
|
private isNqlBindingRoot;
|
|
356
|
+
private buildCorrelatedRelationRefs;
|
|
353
357
|
private compileBindingRelationColumnSubquery;
|
|
354
358
|
private compileExpressionSubquery;
|
|
355
359
|
private compileGenericNqlFunction;
|
|
@@ -1151,8 +1155,8 @@ interface Decision {
|
|
|
1151
1155
|
readonly direction?: 'ASC' | 'DESC';
|
|
1152
1156
|
readonly nulls?: 'FIRST' | 'LAST';
|
|
1153
1157
|
readonly joinType?: 'inner' | 'left';
|
|
1154
|
-
readonly sourceColumn?:
|
|
1155
|
-
readonly targetColumn?:
|
|
1158
|
+
readonly sourceColumn?: ColumnListInput;
|
|
1159
|
+
readonly targetColumn?: ColumnListInput;
|
|
1156
1160
|
readonly targetTable?: string;
|
|
1157
1161
|
readonly function?: string;
|
|
1158
1162
|
readonly args?: readonly unknown[];
|
|
@@ -1176,8 +1180,10 @@ interface Decision {
|
|
|
1176
1180
|
readonly hydrationPrefix?: string;
|
|
1177
1181
|
readonly include?: readonly Decision[];
|
|
1178
1182
|
readonly relationType?: 'belongsTo' | 'hasMany' | 'hasOne';
|
|
1179
|
-
readonly foreignKey?:
|
|
1180
|
-
readonly parentKey?:
|
|
1183
|
+
readonly foreignKey?: ColumnListInput;
|
|
1184
|
+
readonly parentKey?: ColumnListInput;
|
|
1185
|
+
readonly targetPrimaryKey?: readonly JsonAggOrderByEntry[];
|
|
1186
|
+
readonly orderByFallback?: boolean;
|
|
1181
1187
|
readonly children?: readonly Decision[];
|
|
1182
1188
|
readonly partition?: readonly string[];
|
|
1183
1189
|
readonly orderBy?: readonly {
|