Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postgresql-client

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postgresql-client - npm Package Compare versions

Comparing version 2.5.10 to 2.6.0

9

CHANGELOG.md

@@ -0,1 +1,10 @@

# v2.6.0
[2023-08-01]
### Changes
* Now DataTypeMap.determine method lookup for data-types in reverse order. So last registered data-type returns first. ([`759ff85`](https://github.com/panates/postgresql-client/commit/759ff85ceaf0c5d119656b6b61d6450420c19fbc))
* Fixed typing for new eslint rules ([`95f3914`](https://github.com/panates/postgresql-client/commit/95f3914f61d4883b68d4b131f6200b08fc8e2478))
* Fixed typing for new eslint rules ([`f6e0d11`](https://github.com/panates/postgresql-client/commit/f6e0d11041616ee243a95062a4e9d581d5406d62))
# v2.5.10

@@ -2,0 +11,0 @@ [2023-07-26]

1

cjs/data-types/BoxType.js

@@ -40,2 +40,3 @@ "use strict";

return (typeof v === "object" &&
Object.keys(v).length === 4 &&
typeof v.x1 === "number" &&

@@ -42,0 +43,0 @@ typeof v.y1 === "number" &&

4

cjs/data-types/CircleType.js

@@ -36,3 +36,5 @@ "use strict";

isType(v) {
return typeof v === "object" && typeof v.x === "number" && typeof v.y === "number" && typeof v.r === "number";
return typeof v === "object" &&
Object.keys(v).length === 3 &&
typeof v.x === "number" && typeof v.y === "number" && typeof v.r === "number";
},

@@ -39,0 +41,0 @@ };

@@ -49,3 +49,4 @@ "use strict";

isType(v) {
return v instanceof Date;
return (v instanceof Date &&
v.getHours() === 0 && v.getMinutes() === 0 && v.getSeconds() === 0 && v.getMilliseconds() === 0);
},

@@ -52,0 +53,0 @@ };

@@ -18,3 +18,3 @@ "use strict";

isType(v) {
return typeof v === "number" && Number.isInteger(v);
return typeof v === "number" && Number.isInteger(v) && v <= Number.MAX_SAFE_INTEGER;
},

@@ -21,0 +21,0 @@ };

@@ -23,3 +23,4 @@ "use strict";

isType(v) {
return typeof v === "bigint" || (typeof v === "number" && Number.isInteger(v));
return typeof v === "bigint" ||
(typeof v === "number" && Number.isInteger(v) && v > Number.MAX_SAFE_INTEGER);
},

@@ -26,0 +27,0 @@ };

@@ -34,3 +34,3 @@ "use strict";

isType(v) {
return v && typeof v === "object";
return v && typeof v === 'object';
},

@@ -37,0 +37,0 @@ };

@@ -40,2 +40,3 @@ "use strict";

return (typeof v === "object" &&
Object.keys(v).length === 4 &&
typeof v.x1 === "number" &&

@@ -42,0 +43,0 @@ typeof v.y1 === "number" &&

@@ -18,3 +18,3 @@ "use strict";

isType(v) {
return typeof v === "number" && Number.isInteger(v) && v >= 0;
return typeof v === "number" && Number.isInteger(v) && !!definitions_js_1.DataTypeNames[v];
},

@@ -21,0 +21,0 @@ };

@@ -31,3 +31,5 @@ "use strict";

isType(v) {
return typeof v === "object" && typeof v.x === "number" && typeof v.y === "number";
return typeof v === "object" &&
Object.keys(v).length === 2 &&
typeof v.x === "number" && typeof v.y === "number";
},

@@ -34,0 +36,0 @@ };

@@ -55,4 +55,6 @@ "use strict";

isType(v) {
return v instanceof Date;
},
return v instanceof Date &&
!(v.getFullYear() === 1970 && v.getMonth() === 0 && v.getDate() === 1) &&
!(v.getHours() === 0 && v.getMinutes() === 0 && v.getSeconds() === 0 && v.getMilliseconds() === 0);
}
};

