pqb 0.31.8 → 0.32.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 CHANGED
@@ -2446,8 +2446,8 @@ declare class DynamicRawSQL<T extends QueryColumn, ColumnTypes = DefaultColumnTy
2446
2446
  constructor(fn: DynamicSQLArg);
2447
2447
  makeSQL(ctx: ToSQLCtx, quotedAs?: string): string;
2448
2448
  }
2449
- declare function raw<T = unknown>(...args: StaticSQLArgs): RawSQL<QueryColumn<T>>;
2450
- declare function raw<T = unknown>(...args: [DynamicSQLArg]): DynamicRawSQL<QueryColumn<T>>;
2449
+ declare function raw<T = never>(...args: StaticSQLArgs): RawSQL<QueryColumn<T>>;
2450
+ declare function raw<T = never>(...args: [DynamicSQLArg]): DynamicRawSQL<QueryColumn<T>>;
2451
2451
  declare const countSelect: RawSQL<QueryColumn<unknown, orchid_core.CoreBaseOperators>, DefaultColumnTypes<ColumnSchemaConfig<orchid_core.ColumnTypeBase<orchid_core.ColumnTypeSchemaArg, unknown, any, orchid_core.CoreBaseOperators, unknown, unknown, any, unknown, any, orchid_core.ColumnDataBase>>>>[];
2452
2452
  declare function sqlQueryArgsToExpression(args: SQLQueryArgs): RawSQL<QueryColumn>;
2453
2453
  type SqlFn = <T, Args extends [sql: TemplateStringsArray, ...values: unknown[]] | [sql: string] | [values: RecordUnknown, sql?: string]>(this: T, ...args: Args) => Args extends [RecordUnknown] ? (...sql: TemplateLiteralArgs) => RawSQLBase<QueryColumn, T> : RawSQLBase<QueryColumn, T>;
package/dist/index.js CHANGED
@@ -1740,7 +1740,8 @@ class BooleanColumn extends ColumnType {
1740
1740
  }
1741
1741
  }
1742
1742
 
1743
- const toCodeSkip = { encodeFn: JSON.stringify };
1743
+ const encodeFn = (x) => x === null ? x : JSON.stringify(x);
1744
+ const toCodeSkip = { encodeFn };
1744
1745
  class JSONColumn extends ColumnType {
1745
1746
  constructor() {
1746
1747
  super(...arguments);
@@ -1751,7 +1752,7 @@ class JSONColumn extends ColumnType {
1751
1752
  return columnCode(this, t, `json()`, m, this.data, toCodeSkip);
1752
1753
  }
1753
1754
  }
1754
- JSONColumn.prototype.encodeFn = JSON.stringify;
1755
+ JSONColumn.prototype.encodeFn = encodeFn;
1755
1756
  class JSONTextColumn extends ColumnType {
1756
1757
  constructor(schema) {
1757
1758
  super(schema, schema.stringSchema());
@@ -6411,7 +6412,7 @@ const createCtx = () => ({
6411
6412
  });
6412
6413
  const mapColumnValues = (columns, encoders, data) => {
6413
6414
  return columns.map(
6414
- (key) => encoders[key] ? encoders[key](data[key]) : data[key]
6415
+ (key) => encoders[key] && !orchidCore.isExpression(data[key]) ? encoders[key](data[key]) : data[key]
6415
6416
  );
6416
6417
  };
6417
6418
  const handleOneData = (q, data, ctx) => {