@pgtyped/wire
Advanced tools
Comparing version 1.1.0 to 2.0.0-alpha.0
@@ -1,9 +0,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fixedArray = exports.notNullTerminatedString = exports.cString = exports.byteN = exports.byte4 = exports.byte1 = exports.cStringUnknownLengthArray = exports.cStringDict = exports.cByteDict = exports.int32 = exports.int16 = exports.dictToArray = exports.sumSize = void 0; | ||
const sumSize = (array) => array.reduce((acc, e) => acc + e.length, 0); | ||
exports.sumSize = sumSize; | ||
const dictToArray = (dict) => Object.entries(dict).reduce((acc, [key, val]) => [...acc, key, val], []); | ||
exports.dictToArray = dictToArray; | ||
const int16 = (val) => { | ||
export const sumSize = (array) => array.reduce((acc, e) => acc + e.length, 0); | ||
export const dictToArray = (dict) => Object.entries(dict).reduce((acc, [key, val]) => [...acc, key, val], []); | ||
export const int16 = (val) => { | ||
const buf = Buffer.alloc(2); | ||
@@ -13,4 +8,3 @@ buf.writeUInt16BE(val, 0); | ||
}; | ||
exports.int16 = int16; | ||
const int32 = (val) => { | ||
export const int32 = (val) => { | ||
const buf = Buffer.alloc(4); | ||
@@ -20,8 +14,6 @@ buf.writeUInt32BE(val, 0); | ||
}; | ||
exports.int32 = int32; | ||
const cByteDict = (dict) => null; | ||
exports.cByteDict = cByteDict; | ||
const cStringDict = (dict) => { | ||
const dictArray = (0, exports.dictToArray)(dict); | ||
const count = (0, exports.sumSize)(dictArray) + dictArray.length; | ||
export const cByteDict = (dict) => null; | ||
export const cStringDict = (dict) => { | ||
const dictArray = dictToArray(dict); | ||
const count = sumSize(dictArray) + dictArray.length; | ||
// extra byte for dict terminator | ||
@@ -35,17 +27,11 @@ const buf = Buffer.alloc(count + 1, 0); | ||
}; | ||
exports.cStringDict = cStringDict; | ||
const cStringUnknownLengthArray = (array) => null; | ||
exports.cStringUnknownLengthArray = cStringUnknownLengthArray; | ||
const byte1 = (num) => Buffer.from(num); | ||
exports.byte1 = byte1; | ||
const byte4 = () => null; | ||
exports.byte4 = byte4; | ||
const byteN = (buf) => null; | ||
exports.byteN = byteN; | ||
const cString = (str) => { | ||
export const cStringUnknownLengthArray = (array) => null; | ||
export const byte1 = (num) => Buffer.from(num); | ||
export const byte4 = () => null; | ||
export const byteN = (buf) => null; | ||
export const cString = (str) => { | ||
const buf = Buffer.concat([Buffer.from(str, 'utf8'), Buffer.from([0])]); | ||
return buf; | ||
}; | ||
exports.cString = cString; | ||
const notNullTerminatedString = (str) => { | ||
export const notNullTerminatedString = (str) => { | ||
const buf = Buffer.alloc(str.length, 0); | ||
@@ -55,6 +41,5 @@ buf.write(str); | ||
}; | ||
exports.notNullTerminatedString = notNullTerminatedString; | ||
const fixedArray = (builder, items) => { | ||
export const fixedArray = (builder, items) => { | ||
const builtItems = items.map(builder); | ||
const size = builtItems.reduce((acc, item) => acc + (0, exports.sumSize)(item), 2); | ||
const size = builtItems.reduce((acc, item) => acc + sumSize(item), 2); | ||
const result = Buffer.alloc(size, 0); | ||
@@ -69,3 +54,2 @@ result.writeUInt16BE(items.length, 0); | ||
}; | ||
exports.fixedArray = fixedArray; | ||
//# sourceMappingURL=helpers.js.map |
@@ -1,2 +0,3 @@ | ||
export { AsyncQueue } from './queue'; | ||
export { messages, PreparedObjectType } from './messages'; | ||
export { AsyncQueue } from './queue.js'; | ||
export { messages, PreparedObjectType } from './messages.js'; | ||
export { cString } from './helpers.js'; |
@@ -1,9 +0,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PreparedObjectType = exports.messages = exports.AsyncQueue = void 0; | ||
var queue_1 = require("./queue"); | ||
Object.defineProperty(exports, "AsyncQueue", { enumerable: true, get: function () { return queue_1.AsyncQueue; } }); | ||
var messages_1 = require("./messages"); | ||
Object.defineProperty(exports, "messages", { enumerable: true, get: function () { return messages_1.messages; } }); | ||
Object.defineProperty(exports, "PreparedObjectType", { enumerable: true, get: function () { return messages_1.PreparedObjectType; } }); | ||
export { AsyncQueue } from './queue.js'; | ||
export { messages, PreparedObjectType } from './messages.js'; | ||
export { cString } from './helpers.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,7 +0,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.messages = exports.PreparedObjectType = exports.TransactionStatus = void 0; | ||
const helpers_1 = require("./helpers"); | ||
import { byte1, byte4, byteN, cByteDict, cString, cStringDict, cStringUnknownLengthArray, fixedArray, int16, int32, notNullTerminatedString, } from './helpers.js'; | ||
/** The status of the the server query executor */ | ||
var TransactionStatus; | ||
export var TransactionStatus; | ||
(function (TransactionStatus) { | ||
@@ -14,10 +11,10 @@ /** Transaction idle (not in a transaction block) */ | ||
TransactionStatus["Error"] = "E"; | ||
})(TransactionStatus = exports.TransactionStatus || (exports.TransactionStatus = {})); | ||
})(TransactionStatus || (TransactionStatus = {})); | ||
/** Prepared object type */ | ||
var PreparedObjectType; | ||
export var PreparedObjectType; | ||
(function (PreparedObjectType) { | ||
PreparedObjectType["Portal"] = "P"; | ||
PreparedObjectType["Statement"] = "S"; | ||
})(PreparedObjectType = exports.PreparedObjectType || (exports.PreparedObjectType = {})); | ||
exports.messages = { | ||
})(PreparedObjectType || (PreparedObjectType = {})); | ||
export const messages = { | ||
/** SSLRequest message requests SSL from a remote host */ | ||
@@ -30,3 +27,3 @@ sslRequest: { | ||
// The SSL request code. | ||
(0, helpers_1.int32)(80877103), | ||
int32(80877103), | ||
], | ||
@@ -41,3 +38,3 @@ }, | ||
pattern: { | ||
trxStatus: helpers_1.byte1, | ||
trxStatus: byte1, | ||
}, | ||
@@ -52,3 +49,3 @@ }, | ||
pattern: { | ||
status: (0, helpers_1.int32)(0), | ||
status: int32(0), | ||
}, | ||
@@ -63,3 +60,3 @@ }, | ||
pattern: { | ||
status: (0, helpers_1.int32)(3), | ||
status: int32(3), | ||
}, | ||
@@ -74,4 +71,4 @@ }, | ||
pattern: { | ||
status: (0, helpers_1.int32)(5), | ||
salt: helpers_1.byte4, | ||
status: int32(5), | ||
salt: byte4, | ||
}, | ||
@@ -85,4 +82,4 @@ }, | ||
pattern: { | ||
status: (0, helpers_1.int32)(10), | ||
SASLMechanisms: helpers_1.cStringUnknownLengthArray, | ||
status: int32(10), | ||
SASLMechanisms: cStringUnknownLengthArray, | ||
}, | ||
@@ -100,4 +97,4 @@ }, | ||
pattern: { | ||
processId: helpers_1.int32, | ||
secretKey: helpers_1.int32, | ||
processId: int32, | ||
secretKey: int32, | ||
}, | ||
@@ -117,5 +114,5 @@ }, | ||
// The least significant 16 bits are the minor version number (0 for the protocol described here). | ||
(0, helpers_1.int32)(196608), | ||
int32(196608), | ||
// An array of String parameter-value pairs | ||
(0, helpers_1.cStringDict)(data.params), | ||
cStringDict(data.params), | ||
], | ||
@@ -129,4 +126,4 @@ }, | ||
pattern: { | ||
name: helpers_1.cString, | ||
value: helpers_1.cString, | ||
name: cString, | ||
value: cString, | ||
}, | ||
@@ -140,5 +137,5 @@ }, | ||
pattern: (data) => [ | ||
(0, helpers_1.cString)(data.mechanism), | ||
(0, helpers_1.int32)(data.responseLength), | ||
(0, helpers_1.notNullTerminatedString)(data.response), | ||
cString(data.mechanism), | ||
int32(data.responseLength), | ||
notNullTerminatedString(data.response), | ||
], | ||
@@ -155,4 +152,4 @@ }, | ||
pattern: { | ||
status: (0, helpers_1.int32)(11), | ||
SASLData: helpers_1.notNullTerminatedString, | ||
status: int32(11), | ||
SASLData: notNullTerminatedString, | ||
}, | ||
@@ -167,3 +164,3 @@ }, | ||
indicator: 'p', | ||
pattern: (data) => [(0, helpers_1.notNullTerminatedString)(data.response)], | ||
pattern: (data) => [notNullTerminatedString(data.response)], | ||
}, | ||
@@ -178,4 +175,4 @@ /** The AuthenticationSASLFinal message is sent when the password is correct and it returns a server signature | ||
pattern: { | ||
status: (0, helpers_1.int32)(12), | ||
SASLData: helpers_1.notNullTerminatedString, | ||
status: int32(12), | ||
SASLData: notNullTerminatedString, | ||
}, | ||
@@ -188,3 +185,3 @@ }, | ||
indicator: 'p', | ||
pattern: (data) => [(0, helpers_1.cString)(data.password)], | ||
pattern: (data) => [cString(data.password)], | ||
}, | ||
@@ -196,3 +193,3 @@ /** Query message initiates a simple query cycle. */ | ||
indicator: 'Q', | ||
pattern: (data) => [(0, helpers_1.cString)(data.query)], | ||
pattern: (data) => [cString(data.query)], | ||
}, | ||
@@ -211,9 +208,9 @@ /** | ||
{ | ||
name: helpers_1.cString, | ||
tableOID: helpers_1.int32, | ||
columnAttrNumber: helpers_1.int16, | ||
typeOID: helpers_1.int32, | ||
typeSize: helpers_1.int16, | ||
typeModifier: helpers_1.int32, | ||
formatCode: helpers_1.int16, | ||
name: cString, | ||
tableOID: int32, | ||
columnAttrNumber: int16, | ||
typeOID: int32, | ||
typeSize: int16, | ||
typeModifier: int32, | ||
formatCode: int16, | ||
}, | ||
@@ -231,3 +228,3 @@ ], | ||
{ | ||
value: helpers_1.byteN, | ||
value: byteN, | ||
}, | ||
@@ -258,3 +255,3 @@ ], | ||
{ | ||
oid: helpers_1.int32, | ||
oid: int32, | ||
}, | ||
@@ -272,5 +269,5 @@ ], | ||
pattern: (params) => [ | ||
(0, helpers_1.cString)(params.name), | ||
(0, helpers_1.cString)(params.query), | ||
(0, helpers_1.fixedArray)(({ oid }) => [(0, helpers_1.int32)(oid)], params.dataTypes), | ||
cString(params.name), | ||
cString(params.query), | ||
fixedArray(({ oid }) => [int32(oid)], params.dataTypes), | ||
], | ||
@@ -283,3 +280,3 @@ }, | ||
indicator: 'D', | ||
pattern: ({ name, type }) => [(0, helpers_1.byte1)(type), (0, helpers_1.cString)(name)], | ||
pattern: ({ name, type }) => [byte1(type), cString(name)], | ||
}, | ||
@@ -299,3 +296,3 @@ /** ParseComplete informs the client that prepared object parsing was successful */ | ||
indicator: 'S', | ||
size: (0, helpers_1.int32)(4), | ||
size: int32(4), | ||
pattern: () => [], | ||
@@ -308,3 +305,3 @@ }, | ||
indicator: 'H', | ||
size: (0, helpers_1.int32)(4), | ||
size: int32(4), | ||
pattern: () => [], | ||
@@ -318,3 +315,3 @@ }, | ||
pattern: { | ||
fields: helpers_1.cByteDict, | ||
fields: cByteDict, | ||
}, | ||
@@ -330,3 +327,3 @@ }, | ||
indicator: 'C', | ||
pattern: (params) => [(0, helpers_1.byte1)(params.target), (0, helpers_1.cString)(params.targetName)], | ||
pattern: (params) => [byte1(params.target), cString(params.targetName)], | ||
}, | ||
@@ -356,3 +353,3 @@ /** CloseComplete is sent by the server to signify that the prepared object was successfully close */ | ||
*/ | ||
commandTag: helpers_1.cString, | ||
commandTag: cString, | ||
}, | ||
@@ -359,0 +356,0 @@ }, |
/// <reference types="node" /> | ||
import { IClientMessage, IServerMessage } from './messages'; | ||
import { IClientMessage, IServerMessage } from './messages.js'; | ||
export declare const parseSimpleType: (type: any, buf: Buffer, offset: number, offsetEnd?: number) => { | ||
@@ -4,0 +4,0 @@ result: any; |
@@ -1,7 +0,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseMultiple = exports.parseOneOf = exports.buildMessage = exports.parseMessage = exports.parseSimpleType = void 0; | ||
const helpers_1 = require("./helpers"); | ||
const messages_1 = require("./messages"); | ||
const parseSimpleType = (type, buf, offset, offsetEnd) => { | ||
import { byte1, byte4, byteN, cByteDict, cString, cStringUnknownLengthArray, int16, int32, sumSize, notNullTerminatedString, } from './helpers.js'; | ||
import { messages as pgMessages, } from './messages.js'; | ||
export const parseSimpleType = (type, buf, offset, offsetEnd) => { | ||
let result = null; | ||
@@ -15,3 +12,3 @@ if (type instanceof Buffer) { | ||
} | ||
else if (type === helpers_1.byte1) { | ||
else if (type === byte1) { | ||
const val = buf.readInt8(offset); | ||
@@ -21,7 +18,7 @@ result = String.fromCharCode(val); | ||
} | ||
else if (type === helpers_1.byte4) { | ||
else if (type === byte4) { | ||
result = buf.slice(offset, offset + 4); | ||
offset += 4; | ||
} | ||
else if (type === helpers_1.cString) { | ||
else if (type === cString) { | ||
const stringStart = offset; | ||
@@ -34,7 +31,7 @@ while (buf.readInt8(offset) !== 0) { | ||
} | ||
else if (type === helpers_1.notNullTerminatedString) { | ||
else if (type === notNullTerminatedString) { | ||
result = buf.toString('utf8', offset, offsetEnd); | ||
offset += result.length; | ||
} | ||
else if (type === helpers_1.byteN) { | ||
else if (type === byteN) { | ||
const chunkSize = buf.readInt32BE(offset); | ||
@@ -45,7 +42,7 @@ offset += 4; | ||
} | ||
else if (type === helpers_1.int32) { | ||
else if (type === int32) { | ||
result = buf.readInt32BE(offset); | ||
offset += 4; | ||
} | ||
else if (type === helpers_1.int16) { | ||
else if (type === int16) { | ||
result = buf.readInt16BE(offset); | ||
@@ -56,5 +53,4 @@ offset += 2; | ||
}; | ||
exports.parseSimpleType = parseSimpleType; | ||
const errorResponseMessageIndicator = messages_1.messages.errorResponse.indicator.charCodeAt(0); | ||
const parseMessage = (message, buf, messageOffset = 0) => { | ||
const errorResponseMessageIndicator = pgMessages.errorResponse.indicator.charCodeAt(0); | ||
export const parseMessage = (message, buf, messageOffset = 0) => { | ||
let bufferOffset = messageOffset; | ||
@@ -78,3 +74,3 @@ const indicator = buf.readInt8(bufferOffset); | ||
const pattern = isUnexpectedErrorMessage | ||
? messages_1.messages.errorResponse.pattern | ||
? pgMessages.errorResponse.pattern | ||
: message.pattern; | ||
@@ -87,7 +83,7 @@ const result = {}; | ||
const [key, type] = patternPairs[pairIndex]; | ||
if (type === helpers_1.cByteDict) { | ||
if (type === cByteDict) { | ||
const dict = {}; | ||
let fieldKey; | ||
while (({ result: fieldKey, offset: bufferOffset } = (0, exports.parseSimpleType)(helpers_1.byte1, buf, bufferOffset)).result !== '\u0000') { | ||
const { result: fieldValue, offset: valueOffset } = (0, exports.parseSimpleType)(helpers_1.cString, buf, bufferOffset); | ||
while (({ result: fieldKey, offset: bufferOffset } = parseSimpleType(byte1, buf, bufferOffset)).result !== '\u0000') { | ||
const { result: fieldValue, offset: valueOffset } = parseSimpleType(cString, buf, bufferOffset); | ||
bufferOffset = valueOffset; | ||
@@ -98,6 +94,6 @@ dict[fieldKey] = fieldValue; | ||
} | ||
else if (type === helpers_1.cStringUnknownLengthArray) { | ||
else if (type === cStringUnknownLengthArray) { | ||
const arr = []; | ||
while (bufferOffset < messageEnd - 1) { | ||
const { result: arrayValue, offset: valueOffset } = (0, exports.parseSimpleType)(helpers_1.cString, buf, bufferOffset); | ||
const { result: arrayValue, offset: valueOffset } = parseSimpleType(cString, buf, bufferOffset); | ||
bufferOffset = valueOffset; | ||
@@ -118,3 +114,3 @@ arr.push(arrayValue); | ||
for (const [subKey, subType] of subPattern) { | ||
const { result: fieldResult, offset: fieldOffset } = (0, exports.parseSimpleType)(subType, buf, bufferOffset); | ||
const { result: fieldResult, offset: fieldOffset } = parseSimpleType(subType, buf, bufferOffset); | ||
subResult[subKey] = fieldResult; | ||
@@ -128,3 +124,3 @@ bufferOffset = fieldOffset; | ||
else { | ||
const { result: fieldResult, offset: fieldOffset } = (0, exports.parseSimpleType)(type, buf, bufferOffset, messageEnd); | ||
const { result: fieldResult, offset: fieldOffset } = parseSimpleType(type, buf, bufferOffset, messageEnd); | ||
result[key] = fieldResult; | ||
@@ -158,8 +154,7 @@ bufferOffset = fieldOffset; | ||
}; | ||
exports.parseMessage = parseMessage; | ||
const buildMessage = (message, parameters) => { | ||
export const buildMessage = (message, parameters) => { | ||
const bufArray = message.pattern(parameters); | ||
const bufferSize = +(message.indicator ? 1 : 0) + // indicator byte if present | ||
4 + // message size | ||
(0, helpers_1.sumSize)(bufArray); // payload | ||
sumSize(bufArray); // payload | ||
const buf = Buffer.alloc(bufferSize); | ||
@@ -180,8 +175,7 @@ let offset = 0; | ||
}; | ||
exports.buildMessage = buildMessage; | ||
const parseOneOf = (messages, buffer, offset) => { | ||
export const parseOneOf = (messages, buffer, offset) => { | ||
const messageName = messages.map((m) => m.name).join(' | '); | ||
let lastBufferOffset = 0; | ||
for (const message of messages) { | ||
const parseResult = (0, exports.parseMessage)(message, buffer, offset); | ||
const parseResult = parseMessage(message, buffer, offset); | ||
if (parseResult.type !== 'MessageMismatchError') { | ||
@@ -198,4 +192,3 @@ return parseResult; | ||
}; | ||
exports.parseOneOf = parseOneOf; | ||
const parseMultiple = (messages, buffer, offset) => { | ||
export const parseMultiple = (messages, buffer, offset) => { | ||
const result = []; | ||
@@ -205,3 +198,3 @@ const bufferEnd = buffer.byteLength; | ||
while (lastBufferOffset < bufferEnd) { | ||
const parseResult = (0, exports.parseOneOf)(messages, buffer, lastBufferOffset); | ||
const parseResult = parseOneOf(messages, buffer, lastBufferOffset); | ||
if (parseResult.type !== 'MessageMismatchError') { | ||
@@ -217,3 +210,2 @@ result.push(parseResult); | ||
}; | ||
exports.parseMultiple = parseMultiple; | ||
//# sourceMappingURL=protocol.js.map |
@@ -6,4 +6,4 @@ /// <reference types="node" /> | ||
import * as tls from 'tls'; | ||
import { ParseResult } from './protocol'; | ||
import { IClientMessage, IServerMessage } from './messages'; | ||
import { ParseResult } from './protocol.js'; | ||
import { IClientMessage, IServerMessage } from './messages.js'; | ||
type Box<T> = T extends IServerMessage<infer P> ? P : any; | ||
@@ -10,0 +10,0 @@ type Boxified<T extends [any] | any[]> = { |
@@ -1,25 +0,1 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -45,14 +21,9 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AsyncQueue = void 0; | ||
const net = __importStar(require("net")); | ||
const tls = __importStar(require("tls")); | ||
const protocol_1 = require("./protocol"); | ||
const messages_1 = require("./messages"); | ||
const debug_1 = __importDefault(require("debug")); | ||
const debug = (0, debug_1.default)('pg-wire:socket'); | ||
class AsyncQueue { | ||
import * as net from 'net'; | ||
import * as tls from 'tls'; | ||
import { buildMessage, parseMessage, parseMultiple, parseOneOf, } from './protocol.js'; | ||
import { messages } from './messages.js'; | ||
import debugBase from 'debug'; | ||
const debug = debugBase('pg-wire:socket'); | ||
export class AsyncQueue { | ||
constructor() { | ||
@@ -78,3 +49,3 @@ this.queue = []; | ||
if (sslEnabled) { | ||
this.send(messages_1.messages.sslRequest, {}); | ||
this.send(messages.sslRequest, {}); | ||
} | ||
@@ -125,3 +96,3 @@ else { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const buf = (0, protocol_1.buildMessage)(message, params); | ||
const buf = buildMessage(message, params); | ||
return new Promise((resolve) => { | ||
@@ -192,6 +163,6 @@ this.socket.write(buf, () => resolve()); | ||
if (serverMessages instanceof Array) { | ||
parser = (buf, offset) => (0, protocol_1.parseOneOf)(serverMessages, buf, offset); | ||
parser = (buf, offset) => parseOneOf(serverMessages, buf, offset); | ||
} | ||
else { | ||
parser = (buf, offset) => (0, protocol_1.parseMessage)(serverMessages, buf, offset); | ||
parser = (buf, offset) => parseMessage(serverMessages, buf, offset); | ||
} | ||
@@ -220,3 +191,3 @@ return new Promise((resolve, reject) => { | ||
reject, | ||
parser: (buf, offset) => (0, protocol_1.parseMultiple)(serverMessages, buf, offset), | ||
parser: (buf, offset) => parseMultiple(serverMessages, buf, offset), | ||
}; | ||
@@ -228,3 +199,2 @@ this.processQueue(); | ||
} | ||
exports.AsyncQueue = AsyncQueue; | ||
//# sourceMappingURL=queue.js.map |
{ | ||
"name": "@pgtyped/wire", | ||
"version": "1.1.0", | ||
"version": "2.0.0-alpha.0", | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"import": "./lib/index.js", | ||
"types": "./lib/index.d.ts" | ||
} | ||
}, | ||
"main": "lib/index.js", | ||
@@ -15,21 +22,11 @@ "types": "lib/index.d.ts", | ||
}, | ||
"files": [ | ||
"lib" | ||
], | ||
"scripts": { | ||
"test": "jest", | ||
"build": "tsc --declaration", | ||
"test": "NODE_OPTIONS='--experimental-vm-modules' jest", | ||
"build": "tsc", | ||
"check": "tsc --noEmit", | ||
"watch": "tsc --declaration --watch --preserveWatchOutput" | ||
"watch": "tsc --watch --preserveWatchOutput" | ||
}, | ||
"jest": { | ||
"roots": [ | ||
"src" | ||
], | ||
"testRegex": "\\.test\\.tsx?$", | ||
"transform": { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
"snapshotFormat": { | ||
"escapeString": true, | ||
"printBasicPrototype": true | ||
} | ||
}, | ||
"dependencies": { | ||
@@ -42,3 +39,3 @@ "debug": "^4.1.1" | ||
}, | ||
"gitHead": "96f3380fbc95f2b4ed390b0c1d79f368a539ecbf" | ||
"gitHead": "2c66305782b0691dabd0a2a6ef16884d3289305f" | ||
} |
### PgTyped Wire | ||
This package is part of the pgtyped project. | ||
This package implements most of the Postgres protocol for pgTyped internal use. | ||
Refer to root [README](https://github.com/adelsz/pgtyped) for details. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
100652
24
1496
Yes
1