@@ -59,0 +61,0 @@ function padZero(v) {

@@ -37,3 +37,4 @@ "use strict";

}
register(...dataTypes) {
register(dataTypes) {
dataTypes = Array.isArray(dataTypes) ? dataTypes : [dataTypes];
for (const t of dataTypes) {

@@ -52,3 +53,6 @@ this._itemsByOID[t.oid] = t;

const valueIsArray = Array.isArray(value);
for (const t of this._items) {
let i;
let t;
for (i = this._items.length - 1; i >= 0; i--) {
t = this._items[i];
if (valueIsArray) {

@@ -65,21 +69,17 @@ if (t.elementsOID && t.isType(value[0]))

exports.GlobalTypeMap = new DataTypeMap();
exports.GlobalTypeMap.register(BoolType_js_1.BoolType, BoolType_js_1.ArrayBoolType);
exports.GlobalTypeMap.register(Int4Type_js_1.Int4Type, Int4Type_js_1.ArrayInt4Type, Int8Type_js_1.Int8Type, Int8Type_js_1.ArrayInt8Type, Int2Type_js_1.Int2Type, Int2Type_js_1.ArrayInt2Type);
exports.GlobalTypeMap.register(Float8Type_js_1.Float8Type, Float8Type_js_1.ArrayFloat8Type, Float4Type_js_1.Float4Type, Float4Type_js_1.ArrayFloat4Type);
exports.GlobalTypeMap.register(NumericType_js_1.NumericType, NumericType_js_1.ArrayNumericType);
exports.GlobalTypeMap.register(UuidType_js_1.UuidType, UuidType_js_1.ArrayUuidType);
exports.GlobalTypeMap.register(TimestamptzType_js_1.TimestamptzType, TimestamptzType_js_1.ArrayTimestamptzType);
exports.GlobalTypeMap.register(TimestampType_js_1.TimestampType, TimestampType_js_1.ArrayTimestampType);
exports.GlobalTypeMap.register(DateType_js_1.DateType, DateType_js_1.ArrayDateType);
exports.GlobalTypeMap.register(TimeType_js_1.TimeType, TimeType_js_1.ArrayTimeType);
exports.GlobalTypeMap.register(OidType_js_1.OidType, OidType_js_1.ArrayOidType);
exports.GlobalTypeMap.register(JsonType_js_1.JsonType, JsonType_js_1.ArrayJsonType);
exports.GlobalTypeMap.register(JsonbType_js_1.JsonbType, JsonbType_js_1.ArrayJsonbType);
exports.GlobalTypeMap.register(ByteaType_js_1.ByteaType, ByteaType_js_1.ArrayByteaType);
exports.GlobalTypeMap.register(PointType_js_1.PointType, PointType_js_1.ArrayPointType);
exports.GlobalTypeMap.register(CircleType_js_1.CircleType, CircleType_js_1.ArrayCircleType);
exports.GlobalTypeMap.register(LsegType_js_1.LsegType, LsegType_js_1.ArrayLsegType);
exports.GlobalTypeMap.register(BoxType_js_1.BoxType, BoxType_js_1.ArrayBoxType);
exports.GlobalTypeMap.register(VarcharType_js_1.VarcharType, VarcharType_js_1.ArrayVarcharType);
exports.GlobalTypeMap.register(CharType_js_1.CharType, CharType_js_1.ArrayCharType);
exports.GlobalTypeMap.register([OidType_js_1.OidType, OidType_js_1.ArrayOidType]);
exports.GlobalTypeMap.register([JsonbType_js_1.JsonbType, JsonbType_js_1.ArrayJsonbType]);
exports.GlobalTypeMap.register([JsonType_js_1.JsonType, JsonType_js_1.ArrayJsonType]);
exports.GlobalTypeMap.register([BoolType_js_1.BoolType, BoolType_js_1.ArrayBoolType]);
exports.GlobalTypeMap.register([NumericType_js_1.NumericType, NumericType_js_1.ArrayNumericType]);
exports.GlobalTypeMap.register([Float4Type_js_1.Float4Type, Float4Type_js_1.ArrayFloat4Type]);
exports.GlobalTypeMap.register([Float8Type_js_1.Float8Type, Float8Type_js_1.ArrayFloat8Type]);
exports.GlobalTypeMap.register([Int2Type_js_1.Int2Type, Int2Type_js_1.ArrayInt2Type]);
exports.GlobalTypeMap.register([Int4Type_js_1.Int4Type, Int4Type_js_1.ArrayInt4Type]);
exports.GlobalTypeMap.register([Int8Type_js_1.Int8Type, Int8Type_js_1.ArrayInt8Type]);
exports.GlobalTypeMap.register([ByteaType_js_1.ByteaType, ByteaType_js_1.ArrayByteaType]);
exports.GlobalTypeMap.register([CircleType_js_1.CircleType, CircleType_js_1.ArrayCircleType]);
exports.GlobalTypeMap.register([PointType_js_1.PointType, PointType_js_1.ArrayPointType]);
exports.GlobalTypeMap.register([LsegType_js_1.LsegType, LsegType_js_1.ArrayLsegType]);
exports.GlobalTypeMap.register([BoxType_js_1.BoxType, BoxType_js_1.ArrayBoxType]);
exports.GlobalTypeMap.register({ ...VarcharType_js_1.VarcharType, name: "bpchar", oid: definitions_js_1.DataTypeOIDs.bpchar });

@@ -113,1 +113,8 @@ exports.GlobalTypeMap.register({

});
exports.GlobalTypeMap.register([VarcharType_js_1.VarcharType, VarcharType_js_1.ArrayVarcharType]);
exports.GlobalTypeMap.register([UuidType_js_1.UuidType, UuidType_js_1.ArrayUuidType]);
exports.GlobalTypeMap.register([CharType_js_1.CharType, CharType_js_1.ArrayCharType]);
exports.GlobalTypeMap.register([TimestamptzType_js_1.TimestamptzType, TimestamptzType_js_1.ArrayTimestamptzType]);
exports.GlobalTypeMap.register([TimeType_js_1.TimeType, TimeType_js_1.ArrayTimeType]);
exports.GlobalTypeMap.register([DateType_js_1.DateType, DateType_js_1.ArrayDateType]);
exports.GlobalTypeMap.register([TimestampType_js_1.TimestampType, TimestampType_js_1.ArrayTimestampType]);

@@ -37,2 +37,3 @@ import { DataTypeOIDs } from "../definitions.js";

return (typeof v === "object" &&
Object.keys(v).length === 4 &&
typeof v.x1 === "number" &&

@@ -39,0 +40,0 @@ typeof v.y1 === "number" &&

@@ -33,3 +33,5 @@ import { DataTypeOIDs } from "../definitions.js";

isType(v) {
return typeof v === "object" && typeof v.x === "number" && typeof v.y === "number" && typeof v.r === "number";
return typeof v === "object" &&
Object.keys(v).length === 3 &&
typeof v.x === "number" && typeof v.y === "number" && typeof v.r === "number";
},

@@ -36,0 +38,0 @@ };

@@ -46,3 +46,4 @@ import { DataTypeOIDs } from "../definitions.js";

isType(v) {
return v instanceof Date;
return (v instanceof Date &&
v.getHours() === 0 && v.getMinutes() === 0 && v.getSeconds() === 0 && v.getMilliseconds() === 0);
},

@@ -49,0 +50,0 @@ };

@@ -15,3 +15,3 @@ import { DataTypeOIDs } from "../definitions.js";

isType(v) {
return typeof v === "number" && Number.isInteger(v);
return typeof v === "number" && Number.isInteger(v) && v <= Number.MAX_SAFE_INTEGER;
},

@@ -18,0 +18,0 @@ };

@@ -20,3 +20,4 @@ import { DataTypeOIDs } from "../definitions.js";

isType(v) {
return typeof v === "bigint" || (typeof v === "number" && Number.isInteger(v));
return typeof v === "bigint" ||
(typeof v === "number" && Number.isInteger(v) && v > Number.MAX_SAFE_INTEGER);
},

@@ -23,0 +24,0 @@ };

@@ -31,3 +31,3 @@ import { DataTypeOIDs } from "../definitions.js";

isType(v) {
return v && typeof v === "object";
return v && typeof v === 'object';
},

@@ -34,0 +34,0 @@ };

@@ -37,2 +37,3 @@ import { DataTypeOIDs } from "../definitions.js";

return (typeof v === "object" &&
Object.keys(v).length === 4 &&
typeof v.x1 === "number" &&

@@ -39,0 +40,0 @@ typeof v.y1 === "number" &&

@@ -1,2 +0,2 @@

import { DataTypeOIDs } from "../definitions.js";
import { DataTypeNames, DataTypeOIDs } from "../definitions.js";
import { fastParseInt } from "../util/fast-parseint.js";

@@ -15,3 +15,3 @@ export const OidType = {

isType(v) {
return typeof v === "number" && Number.isInteger(v) && v >= 0;
return typeof v === "number" && Number.isInteger(v) && !!DataTypeNames[v];
},

@@ -18,0 +18,0 @@ };

@@ -28,3 +28,5 @@ import { DataTypeOIDs } from "../definitions.js";

isType(v) {
return typeof v === "object" && typeof v.x === "number" && typeof v.y === "number";
return typeof v === "object" &&
Object.keys(v).length === 2 &&
typeof v.x === "number" && typeof v.y === "number";
},

@@ -31,0 +33,0 @@ };

@@ -52,4 +52,6 @@ import { DataTypeOIDs } from "../definitions.js";

isType(v) {
return v instanceof Date;
},
return v instanceof Date &&
!(v.getFullYear() === 1970 && v.getMonth() === 0 && v.getDate() === 1) &&
!(v.getHours() === 0 && v.getMinutes() === 0 && v.getSeconds() === 0 && v.getMilliseconds() === 0);
}
};

