{"id":15570150,"url":"https://github.com/nfroidure/postgresql-service","last_synced_at":"2026-01-31T16:34:07.142Z","repository":{"id":33016380,"uuid":"149869109","full_name":"nfroidure/postgresql-service","owner":"nfroidure","description":"A simple wrapper around `node-pg`","archived":false,"fork":false,"pushed_at":"2025-11-06T21:54:47.000Z","size":3494,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-06T23:28:49.625Z","etag":null,"topics":["hacktoberfest","knifecycle","nodejs","postgresql"],"latest_commit_sha":null,"homepage":"https://insertafter.com/en/blog/unobstrusive_dependency_injection_with_knifecycle.html","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nfroidure.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["nfroidure"]}},"created_at":"2018-09-22T11:04:28.000Z","updated_at":"2025-11-06T21:54:51.000Z","dependencies_parsed_at":"2024-05-28T18:28:08.602Z","dependency_job_id":"c4701603-3962-4ad9-a0a6-c4e6731cefec","html_url":"https://github.com/nfroidure/postgresql-service","commit_stats":{"total_commits":46,"total_committers":1,"mean_commits":46.0,"dds":0.0,"last_synced_commit":"7e993dced60732e8a8a3780569a491928ed42025"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/nfroidure/postgresql-service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfroidure%2Fpostgresql-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfroidure%2Fpostgresql-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfroidure%2Fpostgresql-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfroidure%2Fpostgresql-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nfroidure","download_url":"https://codeload.github.com/nfroidure/postgresql-service/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfroidure%2Fpostgresql-service/sbom","scorecard":{"id":682764,"data":{"date":"2025-08-11","repo":{"name":"github.com/nfroidure/postgresql-service","commit":"df410de3f74d1eefdbfb398dc048c96bd7cd9ae5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/nfroidure/postgresql-service/test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/nfroidure/postgresql-service/test.yml/main?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":6,"reason":"4 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-xffm-g5w8-qvg7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T23:43:11.160Z","repository_id":33016380,"created_at":"2025-08-21T23:43:11.160Z","updated_at":"2025-08-21T23:43:11.160Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28947663,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T14:26:55.697Z","status":"ssl_error","status_checked_at":"2026-01-31T14:26:52.545Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","knifecycle","nodejs","postgresql"],"created_at":"2024-10-02T17:41:24.270Z","updated_at":"2026-01-31T16:34:07.122Z","avatar_url":"https://github.com/nfroidure.png","language":"TypeScript","funding_links":["https://github.com/sponsors/nfroidure"],"categories":[],"sub_categories":[],"readme":"[//]: # ( )\n[//]: # (This file is automatically generated by a `metapak`)\n[//]: # (module. Do not change it  except between the)\n[//]: # (`content:start/end` flags, your changes would)\n[//]: # (be overridden.)\n[//]: # ( )\n# postgresql-service\n\u003e A simple wrapper around `node-pg`\n\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/postgresql-service/blob/main/LICENSE)\n\n\n[//]: # (::contents:start)\n\nThis simple service covers my own usage of the `pg` module. I only use\ntransactions and queries and I use dependency injection with\n[Knifecycle](https://github.com/nfroidure/knifecycle).\n\nIt also sets up a few tweaks I have to do for each projects like avoiding to\nmess up with dates.\n\n## Tagged templates\n\nYou may like to use [pgsqwell](https://github.com/nfroidure/pgsqwell) with this\nmodule.\n\n[//]: # (::contents:end)\n\n# API\n\u003ca name=\"initPGService\"\u003e\u003c/a\u003e\n\n## initPGService(services) ⇒ \u003ccode\u003ePromise.\u0026lt;Object\u0026gt;\u003c/code\u003e\nInstantiate the pg service\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003ePromise.\u0026lt;Object\u0026gt;\u003c/code\u003e - A promise of the pg service  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| services | \u003ccode\u003eObject\u003c/code\u003e | The services to inject |\n| [services.log] | \u003ccode\u003efunction\u003c/code\u003e | A logging function |\n| [services.PG_URL_ENV_NAME] | \u003ccode\u003eObject\u003c/code\u003e | The environment variable name in which to pick-up the  PG url |\n| [services.ENV] | \u003ccode\u003eObject\u003c/code\u003e | An environment object |\n| services.PG | \u003ccode\u003eObject\u003c/code\u003e | A `pg` compatible configuration object |\n\n**Example**  \n```js\nimport initPGService from 'postgresql-service';\n\nconst { service: pg, dispose } = await initPGService({\n  log: console.log.bind(console),\n  ENV: process.env, // Proxy the PG_URL env var\n});\n\nconst result = pg.query('SELECT 1');\n\nawait dispose();\n```\n\n* [initPGService(services)](#initPGService) ⇒ \u003ccode\u003ePromise.\u0026lt;Object\u0026gt;\u003c/code\u003e\n    * [~query()](#initPGService..query) ⇒ \u003ccode\u003eString\u003c/code\u003e \\| \u003ccode\u003eObject\u003c/code\u003e\n    * [~queries()](#initPGService..queries) ⇒ \u003ccode\u003eArray.\u0026lt;String\u0026gt;\u003c/code\u003e \\| \u003ccode\u003eObject\u003c/code\u003e\n    * [~transaction()](#initPGService..transaction) ⇒ \u003ccode\u003eArray.\u0026lt;String\u0026gt;\u003c/code\u003e \\| \u003ccode\u003eObject\u003c/code\u003e\n\n\u003ca name=\"initPGService..query\"\u003e\u003c/a\u003e\n\n### initPGService~query() ⇒ \u003ccode\u003eString\u003c/code\u003e \\| \u003ccode\u003eObject\u003c/code\u003e\nExecutes the given query\n\n**Kind**: inner method of [\u003ccode\u003einitPGService\u003c/code\u003e](#initPGService)  \n**Returns**: \u003ccode\u003eString\u003c/code\u003e - Query to execute\u003ccode\u003eObject\u003c/code\u003e - Arguments hash for the query  \n**Example**  \n```js\nconst { rows, fields } = await pg.query(\n   'SELECT * FROM users WHERE user = $$userId',\n   { userId: 1 }\n);\n```\n\u003ca name=\"initPGService..queries\"\u003e\u003c/a\u003e\n\n### initPGService~queries() ⇒ \u003ccode\u003eArray.\u0026lt;String\u0026gt;\u003c/code\u003e \\| \u003ccode\u003eObject\u003c/code\u003e\nExecutes the given queries in parallel (using the connections pool)\n\n**Kind**: inner method of [\u003ccode\u003einitPGService\u003c/code\u003e](#initPGService)  \n**Returns**: \u003ccode\u003eArray.\u0026lt;String\u0026gt;\u003c/code\u003e - Queries to execute\u003ccode\u003eObject\u003c/code\u003e - Arguments hashes for the queries  \n**Example**  \n```js\nconst [{ rows, fields }, { rows2, fields2 }] = await pg.queries([\n   'SELECT * FROM users WHERE user = $$userId',\n   'SELECT * FROM users WHERE user = $$userId',\n], { userId: 1 });\n```\n\u003ca name=\"initPGService..transaction\"\u003e\u003c/a\u003e\n\n### initPGService~transaction() ⇒ \u003ccode\u003eArray.\u0026lt;String\u0026gt;\u003c/code\u003e \\| \u003ccode\u003eObject\u003c/code\u003e\nExecutes the given queries in a single transaction\n\n**Kind**: inner method of [\u003ccode\u003einitPGService\u003c/code\u003e](#initPGService)  \n**Returns**: \u003ccode\u003eArray.\u0026lt;String\u0026gt;\u003c/code\u003e - Queries to execute\u003ccode\u003eObject\u003c/code\u003e - Arguments hashes for the queries  \n**Example**  \n```js\nconst [, { rows, fields }] = await pg.transaction([\n   'UPDATE users SET isActive = true WHERE user = $$userId',\n   'SELECT * FROM users WHERE user = $$userId',\n], { userId: 1 });\n```\n\n# Authors\n- [Nicolas Froidure](http://insertafter.com/en/index.html)\n\n# License\n[MIT](https://github.com/nfroidure/postgresql-service/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfroidure%2Fpostgresql-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnfroidure%2Fpostgresql-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfroidure%2Fpostgresql-service/lists"}