postgresql-client
Advanced tools
Comparing version 2.6.1 to 2.7.0
@@ -0,1 +1,9 @@ | ||
# v2.7.0 | ||
[2023-08-01] | ||
### Changes | ||
* Restructure files according to current Panates standards ([`58875b3`](https://github.com/panates/postgresql-client/commit/58875b364c58b8b5e5ddac55373dd70ad5639bd0)) | ||
* Renames DatabaseConnectionParams.onErrorRollback to rollbackOnError ([`dc50fb1`](https://github.com/panates/postgresql-client/commit/dc50fb1ee3b9975f188af60b7f3fed5f8d089fcc)) | ||
# v2.6.1 | ||
@@ -2,0 +10,0 @@ [2023-08-01] |
@@ -17,14 +17,24 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./DataTypeMap.js"), exports); | ||
__exportStar(require("./definitions.js"), exports); | ||
__exportStar(require("./Connection.js"), exports); | ||
__exportStar(require("./Pool.js"), exports); | ||
__exportStar(require("./PreparedStatement.js"), exports); | ||
__exportStar(require("./BindParam.js"), exports); | ||
__exportStar(require("./Cursor.js"), exports); | ||
__exportStar(require("./constants.js"), exports); | ||
__exportStar(require("./data-type-map.js"), exports); | ||
__exportStar(require("./types.js"), exports); | ||
__exportStar(require("./connection/bind-param.js"), exports); | ||
__exportStar(require("./connection/connection.js"), exports); | ||
__exportStar(require("./connection/cursor.js"), exports); | ||
__exportStar(require("./connection/pool.js"), exports); | ||
__exportStar(require("./connection/prepared-statement.js"), exports); | ||
__exportStar(require("./interfaces/command-result.js"), exports); | ||
__exportStar(require("./interfaces/data-mapping-options.js"), exports); | ||
__exportStar(require("./interfaces/data-type.js"), exports); | ||
__exportStar(require("./interfaces/database-connection-params.js"), exports); | ||
__exportStar(require("./interfaces/field-info.js"), exports); | ||
__exportStar(require("./interfaces/query-options.js"), exports); | ||
__exportStar(require("./interfaces/query-result.js"), exports); | ||
__exportStar(require("./interfaces/script-execute-options.js"), exports); | ||
__exportStar(require("./interfaces/script-result.js"), exports); | ||
__exportStar(require("./interfaces/statement-prepare-options.js"), exports); | ||
__exportStar(require("./util/connection-config.js"), exports); | ||
__exportStar(require("./util/escape-literal.js"), exports); | ||
__exportStar(require("./util/parse-datetime.js"), exports); | ||
__exportStar(require("./util/stringify-arrayliteral.js"), exports); | ||
__exportStar(require("./util/stringify-for-sql.js"), exports); | ||
__exportStar(require("./util/escape-literal.js"), exports); | ||
__exportStar(require("./util/fast-parseint.js"), exports); | ||
__exportStar(require("./util/connection-config.js"), exports); | ||
__exportStar(require("./util/parse-datetime.js"), exports); |
@@ -8,3 +8,2 @@ "use strict"; | ||
const putil_merge_1 = __importDefault(require("putil-merge")); | ||
const url_1 = __importDefault(require("url")); | ||
const config_from_env_js_1 = require("./config-from-env.js"); | ||
@@ -34,3 +33,3 @@ function getConnectionConfig(config) { | ||
str = "postgres://" + str; | ||
const parsed = url_1.default.parse(str, true); | ||
const parsed = new URL(str); | ||
const getFirst = (v) => { | ||
@@ -47,4 +46,4 @@ return typeof v === "string" ? v : Array.isArray(v) ? v[0] : ""; | ||
cfg.host += decodeURI(parsed.pathname || ""); | ||
if (parsed.query.db) | ||
cfg.database = decodeURI(getFirst(parsed.query.db)); | ||
if (parsed.searchParams.get('db')) | ||
cfg.database = decodeURI(getFirst(parsed.searchParams.get('db'))); | ||
} | ||
@@ -55,19 +54,16 @@ else if (parsed.protocol === "pg:" || parsed.protocol === "postgres:") { | ||
} | ||
if (parsed.query.host) | ||
cfg.host = decodeURI(getFirst(parsed.query.host)); | ||
if (parsed.query.db) | ||
cfg.database = decodeURI(getFirst(parsed.query.db)); | ||
if (parsed.query.schema) | ||
cfg.schema = decodeURI(getFirst(parsed.query.schema)); | ||
if (parsed.query.application_name) | ||
cfg.applicationName = decodeURI(getFirst(parsed.query.application_name)); | ||
if (parsed.auth) { | ||
const a = parsed.auth.split(":"); | ||
if (a[0]) | ||
cfg.user = a[0]; | ||
if (a[1]) | ||
cfg.password = a[1]; | ||
} | ||
if (parsed.searchParams.get('host')) | ||
cfg.host = decodeURI(getFirst(parsed.searchParams.get('host'))); | ||
if (parsed.searchParams.get('db')) | ||
cfg.database = decodeURI(getFirst(parsed.searchParams.get('db'))); | ||
if (parsed.searchParams.get('schema')) | ||
cfg.schema = decodeURI(getFirst(parsed.searchParams.get('schema'))); | ||
if (parsed.searchParams.get('application_name')) | ||
cfg.applicationName = decodeURI(getFirst(parsed.searchParams.get('application_name'))); | ||
if (parsed.username) | ||
cfg.user = parsed.username; | ||
if (parsed.password) | ||
cfg.password = parsed.password; | ||
return cfg; | ||
} | ||
exports.parseConnectionString = parseConnectionString; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.decodeBinaryArray = void 0; | ||
const BufferReader_js_1 = require("../protocol/BufferReader.js"); | ||
const buffer_reader_js_1 = require("../protocol/buffer-reader.js"); | ||
function decodeBinaryArray(buf, decoder, options) { | ||
if (!buf.length) | ||
return null; | ||
const io = new BufferReader_js_1.BufferReader(buf); | ||
const io = new buffer_reader_js_1.BufferReader(buf); | ||
const ndims = io.readInt32BE(); | ||
@@ -10,0 +10,0 @@ io.readInt32BE(); // hasNulls |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.encodeBinaryArray = void 0; | ||
const definitions_js_1 = require("../definitions.js"); | ||
const constants_js_1 = require("../constants.js"); | ||
const array_calculatedim_js_1 = require("./array-calculatedim.js"); | ||
function encodeBinaryArray(io, value, itemOid, options, encode) { | ||
itemOid = itemOid || definitions_js_1.DataTypeOIDs.varchar; | ||
itemOid = itemOid || constants_js_1.DataTypeOIDs.varchar; | ||
const dim = (0, array_calculatedim_js_1.arrayCalculateDim)(value); | ||
@@ -9,0 +9,0 @@ const ndims = dim.length; |
"use strict"; | ||
// noinspection RegExpUnnecessaryNonCapturingGroup | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseDateTime = void 0; | ||
// noinspection RegExpUnnecessaryNonCapturingGroup | ||
const fast_parseint_js_1 = require("./fast-parseint.js"); | ||
// noinspection RegExpUnnecessaryNonCapturingGroup | ||
const TIMESTAMP_PATTERN = | ||
@@ -7,0 +8,0 @@ // eslint-disable-next-line |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.stringifyValueForSQL = exports.stringifyArrayForSQL = void 0; | ||
const UuidType_js_1 = require("../data-types/UuidType.js"); | ||
const uuid_type_js_1 = require("../data-types/uuid-type.js"); | ||
const escape_literal_js_1 = require("./escape-literal.js"); | ||
@@ -24,3 +24,3 @@ function stringifyArrayForSQL(v, options, encode) { | ||
return v.toString(); | ||
if (typeof v === "string" && UuidType_js_1.UuidType.isType(v)) | ||
if (typeof v === "string" && uuid_type_js_1.UuidType.isType(v)) | ||
return (0, escape_literal_js_1.escapeLiteral)("" + v) + "::uuid"; | ||
@@ -27,0 +27,0 @@ if (typeof v === "object") |
@@ -1,13 +0,23 @@ | ||
export * from "./DataTypeMap.js"; | ||
export * from "./definitions.js"; | ||
export * from "./Connection.js"; | ||
export * from "./Pool.js"; | ||
export * from "./PreparedStatement.js"; | ||
export * from "./BindParam.js"; | ||
export * from "./Cursor.js"; | ||
export * from "./util/stringify-arrayliteral.js"; | ||
export * from "./util/stringify-for-sql.js"; | ||
export * from "./util/escape-literal.js"; | ||
export * from "./util/fast-parseint.js"; | ||
export * from "./util/connection-config.js"; | ||
export * from "./util/parse-datetime.js"; | ||
export * from './constants.js'; | ||
export * from './data-type-map.js'; | ||
export * from './types.js'; | ||
export * from './connection/bind-param.js'; | ||
export * from './connection/connection.js'; | ||
export * from './connection/cursor.js'; | ||
export * from './connection/pool.js'; | ||
export * from './connection/prepared-statement.js'; | ||
export * from './interfaces/command-result.js'; | ||
export * from './interfaces/data-mapping-options.js'; | ||
export * from './interfaces/data-type.js'; | ||
export * from './interfaces/database-connection-params.js'; | ||
export * from './interfaces/field-info.js'; | ||
export * from './interfaces/query-options.js'; | ||
export * from './interfaces/query-result.js'; | ||
export * from './interfaces/script-execute-options.js'; | ||
export * from './interfaces/script-result.js'; | ||
export * from './interfaces/statement-prepare-options.js'; | ||
export * from './util/connection-config.js'; | ||
export * from './util/escape-literal.js'; | ||
export * from './util/parse-datetime.js'; | ||
export * from './util/stringify-arrayliteral.js'; | ||
export * from './util/stringify-for-sql.js'; |
@@ -1,4 +0,3 @@ | ||
import merge from "putil-merge"; | ||
import url from "url"; | ||
import { configFromEnv } from "./config-from-env.js"; | ||
import merge from 'putil-merge'; | ||
import { configFromEnv } from './config-from-env.js'; | ||
export function getConnectionConfig(config) { | ||
@@ -26,3 +25,3 @@ const cfg = configFromEnv(); | ||
str = "postgres://" + str; | ||
const parsed = url.parse(str, true); | ||
const parsed = new URL(str); | ||
const getFirst = (v) => { | ||
@@ -39,4 +38,4 @@ return typeof v === "string" ? v : Array.isArray(v) ? v[0] : ""; | ||
cfg.host += decodeURI(parsed.pathname || ""); | ||
if (parsed.query.db) | ||
cfg.database = decodeURI(getFirst(parsed.query.db)); | ||
if (parsed.searchParams.get('db')) | ||
cfg.database = decodeURI(getFirst(parsed.searchParams.get('db'))); | ||
} | ||
@@ -47,18 +46,15 @@ else if (parsed.protocol === "pg:" || parsed.protocol === "postgres:") { | ||
} | ||
if (parsed.query.host) | ||
cfg.host = decodeURI(getFirst(parsed.query.host)); | ||
if (parsed.query.db) | ||
cfg.database = decodeURI(getFirst(parsed.query.db)); | ||
if (parsed.query.schema) | ||
cfg.schema = decodeURI(getFirst(parsed.query.schema)); | ||
if (parsed.query.application_name) | ||
cfg.applicationName = decodeURI(getFirst(parsed.query.application_name)); | ||
if (parsed.auth) { | ||
const a = parsed.auth.split(":"); | ||
if (a[0]) | ||
cfg.user = a[0]; | ||
if (a[1]) | ||
cfg.password = a[1]; | ||
} | ||
if (parsed.searchParams.get('host')) | ||
cfg.host = decodeURI(getFirst(parsed.searchParams.get('host'))); | ||
if (parsed.searchParams.get('db')) | ||
cfg.database = decodeURI(getFirst(parsed.searchParams.get('db'))); | ||
if (parsed.searchParams.get('schema')) | ||
cfg.schema = decodeURI(getFirst(parsed.searchParams.get('schema'))); | ||
if (parsed.searchParams.get('application_name')) | ||
cfg.applicationName = decodeURI(getFirst(parsed.searchParams.get('application_name'))); | ||
if (parsed.username) | ||
cfg.user = parsed.username; | ||
if (parsed.password) | ||
cfg.password = parsed.password; | ||
return cfg; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { BufferReader } from "../protocol/BufferReader.js"; | ||
import { BufferReader } from '../protocol/buffer-reader.js'; | ||
export function decodeBinaryArray(buf, decoder, options) { | ||
@@ -3,0 +3,0 @@ if (!buf.length) |
@@ -1,3 +0,3 @@ | ||
import { DataTypeOIDs } from "../definitions.js"; | ||
import { arrayCalculateDim } from "./array-calculatedim.js"; | ||
import { DataTypeOIDs } from '../constants.js'; | ||
import { arrayCalculateDim } from './array-calculatedim.js'; | ||
export function encodeBinaryArray(io, value, itemOid, options, encode) { | ||
@@ -4,0 +4,0 @@ itemOid = itemOid || DataTypeOIDs.varchar; |
// noinspection RegExpUnnecessaryNonCapturingGroup | ||
import { fastParseInt } from "./fast-parseint.js"; | ||
import { fastParseInt } from './fast-parseint.js'; | ||
// noinspection RegExpUnnecessaryNonCapturingGroup | ||
const TIMESTAMP_PATTERN = | ||
@@ -4,0 +5,0 @@ // eslint-disable-next-line |
@@ -1,2 +0,2 @@ | ||
import { fastParseInt } from "./fast-parseint.js"; | ||
import { fastParseInt } from './fast-parseint.js'; | ||
// eslint-disable-next-line | ||
@@ -3,0 +3,0 @@ // noinspection RegExpUnnecessaryNonCapturingGroup |
@@ -1,2 +0,2 @@ | ||
import { arrayCalculateDim } from "./array-calculatedim.js"; | ||
import { arrayCalculateDim } from './array-calculatedim.js'; | ||
export function stringifyArrayLiteral(value, options, encode) { | ||
@@ -3,0 +3,0 @@ const dim = arrayCalculateDim(value); |
@@ -1,3 +0,3 @@ | ||
import { UuidType } from "../data-types/UuidType.js"; | ||
import { escapeLiteral } from "./escape-literal.js"; | ||
import { UuidType } from '../data-types/uuid-type.js'; | ||
import { escapeLiteral } from './escape-literal.js'; | ||
export function stringifyArrayForSQL(v, options, encode) { | ||
@@ -4,0 +4,0 @@ const arr = v.map((x) => stringifyValueForSQL(x, options, encode)); |
{ | ||
"name": "postgresql-client", | ||
"description": "Enterprise level PostgreSQL client for JavaScript", | ||
"version": "2.6.1", | ||
"version": "2.7.0", | ||
"author": "Panates", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -1,13 +0,23 @@ | ||
export * from "./DataTypeMap.js"; | ||
export * from "./definitions.js"; | ||
export * from "./Connection.js"; | ||
export * from "./Pool.js"; | ||
export * from "./PreparedStatement.js"; | ||
export * from "./BindParam.js"; | ||
export * from "./Cursor.js"; | ||
export * from "./util/stringify-arrayliteral.js"; | ||
export * from "./util/stringify-for-sql.js"; | ||
export * from "./util/escape-literal.js"; | ||
export * from "./util/fast-parseint.js"; | ||
export * from "./util/connection-config.js"; | ||
export * from "./util/parse-datetime.js"; | ||
export * from './constants.js'; | ||
export * from './data-type-map.js'; | ||
export * from './types.js'; | ||
export * from './connection/bind-param.js'; | ||
export * from './connection/connection.js'; | ||
export * from './connection/cursor.js'; | ||
export * from './connection/pool.js'; | ||
export * from './connection/prepared-statement.js'; | ||
export * from './interfaces/command-result.js'; | ||
export * from './interfaces/data-mapping-options.js'; | ||
export * from './interfaces/data-type.js'; | ||
export * from './interfaces/database-connection-params.js'; | ||
export * from './interfaces/field-info.js'; | ||
export * from './interfaces/query-options.js'; | ||
export * from './interfaces/query-result.js'; | ||
export * from './interfaces/script-execute-options.js'; | ||
export * from './interfaces/script-result.js'; | ||
export * from './interfaces/statement-prepare-options.js'; | ||
export * from './util/connection-config.js'; | ||
export * from './util/escape-literal.js'; | ||
export * from './util/parse-datetime.js'; | ||
export * from './util/stringify-arrayliteral.js'; | ||
export * from './util/stringify-for-sql.js'; |
/// <reference types="node" /> | ||
import { Nullable } from "../definitions.js"; | ||
import { Nullable } from "../types.js"; | ||
export declare namespace Protocol { | ||
@@ -4,0 +4,0 @@ const VERSION_MAJOR = 3; |
@@ -1,2 +0,2 @@ | ||
import { DatabaseConnectionParams } from "../definitions.js"; | ||
import type { DatabaseConnectionParams } from '../interfaces/database-connection-params.js'; | ||
export declare function configFromEnv(): DatabaseConnectionParams; |
@@ -1,3 +0,3 @@ | ||
import { ConnectionConfiguration } from "../definitions.js"; | ||
import type { ConnectionConfiguration } from '../interfaces/database-connection-params.js'; | ||
export declare function getConnectionConfig(config?: ConnectionConfiguration | string): ConnectionConfiguration; | ||
export declare function parseConnectionString(str: string): ConnectionConfiguration; |
/// <reference types="node" /> | ||
import { DataMappingOptions, DecodeBinaryFunction, Nullable } from "../definitions.js"; | ||
import { DataMappingOptions } from '../interfaces/data-mapping-options.js'; | ||
import type { DecodeBinaryFunction, Nullable } from '../types.js'; | ||
export declare function decodeBinaryArray(buf: Buffer, decoder: DecodeBinaryFunction, options: DataMappingOptions): Nullable<any[]>; |
@@ -1,3 +0,4 @@ | ||
import { DataMappingOptions, EncodeBinaryFunction, OID } from "../definitions.js"; | ||
import { SmartBuffer } from "../protocol/SmartBuffer.js"; | ||
import type { DataMappingOptions } from '../interfaces/data-mapping-options.js'; | ||
import type { SmartBuffer } from '../protocol/smart-buffer.js'; | ||
import type { EncodeBinaryFunction, OID } from '../types.js'; | ||
export declare function encodeBinaryArray(io: SmartBuffer, value: any[], itemOid: OID, options: DataMappingOptions, encode: EncodeBinaryFunction): void; |
@@ -1,2 +0,2 @@ | ||
import { Maybe } from "../definitions.js"; | ||
import type { Maybe } from '../types.js'; | ||
export declare function parsePostgresArray(s: string, opts?: { | ||
@@ -3,0 +3,0 @@ transform?: (v: string) => any; |
@@ -1,2 +0,3 @@ | ||
import { DataMappingOptions, EncodeTextFunction } from "../definitions.js"; | ||
import { DataMappingOptions } from '../interfaces/data-mapping-options.js'; | ||
import { EncodeTextFunction } from '../types.js'; | ||
export declare function stringifyArrayLiteral(value: any[], options?: DataMappingOptions, encode?: EncodeTextFunction): string; |
@@ -1,3 +0,4 @@ | ||
import { DataMappingOptions, EncodeTextFunction } from "../definitions.js"; | ||
import { DataMappingOptions } from '../interfaces/data-mapping-options.js'; | ||
import { EncodeTextFunction } from '../types.js'; | ||
export declare function stringifyArrayForSQL(v: any[], options?: DataMappingOptions, encode?: EncodeTextFunction): string; | ||
export declare function stringifyValueForSQL(v: any, options?: DataMappingOptions, encode?: EncodeTextFunction): string; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
400905
212
9874
5