Skip to content

Commit

Permalink
Add socket type definition
Browse files Browse the repository at this point in the history
  • Loading branch information
mo36924 committed Oct 25, 2024
1 parent b231b68 commit 8f5ea88
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions deno/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Buffer } from 'https://deno.land/[email protected]/node/buffer.ts'
import process from 'https://deno.land/[email protected]/node/process.ts'
import { Socket } from "https://deno.land/[email protected]/node/net.ts"
import { Readable, Writable } from 'https://deno.land/[email protected]/node/stream.ts'

/**
Expand Down Expand Up @@ -124,6 +125,7 @@ interface BaseOptions<T extends Record<string, postgres.PostgresType>> {
backoff: boolean | ((attemptNum: number) => number);
max_lifetime: number | null;
keep_alive: number | null;
socket: (options: postgres.ParsedOptions<T>) => Socket | Promise<Socket>
}


Expand Down
1 change: 1 addition & 0 deletions transpile.deno.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ function transpile(x, name, folder) {
'(query.writable.push({ chunk }), callback())'
)
.replace('socket.setKeepAlive(true, 1000 * keep_alive)', 'socket.setKeepAlive(true)')
.replace('node:net', std + 'node/net.ts')
.replace('node:stream', std + 'node/stream.ts')
.replace('import net from \'net\'', 'import { net } from \'../polyfills.js\'')
.replace('import tls from \'tls\'', 'import { tls } from \'../polyfills.js\'')
Expand Down
2 changes: 2 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Socket } from "node:net"
import { Readable, Writable } from 'node:stream'

/**
Expand Down Expand Up @@ -122,6 +123,7 @@ interface BaseOptions<T extends Record<string, postgres.PostgresType>> {
backoff: boolean | ((attemptNum: number) => number);
max_lifetime: number | null;
keep_alive: number | null;
socket: (options: postgres.ParsedOptions<T>) => Socket | Promise<Socket>
}


Expand Down

0 comments on commit 8f5ea88

Please sign in to comment.