Registry / database / plv8ify

plv8ify

JSON →
library0.0.67jsnpmunverified

Bundles TypeScript/JavaScript input into SQL files containing Postgres functions using PLV8. Current stable version: 0.0.67, pre-1.0 with frequent releases. Differentiators: enables code sharing between API and database by transpiling TypeScript to PLV8 (Postgres JavaScript engine) functions; supports triggers, custom schemas, and custom type mappings; similar to plv8ts but with CLI focus and schema support.

npm install plv8ify
INSTALL
IMPORT
SIG · PLV8IFY
P
plv8ify
databasejavascriptv0.0.67
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.

plv8ify CLI
npx plv8ify generate input.ts
require('plv8ify')
plv8ify is a CLI tool, not a library. It is used via npx or global install.

Demonstrates basic usage: write a TypeScript function using a npm package, generate SQL via CLI, and call it from Postgres.

// input.ts import { point } from '@turf/helpers' export function myPoint(lat: number, long: number): { coordinates: number[] } { const pt = point([lat, long]) return pt } // Run: npx plv8ify generate input.ts // Executes ./plv8-dist/plv8ify_myPoint.plv8.sql in Postgres // Then call: SELECT plv8ify_myPoint(52.52, 13.405);
Debug
Known issues
gotchaplv8ify is a CLI tool; do not import it as a module. Attempting require('plv8ify') will fail with 'MODULE_NOT_FOUND'.
fix
Install globally or use npx: npx plv8ify generate ...
affects: *
gotchaThe generated SQL must be executed in a Postgres instance with PLV8 installed. Without PLV8, functions will not work.
fix
Install PLV8 extension: CREATE EXTENSION IF NOT EXISTS plv8;
affects: *
deprecatedVersion 0.0.x is pre-1.0 and API may change. The --types-config-file option and custom type mapping are experimental.
fix
Monitor releases for breaking changes; pin version in package.json.
affects: <1.0.0
gotchaOnly exported functions generate SQL. Helper functions not exported are inlined unless bundled with a bundler like esbuild.
fix
Export all functions you want as Postgres functions; use esbuild or other bundler for dependencies.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'plv8ify'
Trying to import plv8ify as a Node module instead of using CLI.
fix
Use npx plv8ify generate ... or install globally with npm install -g plv8ify
plv8ify: command not found
plv8ify is not installed or not in PATH.
fix
Run npx plv8ify generate ... or npm install -g plv8ify
ERROR: function plv8ify_xxx does not exist
The generated SQL has not been executed in Postgres or the function name is incorrect.
fix
Run the generated SQL file in your Postgres database using psql or your preferred client.
Upgrade
Version history
0.0.67latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
plv8ify — npm install plv8ify · libregistry