pqb 0.18.15 → 0.18.17

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.mjs CHANGED
@@ -2553,7 +2553,7 @@ const quoteValue = (arg, ctx, quotedAs, jsonArray) => {
2553
2553
  }
2554
2554
  return addValue(ctx.values, arg);
2555
2555
  };
2556
- const ops = {
2556
+ const base = {
2557
2557
  equals: make(
2558
2558
  (key, value, ctx, quotedAs) => value === null ? `${key} IS NULL` : `${key} = ${quoteValue(value, ctx, quotedAs)}`
2559
2559
  ),
@@ -2565,7 +2565,17 @@ const ops = {
2565
2565
  ),
2566
2566
  notIn: make(
2567
2567
  (key, value, ctx, quotedAs) => `NOT ${key} IN ${quoteValue(value, ctx, quotedAs)}`
2568
+ )
2569
+ };
2570
+ const boolean = __spreadProps$7(__spreadValues$b({}, base), {
2571
+ and: make(
2572
+ (key, value, ctx, quotedAs) => `${key} AND ${value.q.expr.toSQL(ctx, quotedAs)}`
2568
2573
  ),
2574
+ or: make(
2575
+ (key, value, ctx, quotedAs) => `(${key}) OR (${value.q.expr.toSQL(ctx, quotedAs)})`
2576
+ )
2577
+ });
2578
+ const numeric = __spreadProps$7(__spreadValues$b({}, base), {
2569
2579
  lt: make(
2570
2580
  (key, value, ctx, quotedAs) => `${key} < ${quoteValue(value, ctx, quotedAs)}`
2571
2581
  ),
@@ -2578,6 +2588,15 @@ const ops = {
2578
2588
  gte: make(
2579
2589
  (key, value, ctx, quotedAs) => `${key} >= ${quoteValue(value, ctx, quotedAs)}`
2580
2590
  ),
2591
+ between: make(
2592
+ (key, [from, to], ctx, quotedAs) => `${key} BETWEEN ${quoteValue(from, ctx, quotedAs)} AND ${quoteValue(
2593
+ to,
2594
+ ctx,
2595
+ quotedAs
2596
+ )}`
2597
+ )
2598
+ });
2599
+ const text = __spreadProps$7(__spreadValues$b({}, base), {
2581
2600
  contains: make(
2582
2601
  (key, value, ctx, quotedAs) => `${key} ILIKE '%' || ${quoteValue(value, ctx, quotedAs)} || '%'`
2583
2602
  ),
@@ -2595,14 +2614,9 @@ const ops = {
2595
2614
  ),
2596
2615
  endsWithSensitive: make(
2597
2616
  (key, value, ctx, quotedAs) => `${key} LIKE '%' || ${quoteValue(value, ctx, quotedAs)}`
2598
- ),
2599
- between: make(
2600
- (key, [from, to], ctx, quotedAs) => `${key} BETWEEN ${quoteValue(from, ctx, quotedAs)} AND ${quoteValue(
2601
- to,
2602
- ctx,
2603
- quotedAs
2604
- )}`
2605
- ),
2617
+ )
2618
+ });
2619
+ const json = __spreadProps$7(__spreadValues$b({}, base), {
2606
2620
  jsonPath: make(
2607
2621
  (key, [path, op, value], ctx, quotedAs) => `jsonb_path_query_first(${key}, '${path}') #>> '{}' ${op} ${quoteValue(
2608
2622
  value,
@@ -2616,50 +2630,14 @@ const ops = {
2616
2630
  ),
2617
2631
  jsonSubsetOf: make(
2618
2632
  (key, value, ctx, quotedAs) => `${key} <@ ${quoteValue(value, ctx, quotedAs, true)}`
2619
- ),
2620
- and: make(
2621
- (key, value, ctx, quotedAs) => `${key} AND ${value.q.expr.toSQL(ctx, quotedAs)}`
2622
- ),
2623
- or: make(
2624
- (key, value, ctx, quotedAs) => `(${key}) OR (${value.q.expr.toSQL(ctx, quotedAs)})`
2625
2633
  )
2626
- };
2627
- const base = {
2628
- equals: ops.equals,
2629
- not: ops.not,
2630
- in: ops.in,
2631
- notIn: ops.notIn
2632
- };
2633
- const boolean = __spreadProps$7(__spreadValues$b({}, base), {
2634
- and: ops.and,
2635
- or: ops.or
2636
- });
2637
- const numeric = __spreadProps$7(__spreadValues$b({}, base), {
2638
- lt: ops.lt,
2639
- lte: ops.lte,
2640
- gt: ops.gt,
2641
- gte: ops.gte,
2642
- between: ops.between
2643
- });
2644
- const text = __spreadProps$7(__spreadValues$b({}, base), {
2645
- contains: ops.contains,
2646
- containsSensitive: ops.containsSensitive,
2647
- startsWith: ops.startsWith,
2648
- startsWithSensitive: ops.startsWithSensitive,
2649
- endsWith: ops.endsWith,
2650
- endsWithSensitive: ops.endsWithSensitive
2651
- });
2652
- const json = __spreadProps$7(__spreadValues$b({}, base), {
2653
- jsonPath: ops.jsonPath,
2654
- jsonSupersetOf: ops.jsonSupersetOf,
2655
- jsonSubsetOf: ops.jsonSubsetOf
2656
2634
  });
2657
2635
  const Operators = {
2658
2636
  any: base,
2659
2637
  boolean,
2660
2638
  number: numeric,
2661
- date: base,
2662
- time: base,
2639
+ date: numeric,
2640
+ time: numeric,
2663
2641
  text,
2664
2642
  json,
2665
2643
  array: base