Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: test

on: [push, pull_request]
on: [pull_request]

jobs:
test:
name: Node v${{ matrix.node }} on PostgreSQL v${{ matrix.postgres }}
strategy:
fail-fast: false
matrix:
node: ['12', '14', '16', '18', '20', '21']
postgres: ['12', '13', '14', '15', '16']
node: ["22"]
postgres: ["16"]
runs-on: ubuntu-latest
services:
postgres:
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"deno.enablePaths": ["./deno"]
}
14 changes: 7 additions & 7 deletions cjs/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ t('Options from uri with special characters in user and pass', async() => {
return [[opt.user, opt.pass].toString(), 'öla,pass^word']
})

t('Fail with proper error on no host', async() =>
nt('Fail with proper error on no host', async() =>
['ECONNREFUSED', (await new Promise((resolve, reject) => {
const sql = postgres('postgres://localhost:33333/' + options.db, {
idle_timeout
Expand All @@ -383,7 +383,7 @@ t('Fail with proper error on no host', async() =>
})).code]
)

t('Connect using SSL', async() =>
nt('Connect using SSL', async() =>
[true, (await new Promise((resolve, reject) => {
postgres({
ssl: { rejectUnauthorized: false },
Expand All @@ -392,7 +392,7 @@ t('Connect using SSL', async() =>
}))]
)

t('Connect using SSL require', async() =>
nt('Connect using SSL require', async() =>
[true, (await new Promise((resolve, reject) => {
postgres({
ssl: 'require',
Expand All @@ -417,7 +417,7 @@ t('Connect using SSL prefer', async() => {
]
})

t('Reconnect using SSL', { timeout: 2 }, async() => {
nt('Reconnect using SSL', { timeout: 2 }, async() => {
const sql = postgres({
ssl: 'require',
idle_timeout: 0.1
Expand Down Expand Up @@ -1004,7 +1004,7 @@ t('little bobby tables', async() => {
]
})

t('Connection errors are caught using begin()', {
nt('Connection errors are caught using begin()', {
timeout: 2
}, async() => {
let error
Expand Down Expand Up @@ -1220,7 +1220,7 @@ t('Multiple statements', async() =>
`).then(([, [x]]) => x.a)]
)

t('throws correct error when authentication fails', async() => {
nt('throws correct error when authentication fails', async() => {
const sql = postgres({
...options,
...login_md5,
Expand Down Expand Up @@ -1656,7 +1656,7 @@ t('connect_timeout error message includes host:port', { timeout: 20 }, async() =
return [['write CONNECT_TIMEOUT 127.0.0.1:', port].join(''), err]
})

t('requests works after single connect_timeout', async() => {
nt('requests works after single connect_timeout', async() => {
let first = true

const sql = postgres({
Expand Down
2 changes: 1 addition & 1 deletion cjs/tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async function test(o, name, options, fn) {
}

tests[line].succeeded = true
process.stdout.write('✅')
process.stdout.write(`✅ ${name} at line ${line} succeeded\n`)
})
.catch(err => {
tests[line].failed = failed = true
Expand Down
189 changes: 0 additions & 189 deletions deno/polyfills.js

This file was deleted.

2 changes: 1 addition & 1 deletion deno/src/bytes.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Buffer } from 'https://deno.land/std@0.132.0/node/buffer.ts'
import { Buffer } from 'node:buffer'
const size = 256
let buffer = Buffer.allocUnsafe(size)

Expand Down
15 changes: 7 additions & 8 deletions deno/src/connection.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { HmacSha256 } from 'https://deno.land/std@0.132.0/hash/sha256.ts'
import { Buffer } from 'https://deno.land/std@0.132.0/node/buffer.ts'
import { setImmediate, clearImmediate } from '../polyfills.js'
import { net } from '../polyfills.js'
import { tls } from '../polyfills.js'
import crypto from 'https://deno.land/std@0.132.0/node/crypto.ts'
import Stream from 'https://deno.land/std@0.132.0/node/stream.ts'
import { Buffer } from 'node:buffer'
import { setImmediate, clearImmediate } from 'node:timers'
import net from 'node:net'
import tls from 'node:tls'
import crypto from 'node:crypto'
import Stream from 'node:stream'


import { stringify, handleValue, arrayParser, arraySerializer } from './types.js'
Expand Down Expand Up @@ -1001,7 +1000,7 @@ function md5(x) {
}

function hmac(key, x) {
return Buffer.from(new HmacSha256(key).update(x).digest())
return crypto.createHmac('sha256', key).update(x).digest()
}

function sha256(x) {
Expand Down
6 changes: 3 additions & 3 deletions deno/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import process from 'https://deno.land/std@0.132.0/node/process.ts'
import os from 'https://deno.land/std@0.132.0/node/os.ts'
import fs from 'https://deno.land/std@0.132.0/node/fs.ts'
import process from 'node:process'
import os from 'node:os'
import fs from 'node:fs'

import {
mergeUserTypes,
Expand Down
2 changes: 1 addition & 1 deletion deno/src/large.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Stream from 'https://deno.land/std@0.132.0/node/stream.ts'
import Stream from 'node:stream'

export default function largeObject(sql, oid, mode = 0x00020000 | 0x00040000) {
return new Promise(async(resolve, reject) => {
Expand Down
2 changes: 1 addition & 1 deletion deno/src/subscribe.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Buffer } from 'https://deno.land/std@0.132.0/node/buffer.ts'
import { Buffer } from 'node:buffer'
const noop = () => { /* noop */ }

export default function Subscribe(postgres, options) {
Expand Down
2 changes: 1 addition & 1 deletion deno/src/types.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Buffer } from 'https://deno.land/std@0.132.0/node/buffer.ts'
import { Buffer } from 'node:buffer'
import { Query } from './query.js'
import { Errors } from './errors.js'

Expand Down
2 changes: 1 addition & 1 deletion deno/tests/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { spawn } from 'https://deno.land/std@0.132.0/node/child_process.ts'
import { spawn } from 'node:child_process'

await exec('dropdb', ['postgres_js_test'])

Expand Down
Loading