pqb 0.23.0 → 0.23.2

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
@@ -342,6 +342,18 @@ declare class ArrayColumn<Schema extends ColumnSchemaConfig, Item extends ArrayC
342
342
  };
343
343
  }
344
344
 
345
+ declare class JSONColumn<T, Schema extends ColumnSchemaConfig> extends ColumnType<Schema, T, Schema['type'], OperatorsJson> {
346
+ dataType: "jsonb";
347
+ operators: OperatorsJson;
348
+ toCode(t: string): Code;
349
+ }
350
+ declare class JSONTextColumn<Schema extends ColumnSchemaConfig> extends ColumnType<Schema, string, Schema['string'], OperatorsText> {
351
+ dataType: "json";
352
+ operators: OperatorsText;
353
+ constructor(schema: Schema);
354
+ toCode(t: string): Code;
355
+ }
356
+
345
357
  type ParseDateToNumber = ParseColumn<DateBaseColumn<DefaultSchemaConfig>, unknown, number>;
346
358
  type ParseDateToDate = ParseColumn<DateBaseColumn<DefaultSchemaConfig>, unknown, Date>;
347
359
  interface DefaultSchemaConfig extends ColumnSchemaConfig {
@@ -366,7 +378,7 @@ interface DefaultSchemaConfig extends ColumnSchemaConfig {
366
378
  dateAsDate(): ParseDateToDate;
367
379
  enum<U extends string, T extends [U, ...U[]]>(dataType: string, type: T): EnumColumn<DefaultSchemaConfig, unknown, U, T>;
368
380
  array<Item extends ArrayColumnValue>(item: Item): ArrayColumn<DefaultSchemaConfig, Item, unknown, unknown, unknown>;
369
- json<T>(): ColumnType<DefaultSchemaConfig, T>;
381
+ json<T>(): JSONColumn<T, DefaultSchemaConfig>;
370
382
  inputSchema(): undefined;
371
383
  outputSchema(): undefined;
372
384
  querySchema(): undefined;
@@ -6388,18 +6400,6 @@ declare class CitextColumn<Schema extends ColumnSchemaConfig> extends TextBaseCo
6388
6400
  toCode(t: string): Code;
6389
6401
  }
6390
6402
 
6391
- declare class JSONColumn<Schema extends ColumnSchemaConfig> extends ColumnType<Schema, OperatorsJson> {
6392
- dataType: "jsonb";
6393
- operators: OperatorsJson;
6394
- toCode(t: string): Code;
6395
- }
6396
- declare class JSONTextColumn<Schema extends ColumnSchemaConfig> extends ColumnType<Schema, string, Schema['string'], OperatorsText> {
6397
- dataType: "json";
6398
- operators: OperatorsText;
6399
- constructor(schema: Schema);
6400
- toCode(t: string): Code;
6401
- }
6402
-
6403
6403
  declare class CustomTypeColumn<Schema extends ColumnSchemaConfig> extends ColumnType<Schema, unknown, Schema['unknown'], typeof Operators.any> {
6404
6404
  dataType: string;
6405
6405
  operators: OperatorsAny;
package/dist/index.js CHANGED
@@ -3348,12 +3348,7 @@ const text = __spreadProps$6(__spreadValues$a({}, base), {
3348
3348
  });
3349
3349
  const json = __spreadProps$6(__spreadValues$a({}, base), {
3350
3350
  jsonPath: make(
3351
- (key, [path, op, value], ctx, quotedAs) => `jsonb_path_query_first(${key}, '${path}') #>> '{}' ${op} ${quoteValue(
3352
- value,
3353
- ctx,
3354
- quotedAs,
3355
- true
3356
- )}`
3351
+ (key, [path, op, value], ctx, quotedAs) => `jsonb_path_query_first(${key}, '${path}') #>> '{}' ${op} ${value === null ? "null" : quoteValue(value, ctx, quotedAs, true)}`
3357
3352
  ),
3358
3353
  jsonSupersetOf: make(
3359
3354
  (key, value, ctx, quotedAs) => `${key} @> ${quoteValue(value, ctx, quotedAs, true)}`