-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgrade for deno2, publish to jsr https://jsr.io/@y0/postgres
deno2 & jsr : https://deno.com/blog/jsr_open_beta publish method 1. get token for https://jsr.io/account/tokens export DENO_AUTH_TOKENS= 2. npm run deno:publish test deno add jsr:@y0/postgres crate mod.js ``` import postgres from '@y0/postgres' const pg = postgres(process.env.PG_URL) console.log( await pg`SELECT 1` ) ``` deno -A mod.js
- Loading branch information
Showing
16 changed files
with
56 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "@y0/postgres", | ||
"version": "3.4.5", | ||
"exports": "./src/index.js", | ||
"license": "MulanPSL-2.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// @deno-types="./types/index.d.ts" | ||
// @deno-types="./types/index.d" | ||
export { default } from './src/index.js' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* global Deno */ | ||
|
||
import { Buffer } from 'https://deno.land/[email protected]/node/buffer.ts' | ||
import { isIP } from 'https://deno.land/[email protected]/node/net.ts' | ||
import { Buffer } from 'node:buffer' | ||
import { isIP } from 'node:net' | ||
|
||
const events = () => ({ data: [], error: [], drain: [], connect: [], secureConnect: [], close: [] }) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { Buffer } from 'https://deno.land/[email protected]/node/buffer.ts' | ||
import { Buffer } from 'node:buffer' | ||
const size = 256 | ||
let buffer = Buffer.allocUnsafe(size) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import { HmacSha256 } from 'https://deno.land/[email protected]/hash/sha256.ts' | ||
import { Buffer } from 'https://deno.land/[email protected]/node/buffer.ts' | ||
import { Buffer } from 'node:buffer' | ||
import { setImmediate, clearImmediate } from '../polyfills.js' | ||
import { net } from '../polyfills.js' | ||
import { tls } from '../polyfills.js' | ||
import crypto from 'https://deno.land/[email protected]/node/crypto.ts' | ||
import Stream from 'https://deno.land/[email protected]/node/stream.ts' | ||
import crypto from 'node:crypto' | ||
import Stream from 'node:stream' | ||
|
||
|
||
import { stringify, handleValue, arrayParser, arraySerializer } from './types.js' | ||
|
@@ -1000,8 +999,30 @@ function md5(x) { | |
return crypto.createHash('md5').update(x).digest('hex') | ||
} | ||
|
||
function hmac(key, x) { | ||
return Buffer.from(new HmacSha256(key).update(x).digest()) | ||
const UTF8 = new TextEncoder(); | ||
|
||
const hmac = async (key, x) => { | ||
if (key.constructor == String) { | ||
key = UTF8.encode(key); | ||
} | ||
|
||
if (x.constructor == String) { | ||
x = UTF8.encode(x); | ||
} | ||
|
||
const cryptoKey = await crypto.subtle.importKey( | ||
"raw", | ||
key, | ||
{ name: "HMAC", hash: "SHA-256" }, | ||
false, | ||
["sign"] | ||
); | ||
|
||
return Buffer.from(await crypto.subtle.sign( | ||
"HMAC", | ||
cryptoKey, | ||
x | ||
)); | ||
} | ||
|
||
function sha256(x) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import process from 'https://deno.land/[email protected]/node/process.ts' | ||
import os from 'https://deno.land/[email protected]/node/os.ts' | ||
import fs from 'https://deno.land/[email protected]/node/fs.ts' | ||
import process from 'node:process' | ||
import os from 'node:os' | ||
import fs from 'node:fs' | ||
|
||
import { | ||
mergeUserTypes, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import Stream from 'https://deno.land/[email protected]/node/stream.ts' | ||
import Stream from 'node:stream' | ||
|
||
export default function largeObject(sql, oid, mode = 0x00020000 | 0x00040000) { | ||
return new Promise(async(resolve, reject) => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { Buffer } from 'https://deno.land/[email protected]/node/buffer.ts' | ||
import { Buffer } from 'node:buffer' | ||
const noop = () => { /* noop */ } | ||
|
||
export default function Subscribe(postgres, options) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { Buffer } from 'https://deno.land/[email protected]/node/buffer.ts' | ||
import { Buffer } from 'node:buffer' | ||
import { Query } from './query.js' | ||
import { Errors } from './errors.js' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { spawn } from 'https://deno.land/[email protected]/node/child_process.ts' | ||
import { spawn } from 'node:child_process' | ||
|
||
await exec('dropdb', ['postgres_js_test']) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { Buffer } from 'https://deno.land/[email protected]/node/buffer.ts' | ||
import process from 'https://deno.land/[email protected]/node/process.ts' | ||
import { Buffer } from 'node:buffer' | ||
import process from 'node:process' | ||
import { exec } from './bootstrap.js' | ||
|
||
import { t, nt, ot } from './test.js' // eslint-disable-line | ||
import { net } from '../polyfills.js' | ||
import fs from 'https://deno.land/[email protected]/node/fs.ts' | ||
import crypto from 'https://deno.land/[email protected]/node/crypto.ts' | ||
import fs from 'node:fs' | ||
import crypto from 'node:crypto' | ||
|
||
import postgres from '../src/index.js' | ||
const delay = ms => new Promise(r => setTimeout(r, ms)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import process from 'https://deno.land/[email protected]/node/process.ts' | ||
import process from 'node:process' | ||
/* eslint no-console: 0 */ | ||
|
||
import util from 'https://deno.land/[email protected]/node/util.ts' | ||
import util from 'node:util' | ||
|
||
let done = 0 | ||
let only = false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +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 { Readable, Writable } from 'https://deno.land/[email protected]/node/stream.ts' | ||
import { Buffer } from 'node:buffer' | ||
import process from 'node:process' | ||
import { Readable, Writable } from 'node:stream' | ||
|
||
/** | ||
* Establish a connection to a PostgreSQL server. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters