pqb 0.25.1 → 0.26.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 +40 -31
- package/dist/index.js +55 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -829,7 +829,7 @@ class JSONColumn extends ColumnType {
|
|
|
829
829
|
JSONColumn.prototype.encodeFn = JSON.stringify;
|
|
830
830
|
class JSONTextColumn extends ColumnType {
|
|
831
831
|
constructor(schema) {
|
|
832
|
-
super(schema, schema.stringSchema);
|
|
832
|
+
super(schema, schema.stringSchema());
|
|
833
833
|
this.dataType = "json";
|
|
834
834
|
this.operators = Operators.text;
|
|
835
835
|
}
|
|
@@ -1481,7 +1481,12 @@ const dateTimeEncode = (input) => {
|
|
|
1481
1481
|
const skipDateMethodsFromToCode = { encodeFn: dateTimeEncode };
|
|
1482
1482
|
class DateBaseColumn extends ColumnType {
|
|
1483
1483
|
constructor(schema) {
|
|
1484
|
-
super(
|
|
1484
|
+
super(
|
|
1485
|
+
schema,
|
|
1486
|
+
schema.stringNumberDate(),
|
|
1487
|
+
schema.stringSchema(),
|
|
1488
|
+
schema.stringNumberDate()
|
|
1489
|
+
);
|
|
1485
1490
|
this.operators = Operators.date;
|
|
1486
1491
|
this.encodeFn = dateTimeEncode;
|
|
1487
1492
|
this.asNumber = schema.dateAsNumber;
|
|
@@ -1555,7 +1560,7 @@ class TimestampTZColumn extends DateTimeTzBaseClass {
|
|
|
1555
1560
|
}
|
|
1556
1561
|
class TimeColumn extends ColumnType {
|
|
1557
1562
|
constructor(schema, dateTimePrecision) {
|
|
1558
|
-
super(schema, schema.stringSchema);
|
|
1563
|
+
super(schema, schema.stringSchema());
|
|
1559
1564
|
this.dataType = "time";
|
|
1560
1565
|
this.operators = Operators.time;
|
|
1561
1566
|
this.data.dateTimePrecision = dateTimePrecision;
|
|
@@ -1573,7 +1578,7 @@ class TimeColumn extends ColumnType {
|
|
|
1573
1578
|
}
|
|
1574
1579
|
class IntervalColumn extends ColumnType {
|
|
1575
1580
|
constructor(schema, fields, precision) {
|
|
1576
|
-
super(schema, schema.timeInterval);
|
|
1581
|
+
super(schema, schema.timeInterval());
|
|
1577
1582
|
this.dataType = "interval";
|
|
1578
1583
|
this.operators = Operators.date;
|
|
1579
1584
|
this.data.fields = fields;
|
|
@@ -1746,10 +1751,20 @@ const defaultSchemaConfig = {
|
|
|
1746
1751
|
array(item) {
|
|
1747
1752
|
return new ArrayColumn(defaultSchemaConfig, item, void 0);
|
|
1748
1753
|
},
|
|
1754
|
+
boolean: noop,
|
|
1755
|
+
buffer: noop,
|
|
1756
|
+
unknown: noop,
|
|
1757
|
+
never: noop,
|
|
1758
|
+
stringSchema: noop,
|
|
1749
1759
|
stringMin: noop,
|
|
1750
1760
|
stringMax: noop,
|
|
1751
1761
|
stringMinMax: noop,
|
|
1762
|
+
number: noop,
|
|
1763
|
+
int: noop,
|
|
1764
|
+
stringNumberDate: noop,
|
|
1765
|
+
timeInterval: noop,
|
|
1752
1766
|
bit: noop,
|
|
1767
|
+
uuid: noop,
|
|
1753
1768
|
nullable() {
|
|
1754
1769
|
return setColumnData(this, "isNullable", true);
|
|
1755
1770
|
},
|
|
@@ -3524,19 +3539,19 @@ class NumberBaseColumn extends ColumnType {
|
|
|
3524
3539
|
}
|
|
3525
3540
|
class IntegerBaseColumn extends NumberBaseColumn {
|
|
3526
3541
|
constructor(schema) {
|
|
3527
|
-
super(schema, schema.int);
|
|
3542
|
+
super(schema, schema.int());
|
|
3528
3543
|
this.data.int = true;
|
|
3529
3544
|
}
|
|
3530
3545
|
}
|
|
3531
3546
|
class NumberAsStringBaseColumn extends ColumnType {
|
|
3532
3547
|
constructor(schema) {
|
|
3533
|
-
super(schema, schema.stringSchema);
|
|
3548
|
+
super(schema, schema.stringSchema());
|
|
3534
3549
|
this.operators = Operators.number;
|
|
3535
3550
|
}
|
|
3536
3551
|
}
|
|
3537
3552
|
class DecimalColumn extends ColumnType {
|
|
3538
3553
|
constructor(schema, numericPrecision, numericScale) {
|
|
3539
|
-
super(schema, schema.stringSchema);
|
|
3554
|
+
super(schema, schema.stringSchema());
|
|
3540
3555
|
this.operators = Operators.number;
|
|
3541
3556
|
this.dataType = "decimal";
|
|
3542
3557
|
this.data.numericPrecision = numericPrecision;
|
|
@@ -3609,7 +3624,7 @@ class BigIntColumn extends NumberAsStringBaseColumn {
|
|
|
3609
3624
|
}
|
|
3610
3625
|
class RealColumn extends NumberBaseColumn {
|
|
3611
3626
|
constructor(schema) {
|
|
3612
|
-
super(schema, schema.number);
|
|
3627
|
+
super(schema, schema.number());
|
|
3613
3628
|
this.dataType = "real";
|
|
3614
3629
|
this.parseItem = parseFloat;
|
|
3615
3630
|
}
|
|
@@ -3695,14 +3710,17 @@ var __spreadValues$9 = (a, b) => {
|
|
|
3695
3710
|
};
|
|
3696
3711
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
3697
3712
|
class TextBaseColumn extends ColumnType {
|
|
3698
|
-
constructor(schema, schemaType = schema.stringSchema) {
|
|
3713
|
+
constructor(schema, schemaType = schema.stringSchema()) {
|
|
3699
3714
|
super(schema, schemaType);
|
|
3700
3715
|
this.operators = Operators.text;
|
|
3701
3716
|
}
|
|
3702
3717
|
}
|
|
3703
3718
|
class LimitedTextBaseColumn extends TextBaseColumn {
|
|
3704
3719
|
constructor(schema, limit) {
|
|
3705
|
-
super(
|
|
3720
|
+
super(
|
|
3721
|
+
schema,
|
|
3722
|
+
limit ? schema.stringMax(limit) : schema.stringSchema()
|
|
3723
|
+
);
|
|
3706
3724
|
this.data.maxChars = limit;
|
|
3707
3725
|
}
|
|
3708
3726
|
toSQL() {
|
|
@@ -3785,7 +3803,7 @@ const textColumnToCode = (column, t) => {
|
|
|
3785
3803
|
`${column.dataType}(${args})${stringDataToCode(data)}`
|
|
3786
3804
|
);
|
|
3787
3805
|
};
|
|
3788
|
-
const minMaxToSchema = (schema, min, max) => min ? max ? schema.stringMinMax(min, max) : schema.stringMin(min) : schema.stringSchema;
|
|
3806
|
+
const minMaxToSchema = (schema, min, max) => min ? max ? schema.stringMinMax(min, max) : schema.stringMin(min) : schema.stringSchema();
|
|
3789
3807
|
class TextColumn extends TextBaseColumn {
|
|
3790
3808
|
constructor(schema, min, max) {
|
|
3791
3809
|
super(schema, minMaxToSchema(schema, min, max));
|
|
@@ -3798,7 +3816,7 @@ class TextColumn extends TextBaseColumn {
|
|
|
3798
3816
|
}
|
|
3799
3817
|
class ByteaColumn extends ColumnType {
|
|
3800
3818
|
constructor(schema) {
|
|
3801
|
-
super(schema, schema.buffer);
|
|
3819
|
+
super(schema, schema.buffer());
|
|
3802
3820
|
this.dataType = "bytea";
|
|
3803
3821
|
this.operators = Operators.text;
|
|
3804
3822
|
}
|
|
@@ -3808,7 +3826,7 @@ class ByteaColumn extends ColumnType {
|
|
|
3808
3826
|
}
|
|
3809
3827
|
class PointColumn extends ColumnType {
|
|
3810
3828
|
constructor(schema) {
|
|
3811
|
-
super(schema, schema.stringSchema);
|
|
3829
|
+
super(schema, schema.stringSchema());
|
|
3812
3830
|
this.dataType = "point";
|
|
3813
3831
|
this.operators = Operators.text;
|
|
3814
3832
|
}
|
|
@@ -3818,7 +3836,7 @@ class PointColumn extends ColumnType {
|
|
|
3818
3836
|
}
|
|
3819
3837
|
class LineColumn extends ColumnType {
|
|
3820
3838
|
constructor(schema) {
|
|
3821
|
-
super(schema, schema.stringSchema);
|
|
3839
|
+
super(schema, schema.stringSchema());
|
|
3822
3840
|
this.dataType = "line";
|
|
3823
3841
|
this.operators = Operators.text;
|
|
3824
3842
|
}
|
|
@@ -3828,7 +3846,7 @@ class LineColumn extends ColumnType {
|
|
|
3828
3846
|
}
|
|
3829
3847
|
class LsegColumn extends ColumnType {
|
|
3830
3848
|
constructor(schema) {
|
|
3831
|
-
super(schema, schema.stringSchema);
|
|
3849
|
+
super(schema, schema.stringSchema());
|
|
3832
3850
|
this.dataType = "lseg";
|
|
3833
3851
|
this.operators = Operators.text;
|
|
3834
3852
|
}
|
|
@@ -3838,7 +3856,7 @@ class LsegColumn extends ColumnType {
|
|
|
3838
3856
|
}
|
|
3839
3857
|
class BoxColumn extends ColumnType {
|
|
3840
3858
|
constructor(schema) {
|
|
3841
|
-
super(schema, schema.stringSchema);
|
|
3859
|
+
super(schema, schema.stringSchema());
|
|
3842
3860
|
this.dataType = "box";
|
|
3843
3861
|
this.operators = Operators.text;
|
|
3844
3862
|
}
|
|
@@ -3848,7 +3866,7 @@ class BoxColumn extends ColumnType {
|
|
|
3848
3866
|
}
|
|
3849
3867
|
class PathColumn extends ColumnType {
|
|
3850
3868
|
constructor(schema) {
|
|
3851
|
-
super(schema, schema.stringSchema);
|
|
3869
|
+
super(schema, schema.stringSchema());
|
|
3852
3870
|
this.dataType = "path";
|
|
3853
3871
|
this.operators = Operators.text;
|
|
3854
3872
|
}
|
|
@@ -3858,7 +3876,7 @@ class PathColumn extends ColumnType {
|
|
|
3858
3876
|
}
|
|
3859
3877
|
class PolygonColumn extends ColumnType {
|
|
3860
3878
|
constructor(schema) {
|
|
3861
|
-
super(schema, schema.stringSchema);
|
|
3879
|
+
super(schema, schema.stringSchema());
|
|
3862
3880
|
this.dataType = "polygon";
|
|
3863
3881
|
this.operators = Operators.text;
|
|
3864
3882
|
}
|
|
@@ -3868,7 +3886,7 @@ class PolygonColumn extends ColumnType {
|
|
|
3868
3886
|
}
|
|
3869
3887
|
class CircleColumn extends ColumnType {
|
|
3870
3888
|
constructor(schema) {
|
|
3871
|
-
super(schema, schema.stringSchema);
|
|
3889
|
+
super(schema, schema.stringSchema());
|
|
3872
3890
|
this.dataType = "circle";
|
|
3873
3891
|
this.operators = Operators.text;
|
|
3874
3892
|
}
|
|
@@ -3878,7 +3896,7 @@ class CircleColumn extends ColumnType {
|
|
|
3878
3896
|
}
|
|
3879
3897
|
class MoneyColumn extends NumberBaseColumn {
|
|
3880
3898
|
constructor(schema) {
|
|
3881
|
-
super(schema, schema.stringSchema);
|
|
3899
|
+
super(schema, schema.stringSchema());
|
|
3882
3900
|
this.dataType = "money";
|
|
3883
3901
|
this.parseFn = Object.assign(
|
|
3884
3902
|
function(input) {
|
|
@@ -3895,7 +3913,7 @@ class MoneyColumn extends NumberBaseColumn {
|
|
|
3895
3913
|
}
|
|
3896
3914
|
class CidrColumn extends ColumnType {
|
|
3897
3915
|
constructor(schema) {
|
|
3898
|
-
super(schema, schema.stringSchema);
|
|
3916
|
+
super(schema, schema.stringSchema());
|
|
3899
3917
|
this.dataType = "cidr";
|
|
3900
3918
|
this.operators = Operators.text;
|
|
3901
3919
|
}
|
|
@@ -3905,7 +3923,7 @@ class CidrColumn extends ColumnType {
|
|
|
3905
3923
|
}
|
|
3906
3924
|
class InetColumn extends ColumnType {
|
|
3907
3925
|
constructor(schema) {
|
|
3908
|
-
super(schema, schema.stringSchema);
|
|
3926
|
+
super(schema, schema.stringSchema());
|
|
3909
3927
|
this.dataType = "inet";
|
|
3910
3928
|
this.operators = Operators.text;
|
|
3911
3929
|
}
|
|
@@ -3915,7 +3933,7 @@ class InetColumn extends ColumnType {
|
|
|
3915
3933
|
}
|
|
3916
3934
|
class MacAddrColumn extends ColumnType {
|
|
3917
3935
|
constructor(schema) {
|
|
3918
|
-
super(schema, schema.stringSchema);
|
|
3936
|
+
super(schema, schema.stringSchema());
|
|
3919
3937
|
this.dataType = "macaddr";
|
|
3920
3938
|
this.operators = Operators.text;
|
|
3921
3939
|
}
|
|
@@ -3925,7 +3943,7 @@ class MacAddrColumn extends ColumnType {
|
|
|
3925
3943
|
}
|
|
3926
3944
|
class MacAddr8Column extends ColumnType {
|
|
3927
3945
|
constructor(schema) {
|
|
3928
|
-
super(schema, schema.stringSchema);
|
|
3946
|
+
super(schema, schema.stringSchema());
|
|
3929
3947
|
this.dataType = "macaddr8";
|
|
3930
3948
|
this.operators = Operators.text;
|
|
3931
3949
|
}
|
|
@@ -3971,7 +3989,7 @@ class BitVaryingColumn extends ColumnType {
|
|
|
3971
3989
|
}
|
|
3972
3990
|
class TsVectorColumn extends ColumnType {
|
|
3973
3991
|
constructor(schema, defaultLanguage = getDefaultLanguage()) {
|
|
3974
|
-
super(schema, schema.stringSchema);
|
|
3992
|
+
super(schema, schema.stringSchema());
|
|
3975
3993
|
this.defaultLanguage = defaultLanguage;
|
|
3976
3994
|
this.dataType = "tsvector";
|
|
3977
3995
|
this.operators = Operators.text;
|
|
@@ -4025,7 +4043,7 @@ class TsVectorColumn extends ColumnType {
|
|
|
4025
4043
|
}
|
|
4026
4044
|
class TsQueryColumn extends ColumnType {
|
|
4027
4045
|
constructor(schema) {
|
|
4028
|
-
super(schema, schema.stringSchema);
|
|
4046
|
+
super(schema, schema.stringSchema());
|
|
4029
4047
|
this.dataType = "tsquery";
|
|
4030
4048
|
this.operators = Operators.text;
|
|
4031
4049
|
}
|
|
@@ -4037,7 +4055,7 @@ const uuidDefaultSQL = "gen_random_uuid()";
|
|
|
4037
4055
|
const uuidDefault = new RawSQL(uuidDefaultSQL);
|
|
4038
4056
|
class UUIDColumn extends ColumnType {
|
|
4039
4057
|
constructor(schema) {
|
|
4040
|
-
super(schema, schema.uuid);
|
|
4058
|
+
super(schema, schema.uuid());
|
|
4041
4059
|
this.dataType = "uuid";
|
|
4042
4060
|
this.operators = Operators.text;
|
|
4043
4061
|
}
|
|
@@ -4060,7 +4078,7 @@ class UUIDColumn extends ColumnType {
|
|
|
4060
4078
|
}
|
|
4061
4079
|
class XMLColumn extends ColumnType {
|
|
4062
4080
|
constructor(schema) {
|
|
4063
|
-
super(schema, schema.stringSchema);
|
|
4081
|
+
super(schema, schema.stringSchema());
|
|
4064
4082
|
this.dataType = "xml";
|
|
4065
4083
|
this.operators = Operators.text;
|
|
4066
4084
|
}
|
|
@@ -4081,7 +4099,7 @@ class CitextColumn extends TextBaseColumn {
|
|
|
4081
4099
|
|
|
4082
4100
|
class BooleanColumn extends ColumnType {
|
|
4083
4101
|
constructor(schema) {
|
|
4084
|
-
super(schema, schema.boolean);
|
|
4102
|
+
super(schema, schema.boolean());
|
|
4085
4103
|
this.dataType = "boolean";
|
|
4086
4104
|
this.operators = Operators.boolean;
|
|
4087
4105
|
this.parseItem = (input) => input[0] === "t";
|
|
@@ -4093,7 +4111,12 @@ class BooleanColumn extends ColumnType {
|
|
|
4093
4111
|
|
|
4094
4112
|
class CustomTypeColumn extends ColumnType {
|
|
4095
4113
|
constructor(schema, dataType) {
|
|
4096
|
-
super(
|
|
4114
|
+
super(
|
|
4115
|
+
schema,
|
|
4116
|
+
schema.unknown(),
|
|
4117
|
+
schema.unknown(),
|
|
4118
|
+
schema.unknown()
|
|
4119
|
+
);
|
|
4097
4120
|
this.dataType = dataType;
|
|
4098
4121
|
this.operators = Operators.any;
|
|
4099
4122
|
this.data.isOfCustomType = true;
|
|
@@ -4342,7 +4365,7 @@ const makeColumnTypes = (schema) => {
|
|
|
4342
4365
|
RawSQL.prototype.columnTypes = makeColumnTypes;
|
|
4343
4366
|
|
|
4344
4367
|
class VirtualColumn extends ColumnType {
|
|
4345
|
-
constructor(schema, inputSchema = schema.never) {
|
|
4368
|
+
constructor(schema, inputSchema = schema.never()) {
|
|
4346
4369
|
super(schema, inputSchema);
|
|
4347
4370
|
this.dataType = "";
|
|
4348
4371
|
this.operators = Operators.any;
|
|
@@ -4354,7 +4377,7 @@ class VirtualColumn extends ColumnType {
|
|
|
4354
4377
|
|
|
4355
4378
|
class UnknownColumn extends VirtualColumn {
|
|
4356
4379
|
constructor(schema) {
|
|
4357
|
-
super(schema, schema.unknown);
|
|
4380
|
+
super(schema, schema.unknown());
|
|
4358
4381
|
}
|
|
4359
4382
|
}
|
|
4360
4383
|
RawSQL.prototype._type = new UnknownColumn(defaultSchemaConfig);
|