@@ -56,0 +58,0 @@ function padZero(v) {

@@ -34,3 +34,4 @@ import { ArrayBoolType, BoolType } from "./data-types/BoolType.js";

}
register(...dataTypes) {
register(dataTypes) {
dataTypes = Array.isArray(dataTypes) ? dataTypes : [dataTypes];
for (const t of dataTypes) {

@@ -49,3 +50,6 @@ this._itemsByOID[t.oid] = t;

const valueIsArray = Array.isArray(value);
for (const t of this._items) {
let i;
let t;
for (i = this._items.length - 1; i >= 0; i--) {
t = this._items[i];
if (valueIsArray) {

@@ -61,21 +65,17 @@ if (t.elementsOID && t.isType(value[0]))

export const GlobalTypeMap = new DataTypeMap();
GlobalTypeMap.register(BoolType, ArrayBoolType);
GlobalTypeMap.register(Int4Type, ArrayInt4Type, Int8Type, ArrayInt8Type, Int2Type, ArrayInt2Type);
GlobalTypeMap.register(Float8Type, ArrayFloat8Type, Float4Type, ArrayFloat4Type);
GlobalTypeMap.register(NumericType, ArrayNumericType);
GlobalTypeMap.register(UuidType, ArrayUuidType);
GlobalTypeMap.register(TimestamptzType, ArrayTimestamptzType);
GlobalTypeMap.register(TimestampType, ArrayTimestampType);
GlobalTypeMap.register(DateType, ArrayDateType);
GlobalTypeMap.register(TimeType, ArrayTimeType);
GlobalTypeMap.register(OidType, ArrayOidType);
GlobalTypeMap.register(JsonType, ArrayJsonType);
GlobalTypeMap.register(JsonbType, ArrayJsonbType);
GlobalTypeMap.register(ByteaType, ArrayByteaType);
GlobalTypeMap.register(PointType, ArrayPointType);
GlobalTypeMap.register(CircleType, ArrayCircleType);
GlobalTypeMap.register(LsegType, ArrayLsegType);
GlobalTypeMap.register(BoxType, ArrayBoxType);
GlobalTypeMap.register(VarcharType, ArrayVarcharType);
GlobalTypeMap.register(CharType, ArrayCharType);
GlobalTypeMap.register([OidType, ArrayOidType]);
GlobalTypeMap.register([JsonbType, ArrayJsonbType]);
GlobalTypeMap.register([JsonType, ArrayJsonType]);
GlobalTypeMap.register([BoolType, ArrayBoolType]);
GlobalTypeMap.register([NumericType, ArrayNumericType]);
GlobalTypeMap.register([Float4Type, ArrayFloat4Type]);
GlobalTypeMap.register([Float8Type, ArrayFloat8Type]);
GlobalTypeMap.register([Int2Type, ArrayInt2Type]);
GlobalTypeMap.register([Int4Type, ArrayInt4Type]);
GlobalTypeMap.register([Int8Type, ArrayInt8Type]);
GlobalTypeMap.register([ByteaType, ArrayByteaType]);
GlobalTypeMap.register([CircleType, ArrayCircleType]);
GlobalTypeMap.register([PointType, ArrayPointType]);
GlobalTypeMap.register([LsegType, ArrayLsegType]);
GlobalTypeMap.register([BoxType, ArrayBoxType]);
GlobalTypeMap.register({ ...VarcharType, name: "bpchar", oid: DataTypeOIDs.bpchar });

@@ -109,1 +109,8 @@ GlobalTypeMap.register({

});
GlobalTypeMap.register([VarcharType, ArrayVarcharType]);
GlobalTypeMap.register([UuidType, ArrayUuidType]);
GlobalTypeMap.register([CharType, ArrayCharType]);
GlobalTypeMap.register([TimestamptzType, ArrayTimestamptzType]);
GlobalTypeMap.register([TimeType, ArrayTimeType]);
GlobalTypeMap.register([DateType, ArrayDateType]);
GlobalTypeMap.register([TimestampType, ArrayTimestampType]);
{
"name": "postgresql-client",
"description": "Enterprise level PostgreSQL client for JavaScript",
"version": "2.5.10",
"version": "2.6.0",
"author": "Panates",

@@ -6,0 +6,0 @@ "contributors": [

@@ -7,5 +7,5 @@ import { DataType, Maybe, OID } from "./definitions.js";

get(oid: OID): DataType;
register(...dataTypes: DataType[]): void;
register(dataTypes: DataType | DataType[]): void;
determine(value: any): Maybe<OID>;
}
export declare const GlobalTypeMap: DataTypeMap;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc