ts-postgres
Advanced tools
Comparing version
{ | ||
"name": "ts-postgres", | ||
"version": "1.8.0", | ||
"type": "module", | ||
"version": "1.9.0", | ||
"description": "PostgreSQL client in TypeScript", | ||
@@ -13,4 +14,2 @@ "declaration": true, | ||
"homepage": "https://github.com/malthe/ts-postgres", | ||
"main": "dist/src/index.js", | ||
"types": "dist/src/index.d.ts", | ||
"author": "Malthe Borch <mborch@gmail.com>", | ||
@@ -20,5 +19,10 @@ "dependencies": { | ||
}, | ||
"main": "./dist/module/index.js", | ||
"types": "./dist/module/index.d.ts", | ||
"exports": { | ||
"require": "./dist/commonjs/index.js", | ||
"import": "./dist/module/index.js" | ||
}, | ||
"files": [ | ||
"/dist", | ||
"/src" | ||
"/dist" | ||
], | ||
@@ -37,30 +41,7 @@ "repository": { | ||
"prebuild": "rimraf dist", | ||
"build": "tsc", | ||
"test": "jest --verbose --unhandled-rejections=strict --detectOpenHandles --silent false", | ||
"test:watch": "jest --watch", | ||
"test:prod": "npm run lint && npm run test -- --coverage --no-cache --testTimeout=5000" | ||
"build:cjs": "tsc --module commonjs --moduleResolution node --outDir dist/commonjs", | ||
"build:esm": "tsc --outDir dist/module", | ||
"test": "node --experimental-default-type module --loader ts-node/esm --enable-source-maps --test test/*.test.ts", | ||
"test:prod": "npm run lint && npm run test" | ||
}, | ||
"jest": { | ||
"preset": "ts-jest", | ||
"testEnvironment": "node", | ||
"coveragePathIgnorePatterns": [ | ||
"/node_modules/", | ||
"/test/", | ||
"/src/defaults.ts", | ||
"/src/index.ts", | ||
"/src/logging.ts", | ||
"/src/queue.ts", | ||
"/src/sasl.ts", | ||
"/src/utils.ts" | ||
], | ||
"coverageThreshold": { | ||
"global": { | ||
"branches": 70, | ||
"functions": 80, | ||
"lines": 85, | ||
"statements": 85 | ||
} | ||
}, | ||
"collectCoverage": true | ||
}, | ||
"prettier": { | ||
@@ -71,8 +52,7 @@ "semi": true, | ||
"devDependencies": { | ||
"@jest/globals": "^29.7.0", | ||
"@types/node": "^18.15.3", | ||
"@types/node": "^20.10.6", | ||
"@typescript-eslint/eslint-plugin": "^6.10.0", | ||
"@typescript-eslint/parser": "^6.10.0", | ||
"colors": "^1.4.0", | ||
"eslint": "^8.53.0", | ||
"eslint": "^8.56.0", | ||
"eslint-config-standard": "^17.1.0", | ||
@@ -83,10 +63,8 @@ "eslint-plugin-import": "^2.29.0", | ||
"eslint-plugin-promise": "^6.1.1", | ||
"jest": "^29.7.0", | ||
"lint-staged": "^15.0.2", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^29.1.1", | ||
"ts-node": "^10.9.1", | ||
"ts-node": "^10.9.2", | ||
"typedoc": "^0.25.4", | ||
"typescript": "^4.9.5" | ||
"typescript": "^5.2.2" | ||
} | ||
} |
@@ -12,3 +12,3 @@  | ||
```sh | ||
$ npm install ts-postgres@latest | ||
$ npm install ts-postgres | ||
``` | ||
@@ -19,4 +19,3 @@ | ||
* Fast! | ||
* Supports both binary and text value formats | ||
* Result data is currently sent in binary format only | ||
* Supports binary and text value formats (result data always uses binary) | ||
* Multiple queries can be sent at once (pipeline) | ||
@@ -28,2 +27,3 @@ * Extensible value model | ||
* Streaming data directly into a socket | ||
* Supports CommonJS and ESM modules | ||
@@ -45,23 +45,19 @@ See the [documentation](https://malthe.github.io/ts-postgres/) for a complete reference. | ||
async function main() { | ||
const client = new Client(); | ||
await client.connect(); | ||
const client = new Client(); | ||
await client.connect(); | ||
try { | ||
// The query method is generic on the result row. | ||
const result = client.query<Greeting>( | ||
"SELECT 'Hello ' || $1 || '!' AS message", | ||
['world'] | ||
); | ||
try { | ||
// The query method is generic on the result row. | ||
const result = client.query<Greeting>( | ||
"SELECT 'Hello ' || $1 || '!' AS message", | ||
['world'] | ||
); | ||
for await (const obj of result) { | ||
// 'Hello world!' | ||
console.log(obj.message); | ||
} | ||
} finally { | ||
await client.end(); | ||
for await (const obj of result) { | ||
// 'Hello world!' | ||
console.log(obj.message); | ||
} | ||
} finally { | ||
await client.end(); | ||
} | ||
await main(); | ||
``` | ||
@@ -68,0 +64,0 @@ Waiting on the result (i.e., result iterator) returns the complete query result. |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
688557
65.45%15
-16.67%83
23.88%0
-100%1
-66.67%Yes
NaN6898
-4.14%321
-1.23%