Registry / database / ectypes-postgres

ectypes-postgres

JSON →
library1.0.0jsnpmunverified

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.

npm install ectypes-postgres
INSTALL
IMPORT
SIG · ECTYPES-POSTGRES
E
ectypes-postgres
databasejavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PGStrategy
✓ const { PGStrategy } = require('ectypes-postgres')
✗ import { PGStrategy } from 'ectypes-postgres'
Package is older and uses CommonJS; ESM import may fail in Node <14 or without transpilation
default
✓ const PGStrategy = require('ectypes-postgres').PGStrategy
✗ const PGStrategy = require('ectypes-postgres')
Package does not export default; must destructure or use .PGStrategy

Creates a PGStrategy instance with a PostgreSQL connection string for use with ectypes schema validation.

const { PGStrategy } = require('ectypes-postgres'); const connectionString = process.env.DBCONN ?? 'postgres://user:pass@localhost/mydb'; const strategy = new PGStrategy(connectionString); // The strategy can then be used with ectypes schema validation console.log('PGStrategy created');
Debug
Known issues
gotchaPGStrategy constructor requires a connectionString; if missing or undefined, will throw or fail silently
fix
Ensure process.env.DBCONN or a valid connection string is passed to the constructor
affects: >=1.0.0
deprecatedPackage last published in 2012; no updates for over a decade; may have unpatched vulnerabilities in dependencies
fix
Consider migrating to a maintained alternative like knex or node-postgres with manual validation
affects: 1.0.0
gotchaectypes is a peer dependency and must be manually installed; running tests requires 'npm install ectypes'
fix
Run 'npm install ectypes' alongside ectypes-postgres
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'ectypes'
ectypes is a peer dependency not automatically installed
fix
Run 'npm install ectypes' to install peer dependency
TypeError: PGStrategy is not a constructor
Incorrect import; probably using default import instead of named import
fix
Use const { PGStrategy } = require('ectypes-postgres') or const PGStrategy = require('ectypes-postgres').PGStrategy
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
ectypesrequiredpeer dependency; provides schema and validation layer
pgrequirednode-postgres driver for database connectivity
Agent activity
9 hits · last 30 days
node
8
Resources
ectypes-postgres — npm install ectypes-postgres · libregistry