Socket
Socket
Sign inDemoInstall

@vercel/postgres

Package Overview
Dependencies
Maintainers
8
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/postgres - npm Package Compare versions

Comparing version 0.1.0-canary.4 to 0.1.0-canary.5

12

dist/index.d.ts

@@ -1,8 +0,9 @@

import { Pool as Pool$1 } from '@neondatabase/serverless';
import { Pool as Pool$1, Client as Client$1 } from '@neondatabase/serverless';
export { FieldDef, Query, QueryArrayConfig, QueryArrayResult, QueryConfig, QueryParse, QueryResult, QueryResultBase, QueryResultRow } from '@neondatabase/serverless';
declare type Pool = typeof Pool$1;
declare type Client = typeof Client$1;
interface PostgresConfig {
connectionString?: string | undefined;
connectionString: string;
keepAlive?: boolean | undefined;

@@ -15,2 +16,4 @@ statement_timeout?: false | number | undefined;

connectionTimeoutMillis?: number | undefined;
}
interface PostgresPoolConfig extends PostgresConfig {
max?: number | undefined;

@@ -23,5 +26,6 @@ min?: number | undefined;

}
declare function createClient(connectionString: string, config?: PostgresConfig): Pool$1;
declare function createClient(config: PostgresConfig): Client$1;
declare function createPool(config: PostgresPoolConfig): Pool$1;
declare const postgres: Pool$1;
export { Pool, PostgresConfig, createClient, postgres as default, postgres };
export { Client, Pool, PostgresConfig, PostgresPoolConfig, createClient, createPool, postgres as default, postgres };

@@ -1,1 +0,1 @@

import{Pool as r}from"@neondatabase/serverless";var i={},n=null;function t(o,e){return new r({...e,connectionString:o})}var u=new Proxy({},{get(o,e){if(!n){if(!process.env.POSTGRES_URL)throw new Error("@vercel/postgres: Missing required environment variable POSTGRES_URL");n=t(process.env.POSTGRES_URL,i)}return Reflect.get(n,e)}}),s=u;export{t as createClient,s as default,u as postgres};
import{Pool as r,Client as t}from"@neondatabase/serverless";var i={},n=null;function a(e){return new t({...e})}function l(e){return new r({...e})}var u=new Proxy({},{get(e,o){if(!n){if(!process.env.POSTGRES_URL)throw new Error("@vercel/postgres: Missing required environment variable POSTGRES_URL");n=l({...i,connectionString:process.env.POSTGRES_URL})}return Reflect.get(n,o)}}),f=u;export{a as createClient,l as createPool,f as default,u as postgres};
{
"name": "@vercel/postgres",
"version": "0.1.0-canary.4",
"version": "0.1.0-canary.5",
"description": "Connect to Vercel Postgres databases on the Edge",

@@ -5,0 +5,0 @@ "homepage": "https://vercel.com",

@@ -33,9 +33,18 @@ # @vercel/postgres 🚧

#### Set Connection String Manually
#### Set Connection String Manually (Client or Pool)
```typescript
import { createClient } from '@vercel/postgres';
import { createClient, createPool } from '@vercel/postgres';
const postgres = createClient(process.env.SOME_POSTGRES_CONNECTION_STRING);
await postgres.query('SELECT * from POSTS WHERE likes > 100;');
const client = createClient({
connectionString: process.env.SOME_POSTGRES_CONNECTION_STRING,
});
await client.query('SELECT * from POSTS WHERE likes > 100;');
const pool = createPool({
connectionString: process.env.SOME_POSTGRES_CONNECTION_STRING,
});
await pool.query('SELECT * from POSTS WHERE likes > 100;');
```

@@ -53,7 +62,7 @@

When using the `createClient` function, you can pass an optional configuration object that conforms to `PostgresConfig`:
When using the `createClient` or `createPool` functions, you can pass in additional options to configuration object alongside the connection string that conforms to `PostgresConfig` or `PostgresPoolConfig`, respectively:
```typescript
export interface PostgresConfig {
connectionString?: string | undefined;
connectionString: string;
keepAlive?: boolean | undefined;

@@ -73,2 +82,11 @@ statement_timeout?: false | number | undefined;

}
export interface PostgresPoolConfig extends PostgresConfig {
max?: number | undefined;
min?: number | undefined;
idleTimeoutMillis?: number | undefined;
log?: ((...messages: unknown[]) => void) | undefined;
allowExitOnIdle?: boolean | undefined;
maxUses?: number | undefined;
}
```

@@ -75,0 +93,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc