{"id":42676,"library":"ectypes-postgres","title":"ectypes-postgres","description":"An ectypes strategy for node-postgres, version 1.0.0 (latest). Provides a PGStrategy class that wraps node-postgres with ectypes schema validation. Minimal release history, no recent updates. Key differentiator: integrates ectypes data validation into PostgreSQL queries, but dependency on ectypes and node-postgres makes it niche. Requires ectypes as peer dependency.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"git://github.com/nicholas/ectypes-postgres","tags":["javascript"],"install":[{"cmd":"npm install ectypes-postgres","lang":"bash","label":"npm"},{"cmd":"yarn add ectypes-postgres","lang":"bash","label":"yarn"},{"cmd":"pnpm add ectypes-postgres","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; provides schema and validation layer","package":"ectypes","optional":false},{"reason":"node-postgres driver for database connectivity","package":"pg","optional":false}],"imports":[{"note":"Package is older and uses CommonJS; ESM import may fail in Node <14 or without transpilation","wrong":"import { PGStrategy } from 'ectypes-postgres'","symbol":"PGStrategy","correct":"const { PGStrategy } = require('ectypes-postgres')"},{"note":"Package does not export default; must destructure or use .PGStrategy","wrong":"const PGStrategy = require('ectypes-postgres')","symbol":"default","correct":"const PGStrategy = require('ectypes-postgres').PGStrategy"}],"quickstart":{"code":"const { PGStrategy } = require('ectypes-postgres');\nconst connectionString = process.env.DBCONN ?? 'postgres://user:pass@localhost/mydb';\nconst strategy = new PGStrategy(connectionString);\n// The strategy can then be used with ectypes schema validation\nconsole.log('PGStrategy created');","lang":"javascript","description":"Creates a PGStrategy instance with a PostgreSQL connection string for use with ectypes schema validation."},"warnings":[{"fix":"Ensure process.env.DBCONN or a valid connection string is passed to the constructor","message":"PGStrategy constructor requires a connectionString; if missing or undefined, will throw or fail silently","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider migrating to a maintained alternative like knex or node-postgres with manual validation","message":"Package last published in 2012; no updates for over a decade; may have unpatched vulnerabilities in dependencies","severity":"deprecated","affected_versions":"1.0.0"},{"fix":"Run 'npm install ectypes' alongside ectypes-postgres","message":"ectypes is a peer dependency and must be manually installed; running tests requires 'npm install ectypes'","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.0':12 'class':17 'data':37 'depend':43,57 'differenti':34 'ectyp':2,5,24,36,45,54 'ectypes-postgr':1 'histori':29 'integr':35 'javascript':58 'key':33 'latest':13 'make':50 'minim':27 'nich':52 'node':9,21,48 'node-postgr':8,20,47 'peer':56 'pgstrategi':16 'postgr':3,10,22,49 'postgresql':40 'provid':14 'queri':41 'recent':31 'releas':28 'requir':53 'schema':25 'strategi':6 'updat':32 'valid':26,38 'version':11 'wrap':19","created_at":"2026-06-05T16:56:07.391005+00:00","updated_at":"2026-06-05T16:56:07.391005+00:00","problems":[{"fix":"Run 'npm install ectypes' to install peer dependency","cause":"ectypes is a peer dependency not automatically installed","error":"Cannot find module 'ectypes'"},{"fix":"Use const { PGStrategy } = require('ectypes-postgres') or const PGStrategy = require('ectypes-postgres').PGStrategy","cause":"Incorrect import; probably using default import instead of named import","error":"TypeError: PGStrategy is not a constructor"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/nicholas/ectypes-postgres","github":"git://github.com/nicholas/ectypes-postgres","docs":null,"changelog":null,"pypi":null,"npm":"ectypes-postgres","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}