mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
Compare commits
14 Commits
master
...
pg-cloudfl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
306fa83d84 | ||
|
|
69e56976c6 | ||
|
|
56762beebf | ||
|
|
6a9b873f5f | ||
|
|
ffd5adc583 | ||
|
|
0a0e298e06 | ||
|
|
0cb8fd4216 | ||
|
|
6949c7ad73 | ||
|
|
739308463d | ||
|
|
c484282ace | ||
|
|
8a58659ed3 | ||
|
|
b4c1a4e935 | ||
|
|
c2cbc2b0b1 | ||
|
|
98bc876b49 |
@ -10,7 +10,7 @@
|
|||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "yarn lerna exec yarn test",
|
"test": "yarn lerna exec --concurrency 1 yarn test",
|
||||||
"build": "tsc --build",
|
"build": "tsc --build",
|
||||||
"build:watch": "tsc --build --watch",
|
"build:watch": "tsc --build --watch",
|
||||||
"docs:build": "cd docs && yarn build",
|
"docs:build": "cd docs && yarn build",
|
||||||
|
|||||||
1
packages/pg-cloudflare/esm/index.mjs
Normal file
1
packages/pg-cloudflare/esm/index.mjs
Normal file
@ -0,0 +1 @@
|
|||||||
|
export const TEST = 'true'
|
||||||
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "pg-cloudflare",
|
"name": "pg-cloudflare",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2-alpha.1",
|
||||||
"description": "A socket implementation that can run on Cloudflare Workers using native TCP connections.",
|
"description": "A socket implementation that can run on Cloudflare Workers using native TCP connections.",
|
||||||
"main": "dist/empty.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -10,8 +10,11 @@
|
|||||||
"typescript": "^4.0.3"
|
"typescript": "^4.0.3"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
"workerd": "./dist/index.js",
|
".": {
|
||||||
"default": "./dist/empty.js"
|
"import": "./esm/index.mjs",
|
||||||
|
"require": "./dist/index.js",
|
||||||
|
"default": "./dist/index.js"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
@ -26,6 +29,7 @@
|
|||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"/dist/*{js,ts,map}",
|
"/dist/*{js,ts,map}",
|
||||||
"/src"
|
"/src",
|
||||||
|
"/esm"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,7 +37,8 @@ export class CloudflareSocket extends EventEmitter {
|
|||||||
if (connectListener) this.once('connect', connectListener)
|
if (connectListener) this.once('connect', connectListener)
|
||||||
|
|
||||||
const options: SocketOptions = this.ssl ? { secureTransport: 'starttls' } : {}
|
const options: SocketOptions = this.ssl ? { secureTransport: 'starttls' } : {}
|
||||||
const { connect } = await import('cloudflare:sockets')
|
const mod = await import('cloudflare:sockets')
|
||||||
|
const connect = mod.connect
|
||||||
this._cfSocket = connect(`${host}:${port}`, options)
|
this._cfSocket = connect(`${host}:${port}`, options)
|
||||||
this._cfWriter = this._cfSocket.writable.getWriter()
|
this._cfWriter = this._cfSocket.writable.getWriter()
|
||||||
this._addClosedHandler()
|
this._addClosedHandler()
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "ES2020",
|
"module": "node16",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "ES2020",
|
"target": "es2020",
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node16",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
|
|||||||
7
packages/pg-connection-string/esm/index.mjs
Normal file
7
packages/pg-connection-string/esm/index.mjs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// ESM wrapper for pg-connection-string
|
||||||
|
import connectionString from '../index.js'
|
||||||
|
|
||||||
|
// Re-export the parse function
|
||||||
|
export const parse = connectionString.parse
|
||||||
|
export const toClientConfig = connectionString.toClientConfig
|
||||||
|
export const parseIntoClientConfig = connectionString.parseIntoClientConfig
|
||||||
@ -1,9 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "pg-connection-string",
|
"name": "pg-connection-string",
|
||||||
"version": "2.7.0",
|
"version": "2.7.1-alpha.0",
|
||||||
"description": "Functions for dealing with a PostgresSQL connection string",
|
"description": "Functions for dealing with a PostgresSQL connection string",
|
||||||
"main": "./index.js",
|
"main": "./index.js",
|
||||||
"types": "./index.d.ts",
|
"types": "./index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"types": "./index.d.ts",
|
||||||
|
"import": "./esm/index.mjs",
|
||||||
|
"require": "./index.js",
|
||||||
|
"default": "./index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "istanbul cover _mocha && npm run check-coverage",
|
"test": "istanbul cover _mocha && npm run check-coverage",
|
||||||
"check-coverage": "istanbul check-coverage --statements 100 --branches 100 --lines 100 --functions 100",
|
"check-coverage": "istanbul check-coverage --statements 100 --branches 100 --lines 100 --functions 100",
|
||||||
@ -34,6 +42,7 @@
|
|||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"index.js",
|
"index.js",
|
||||||
"index.d.ts"
|
"index.d.ts",
|
||||||
|
"esm"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
5
packages/pg-cursor/esm/index.mjs
Normal file
5
packages/pg-cursor/esm/index.mjs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// ESM wrapper for pg-cursor
|
||||||
|
import Cursor from '../index.js'
|
||||||
|
|
||||||
|
// Export as default only to match CJS module
|
||||||
|
export default Cursor
|
||||||
@ -1,6 +1,7 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
const Result = require('pg/lib/result.js')
|
const pg = require('pg')
|
||||||
const prepare = require('pg/lib/utils.js').prepareValue
|
const { Result, utils } = pg
|
||||||
|
const prepare = utils.prepareValue
|
||||||
const EventEmitter = require('events').EventEmitter
|
const EventEmitter = require('events').EventEmitter
|
||||||
const util = require('util')
|
const util = require('util')
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "pg-cursor",
|
"name": "pg-cursor",
|
||||||
"version": "2.13.1",
|
"version": "2.13.2-alpha.1",
|
||||||
"description": "Query cursor extension for node-postgres",
|
"description": "Query cursor extension for node-postgres",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./esm/index.mjs",
|
||||||
|
"require": "./index.js",
|
||||||
|
"default": "./index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"directories": {
|
"directories": {
|
||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
},
|
||||||
@ -18,9 +25,13 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"mocha": "^10.5.2",
|
"mocha": "^10.5.2",
|
||||||
"pg": "^8.14.1"
|
"pg": "^8.14.2-alpha.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"pg": "^8"
|
"pg": "^8"
|
||||||
}
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"esm"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
26
packages/pg-esm-test/package.json
Normal file
26
packages/pg-esm-test/package.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "pg-esm-test",
|
||||||
|
"version": "1.0.1-alpha.1",
|
||||||
|
"description": "A test module for PostgreSQL with ESM support",
|
||||||
|
"main": "index.js",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"test": "node --test"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"postgres",
|
||||||
|
"postgresql",
|
||||||
|
"esm",
|
||||||
|
"test"
|
||||||
|
],
|
||||||
|
"devDependencies": {
|
||||||
|
"pg": "^8.14.2-alpha.1",
|
||||||
|
"pg-cloudflare": "^1.1.2-alpha.1",
|
||||||
|
"pg-cursor": "^2.13.2-alpha.1",
|
||||||
|
"pg-native": "^3.3.1-alpha.0",
|
||||||
|
"pg-pool": "^3.8.1-alpha.1",
|
||||||
|
"pg-query-stream": "^4.8.2-alpha.1"
|
||||||
|
},
|
||||||
|
"author": "Brian M. Carlson <brian.m.carlson@gmail.com>",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
9
packages/pg-esm-test/pg-cloudflare.test.js
Normal file
9
packages/pg-esm-test/pg-cloudflare.test.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import assert from 'node:assert'
|
||||||
|
import { describe, it } from 'node:test'
|
||||||
|
import { CloudflareSocket } from 'pg-cloudflare'
|
||||||
|
|
||||||
|
describe('pg-cloudflare', () => {
|
||||||
|
it('should export CloudflareSocket constructor', () => {
|
||||||
|
assert.ok(new CloudflareSocket())
|
||||||
|
})
|
||||||
|
})
|
||||||
17
packages/pg-esm-test/pg-connection-string.test.js
Normal file
17
packages/pg-esm-test/pg-connection-string.test.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import assert from 'node:assert'
|
||||||
|
import { describe, it } from 'node:test'
|
||||||
|
import { parse, toClientConfig, parseIntoClientConfig } from 'pg-connection-string'
|
||||||
|
|
||||||
|
describe('pg-connection-string', () => {
|
||||||
|
it('should export parse function', () => {
|
||||||
|
assert.strictEqual(typeof parse, 'function')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should export toClientConfig function', () => {
|
||||||
|
assert.strictEqual(typeof toClientConfig, 'function')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should export parseIntoClientConfig function', () => {
|
||||||
|
assert.strictEqual(typeof parseIntoClientConfig, 'function')
|
||||||
|
})
|
||||||
|
})
|
||||||
9
packages/pg-esm-test/pg-cursor.test.js
Normal file
9
packages/pg-esm-test/pg-cursor.test.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import assert from 'node:assert'
|
||||||
|
import { describe, it } from 'node:test'
|
||||||
|
import Cursor from 'pg-cursor'
|
||||||
|
|
||||||
|
describe('pg-cursor', () => {
|
||||||
|
it('should export Cursor constructor as default', () => {
|
||||||
|
assert.ok(new Cursor())
|
||||||
|
})
|
||||||
|
})
|
||||||
9
packages/pg-esm-test/pg-native.test.js
Normal file
9
packages/pg-esm-test/pg-native.test.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import assert from 'node:assert'
|
||||||
|
import { describe, it } from 'node:test'
|
||||||
|
import Client from 'pg-native'
|
||||||
|
|
||||||
|
describe('pg-native', () => {
|
||||||
|
it('should export Client constructor', () => {
|
||||||
|
assert.ok(new Client())
|
||||||
|
})
|
||||||
|
})
|
||||||
9
packages/pg-esm-test/pg-pool.test.js
Normal file
9
packages/pg-esm-test/pg-pool.test.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import assert from 'node:assert'
|
||||||
|
import { describe, it } from 'node:test'
|
||||||
|
import Pool from 'pg-pool'
|
||||||
|
|
||||||
|
describe('pg-pool', () => {
|
||||||
|
it('should export Pool constructor', () => {
|
||||||
|
assert.ok(new Pool())
|
||||||
|
})
|
||||||
|
})
|
||||||
9
packages/pg-esm-test/pg-query-stream.test.js
Normal file
9
packages/pg-esm-test/pg-query-stream.test.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import assert from 'node:assert'
|
||||||
|
import { describe, it } from 'node:test'
|
||||||
|
import QueryStream from 'pg-query-stream'
|
||||||
|
|
||||||
|
describe('pg-query-stream', () => {
|
||||||
|
it('should export QueryStream constructor as default', () => {
|
||||||
|
assert.ok(new QueryStream())
|
||||||
|
})
|
||||||
|
})
|
||||||
17
packages/pg-esm-test/pg.test.js
Normal file
17
packages/pg-esm-test/pg.test.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import assert from 'node:assert'
|
||||||
|
import { describe, it } from 'node:test'
|
||||||
|
import pg, { Client, Pool } from 'pg'
|
||||||
|
|
||||||
|
describe('pg', () => {
|
||||||
|
it('should export Client constructor', () => {
|
||||||
|
assert.ok(new Client())
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should export Pool constructor', () => {
|
||||||
|
assert.ok(new Pool())
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should still provide default export', () => {
|
||||||
|
assert.ok(new pg.Pool())
|
||||||
|
})
|
||||||
|
})
|
||||||
5
packages/pg-native/esm/index.mjs
Normal file
5
packages/pg-native/esm/index.mjs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// ESM wrapper for pg-native
|
||||||
|
import Client from '../index.js'
|
||||||
|
|
||||||
|
// Export as default only to match CJS module
|
||||||
|
export default Client
|
||||||
@ -1,8 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "pg-native",
|
"name": "pg-native",
|
||||||
"version": "3.3.0",
|
"version": "3.3.1-alpha.0",
|
||||||
"description": "A slightly nicer interface to Postgres over node-libpq",
|
"description": "A slightly nicer interface to Postgres over node-libpq",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./esm/index.mjs",
|
||||||
|
"require": "./index.js",
|
||||||
|
"default": "./index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha"
|
"test": "mocha"
|
||||||
},
|
},
|
||||||
@ -34,5 +41,9 @@
|
|||||||
"node-gyp": ">=10.x",
|
"node-gyp": ">=10.x",
|
||||||
"okay": "^0.3.0",
|
"okay": "^0.3.0",
|
||||||
"semver": "^4.1.0"
|
"semver": "^4.1.0"
|
||||||
}
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"esm"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
5
packages/pg-pool/esm/index.mjs
Normal file
5
packages/pg-pool/esm/index.mjs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// ESM wrapper for pg-pool
|
||||||
|
import Pool from '../index.js'
|
||||||
|
|
||||||
|
// Export as default only to match CJS module
|
||||||
|
export default Pool
|
||||||
@ -1,8 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "pg-pool",
|
"name": "pg-pool",
|
||||||
"version": "3.8.0",
|
"version": "3.8.1-alpha.1",
|
||||||
"description": "Connection pool for node-postgres",
|
"description": "Connection pool for node-postgres",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./esm/index.mjs",
|
||||||
|
"require": "./index.js",
|
||||||
|
"default": "./index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"directories": {
|
"directories": {
|
||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
},
|
||||||
@ -32,9 +39,13 @@
|
|||||||
"expect.js": "0.3.1",
|
"expect.js": "0.3.1",
|
||||||
"lodash": "^4.17.11",
|
"lodash": "^4.17.11",
|
||||||
"mocha": "^10.5.2",
|
"mocha": "^10.5.2",
|
||||||
"pg-cursor": "^1.3.0"
|
"pg-cursor": "^2.13.2-alpha.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"pg": ">=8.0"
|
"pg": ">=8.0"
|
||||||
}
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"esm"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
11
packages/pg-protocol/esm/index.js
Normal file
11
packages/pg-protocol/esm/index.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// ESM wrapper for pg-protocol
|
||||||
|
import protocol from '../dist/index.js'
|
||||||
|
|
||||||
|
// Re-export all the properties
|
||||||
|
export const DatabaseError = protocol.DatabaseError
|
||||||
|
export const SASL = protocol.SASL
|
||||||
|
export const serialize = protocol.serialize
|
||||||
|
export const parse = protocol.parse
|
||||||
|
|
||||||
|
// Re-export the default
|
||||||
|
export default protocol
|
||||||
@ -1,9 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "pg-protocol",
|
"name": "pg-protocol",
|
||||||
"version": "1.8.0",
|
"version": "1.8.1-alpha.0",
|
||||||
"description": "The postgres client/server binary protocol, implemented in TypeScript",
|
"description": "The postgres client/server binary protocol, implemented in TypeScript",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./esm/index.js",
|
||||||
|
"require": "./dist/index.js",
|
||||||
|
"default": "./dist/index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/chai": "^4.2.7",
|
"@types/chai": "^4.2.7",
|
||||||
@ -29,6 +36,7 @@
|
|||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"/dist/*{js,ts,map}",
|
"/dist/*{js,ts,map}",
|
||||||
"/src"
|
"/src",
|
||||||
|
"/esm"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
5
packages/pg-query-stream/esm/index.mjs
Normal file
5
packages/pg-query-stream/esm/index.mjs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// ESM wrapper for pg-query-stream
|
||||||
|
import QueryStream from '../dist/index.js'
|
||||||
|
|
||||||
|
// Export as default only to match CJS module
|
||||||
|
export default QueryStream
|
||||||
@ -1,9 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "pg-query-stream",
|
"name": "pg-query-stream",
|
||||||
"version": "4.8.1",
|
"version": "4.8.2-alpha.1",
|
||||||
"description": "Postgres query result returned as readable stream",
|
"description": "Postgres query result returned as readable stream",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"types": "./dist/index.d.ts",
|
"types": "./dist/index.d.ts",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./esm/index.mjs",
|
||||||
|
"require": "./dist/index.js",
|
||||||
|
"default": "./dist/index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha -r ts-node/register test/**/*.ts"
|
"test": "mocha -r ts-node/register test/**/*.ts"
|
||||||
},
|
},
|
||||||
@ -21,7 +28,8 @@
|
|||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"/dist/*{js,ts,map}",
|
"/dist/*{js,ts,map}",
|
||||||
"/src"
|
"/src",
|
||||||
|
"/esm"
|
||||||
],
|
],
|
||||||
"author": "Brian M. Carlson",
|
"author": "Brian M. Carlson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -37,7 +45,7 @@
|
|||||||
"concat-stream": "~1.0.1",
|
"concat-stream": "~1.0.1",
|
||||||
"eslint-plugin-promise": "^6.0.1",
|
"eslint-plugin-promise": "^6.0.1",
|
||||||
"mocha": "^10.5.2",
|
"mocha": "^10.5.2",
|
||||||
"pg": "^8.14.1",
|
"pg": "^8.14.2-alpha.1",
|
||||||
"stream-spec": "~0.3.5",
|
"stream-spec": "~0.3.5",
|
||||||
"ts-node": "^8.5.4",
|
"ts-node": "^8.5.4",
|
||||||
"typescript": "^4.0.3"
|
"typescript": "^4.0.3"
|
||||||
@ -46,6 +54,6 @@
|
|||||||
"pg": "^8"
|
"pg": "^8"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pg-cursor": "^2.13.1"
|
"pg-cursor": "^2.13.2-alpha.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
18
packages/pg/esm/index.mjs
Normal file
18
packages/pg/esm/index.mjs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// ESM wrapper for pg
|
||||||
|
import pg from '../lib/index.js'
|
||||||
|
|
||||||
|
// Re-export all the properties
|
||||||
|
export const Client = pg.Client
|
||||||
|
export const Pool = pg.Pool
|
||||||
|
export const Connection = pg.Connection
|
||||||
|
export const types = pg.types
|
||||||
|
export const Query = pg.Query
|
||||||
|
export const DatabaseError = pg.DatabaseError
|
||||||
|
export const escapeIdentifier = pg.escapeIdentifier
|
||||||
|
export const escapeLiteral = pg.escapeLiteral
|
||||||
|
|
||||||
|
// Also export the defaults
|
||||||
|
export const defaults = pg.defaults
|
||||||
|
|
||||||
|
// Re-export the default
|
||||||
|
export default pg
|
||||||
@ -3,6 +3,8 @@
|
|||||||
var Client = require('./client')
|
var Client = require('./client')
|
||||||
var defaults = require('./defaults')
|
var defaults = require('./defaults')
|
||||||
var Connection = require('./connection')
|
var Connection = require('./connection')
|
||||||
|
var Result = require('./result')
|
||||||
|
var utils = require('./utils')
|
||||||
var Pool = require('pg-pool')
|
var Pool = require('pg-pool')
|
||||||
const { DatabaseError } = require('pg-protocol')
|
const { DatabaseError } = require('pg-protocol')
|
||||||
const { escapeIdentifier, escapeLiteral } = require('./utils')
|
const { escapeIdentifier, escapeLiteral } = require('./utils')
|
||||||
@ -26,6 +28,8 @@ var PG = function (clientConstructor) {
|
|||||||
this.DatabaseError = DatabaseError
|
this.DatabaseError = DatabaseError
|
||||||
this.escapeIdentifier = escapeIdentifier
|
this.escapeIdentifier = escapeIdentifier
|
||||||
this.escapeLiteral = escapeLiteral
|
this.escapeLiteral = escapeLiteral
|
||||||
|
this.Result = Result
|
||||||
|
this.utils = utils
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof process.env.NODE_PG_FORCE_NATIVE !== 'undefined') {
|
if (typeof process.env.NODE_PG_FORCE_NATIVE !== 'undefined') {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pg",
|
"name": "pg",
|
||||||
"version": "8.14.1",
|
"version": "8.14.2-alpha.1",
|
||||||
"description": "PostgreSQL client - pure javascript & libpq with the same API",
|
"description": "PostgreSQL client - pure javascript & libpq with the same API",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"database",
|
"database",
|
||||||
@ -19,25 +19,34 @@
|
|||||||
},
|
},
|
||||||
"author": "Brian Carlson <brian.m.carlson@gmail.com>",
|
"author": "Brian Carlson <brian.m.carlson@gmail.com>",
|
||||||
"main": "./lib",
|
"main": "./lib",
|
||||||
|
"exports": {
|
||||||
|
".": {
|
||||||
|
"import": "./esm/index.mjs",
|
||||||
|
"require": "./lib/index.js",
|
||||||
|
"default": "./lib/index.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pg-connection-string": "^2.7.0",
|
"pg-connection-string": "^2.7.1-alpha.0",
|
||||||
"pg-pool": "^3.8.0",
|
"pg-pool": "^3.8.1-alpha.1",
|
||||||
"pg-protocol": "^1.8.0",
|
"pg-protocol": "^1.8.1-alpha.0",
|
||||||
"pg-types": "^2.1.0",
|
"pg-types": "^2.1.0",
|
||||||
"pgpass": "1.x"
|
"pgpass": "1.x"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@cloudflare/vitest-pool-workers": "0.8.12",
|
||||||
"@cloudflare/workers-types": "^4.20230404.0",
|
"@cloudflare/workers-types": "^4.20230404.0",
|
||||||
"async": "2.6.4",
|
"async": "2.6.4",
|
||||||
"bluebird": "3.7.2",
|
"bluebird": "3.7.2",
|
||||||
"co": "4.6.0",
|
"co": "4.6.0",
|
||||||
"pg-copy-streams": "0.3.0",
|
"pg-copy-streams": "0.3.0",
|
||||||
"typescript": "^4.0.3",
|
"typescript": "^4.0.3",
|
||||||
|
"vitest": "~3.0.9",
|
||||||
"workerd": "^1.20230419.0",
|
"workerd": "^1.20230419.0",
|
||||||
"wrangler": "3.58.0"
|
"wrangler": "^3.x"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"pg-cloudflare": "^1.1.1"
|
"pg-cloudflare": "^1.1.2-alpha.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"pg-native": ">=3.0.1"
|
"pg-native": ">=3.0.1"
|
||||||
@ -52,6 +61,7 @@
|
|||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib",
|
"lib",
|
||||||
|
"esm",
|
||||||
"SPONSORS.md"
|
"SPONSORS.md"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
13
packages/pg/test/cloudflare/vitest-cf.test.ts
Normal file
13
packages/pg/test/cloudflare/vitest-cf.test.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { Pool } from 'pg'
|
||||||
|
import { test } from 'vitest'
|
||||||
|
import assert from 'node:assert'
|
||||||
|
|
||||||
|
test('default', async () => {
|
||||||
|
const pool = new Pool({
|
||||||
|
connectionString: 'postgres://postgres:password@localhost:5432/postgres',
|
||||||
|
})
|
||||||
|
|
||||||
|
const result = await pool.query('SELECT $1::text as name', ['cloudflare'])
|
||||||
|
assert(result.rows[0].name === 'cloudflare')
|
||||||
|
pool.end()
|
||||||
|
})
|
||||||
11
packages/pg/test/vitest.config.mts
Normal file
11
packages/pg/test/vitest.config.mts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { defineWorkersConfig } from '@cloudflare/vitest-pool-workers/config'
|
||||||
|
|
||||||
|
export default defineWorkersConfig({
|
||||||
|
test: {
|
||||||
|
poolOptions: {
|
||||||
|
workers: {
|
||||||
|
wrangler: { configPath: './wrangler.jsonc' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
@ -24,7 +24,8 @@ async function test() {
|
|||||||
})
|
})
|
||||||
try {
|
try {
|
||||||
const resp = await worker.fetch('/')
|
const resp = await worker.fetch('/')
|
||||||
const { rows } = await resp.json()
|
const res = await resp.json()
|
||||||
|
const { rows } = res
|
||||||
assert.same(rows[0].text, 'Hello, World!')
|
assert.same(rows[0].text, 'Hello, World!')
|
||||||
} finally {
|
} finally {
|
||||||
await worker.stop()
|
await worker.stop()
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
name = "pg-cf-test"
|
name = "pg-cf-test"
|
||||||
main = "src/index.ts"
|
main = "src/index.ts"
|
||||||
compatibility_date = "2023-04-04"
|
compatibility_date = "2023-04-04"
|
||||||
compatibility_flags = ["tcp_sockets_support"]
|
compatibility_flags = ["tcp_sockets_support", "nodejs_compat"]
|
||||||
node_compat = true
|
|
||||||
|
|||||||
48
packages/pg/test/wrangler.jsonc
Normal file
48
packages/pg/test/wrangler.jsonc
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
* For more details on how to configure Wrangler, refer to:
|
||||||
|
* https://developers.cloudflare.com/workers/wrangler/configuration/
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
"$schema": "node_modules/wrangler/config-schema.json",
|
||||||
|
"name": "my-first-worker",
|
||||||
|
"main": "src/index.ts",
|
||||||
|
"compatibility_date": "2025-04-07",
|
||||||
|
"compatibility_flags": ["nodejs_compat"],
|
||||||
|
"observability": {
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* t
|
||||||
|
* Docs: https://developers.cloudflare.com/workers/configuration/smart-placement/#smart-placement
|
||||||
|
*/
|
||||||
|
// "placement": { "mode": "smart" },
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bindings
|
||||||
|
* Bindings allow your Worker to interact with resources on the Cloudflare Developer Platform, including
|
||||||
|
* databases, object storage, AI inference, real-time communication and more.
|
||||||
|
* https://developers.cloudflare.com/workers/runtime-apis/bindings/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Environment Variables
|
||||||
|
* https://developers.cloudflare.com/workers/wrangler/configuration/#environment-variables
|
||||||
|
*/
|
||||||
|
// "vars": { "MY_VARIABLE": "production_value" },
|
||||||
|
/**
|
||||||
|
* Note: Use secrets to store sensitive data.
|
||||||
|
* https://developers.cloudflare.com/workers/configuration/secrets/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Static Assets
|
||||||
|
* https://developers.cloudflare.com/workers/static-assets/binding/
|
||||||
|
*/
|
||||||
|
// "assets": { "directory": "./public/", "binding": "ASSETS" },
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service Bindings (communicate between multiple Workers)
|
||||||
|
* https://developers.cloudflare.com/workers/wrangler/configuration/#service-bindings
|
||||||
|
*/
|
||||||
|
// "services": [{ "binding": "MY_SERVICE", "service": "my-service" }]
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user