@dbsp/adapter-pgsql 1.3.0 → 1.4.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/README.md CHANGED
@@ -42,6 +42,10 @@ const { sql, params } = orm.select('users').where(eq('active', true)).dump();
42
42
  // sql, params — no Pool needed
43
43
  ```
44
44
 
45
+ ### Direct NQL bundles
46
+
47
+ `adapter.compile(compiledNqlBundle, options)` trusts that direct `CompiledNqlQuery` bundles are well-formed and semantically validated by the NQL compiler. The adapter still enforces SQL safety for emitted binding names, including identifier validation and binding/table or binding/binding collision checks before emitting `WITH` CTEs.
48
+
45
49
  ## Key features
46
50
 
47
51
  - **Parameterized queries** — All user values use `$N` positional parameters; no SQL injection surface
package/dist/index.d.ts CHANGED
@@ -261,6 +261,7 @@ interface CompiledResult {
261
261
  interface CompilerOptions {
262
262
  readonly naming?: NamingPlugin;
263
263
  readonly schema?: string;
264
+ readonly dialectCapabilities?: DialectCapabilities;
264
265
  /** Default primary key column name convention (default: 'id') */
265
266
  readonly defaultPkColumnName?: string;
266
267
  /** Convention for deriving FK column names: (tableName, pkName) => fkColumnName */
@@ -276,6 +277,7 @@ declare class PlanCompiler {
276
277
  private readonly defaultPk;
277
278
  private readonly deriveFk;
278
279
  private readonly model;
280
+ private readonly dialectCapabilities;
279
281
  private readonly bindingNames;
280
282
  /** Mutable state shared with extracted condition/value compilation functions */
281
283
  private state;
@@ -300,6 +302,7 @@ declare class PlanCompiler {
300
302
  */
301
303
  private usedJoinAliases;
302
304
  constructor(options?: CompilerOptions);
305
+ private childCompilerOptions;
303
306
  /** Build immutable context for handler-based WHERE compilation */
304
307
  private handlerCtx;
305
308
  private findAliasForLegacySourceTable;
@@ -343,6 +346,7 @@ declare class PlanCompiler {
343
346
  private createHandlerContext;
344
347
  /** Build a fresh HandlerCompilerState sharing the current parameter array. */
345
348
  private createHandlerState;
349
+ private schemaForRangeVar;
346
350
  private compileExpressionSubquery;
347
351
  private compileGenericNqlFunction;
348
352
  private compileNqlFunctionArg;
@@ -1067,6 +1071,8 @@ interface CompilerContext {
1067
1071
  readonly naming: NamingPlugin;
1068
1072
  /** Schema name for table qualification (optional) */
1069
1073
  readonly schema?: string;
1074
+ /** Dialect capabilities for adapter-layer SQL surface gates */
1075
+ readonly dialectCapabilities?: DialectCapabilities;
1070
1076
  /** Root table name for the query */
1071
1077
  readonly rootTable: string;
1072
1078
  /** Current table alias (for JOINs) */
@@ -1669,6 +1675,11 @@ declare class PgsqlAdapter<DB = unknown> implements Adapter<DB> {
1669
1675
  getPoolInstance(): Pool;
1670
1676
  /**
1671
1677
  * Compile a plan to executable SQL.
1678
+ *
1679
+ * When passed a direct `CompiledNqlQuery`, the adapter trusts that the bundle
1680
+ * has already been semantically validated by the NQL compiler. This method
1681
+ * still performs adapter-owned SQL safety checks for emitted binding names
1682
+ * before CTE emission.
1672
1683
  */
1673
1684
  compile<T = unknown>(plan: PlanReport | CompiledNqlQuery, options?: CompileOptions): CompiledQuery<T>;
1674
1685
  /**