@pgxsinkit/pgwasm 0.5.2 → 0.6.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunk-0w227vw2.js.map +1 -1
- package/dist/{chunk-gjf102c9.js → chunk-8q0zqcbv.js} +66 -66
- package/dist/{chunk-gjf102c9.js.map → chunk-8q0zqcbv.js.map} +4 -4
- package/dist/{chunk-d82gg1hx.js → chunk-jnmd6w7f.js} +1 -1
- package/dist/{chunk-d82gg1hx.js.map → chunk-jnmd6w7f.js.map} +2 -2
- package/dist/{chunk-at1py5s5.js → chunk-s6a029ak.js} +14 -9
- package/dist/chunk-s6a029ak.js.map +12 -0
- package/dist/{chunk-74gcrk47.js → chunk-t3q74nsz.js} +18 -4
- package/dist/{chunk-74gcrk47.js.map → chunk-t3q74nsz.js.map} +4 -4
- package/dist/chunk-z0c40tja.js.map +1 -1
- package/dist/{chunk-tdvrvgt5.js → chunk-zm269na3.js} +2 -2
- package/dist/{chunk-tdvrvgt5.js.map → chunk-zm269na3.js.map} +1 -1
- package/dist/drizzle/codecs.d.ts +5 -2
- package/dist/drizzle/codecs.d.ts.map +1 -1
- package/dist/drizzle/driver.d.ts.map +1 -1
- package/dist/drizzle/index.js +42 -27
- package/dist/drizzle/index.js.map +5 -5
- package/dist/drizzle/session.d.ts +2 -6
- package/dist/drizzle/session.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/live/index.d.ts.map +1 -1
- package/dist/live/index.js +5 -4
- package/dist/live/index.js.map +3 -3
- package/dist/opfs/index.js +2 -2
- package/dist/opfs/index.js.map +1 -1
- package/dist/protocol/index.js +2 -2
- package/dist/protocol/wire/buffer-reader.d.ts +1 -0
- package/dist/protocol/wire/buffer-reader.d.ts.map +1 -1
- package/dist/protocol/wire/buffer-writer.d.ts +1 -0
- package/dist/protocol/wire/buffer-writer.d.ts.map +1 -1
- package/dist/protocol/wire/serializer.d.ts.map +1 -1
- package/package.json +2 -2
- package/skills/opfs/SKILL.md +5 -3
- package/src/drizzle/codecs.ts +43 -25
- package/src/drizzle/driver.ts +1 -0
- package/src/drizzle/session.ts +3 -3
- package/src/live/index.ts +1 -0
- package/src/protocol/wire/buffer-reader.ts +6 -0
- package/src/protocol/wire/buffer-writer.ts +7 -0
- package/src/protocol/wire/parser.ts +1 -1
- package/src/protocol/wire/serializer.ts +12 -6
- package/dist/chunk-at1py5s5.js.map +0 -12
|
@@ -27,13 +27,7 @@ import {
|
|
|
27
27
|
CommandCompleteMessage,
|
|
28
28
|
DataRowMessage,
|
|
29
29
|
NoticeMessage
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
|
|
32
|
-
// packages/pgwasm/src/protocol/wire/types.ts
|
|
33
|
-
var Modes2 = {
|
|
34
|
-
text: 0,
|
|
35
|
-
binary: 1
|
|
36
|
-
};
|
|
30
|
+
} from "./chunk-t3q74nsz.js";
|
|
37
31
|
|
|
38
32
|
// packages/pgwasm/src/protocol/wire/buffer-reader.ts
|
|
39
33
|
var emptyBuffer = new ArrayBuffer(0);
|
|
@@ -54,6 +48,11 @@ class BufferReader {
|
|
|
54
48
|
this.#offset += 2;
|
|
55
49
|
return result;
|
|
56
50
|
}
|
|
51
|
+
uint16() {
|
|
52
|
+
const result = this.#bufferView.getUint16(this.#offset, false);
|
|
53
|
+
this.#offset += 2;
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
57
56
|
byte() {
|
|
58
57
|
const result = this.#bufferView.getUint8(this.#offset);
|
|
59
58
|
this.#offset++;
|
|
@@ -82,6 +81,12 @@ class BufferReader {
|
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
|
|
84
|
+
// packages/pgwasm/src/protocol/wire/types.ts
|
|
85
|
+
var Modes2 = {
|
|
86
|
+
text: 0,
|
|
87
|
+
binary: 1
|
|
88
|
+
};
|
|
89
|
+
|
|
85
90
|
// packages/pgwasm/src/protocol/wire/parser.ts
|
|
86
91
|
var CODE_LENGTH = 1;
|
|
87
92
|
var LEN_LENGTH = 4;
|
|
@@ -281,7 +286,7 @@ class Parser2 {
|
|
|
281
286
|
}
|
|
282
287
|
#parseParameterDescriptionMessage(offset, length, bytes) {
|
|
283
288
|
this.#setBuffer(offset, bytes);
|
|
284
|
-
const parameterCount = this.#reader.
|
|
289
|
+
const parameterCount = this.#reader.uint16();
|
|
285
290
|
const dataTypeIDs = [];
|
|
286
291
|
for (let i = 0;i < parameterCount; i++) {
|
|
287
292
|
dataTypeIDs.push(this.#reader.int32());
|
|
@@ -370,4 +375,4 @@ class Parser2 {
|
|
|
370
375
|
|
|
371
376
|
export { Modes2, Parser2 };
|
|
372
377
|
|
|
373
|
-
//# debugId=
|
|
378
|
+
//# debugId=7E57CFB46D6FFAF764756E2164756E21
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/protocol/wire/buffer-reader.ts", "../src/protocol/wire/types.ts", "../src/protocol/wire/parser.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"// Began as a copy of `@electric-sql/pg-protocol`, itself adapted from node-postgres' `pg-protocol`\n// (MIT, © Brian Carlson; ElectricSQL's changes taken under the PostgreSQL License — see NOTICE).\n// Owned outright (ADR-0062); compatibility with PGlite is an anti-goal — evolve freely.\n\nconst emptyBuffer = new ArrayBuffer(0);\n\n/** Big-endian reads over one backend message, advancing an offset. */\nexport class BufferReader {\n #bufferView: DataView = new DataView(emptyBuffer);\n #offset: number;\n readonly #decoder = new TextDecoder(\"utf-8\");\n\n constructor(offset = 0) {\n this.#offset = offset;\n }\n\n setBuffer(offset: number, buffer: ArrayBufferLike): void {\n this.#offset = offset;\n this.#bufferView = new DataView(buffer);\n }\n\n int16(): number {\n const result = this.#bufferView.getInt16(this.#offset, false);\n this.#offset += 2;\n return result;\n }\n\n uint16(): number {\n const result = this.#bufferView.getUint16(this.#offset, false);\n this.#offset += 2;\n return result;\n }\n\n byte(): number {\n const result = this.#bufferView.getUint8(this.#offset);\n this.#offset++;\n return result;\n }\n\n int32(): number {\n const result = this.#bufferView.getInt32(this.#offset, false);\n this.#offset += 4;\n return result;\n }\n\n string(length: number): string {\n return this.#decoder.decode(this.bytes(length));\n }\n\n cstring(): string {\n const start = this.#offset;\n let end = start;\n while (this.#bufferView.getUint8(end++) !== 0) {\n // advance to the terminator\n }\n const result = this.string(end - start - 1);\n this.#offset = end;\n return result;\n }\n\n bytes(length: number): Uint8Array {\n const result = this.#bufferView.buffer.slice(this.#offset, this.#offset + length);\n this.#offset += length;\n return new Uint8Array(result);\n }\n}\n",
|
|
6
|
+
"// Began as a copy of `@electric-sql/pg-protocol`, itself adapted from node-postgres' `pg-protocol`\n// (MIT, © Brian Carlson; ElectricSQL's changes taken under the PostgreSQL License — see NOTICE).\n// Owned outright (ADR-0062); compatibility with PGlite is an anti-goal — evolve freely.\n\nexport const Modes = {\n text: 0,\n binary: 1,\n} as const;\n\nexport type Mode = (typeof Modes)[keyof typeof Modes];\n\nexport type BufferParameter = ArrayBuffer | ArrayBufferView;\n",
|
|
7
|
+
"// Began as a copy of `@electric-sql/pg-protocol`, itself adapted from node-postgres' `pg-protocol`\n// (MIT, © Brian Carlson; ElectricSQL's changes taken under the PostgreSQL License — see NOTICE).\n// Owned outright (ADR-0062); compatibility with PGlite is an anti-goal — evolve freely.\n\nimport { BufferReader } from \"./buffer-reader\";\nimport {\n AuthenticationCleartextPassword,\n AuthenticationMD5Password,\n AuthenticationOk,\n AuthenticationSASL,\n AuthenticationSASLContinue,\n AuthenticationSASLFinal,\n BackendKeyDataMessage,\n bindComplete,\n closeComplete,\n CommandCompleteMessage,\n CopyDataMessage,\n copyDone,\n CopyResponse,\n DatabaseError,\n DataRowMessage,\n emptyQuery,\n Field,\n noData,\n NoticeMessage,\n NotificationResponseMessage,\n ParameterDescriptionMessage,\n ParameterStatusMessage,\n parseComplete,\n portalSuspended,\n ReadyForQueryMessage,\n replicationStart,\n RowDescriptionMessage,\n type AuthenticationMessage,\n type BackendMessage,\n type MessageName,\n} from \"./messages\";\nimport { Modes, type BufferParameter } from \"./types\";\n\n// Every message starts with one type byte and an int32 length that counts itself but not the type.\nconst CODE_LENGTH = 1;\nconst LEN_LENGTH = 4;\nconst HEADER_LENGTH = CODE_LENGTH + LEN_LENGTH;\n\nconst emptyBuffer = new ArrayBuffer(0);\n\nconst MessageCodes = {\n DataRow: 0x44, // D\n ParseComplete: 0x31, // 1\n BindComplete: 0x32, // 2\n CloseComplete: 0x33, // 3\n CommandComplete: 0x43, // C\n ReadyForQuery: 0x5a, // Z\n NoData: 0x6e, // n\n NotificationResponse: 0x41, // A\n AuthenticationResponse: 0x52, // R\n ParameterStatus: 0x53, // S\n BackendKeyData: 0x4b, // K\n ErrorMessage: 0x45, // E\n NoticeMessage: 0x4e, // N\n RowDescriptionMessage: 0x54, // T\n ParameterDescriptionMessage: 0x74, // t\n PortalSuspended: 0x73, // s\n ReplicationStart: 0x57, // W\n EmptyQuery: 0x49, // I\n CopyIn: 0x47, // G\n CopyOut: 0x48, // H\n CopyDone: 0x63, // c\n CopyData: 0x64, // d\n} as const;\n\nexport type MessageCallback = (msg: BackendMessage) => void;\n\n/**\n * Parses backend messages out of a byte stream that may arrive in arbitrary chunks: a message split\n * across calls is buffered until the rest arrives.\n */\nexport class Parser {\n #bufferView: DataView = new DataView(emptyBuffer);\n #bufferRemainingLength = 0;\n #bufferOffset = 0;\n readonly #reader = new BufferReader();\n\n parse(buffer: BufferParameter, callback: MessageCallback): void {\n this.#mergeBuffer(\n ArrayBuffer.isView(buffer)\n ? buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength)\n : buffer,\n );\n const bufferFullLength = this.#bufferOffset + this.#bufferRemainingLength;\n let offset = this.#bufferOffset;\n while (offset + HEADER_LENGTH <= bufferFullLength) {\n const code = this.#bufferView.getUint8(offset);\n const length = this.#bufferView.getUint32(offset + CODE_LENGTH, false);\n const fullMessageLength = CODE_LENGTH + length;\n if (fullMessageLength + offset <= bufferFullLength && length > 0) {\n let message: BackendMessage;\n try {\n message = this.#handlePacket(offset + HEADER_LENGTH, code, length, this.#bufferView.buffer);\n } catch (error) {\n this.#resetBuffer();\n throw error;\n }\n callback(message);\n offset += fullMessageLength;\n } else {\n break;\n }\n }\n if (offset === bufferFullLength) {\n this.#resetBuffer();\n } else {\n this.#bufferRemainingLength = bufferFullLength - offset;\n this.#bufferOffset = offset;\n }\n }\n\n #resetBuffer(): void {\n this.#bufferView = new DataView(emptyBuffer);\n this.#bufferRemainingLength = 0;\n this.#bufferOffset = 0;\n }\n\n #mergeBuffer(buffer: ArrayBufferLike): void {\n if (this.#bufferRemainingLength > 0) {\n const newLength = this.#bufferRemainingLength + buffer.byteLength;\n const newFullLength = newLength + this.#bufferOffset;\n if (newFullLength > this.#bufferView.byteLength) {\n let newBuffer: ArrayBufferLike;\n if (newLength <= this.#bufferView.byteLength && this.#bufferOffset >= this.#bufferRemainingLength) {\n // Move the pending bytes to the front instead of allocating.\n newBuffer = this.#bufferView.buffer;\n } else {\n let newBufferLength = this.#bufferView.byteLength * 2;\n while (newLength >= newBufferLength) {\n newBufferLength *= 2;\n }\n newBuffer = new ArrayBuffer(newBufferLength);\n }\n new Uint8Array(newBuffer).set(\n new Uint8Array(this.#bufferView.buffer, this.#bufferOffset, this.#bufferRemainingLength),\n );\n this.#bufferView = new DataView(newBuffer);\n this.#bufferOffset = 0;\n }\n new Uint8Array(this.#bufferView.buffer).set(\n new Uint8Array(buffer),\n this.#bufferOffset + this.#bufferRemainingLength,\n );\n this.#bufferRemainingLength = newLength;\n } else {\n this.#bufferView = new DataView(buffer);\n this.#bufferOffset = 0;\n this.#bufferRemainingLength = buffer.byteLength;\n }\n }\n\n #handlePacket(offset: number, code: number, length: number, bytes: ArrayBufferLike): BackendMessage {\n switch (code) {\n case MessageCodes.BindComplete:\n return bindComplete;\n case MessageCodes.ParseComplete:\n return parseComplete;\n case MessageCodes.CloseComplete:\n return closeComplete;\n case MessageCodes.NoData:\n return noData;\n case MessageCodes.PortalSuspended:\n return portalSuspended;\n case MessageCodes.CopyDone:\n return copyDone;\n case MessageCodes.ReplicationStart:\n return replicationStart;\n case MessageCodes.EmptyQuery:\n return emptyQuery;\n case MessageCodes.DataRow:\n return this.#parseDataRowMessage(offset, length, bytes);\n case MessageCodes.CommandComplete:\n return this.#parseCommandCompleteMessage(offset, length, bytes);\n case MessageCodes.ReadyForQuery:\n return this.#parseReadyForQueryMessage(offset, length, bytes);\n case MessageCodes.NotificationResponse:\n return this.#parseNotificationMessage(offset, length, bytes);\n case MessageCodes.AuthenticationResponse:\n return this.#parseAuthenticationResponse(offset, length, bytes);\n case MessageCodes.ParameterStatus:\n return this.#parseParameterStatusMessage(offset, length, bytes);\n case MessageCodes.BackendKeyData:\n return this.#parseBackendKeyData(offset, length, bytes);\n case MessageCodes.ErrorMessage:\n return this.#parseErrorMessage(offset, length, bytes, \"error\");\n case MessageCodes.NoticeMessage:\n return this.#parseErrorMessage(offset, length, bytes, \"notice\");\n case MessageCodes.RowDescriptionMessage:\n return this.#parseRowDescriptionMessage(offset, length, bytes);\n case MessageCodes.ParameterDescriptionMessage:\n return this.#parseParameterDescriptionMessage(offset, length, bytes);\n case MessageCodes.CopyIn:\n return this.#parseCopyMessage(offset, length, bytes, \"copyInResponse\");\n case MessageCodes.CopyOut:\n return this.#parseCopyMessage(offset, length, bytes, \"copyOutResponse\");\n case MessageCodes.CopyData:\n return this.#parseCopyData(offset, length, bytes);\n default:\n return new DatabaseError(`received invalid response: ${code.toString(16)}`, length, \"error\");\n }\n }\n\n #setBuffer(offset: number, bytes: ArrayBufferLike): void {\n this.#reader.setBuffer(offset, bytes);\n }\n\n #parseReadyForQueryMessage(offset: number, length: number, bytes: ArrayBufferLike): ReadyForQueryMessage {\n this.#setBuffer(offset, bytes);\n return new ReadyForQueryMessage(length, this.#reader.string(1));\n }\n\n #parseCommandCompleteMessage(offset: number, length: number, bytes: ArrayBufferLike): CommandCompleteMessage {\n this.#setBuffer(offset, bytes);\n return new CommandCompleteMessage(length, this.#reader.cstring());\n }\n\n #parseCopyData(offset: number, length: number, bytes: ArrayBufferLike): CopyDataMessage {\n const chunk = bytes.slice(offset, offset + (length - 4));\n return new CopyDataMessage(length, new Uint8Array(chunk));\n }\n\n #parseCopyMessage(offset: number, length: number, bytes: ArrayBufferLike, messageName: MessageName): CopyResponse {\n this.#setBuffer(offset, bytes);\n const isBinary = this.#reader.byte() !== 0;\n const columnCount = this.#reader.int16();\n const message = new CopyResponse(length, messageName, isBinary, columnCount);\n for (let i = 0; i < columnCount; i++) {\n message.columnTypes[i] = this.#reader.int16();\n }\n return message;\n }\n\n #parseNotificationMessage(offset: number, length: number, bytes: ArrayBufferLike): NotificationResponseMessage {\n this.#setBuffer(offset, bytes);\n const processId = this.#reader.int32();\n const channel = this.#reader.cstring();\n const payload = this.#reader.cstring();\n return new NotificationResponseMessage(length, processId, channel, payload);\n }\n\n #parseRowDescriptionMessage(offset: number, length: number, bytes: ArrayBufferLike): RowDescriptionMessage {\n this.#setBuffer(offset, bytes);\n const fieldCount = this.#reader.int16();\n const fields: Field[] = [];\n for (let i = 0; i < fieldCount; i++) {\n fields.push(this.#parseField());\n }\n return new RowDescriptionMessage(length, fields);\n }\n\n #parseField(): Field {\n const name = this.#reader.cstring();\n const tableID = this.#reader.int32();\n const columnID = this.#reader.int16();\n const dataTypeID = this.#reader.int32();\n const dataTypeSize = this.#reader.int16();\n const dataTypeModifier = this.#reader.int32();\n const mode = this.#reader.int16() === 0 ? Modes.text : Modes.binary;\n return new Field(name, tableID, columnID, dataTypeID, dataTypeSize, dataTypeModifier, mode);\n }\n\n #parseParameterDescriptionMessage(\n offset: number,\n length: number,\n bytes: ArrayBufferLike,\n ): ParameterDescriptionMessage {\n this.#setBuffer(offset, bytes);\n const parameterCount = this.#reader.uint16();\n const dataTypeIDs: number[] = [];\n for (let i = 0; i < parameterCount; i++) {\n dataTypeIDs.push(this.#reader.int32());\n }\n return new ParameterDescriptionMessage(length, dataTypeIDs);\n }\n\n #parseDataRowMessage(offset: number, length: number, bytes: ArrayBufferLike): DataRowMessage {\n this.#setBuffer(offset, bytes);\n const fieldCount = this.#reader.int16();\n const fields: (string | null)[] = [];\n for (let i = 0; i < fieldCount; i++) {\n const len = this.#reader.int32();\n // A length of -1 is SQL NULL.\n fields.push(len === -1 ? null : this.#reader.string(len));\n }\n return new DataRowMessage(length, fields);\n }\n\n #parseParameterStatusMessage(offset: number, length: number, bytes: ArrayBufferLike): ParameterStatusMessage {\n this.#setBuffer(offset, bytes);\n const name = this.#reader.cstring();\n const value = this.#reader.cstring();\n return new ParameterStatusMessage(length, name, value);\n }\n\n #parseBackendKeyData(offset: number, length: number, bytes: ArrayBufferLike): BackendKeyDataMessage {\n this.#setBuffer(offset, bytes);\n const processID = this.#reader.int32();\n const secretKey = this.#reader.int32();\n return new BackendKeyDataMessage(length, processID, secretKey);\n }\n\n #parseAuthenticationResponse(offset: number, length: number, bytes: ArrayBufferLike): AuthenticationMessage {\n this.#setBuffer(offset, bytes);\n const code = this.#reader.int32();\n switch (code) {\n case 0:\n return new AuthenticationOk(length);\n case 3:\n return new AuthenticationCleartextPassword(length);\n case 5:\n return new AuthenticationMD5Password(length, this.#reader.bytes(4));\n case 10: {\n const mechanisms: string[] = [];\n for (;;) {\n const mechanism = this.#reader.cstring();\n if (mechanism.length === 0) {\n return new AuthenticationSASL(length, mechanisms);\n }\n mechanisms.push(mechanism);\n }\n }\n case 11:\n return new AuthenticationSASLContinue(length, this.#reader.string(length - 8));\n case 12:\n return new AuthenticationSASLFinal(length, this.#reader.string(length - 8));\n default:\n throw new Error(`Unknown authenticationOk message type ${code}`);\n }\n }\n\n #parseErrorMessage(\n offset: number,\n length: number,\n bytes: ArrayBufferLike,\n name: MessageName,\n ): DatabaseError | NoticeMessage {\n this.#setBuffer(offset, bytes);\n const fields: Record<string, string> = {};\n let fieldType = this.#reader.string(1);\n while (fieldType !== \"\\0\") {\n fields[fieldType] = this.#reader.cstring();\n fieldType = this.#reader.string(1);\n }\n\n const messageValue = fields[\"M\"];\n const message =\n name === \"notice\" ? new NoticeMessage(length, messageValue) : new DatabaseError(messageValue ?? \"\", length, name);\n\n message.severity = fields[\"S\"];\n message.code = fields[\"C\"];\n message.detail = fields[\"D\"];\n message.hint = fields[\"H\"];\n message.position = fields[\"P\"];\n message.internalPosition = fields[\"p\"];\n message.internalQuery = fields[\"q\"];\n message.where = fields[\"W\"];\n message.schema = fields[\"s\"];\n message.table = fields[\"t\"];\n message.column = fields[\"c\"];\n message.dataType = fields[\"d\"];\n message.constraint = fields[\"n\"];\n message.file = fields[\"F\"];\n message.line = fields[\"L\"];\n message.routine = fields[\"R\"];\n return message;\n }\n}\n"
|
|
8
|
+
],
|
|
9
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAM,cAAc,IAAI,YAAY,CAAC;AAAA;AAG9B,MAAM,aAAa;AAAA,EACxB,cAAwB,IAAI,SAAS,WAAW;AAAA,EAChD;AAAA,EACS,WAAW,IAAI,YAAY,OAAO;AAAA,EAE3C,WAAW,CAAC,SAAS,GAAG;AAAA,IACtB,KAAK,UAAU;AAAA;AAAA,EAGjB,SAAS,CAAC,QAAgB,QAA+B;AAAA,IACvD,KAAK,UAAU;AAAA,IACf,KAAK,cAAc,IAAI,SAAS,MAAM;AAAA;AAAA,EAGxC,KAAK,GAAW;AAAA,IACd,MAAM,SAAS,KAAK,YAAY,SAAS,KAAK,SAAS,KAAK;AAAA,IAC5D,KAAK,WAAW;AAAA,IAChB,OAAO;AAAA;AAAA,EAGT,MAAM,GAAW;AAAA,IACf,MAAM,SAAS,KAAK,YAAY,UAAU,KAAK,SAAS,KAAK;AAAA,IAC7D,KAAK,WAAW;AAAA,IAChB,OAAO;AAAA;AAAA,EAGT,IAAI,GAAW;AAAA,IACb,MAAM,SAAS,KAAK,YAAY,SAAS,KAAK,OAAO;AAAA,IACrD,KAAK;AAAA,IACL,OAAO;AA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AQ,WAAW,OAAO;AAAA,IAC1B,QAAQ,aAAa,OAAO;AAAA,IAC5B,QAAQ,OAAO,OAAO;AAAA,IACtB,QAAQ,OAAO,OAAO;AAAA,IACtB,QAAQ,UAAU,OAAO;AAAA,IACzB,OAAO;AAAA;AAEX;",
|
|
10
|
+
"debugId": "7E57CFB46D6FFAF764756E2164756E21",
|
|
11
|
+
"names": []
|
|
12
|
+
}
|
|
@@ -337,6 +337,12 @@ class Writer {
|
|
|
337
337
|
this.#offset += 2;
|
|
338
338
|
return this;
|
|
339
339
|
}
|
|
340
|
+
addUint16(num) {
|
|
341
|
+
this.#ensure(2);
|
|
342
|
+
this.#bufferView.setUint16(this.#offset, num, false);
|
|
343
|
+
this.#offset += 2;
|
|
344
|
+
return this;
|
|
345
|
+
}
|
|
340
346
|
addCString(string) {
|
|
341
347
|
if (string) {
|
|
342
348
|
this.addString(string);
|
|
@@ -423,12 +429,19 @@ function query(text) {
|
|
|
423
429
|
return writer.addCString(text).flush(code.query);
|
|
424
430
|
}
|
|
425
431
|
var emptyValueArray = [];
|
|
432
|
+
function assertParameterCount(count) {
|
|
433
|
+
if (count > 65535) {
|
|
434
|
+
throw new RangeError(`Postgres messages support at most 65535 parameters (received ${count})`);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
426
437
|
function parse(opts) {
|
|
427
438
|
const name = opts.name ?? "";
|
|
428
439
|
if (name.length > 63) {
|
|
429
440
|
throw new RangeError(`Postgres statement names are at most 63 characters: "${name}" (${name.length})`);
|
|
430
441
|
}
|
|
431
|
-
const
|
|
442
|
+
const typeCount = opts.types?.length ?? 0;
|
|
443
|
+
assertParameterCount(typeCount);
|
|
444
|
+
const buffer = writer.addCString(name).addCString(opts.text).addUint16(typeCount);
|
|
432
445
|
opts.types?.forEach((type) => buffer.addInt32(type));
|
|
433
446
|
return writer.flush(code.parse);
|
|
434
447
|
}
|
|
@@ -459,10 +472,11 @@ function bind(config = {}) {
|
|
|
459
472
|
const binary = config.binary ?? false;
|
|
460
473
|
const values = config.values ?? emptyValueArray;
|
|
461
474
|
const len = values.length;
|
|
475
|
+
assertParameterCount(len);
|
|
462
476
|
writer.addCString(portal).addCString(statement);
|
|
463
|
-
writer.
|
|
477
|
+
writer.addUint16(len);
|
|
464
478
|
writeValues(values, config.valueMapper);
|
|
465
|
-
writer.
|
|
479
|
+
writer.addUint16(len);
|
|
466
480
|
writer.add(paramWriter.flush());
|
|
467
481
|
writer.addInt16(binary ? ParamType.BINARY : ParamType.STRING);
|
|
468
482
|
return writer.flush(code.bind);
|
|
@@ -560,4 +574,4 @@ function strictSyncOf(pg) {
|
|
|
560
574
|
|
|
561
575
|
export { parseComplete, bindComplete, closeComplete, noData, portalSuspended, replicationStart, emptyQuery, copyDone, AuthenticationOk, AuthenticationCleartextPassword, AuthenticationMD5Password, AuthenticationSASL, AuthenticationSASLContinue, AuthenticationSASLFinal, DatabaseError2, CopyDataMessage, CopyResponse, Field, RowDescriptionMessage, ParameterDescriptionMessage, ParameterStatusMessage, BackendKeyDataMessage, NotificationResponseMessage, ReadyForQueryMessage, CommandCompleteMessage, DataRowMessage, NoticeMessage, exports_messages, serialize2, registerProtocolAccess, protocolAccessOf, registerStrictSync, strictSyncOf };
|
|
562
576
|
|
|
563
|
-
//# debugId=
|
|
577
|
+
//# debugId=0D8676B0FD22483564756E2164756E21
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"// Began as a copy of `@electric-sql/pg-protocol`, itself adapted from node-postgres' `pg-protocol`\n// (MIT, © Brian Carlson; ElectricSQL's changes taken under the PostgreSQL License — see NOTICE).\n// Owned outright (ADR-0062); compatibility with PGlite is an anti-goal — evolve freely.\n\nimport type { Mode } from \"./types\";\n\nexport type MessageName =\n | \"parseComplete\"\n | \"bindComplete\"\n | \"closeComplete\"\n | \"noData\"\n | \"portalSuspended\"\n | \"replicationStart\"\n | \"emptyQuery\"\n | \"copyDone\"\n | \"copyData\"\n | \"rowDescription\"\n | \"parameterDescription\"\n | \"parameterStatus\"\n | \"backendKeyData\"\n | \"notification\"\n | \"readyForQuery\"\n | \"commandComplete\"\n | \"dataRow\"\n | \"copyInResponse\"\n | \"copyOutResponse\"\n | \"authenticationOk\"\n | \"authenticationMD5Password\"\n | \"authenticationCleartextPassword\"\n | \"authenticationSASL\"\n | \"authenticationSASLContinue\"\n | \"authenticationSASLFinal\"\n | \"error\"\n | \"notice\";\n\n/** Every backend message: its name and the length its header declared (excluding the type byte). */\nexport interface BackendMessage {\n readonly name: MessageName;\n readonly length: number;\n}\n\nexport const parseComplete: BackendMessage = { name: \"parseComplete\", length: 5 };\nexport const bindComplete: BackendMessage = { name: \"bindComplete\", length: 5 };\nexport const closeComplete: BackendMessage = { name: \"closeComplete\", length: 5 };\nexport const noData: BackendMessage = { name: \"noData\", length: 5 };\nexport const portalSuspended: BackendMessage = { name: \"portalSuspended\", length: 5 };\nexport const replicationStart: BackendMessage = { name: \"replicationStart\", length: 4 };\nexport const emptyQuery: BackendMessage = { name: \"emptyQuery\", length: 4 };\nexport const copyDone: BackendMessage = { name: \"copyDone\", length: 4 };\n\nexport class AuthenticationOk implements BackendMessage {\n readonly name = \"authenticationOk\";\n readonly length: number;\n constructor(length: number) {\n this.length = length;\n }\n}\n\nexport class AuthenticationCleartextPassword implements BackendMessage {\n readonly name = \"authenticationCleartextPassword\";\n readonly length: number;\n constructor(length: number) {\n this.length = length;\n }\n}\n\nexport class AuthenticationMD5Password implements BackendMessage {\n readonly name = \"authenticationMD5Password\";\n readonly length: number;\n readonly salt: Uint8Array;\n constructor(length: number, salt: Uint8Array) {\n this.length = length;\n this.salt = salt;\n }\n}\n\nexport class AuthenticationSASL implements BackendMessage {\n readonly name = \"authenticationSASL\";\n readonly length: number;\n readonly mechanisms: string[];\n constructor(length: number, mechanisms: string[]) {\n this.length = length;\n this.mechanisms = mechanisms;\n }\n}\n\nexport class AuthenticationSASLContinue implements BackendMessage {\n readonly name = \"authenticationSASLContinue\";\n readonly length: number;\n readonly data: string;\n constructor(length: number, data: string) {\n this.length = length;\n this.data = data;\n }\n}\n\nexport class AuthenticationSASLFinal implements BackendMessage {\n readonly name = \"authenticationSASLFinal\";\n readonly length: number;\n readonly data: string;\n constructor(length: number, data: string) {\n this.length = length;\n this.data = data;\n }\n}\n\nexport type AuthenticationMessage =\n | AuthenticationOk\n | AuthenticationCleartextPassword\n | AuthenticationMD5Password\n | AuthenticationSASL\n | AuthenticationSASLContinue\n | AuthenticationSASLFinal;\n\n/** The fields an ErrorResponse and a NoticeResponse share. */\nexport interface NoticeOrError {\n message: string | undefined;\n severity: string | undefined;\n code: string | undefined;\n detail: string | undefined;\n hint: string | undefined;\n position: string | undefined;\n internalPosition: string | undefined;\n internalQuery: string | undefined;\n where: string | undefined;\n schema: string | undefined;\n table: string | undefined;\n column: string | undefined;\n dataType: string | undefined;\n constraint: string | undefined;\n file: string | undefined;\n line: string | undefined;\n routine: string | undefined;\n}\n\n/** An ErrorResponse from Postgres: an SQL error. `code` is the SQLSTATE. */\nexport class DatabaseError extends Error implements NoticeOrError {\n severity: string | undefined;\n code: string | undefined;\n detail: string | undefined;\n hint: string | undefined;\n position: string | undefined;\n internalPosition: string | undefined;\n internalQuery: string | undefined;\n where: string | undefined;\n schema: string | undefined;\n table: string | undefined;\n column: string | undefined;\n dataType: string | undefined;\n constraint: string | undefined;\n file: string | undefined;\n line: string | undefined;\n routine: string | undefined;\n readonly length: number;\n override readonly name: MessageName;\n constructor(message: string, length: number, name: MessageName) {\n super(message);\n this.length = length;\n this.name = name;\n }\n}\n\nexport class CopyDataMessage implements BackendMessage {\n readonly name = \"copyData\";\n readonly length: number;\n readonly chunk: Uint8Array;\n constructor(length: number, chunk: Uint8Array) {\n this.length = length;\n this.chunk = chunk;\n }\n}\n\nexport class CopyResponse implements BackendMessage {\n readonly length: number;\n readonly name: MessageName;\n readonly binary: boolean;\n readonly columnTypes: number[];\n constructor(length: number, name: MessageName, binary: boolean, columnCount: number) {\n this.length = length;\n this.name = name;\n this.binary = binary;\n this.columnTypes = Array.from({ length: columnCount }, () => 0);\n }\n}\n\nexport class Field {\n readonly name: string;\n readonly tableID: number;\n readonly columnID: number;\n readonly dataTypeID: number;\n readonly dataTypeSize: number;\n readonly dataTypeModifier: number;\n readonly format: Mode;\n constructor(\n name: string,\n tableID: number,\n columnID: number,\n dataTypeID: number,\n dataTypeSize: number,\n dataTypeModifier: number,\n format: Mode,\n ) {\n this.name = name;\n this.tableID = tableID;\n this.columnID = columnID;\n this.dataTypeID = dataTypeID;\n this.dataTypeSize = dataTypeSize;\n this.dataTypeModifier = dataTypeModifier;\n this.format = format;\n }\n}\n\nexport class RowDescriptionMessage implements BackendMessage {\n readonly name: MessageName = \"rowDescription\";\n readonly length: number;\n readonly fieldCount: number;\n readonly fields: Field[];\n constructor(length: number, fields: Field[]) {\n this.length = length;\n this.fieldCount = fields.length;\n this.fields = fields;\n }\n}\n\nexport class ParameterDescriptionMessage implements BackendMessage {\n readonly name: MessageName = \"parameterDescription\";\n readonly length: number;\n readonly parameterCount: number;\n readonly dataTypeIDs: number[];\n constructor(length: number, dataTypeIDs: number[]) {\n this.length = length;\n this.parameterCount = dataTypeIDs.length;\n this.dataTypeIDs = dataTypeIDs;\n }\n}\n\nexport class ParameterStatusMessage implements BackendMessage {\n readonly name: MessageName = \"parameterStatus\";\n readonly length: number;\n readonly parameterName: string;\n readonly parameterValue: string;\n constructor(length: number, parameterName: string, parameterValue: string) {\n this.length = length;\n this.parameterName = parameterName;\n this.parameterValue = parameterValue;\n }\n}\n\nexport class BackendKeyDataMessage implements BackendMessage {\n readonly name: MessageName = \"backendKeyData\";\n readonly length: number;\n readonly processID: number;\n readonly secretKey: number;\n constructor(length: number, processID: number, secretKey: number) {\n this.length = length;\n this.processID = processID;\n this.secretKey = secretKey;\n }\n}\n\nexport class NotificationResponseMessage implements BackendMessage {\n readonly name: MessageName = \"notification\";\n readonly length: number;\n readonly processId: number;\n readonly channel: string;\n readonly payload: string;\n constructor(length: number, processId: number, channel: string, payload: string) {\n this.length = length;\n this.processId = processId;\n this.channel = channel;\n this.payload = payload;\n }\n}\n\nexport class ReadyForQueryMessage implements BackendMessage {\n readonly name: MessageName = \"readyForQuery\";\n readonly length: number;\n /** `I` idle, `T` in a transaction block, `E` in a failed transaction block. */\n readonly status: string;\n constructor(length: number, status: string) {\n this.length = length;\n this.status = status;\n }\n}\n\nexport class CommandCompleteMessage implements BackendMessage {\n readonly name: MessageName = \"commandComplete\";\n readonly length: number;\n readonly text: string;\n constructor(length: number, text: string) {\n this.length = length;\n this.text = text;\n }\n}\n\nexport class DataRowMessage implements BackendMessage {\n readonly name: MessageName = \"dataRow\";\n readonly length: number;\n readonly fieldCount: number;\n readonly fields: (string | null)[];\n constructor(length: number, fields: (string | null)[]) {\n this.length = length;\n this.fields = fields;\n this.fieldCount = fields.length;\n }\n}\n\nexport class NoticeMessage implements BackendMessage, NoticeOrError {\n readonly name = \"notice\";\n readonly length: number;\n readonly message: string | undefined;\n severity: string | undefined;\n code: string | undefined;\n detail: string | undefined;\n hint: string | undefined;\n position: string | undefined;\n internalPosition: string | undefined;\n internalQuery: string | undefined;\n where: string | undefined;\n schema: string | undefined;\n table: string | undefined;\n column: string | undefined;\n dataType: string | undefined;\n constraint: string | undefined;\n file: string | undefined;\n line: string | undefined;\n routine: string | undefined;\n constructor(length: number, message: string | undefined) {\n this.length = length;\n this.message = message;\n }\n}\n",
|
|
6
6
|
"// Began as a copy of `@electric-sql/pg-protocol`, itself adapted from node-postgres' `pg-protocol`\n// (MIT, © Brian Carlson; ElectricSQL's changes taken under the PostgreSQL License — see NOTICE).\n// Owned outright (ADR-0062); compatibility with PGlite is an anti-goal — evolve freely.\n\n/**\n * The byte length of a string once UTF-8 encoded.\n * Adapted from https://stackoverflow.com/a/23329386\n */\nexport function byteLengthUtf8(str: string): number {\n let byteLength = str.length;\n for (let i = str.length - 1; i >= 0; i--) {\n const code = str.charCodeAt(i);\n if (code > 0x7f && code <= 0x7ff) byteLength++;\n else if (code > 0x7ff && code <= 0xffff) byteLength += 2;\n if (code >= 0xdc00 && code <= 0xdfff) i--; // trail surrogate\n }\n return byteLength;\n}\n",
|
|
7
|
-
"// Began as a copy of `@electric-sql/pg-protocol`, itself adapted from node-postgres' `pg-protocol`\n// (MIT, © Brian Carlson; ElectricSQL's changes taken under the PostgreSQL License — see NOTICE).\n// Owned outright (ADR-0062); compatibility with PGlite is an anti-goal — evolve freely.\n\nimport { byteLengthUtf8 } from \"./string-utils\";\n\n/** Builds frontend messages: a 5-byte header slot (code + length) followed by the body. */\nexport class Writer {\n readonly #size: number;\n #bufferView: DataView<ArrayBuffer>;\n #offset = 5;\n readonly #encoder = new TextEncoder();\n readonly #headerPosition = 0;\n\n constructor(size = 256) {\n this.#size = size;\n this.#bufferView = this.#allocateBuffer(size);\n }\n\n #allocateBuffer(size: number): DataView<ArrayBuffer> {\n return new DataView(new ArrayBuffer(size));\n }\n\n #ensure(size: number): void {\n const remaining = this.#bufferView.byteLength - this.#offset;\n if (remaining < size) {\n const oldBuffer = this.#bufferView.buffer;\n // Grow by ~1.5x (https://stackoverflow.com/questions/2269063/buffer-growth-strategy).\n const newSize = oldBuffer.byteLength + (oldBuffer.byteLength >> 1) + size;\n this.#bufferView = this.#allocateBuffer(newSize);\n new Uint8Array(this.#bufferView.buffer).set(new Uint8Array(oldBuffer));\n }\n }\n\n addInt32(num: number): Writer {\n this.#ensure(4);\n this.#bufferView.setInt32(this.#offset, num, false);\n this.#offset += 4;\n return this;\n }\n\n addInt16(num: number): Writer {\n this.#ensure(2);\n this.#bufferView.setInt16(this.#offset, num, false);\n this.#offset += 2;\n return this;\n }\n\n addCString(string: string): Writer {\n if (string) {\n this.addString(string);\n }\n this.#ensure(1);\n this.#bufferView.setUint8(this.#offset, 0);\n this.#offset++;\n return this;\n }\n\n addString(string = \"\"): Writer {\n const length = byteLengthUtf8(string);\n this.#ensure(length);\n this.#encoder.encodeInto(string, new Uint8Array(this.#bufferView.buffer, this.#offset));\n this.#offset += length;\n return this;\n }\n\n add(otherBuffer: ArrayBuffer | ArrayBufferView): Writer {\n const bytes = ArrayBuffer.isView(otherBuffer)\n ? new Uint8Array(otherBuffer.buffer, otherBuffer.byteOffset, otherBuffer.byteLength)\n : new Uint8Array(otherBuffer);\n this.#ensure(bytes.byteLength);\n new Uint8Array(this.#bufferView.buffer).set(bytes, this.#offset);\n this.#offset += bytes.byteLength;\n return this;\n }\n\n #join(code?: number): ArrayBuffer {\n if (code) {\n this.#bufferView.setUint8(this.#headerPosition, code);\n // The length counts everything in the message but the code byte.\n const length = this.#offset - (this.#headerPosition + 1);\n this.#bufferView.setInt32(this.#headerPosition + 1, length, false);\n }\n return this.#bufferView.buffer.slice(code ? 0 : 5, this.#offset);\n }\n\n flush(code?: number): Uint8Array<ArrayBuffer> {\n const result = this.#join(code);\n this.#offset = 5;\n this.#bufferView = this.#allocateBuffer(this.#size);\n return new Uint8Array(result);\n }\n}\n",
|
|
8
|
-
"// Began as a copy of `@electric-sql/pg-protocol`, itself adapted from node-postgres' `pg-protocol`\n// (MIT, © Brian Carlson; ElectricSQL's changes taken under the PostgreSQL License — see NOTICE).\n// Owned outright (ADR-0062); compatibility with PGlite is an anti-goal — evolve freely.\n\nimport { Writer } from \"./buffer-writer\";\nimport { byteLengthUtf8 } from \"./string-utils\";\n\nconst code = {\n startup: 0x70,\n query: 0x51,\n parse: 0x50,\n bind: 0x42,\n execute: 0x45,\n flush: 0x48,\n sync: 0x53,\n end: 0x58,\n close: 0x43,\n describe: 0x44,\n copyFromChunk: 0x64,\n copyDone: 0x63,\n copyFail: 0x66,\n} as const;\n\ntype Code = (typeof code)[keyof typeof code];\n\n/** A bind parameter: text, raw bytes (sent as binary), or SQL NULL. */\nexport type LegalValue = string | ArrayBuffer | ArrayBufferView | null;\n\nconst writer = new Writer();\n\nfunction startup(opts: Record<string, string>): Uint8Array<ArrayBuffer> {\n // protocol version 3.0\n writer.addInt16(3).addInt16(0);\n for (const [key, value] of Object.entries(opts)) {\n writer.addCString(key).addCString(value);\n }\n writer.addCString(\"client_encoding\").addCString(\"UTF8\");\n // The startup message is sent without a type byte.\n const bodyBuffer = writer.addCString(\"\").flush();\n const length = bodyBuffer.byteLength + 4;\n return new Writer().addInt32(length).add(bodyBuffer).flush();\n}\n\nfunction requestSsl(): Uint8Array<ArrayBuffer> {\n const bufferView = new DataView(new ArrayBuffer(8));\n bufferView.setInt32(0, 8, false);\n bufferView.setInt32(4, 80877103, false);\n return new Uint8Array(bufferView.buffer);\n}\n\nfunction password(value: string): Uint8Array<ArrayBuffer> {\n return writer.addCString(value).flush(code.startup);\n}\n\nfunction sendSASLInitialResponseMessage(mechanism: string, initialResponse: string): Uint8Array<ArrayBuffer> {\n writer.addCString(mechanism).addInt32(byteLengthUtf8(initialResponse)).addString(initialResponse);\n return writer.flush(code.startup);\n}\n\nfunction sendSCRAMClientFinalMessage(additionalData: string): Uint8Array<ArrayBuffer> {\n return writer.addString(additionalData).flush(code.startup);\n}\n\nfunction query(text: string): Uint8Array<ArrayBuffer> {\n return writer.addCString(text).flush(code.query);\n}\n\nexport interface ParseOpts {\n name?: string;\n types?: readonly number[];\n text: string;\n}\n\nconst emptyValueArray: LegalValue[] = [];\n\nfunction parse(opts: ParseOpts): Uint8Array<ArrayBuffer> {\n const name = opts.name ?? \"\";\n if (name.length > 63) {\n throw new RangeError(`Postgres statement names are at most 63 characters: \"${name}\" (${name.length})`);\n }\n const buffer = writer
|
|
7
|
+
"// Began as a copy of `@electric-sql/pg-protocol`, itself adapted from node-postgres' `pg-protocol`\n// (MIT, © Brian Carlson; ElectricSQL's changes taken under the PostgreSQL License — see NOTICE).\n// Owned outright (ADR-0062); compatibility with PGlite is an anti-goal — evolve freely.\n\nimport { byteLengthUtf8 } from \"./string-utils\";\n\n/** Builds frontend messages: a 5-byte header slot (code + length) followed by the body. */\nexport class Writer {\n readonly #size: number;\n #bufferView: DataView<ArrayBuffer>;\n #offset = 5;\n readonly #encoder = new TextEncoder();\n readonly #headerPosition = 0;\n\n constructor(size = 256) {\n this.#size = size;\n this.#bufferView = this.#allocateBuffer(size);\n }\n\n #allocateBuffer(size: number): DataView<ArrayBuffer> {\n return new DataView(new ArrayBuffer(size));\n }\n\n #ensure(size: number): void {\n const remaining = this.#bufferView.byteLength - this.#offset;\n if (remaining < size) {\n const oldBuffer = this.#bufferView.buffer;\n // Grow by ~1.5x (https://stackoverflow.com/questions/2269063/buffer-growth-strategy).\n const newSize = oldBuffer.byteLength + (oldBuffer.byteLength >> 1) + size;\n this.#bufferView = this.#allocateBuffer(newSize);\n new Uint8Array(this.#bufferView.buffer).set(new Uint8Array(oldBuffer));\n }\n }\n\n addInt32(num: number): Writer {\n this.#ensure(4);\n this.#bufferView.setInt32(this.#offset, num, false);\n this.#offset += 4;\n return this;\n }\n\n addInt16(num: number): Writer {\n this.#ensure(2);\n this.#bufferView.setInt16(this.#offset, num, false);\n this.#offset += 2;\n return this;\n }\n\n addUint16(num: number): Writer {\n this.#ensure(2);\n this.#bufferView.setUint16(this.#offset, num, false);\n this.#offset += 2;\n return this;\n }\n\n addCString(string: string): Writer {\n if (string) {\n this.addString(string);\n }\n this.#ensure(1);\n this.#bufferView.setUint8(this.#offset, 0);\n this.#offset++;\n return this;\n }\n\n addString(string = \"\"): Writer {\n const length = byteLengthUtf8(string);\n this.#ensure(length);\n this.#encoder.encodeInto(string, new Uint8Array(this.#bufferView.buffer, this.#offset));\n this.#offset += length;\n return this;\n }\n\n add(otherBuffer: ArrayBuffer | ArrayBufferView): Writer {\n const bytes = ArrayBuffer.isView(otherBuffer)\n ? new Uint8Array(otherBuffer.buffer, otherBuffer.byteOffset, otherBuffer.byteLength)\n : new Uint8Array(otherBuffer);\n this.#ensure(bytes.byteLength);\n new Uint8Array(this.#bufferView.buffer).set(bytes, this.#offset);\n this.#offset += bytes.byteLength;\n return this;\n }\n\n #join(code?: number): ArrayBuffer {\n if (code) {\n this.#bufferView.setUint8(this.#headerPosition, code);\n // The length counts everything in the message but the code byte.\n const length = this.#offset - (this.#headerPosition + 1);\n this.#bufferView.setInt32(this.#headerPosition + 1, length, false);\n }\n return this.#bufferView.buffer.slice(code ? 0 : 5, this.#offset);\n }\n\n flush(code?: number): Uint8Array<ArrayBuffer> {\n const result = this.#join(code);\n this.#offset = 5;\n this.#bufferView = this.#allocateBuffer(this.#size);\n return new Uint8Array(result);\n }\n}\n",
|
|
8
|
+
"// Began as a copy of `@electric-sql/pg-protocol`, itself adapted from node-postgres' `pg-protocol`\n// (MIT, © Brian Carlson; ElectricSQL's changes taken under the PostgreSQL License — see NOTICE).\n// Owned outright (ADR-0062); compatibility with PGlite is an anti-goal — evolve freely.\n\nimport { Writer } from \"./buffer-writer\";\nimport { byteLengthUtf8 } from \"./string-utils\";\n\nconst code = {\n startup: 0x70,\n query: 0x51,\n parse: 0x50,\n bind: 0x42,\n execute: 0x45,\n flush: 0x48,\n sync: 0x53,\n end: 0x58,\n close: 0x43,\n describe: 0x44,\n copyFromChunk: 0x64,\n copyDone: 0x63,\n copyFail: 0x66,\n} as const;\n\ntype Code = (typeof code)[keyof typeof code];\n\n/** A bind parameter: text, raw bytes (sent as binary), or SQL NULL. */\nexport type LegalValue = string | ArrayBuffer | ArrayBufferView | null;\n\nconst writer = new Writer();\n\nfunction startup(opts: Record<string, string>): Uint8Array<ArrayBuffer> {\n // protocol version 3.0\n writer.addInt16(3).addInt16(0);\n for (const [key, value] of Object.entries(opts)) {\n writer.addCString(key).addCString(value);\n }\n writer.addCString(\"client_encoding\").addCString(\"UTF8\");\n // The startup message is sent without a type byte.\n const bodyBuffer = writer.addCString(\"\").flush();\n const length = bodyBuffer.byteLength + 4;\n return new Writer().addInt32(length).add(bodyBuffer).flush();\n}\n\nfunction requestSsl(): Uint8Array<ArrayBuffer> {\n const bufferView = new DataView(new ArrayBuffer(8));\n bufferView.setInt32(0, 8, false);\n bufferView.setInt32(4, 80877103, false);\n return new Uint8Array(bufferView.buffer);\n}\n\nfunction password(value: string): Uint8Array<ArrayBuffer> {\n return writer.addCString(value).flush(code.startup);\n}\n\nfunction sendSASLInitialResponseMessage(mechanism: string, initialResponse: string): Uint8Array<ArrayBuffer> {\n writer.addCString(mechanism).addInt32(byteLengthUtf8(initialResponse)).addString(initialResponse);\n return writer.flush(code.startup);\n}\n\nfunction sendSCRAMClientFinalMessage(additionalData: string): Uint8Array<ArrayBuffer> {\n return writer.addString(additionalData).flush(code.startup);\n}\n\nfunction query(text: string): Uint8Array<ArrayBuffer> {\n return writer.addCString(text).flush(code.query);\n}\n\nexport interface ParseOpts {\n name?: string;\n types?: readonly number[];\n text: string;\n}\n\nconst emptyValueArray: LegalValue[] = [];\n\nfunction assertParameterCount(count: number): void {\n if (count > 65_535) {\n throw new RangeError(`Postgres messages support at most 65535 parameters (received ${count})`);\n }\n}\n\nfunction parse(opts: ParseOpts): Uint8Array<ArrayBuffer> {\n const name = opts.name ?? \"\";\n if (name.length > 63) {\n throw new RangeError(`Postgres statement names are at most 63 characters: \"${name}\" (${name.length})`);\n }\n const typeCount = opts.types?.length ?? 0;\n assertParameterCount(typeCount);\n const buffer = writer.addCString(name).addCString(opts.text).addUint16(typeCount);\n opts.types?.forEach((type) => buffer.addInt32(type));\n return writer.flush(code.parse);\n}\n\ntype ValueMapper = (param: unknown, index: number) => LegalValue;\n\nexport interface BindOpts {\n portal?: string;\n binary?: boolean;\n statement?: string;\n values?: readonly LegalValue[];\n /** Optional map from a JS value to the value sent, per parameter. */\n valueMapper?: ValueMapper;\n}\n\nconst paramWriter = new Writer();\n\nconst ParamType = { STRING: 0, BINARY: 1 } as const;\n\nfunction writeValues(values: readonly LegalValue[], valueMapper?: ValueMapper): void {\n for (let i = 0; i < values.length; i++) {\n const value = values[i] ?? null;\n const mappedVal = valueMapper ? valueMapper(value, i) : value;\n if (mappedVal === null) {\n writer.addInt16(ParamType.STRING);\n // -1 is SQL NULL.\n paramWriter.addInt32(-1);\n } else if (mappedVal instanceof ArrayBuffer || ArrayBuffer.isView(mappedVal)) {\n const byteLength = mappedVal.byteLength;\n writer.addInt16(ParamType.BINARY);\n paramWriter.addInt32(byteLength);\n paramWriter.add(mappedVal);\n } else {\n writer.addInt16(ParamType.STRING);\n paramWriter.addInt32(byteLengthUtf8(mappedVal));\n paramWriter.addString(mappedVal);\n }\n }\n}\n\nfunction bind(config: BindOpts = {}): Uint8Array<ArrayBuffer> {\n const portal = config.portal ?? \"\";\n const statement = config.statement ?? \"\";\n const binary = config.binary ?? false;\n const values = config.values ?? emptyValueArray;\n const len = values.length;\n assertParameterCount(len);\n\n writer.addCString(portal).addCString(statement);\n writer.addUint16(len);\n writeValues(values, config.valueMapper);\n writer.addUint16(len);\n writer.add(paramWriter.flush());\n // result format code\n writer.addInt16(binary ? ParamType.BINARY : ParamType.STRING);\n return writer.flush(code.bind);\n}\n\nexport interface ExecOpts {\n portal?: string;\n rows?: number;\n}\n\nconst emptyExecute = new Uint8Array([code.execute, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00]);\n\nfunction execute(config?: ExecOpts): Uint8Array<ArrayBuffer> {\n if (!config || (!config.portal && !config.rows)) {\n return emptyExecute;\n }\n const portal = config.portal ?? \"\";\n const rows = config.rows ?? 0;\n const portalLength = byteLengthUtf8(portal);\n const len = 4 + portalLength + 1 + 4;\n const bufferView = new DataView(new ArrayBuffer(1 + len));\n bufferView.setUint8(0, code.execute);\n bufferView.setInt32(1, len, false);\n new TextEncoder().encodeInto(portal, new Uint8Array(bufferView.buffer, 5));\n bufferView.setUint8(portalLength + 5, 0); // the portal name's terminator\n bufferView.setUint32(bufferView.byteLength - 4, rows, false);\n return new Uint8Array(bufferView.buffer);\n}\n\nfunction cancel(processID: number, secretKey: number): Uint8Array<ArrayBuffer> {\n const bufferView = new DataView(new ArrayBuffer(16));\n bufferView.setInt32(0, 16, false);\n bufferView.setInt16(4, 1234, false);\n bufferView.setInt16(6, 5678, false);\n bufferView.setInt32(8, processID, false);\n bufferView.setInt32(12, secretKey, false);\n return new Uint8Array(bufferView.buffer);\n}\n\nexport interface PortalOpts {\n type: \"S\" | \"P\";\n name?: string;\n}\n\nfunction cstringMessage(messageCode: Code, string: string): Uint8Array<ArrayBuffer> {\n return new Writer().addCString(string).flush(messageCode);\n}\n\nconst emptyDescribePortal = writer.addCString(\"P\").flush(code.describe);\nconst emptyDescribeStatement = writer.addCString(\"S\").flush(code.describe);\n\nfunction describe(msg: PortalOpts): Uint8Array<ArrayBuffer> {\n if (msg.name) return cstringMessage(code.describe, `${msg.type}${msg.name}`);\n return msg.type === \"P\" ? emptyDescribePortal : emptyDescribeStatement;\n}\n\nfunction close(msg: PortalOpts): Uint8Array<ArrayBuffer> {\n return cstringMessage(code.close, `${msg.type}${msg.name ?? \"\"}`);\n}\n\nfunction copyData(chunk: ArrayBuffer | ArrayBufferView): Uint8Array<ArrayBuffer> {\n return writer.add(chunk).flush(code.copyFromChunk);\n}\n\nfunction copyFail(message: string): Uint8Array<ArrayBuffer> {\n return cstringMessage(code.copyFail, message);\n}\n\nconst codeOnlyBuffer = (messageCode: Code): Uint8Array<ArrayBuffer> =>\n new Uint8Array([messageCode, 0x00, 0x00, 0x00, 0x04]);\n\nconst flushBuffer = codeOnlyBuffer(code.flush);\nconst syncBuffer = codeOnlyBuffer(code.sync);\nconst endBuffer = codeOnlyBuffer(code.end);\nconst copyDoneBuffer = codeOnlyBuffer(code.copyDone);\n\n/** Frontend message builders. */\nexport const serialize = {\n startup,\n password,\n requestSsl,\n sendSASLInitialResponseMessage,\n sendSCRAMClientFinalMessage,\n query,\n parse,\n bind,\n execute,\n describe,\n close,\n flush: (): Uint8Array<ArrayBuffer> => flushBuffer,\n sync: (): Uint8Array<ArrayBuffer> => syncBuffer,\n end: (): Uint8Array<ArrayBuffer> => endBuffer,\n copyData,\n copyDone: (): Uint8Array<ArrayBuffer> => copyDoneBuffer,\n copyFail,\n cancel,\n};\n",
|
|
9
9
|
"/**\n * Wire-level access to a pgwasm instance, kept off its public type. `@pgxsinkit/pgwasm/protocol` and the\n * `live` extension reach it through this registry; pgwasm is bundled with code splitting, so every\n * entry point shares this one module and its map.\n */\n\nimport type { BuildCapabilities } from \"../build/seam\";\nimport type { BackendMessage, NoticeMessage } from \"../protocol/wire/messages\";\n\nexport interface ExecProtocolOptions {\n /** Persist storage after the message, as a statement does. Defaults to `true`. */\n readonly persist?: boolean;\n /** Throw the first ErrorResponse. Defaults to `true`. */\n readonly throwOnError?: boolean;\n readonly onNotice?: (notice: NoticeMessage) => void;\n}\n\nexport interface ExecProtocolStreamOptions {\n /** Persist storage after the message. Defaults to `true`. */\n readonly persist?: boolean;\n /** Every backend byte, as it arrives. A chunk is only valid during the call: copy it to keep it. */\n readonly onRawData: (data: Uint8Array) => void;\n}\n\nexport interface ExecProtocolResult {\n readonly messages: BackendMessage[];\n readonly data: Uint8Array;\n}\n\n/** What `protocol(pg)` returns. */\nexport interface PgwasmProtocol {\n /** Run frontend message bytes; the parsed backend messages and the raw reply. */\n execProtocol(message: Uint8Array, options?: ExecProtocolOptions): Promise<ExecProtocolResult>;\n /** Run frontend message bytes; the parsed backend messages only. */\n execProtocolStream(message: Uint8Array, options?: ExecProtocolOptions): Promise<BackendMessage[]>;\n /** Run frontend message bytes; the raw reply. Notifications and errors are still dispatched. */\n execProtocolRaw(message: Uint8Array, options?: Pick<ExecProtocolOptions, \"persist\">): Promise<Uint8Array>;\n /**\n * Run frontend message bytes and stream the raw reply. When nothing is pending and the build has\n * `synchronousExchange`, the whole reply is delivered before this call returns its promise — what a\n * tool driving it from inside a blocking wasm callback (pg_dump) needs.\n */\n execProtocolRawStream(message: Uint8Array, options: ExecProtocolStreamOptions): Promise<void>;\n /**\n * Run `fn` with the database's session to itself, for a tool whose exchanges must not interleave with\n * anything else (pg_dump). It waits for, then holds, the locks a `transaction()` holds, and the query\n * lock: no query, exec, transaction, listen, live-query refresh or Store backup of this database runs\n * until `fn` settles.\n *\n * What `fn` sends with the `execProtocol*` methods is its own responsibility: no transaction is begun\n * or ended around it, and a message is persisted only as its options say. Inside `fn`, use only these\n * wire methods: the database's query methods wait for the locks `fn` holds, so awaiting one deadlocks.\n */\n runExclusiveSession<T>(fn: () => Promise<T>): Promise<T>;\n /** The build's capabilities, e.g. to check `synchronousExchange` before relying on it. */\n readonly capabilities: BuildCapabilities;\n}\n\nconst registry = new WeakMap<object, PgwasmProtocol>();\n\nexport function registerProtocolAccess(pg: object, access: PgwasmProtocol): void {\n registry.set(pg, access);\n}\n\n/** The wire-level access of a pgwasm instance. Throws for anything else. */\nexport function protocolAccessOf(pg: object): PgwasmProtocol {\n const access = registry.get(pg);\n if (access === undefined) {\n throw new TypeError(\"Not a pgwasm instance (created by createPgwasm).\");\n }\n return access;\n}\n\n/**\n * The strict sync of a database whose data directory is an OPFS-repacked store, registered by\n * `createOpfsPgwasm` and run by `strictSync(pg)` from `@pgxsinkit/pgwasm/opfs`.\n */\nconst strictSyncs = new WeakMap<object, () => void>();\n\nexport function registerStrictSync(pg: object, strictSync: () => void): void {\n strictSyncs.set(pg, strictSync);\n}\n\n/** The registered strict sync of `pg`, or `undefined` when it has none (not an OPFS-repacked store). */\nexport function strictSyncOf(pg: object): (() => void) | undefined {\n return strictSyncs.get(pg);\n}\n"
|
|
10
10
|
],
|
|
11
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCO,IAAM,gBAAgC,EAAE,MAAM,iBAAiB,QAAQ,EAAE;AACzE,IAAM,eAA+B,EAAE,MAAM,gBAAgB,QAAQ,EAAE;AACvE,IAAM,gBAAgC,EAAE,MAAM,iBAAiB,QAAQ,EAAE;AACzE,IAAM,SAAyB,EAAE,MAAM,UAAU,QAAQ,EAAE;AAC3D,IAAM,kBAAkC,EAAE,MAAM,mBAAmB,QAAQ,EAAE;AAC7E,IAAM,mBAAmC,EAAE,MAAM,oBAAoB,QAAQ,EAAE;AAC/E,IAAM,aAA6B,EAAE,MAAM,cAAc,QAAQ,EAAE;AACnE,IAAM,WAA2B,EAAE,MAAM,YAAY,QAAQ,EAAE;AAA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OAAO,YAAY,IAAI,EAAE;AAAA;",
|
|
12
|
+
"debugId": "0D8676B0FD22483564756E2164756E21",
|
|
13
13
|
"names": []
|
|
14
14
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"// Began as a copy of `@electric-sql/pglite` (taken under its PostgreSQL License option, © ElectricSQL\n// — see NOTICE). Owned outright (ADR-0062); compatibility with PGlite is an anti-goal — evolve freely.\n\n/** Stat results, in the shape a POSIX `stat` returns them. Times are milliseconds since the epoch. */\nexport interface FsStats {\n dev: number;\n ino: number;\n mode: number;\n nlink: number;\n uid: number;\n gid: number;\n rdev: number;\n size: number;\n blksize: number;\n blocks: number;\n atime: number;\n mtime: number;\n ctime: number;\n}\n\n/**\n * Errno values, in the numbering Postgres builds use (Emscripten's). A filesystem reports a failed\n * operation by throwing an error whose `code` is one of these; an error without a `code` is reported to\n * Postgres as `EIO`.\n */\nexport const ERRNO_CODES = {\n EBADF: 8,\n EBADFD: 127,\n EEXIST: 20,\n EINVAL: 28,\n EIO: 29,\n EISDIR: 31,\n ENODEV: 43,\n ENOENT: 44,\n ENOTDIR: 54,\n ENOTEMPTY: 55,\n} as const;\n\n/**\n * A filesystem call that failed and was reported to Postgres as an errno. Kept in a small ring so\n * that when Postgres later fails, the storage failures underneath it are visible.\n */\nexport interface SyscallError {\n readonly op: string;\n readonly path: string;\n readonly errno: number;\n readonly message: string;\n readonly timeMs: number;\n}\n\nconst MAX_SYSCALL_ERRORS = 50;\n\n/**\n * What a filesystem says about itself, reported in `pg.storage` as `{ kind: \"vfs\", ...description }`:\n * a short name for diagnostics, and whether what it holds survives the process (or the page) that wrote it.\n */\nexport interface FilesystemDescription {\n /** A short name for diagnostics, e.g. `opfs-repacked`. */\n readonly name: string;\n /**\n * Whether the data directory outlives the process (or page) that wrote it. Absent when the filesystem\n * doesn't say: nothing outside it can tell, so callers treat an undeclared filesystem as the author's\n * own call rather than as non-persistent.\n */\n readonly persistent?: boolean;\n}\n\nconst DEFAULT_DESCRIPTION: FilesystemDescription = Object.freeze({ name: \"custom\" });\n\n/**\n * A synchronous virtual filesystem that holds a data directory, mounted by a Postgres build in place\n * of its built-in storage (pass it as `createPgwasm({ fs })`). Paths are absolute within the\n * filesystem, `/`-separated, `/` being the data directory itself.\n *\n * Besides the POSIX-shaped operations, a filesystem takes part in durability: pgwasm calls\n * `syncToFs(relaxed)` after statements (see `createPgwasm`'s `relaxedDurability`), the build calls\n * `initialSyncFs()` once when it mounts the filesystem, `closeFs()` when the database closes and\n * `cleanupFailedInit()` when a boot fails after the filesystem was handed over.\n */\nexport abstract class BaseFilesystem {\n readonly debug: boolean;\n readonly #recentSyscallErrors: SyscallError[] = [];\n\n constructor({ debug = false }: { debug?: boolean } = {}) {\n this.debug = debug;\n }\n\n /**\n * What this filesystem is, as `pg.storage` reports it. Defaults to `{ name: \"custom\" }`, persistence\n * undeclared: a filesystem overrides it to name itself and to say whether its data outlives the process\n * (`persistent: true`) or not (`persistent: false`), since nothing else can tell.\n */\n get description(): FilesystemDescription {\n return DEFAULT_DESCRIPTION;\n }\n\n /** The most recent failed filesystem calls reported to Postgres (up to 50), oldest first. */\n get recentSyscallErrors(): readonly SyscallError[] {\n return this.#recentSyscallErrors;\n }\n\n /** Record a failed call. The build's mount calls this where it turns a thrown error into an errno. */\n recordSyscallError(op: string, path: string, errno: number, message: string): void {\n const buffer = this.#recentSyscallErrors;\n buffer.push({ op, path, errno, message, timeMs: Date.now() });\n if (buffer.length > MAX_SYSCALL_ERRORS) {\n buffer.shift();\n }\n if (this.debug) {\n console.warn(\"[pgwasm-fs] syscall error\", op, path, errno, message);\n }\n }\n\n /** Make everything written so far durable. `relaxed` is pgwasm's background persist. */\n async syncToFs(_relaxed?: boolean): Promise<void> {}\n\n /** Called once when the build mounts the filesystem, before anything reads it. */\n async initialSyncFs(): Promise<void> {}\n\n /** Release everything the filesystem holds. Called when the database closes. */\n async closeFs(): Promise<void> {}\n\n /** Release what the filesystem holds after a boot failed. Defaults to {@link closeFs}. */\n async cleanupFailedInit(): Promise<void> {\n await this.closeFs();\n }\n\n abstract chmod(path: string, mode: number): void;\n abstract close(fd: number): void;\n abstract fstat(fd: number): FsStats;\n abstract lstat(path: string): FsStats;\n abstract mkdir(path: string, options?: { recursive?: boolean; mode?: number }): void;\n abstract open(path: string, flags?: string, mode?: number): number;\n abstract readdir(path: string): string[];\n /** Read into `buffer[offset, offset + length)` from `position`; returns the bytes read. */\n abstract read(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): number;\n abstract rename(oldPath: string, newPath: string): void;\n abstract rmdir(path: string): void;\n abstract truncate(path: string, length: number): void;\n abstract unlink(path: string): void;\n abstract utimes(path: string, atime: number, mtime: number): void;\n abstract writeFile(\n path: string,\n data: string | Uint8Array,\n options?: { encoding?: string; mode?: number; flag?: string },\n ): void;\n /** Write `buffer[offset, offset + length)` at `position`; returns the bytes written. */\n abstract write(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): number;\n}\n"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";;AAyBO,IAAM,eAAc;AAAA,EACzB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,WAAW;AACb;AAcA,IAAM,qBAAqB;AAiB3B,IAAM,sBAA6C,OAAO,OAAO,EAAE,MAAM,SAAS,CAAC;AAAA;
|
|
7
|
+
"mappings": ";;AAyBO,IAAM,eAAc;AAAA,EACzB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,WAAW;AACb;AAcA,IAAM,qBAAqB;AAiB3B,IAAM,sBAA6C,OAAO,OAAO,EAAE,MAAM,SAAS,CAAC;AAAA;AAYnE,MAAM,gBAAe;AAAA,EAC1B;AAAA,EACA,uBAAuC,CAAC;AAAA,EAEjD,WAAW,GAAG,QAAQ,UAA+B,CAAC,GAAG;AAAA,IACvD,KAAK,QAAQ;AAAA;AAAA,MAQX,WAAW,GAA0B;AAAA,IACvC,OAAO;AAAA;AAAA,MAIL,mBAAmB,GAA4B;AAAA,IACjD,OAAO,KAAK;AAAA;AAAA,EAId,kBAAkB,CAAC,IAAY,MAAc,OAAe,SAAuB;AAAA,IACjF,MAAM,SAAS,KAAK;AAAA,IACpB,OAAO,KAAK,EAAE,IAAI,MAAM,OAAO,SAAS,QAAQ,KAAK,IAAI,EAAE,CAAC;AAAA,IAC5D,IAAI,OAAO,SAAS,oBAAoB;AAAA,MACtC,OAAO,MAAM;AAAA,IACf;AAAA,IACA,IAAI,KAAK,OAAO;AAAA,MACd,QAAQ,KAAK,6BAA6B,IAAI,MAAM,OAAO,OAAO;AAAA,IACpE;AAAA;AAAA,QAII,QAAQ,CAAC,UAAmC;AAAA,QAG5C,aAAa,GAAkB;AAAA,QAG/B,OAAO,GAAkB;AAAA,QAGzB,iBAAiB,GAAkB;AAAA,IACvC,MAAM,KAAK,QAAQ;AAAA;AAwBvB;",
|
|
8
8
|
"debugId": "A14DDD1F35E244A664756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
parseType
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-jnmd6w7f.js";
|
|
5
5
|
import {
|
|
6
6
|
RowDescriptionMessage,
|
|
7
7
|
ParameterDescriptionMessage,
|
|
8
8
|
CommandCompleteMessage,
|
|
9
9
|
DataRowMessage
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-t3q74nsz.js";
|
|
11
11
|
|
|
12
12
|
// packages/pgwasm/src/core/names.ts
|
|
13
13
|
function toPostgresName(input) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"// Began as a copy of `@electric-sql/pglite` (taken under its PostgreSQL License option, © ElectricSQL\n// — see NOTICE). Owned outright (ADR-0062); compatibility with PGlite is an anti-goal — evolve freely.\n\n/**\n * The name Postgres stores for an identifier: a quoted one keeps its case (quotes removed), an\n * unquoted one is folded to lower case. Used to key notification listeners the way Postgres names\n * the channel.\n */\nexport function toPostgresName(input: string): string {\n if (input.startsWith('\"') && input.endsWith('\"') && input.length >= 2) {\n return input.slice(1, -1);\n }\n return input.toLowerCase();\n}\n\n/** Quote an identifier for SQL: wrap in double quotes, doubling any inside. */\nexport function quoteIdentifier(name: string): string {\n return `\"${name.replaceAll('\"', '\"\"')}\"`;\n}\n\n/** A random 32-character hex id, for the names of temporary objects. */\nexport function randomId(): string {\n const bytes = new Uint8Array(16);\n crypto.getRandomValues(bytes);\n return Array.from(bytes, (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n}\n",
|
|
6
6
|
"// Began as a copy of `@electric-sql/pglite` (taken under its PostgreSQL License option, © ElectricSQL\n// — see NOTICE). Owned outright (ADR-0062); compatibility with PGlite is an anti-goal — evolve freely.\n\nimport type { QueryOptions, Results, Row } from \"../interface\";\nimport {\n CommandCompleteMessage,\n DataRowMessage,\n ParameterDescriptionMessage,\n RowDescriptionMessage,\n type BackendMessage,\n} from \"../protocol/wire/messages\";\nimport { parseType, type Parser } from \"../types\";\n\n/**\n * Turn the backend messages of a simple or extended query into result sets, one per statement\n * (https://www.postgresql.org/docs/current/protocol-flow.html).\n */\nexport function parseResults(\n messages: readonly BackendMessage[],\n defaultParsers: Readonly<Record<number | string, Parser>>,\n options?: QueryOptions,\n blob?: Blob,\n): Results<unknown>[] {\n const resultSets: Results<unknown>[] = [];\n let current: Results<unknown> = { rows: [], fields: [] };\n let affectedRows = 0;\n const parsers = { ...defaultParsers, ...options?.parsers };\n\n for (const message of messages) {\n if (message instanceof RowDescriptionMessage) {\n current.fields = message.fields.map((field) => ({ name: field.name, dataTypeID: field.dataTypeID }));\n } else if (message instanceof DataRowMessage) {\n const fields = current.fields;\n const typeOf = (index: number) => fields[index]?.dataTypeID ?? 0;\n if (options?.rowMode === \"array\") {\n current.rows.push(message.fields.map((value, index) => parseType(value, typeOf(index), parsers)));\n } else {\n const row: Row = {};\n message.fields.forEach((value, index) => {\n row[fields[index]?.name ?? String(index)] = parseType(value, typeOf(index), parsers);\n });\n current.rows.push(row);\n }\n } else if (message instanceof CommandCompleteMessage) {\n // A tag that carries a row count ends in it (\"SELECT 2\", \"UPDATE 3\", \"INSERT 0 5\"); the rest end\n // in a word (\"CREATE TABLE\").\n const parts = message.text.split(\" \");\n const command = parts[0] ?? \"\";\n const rowCount = Number.parseInt(parts[parts.length - 1] ?? \"\", 10);\n switch (command) {\n case \"INSERT\":\n case \"UPDATE\":\n case \"DELETE\":\n case \"COPY\":\n case \"MERGE\":\n affectedRows += rowCount;\n break;\n }\n const result: Results<unknown> = { ...current, command, affectedRows };\n if (!Number.isNaN(rowCount)) result.rowCount = rowCount;\n if (blob) result.blob = blob;\n resultSets.push(result);\n current = { rows: [], fields: [] };\n }\n }\n\n if (resultSets.length === 0) {\n resultSets.push({ affectedRows: 0, rows: [], fields: [] });\n }\n return resultSets;\n}\n\n/** The parameter type OIDs from a Describe(statement) reply, when it has them. */\nexport function parseDescribeStatementResults(messages: readonly BackendMessage[]): number[] {\n const message = messages.find(\n (msg): msg is ParameterDescriptionMessage => msg instanceof ParameterDescriptionMessage,\n );\n return message ? message.dataTypeIDs : [];\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";;;;;;;;;;;;AAQO,SAAS,cAAc,CAAC,OAAuB;AAAA,EACpD,IAAI,MAAM,WAAW,GAAG,KAAK,MAAM,SAAS,GAAG,KAAK,MAAM,UAAU,GAAG;AAAA,IACrE,OAAO,MAAM,MAAM,GAAG,EAAE;AAAA,EAC1B;AAAA,EACA,OAAO,MAAM,YAAY;AAAA;AAIpB,SAAS,e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AAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,UACH,gBAAgB;AAAA,UAChB;AAAA;AAAA,MAEJ,MAAM,SAA2B,KAAK,SAAS,SAAS,aAAa;AAAA,MACrE,IAAI,CAAC,OAAO,MAAM,QAAQ;AAAA,QAAG,OAAO,WAAW;AAAA,MAC/C,IAAI;AAAA,QAAM,OAAO,OAAO;AAAA,MACxB,WAAW,KAAK,MAAM;AAAA,MACtB,UAAU,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,EAAE;AAAA,IACnC;AAAA,EACF;AAAA,EAEA,IAAI,WAAW,WAAW,GAAG;AAAA,IAC3B,WAAW,KAAK,EAAE,cAAc,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;AAAA,EAC3D;AAAA,EACA,OAAO;AAAA;AAIF,SAAS,6BAA6B,CAAC,UAA+C;AAAA,EAC3F,MAAM,UAAU,SAAS,KACvB,CAAC,QAA4C,eAAe,2BAC9D;AAAA,EACA,OAAO,UAAU,QAAQ,cAAc,CAAC;AAAA;",
|
|
9
9
|
"debugId": "C407675D55809A7C64756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/dist/drizzle/codecs.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { type PgCodecs } from "drizzle-orm/pg-core/codecs";
|
|
2
|
+
import { type Parser } from "../types";
|
|
2
3
|
/**
|
|
3
4
|
* The identity parsers the driver passes with every query: these types reach drizzle as Postgres'
|
|
4
|
-
* text, and drizzle's codecs turn them into values
|
|
5
|
+
* text, and drizzle's codecs turn them into values. Array parsers keep each element's text while
|
|
6
|
+
* preserving PostgreSQL nulls and dimensions; the scalar Date parser must not run before Drizzle's
|
|
7
|
+
* mode-specific normalizer. Numeric arrays use pgwasm's native precision-preserving parser.
|
|
5
8
|
*/
|
|
6
|
-
export declare const drizzleParsers: Readonly<Record<number,
|
|
9
|
+
export declare const drizzleParsers: Readonly<Record<number, Parser>>;
|
|
7
10
|
/** drizzle's codecs for pgwasm's value formats (the text protocol, pgwasm's default parsers). */
|
|
8
11
|
export declare const pgwasmCodecs: PgCodecs;
|
|
9
12
|
//# sourceMappingURL=codecs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../../src/drizzle/codecs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../../src/drizzle/codecs.ts"],"names":[],"mappings":"AAMA,OAAO,EAYL,KAAK,QAAQ,EACd,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAuD,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAE5F;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAS3D,CAAC;AAMF,iGAAiG;AACjG,eAAO,MAAM,YAAY,EAAE,QAqFzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../src/drizzle/driver.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAiB,KAAK,oBAAoB,EAA4B,MAAM,WAAW,CAAC;AAE/F,qBAAa,cAAc,CAAC,UAAU,SAAS,YAAY,GAAG,cAAc,CAAE,SAAQ,eAAe,CACnG,oBAAoB,EACpB,UAAU,CACX;IACC,gB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,CAAC,IAAI,EAAE,sBAAsB,CAAC;IAEtC,YAAY,IAAI,EAAE,sBAAsB,EAYvC;CACF;AAMD;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,UAAU,SAAS,YAAY,GAAG,cAAc,EAAE,OAAO,SAAS,MAAM,GAAG,MAAM,EACvG,MAAM,EAAE,OAAO,EACf,MAAM,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,GACnC,cAAc,CAAC,UAAU,CAAC,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;yBAHrC,OAAO;eA8BM,UAAU,SAAS,YAAY,4BACjD,eAAe,CAAC,UAAU,CAAC,KACnC,cAAc,CAAC,UAAU,CAAC,GAAG;QAAE,OAAO,EAAE,4CAA4C,CAAA;KAAE;;AA5BzF,wBAAgB,OAAO,CAAC,UAAU,SAAS,YAAY,GAAG,cAAc,EAAE,OAAO,SAAS,MAAM,GAAG,MAAM,EACvG,MAAM,EAAE,mBAAmB,CAAC,UAAU,EAAE,OAAO,CAAC,GAC/C,cAAc,CAAC,UAAU,CAAC,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC"}
|
package/dist/drizzle/index.js
CHANGED
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
DATE,
|
|
7
7
|
TIMESTAMP,
|
|
8
8
|
TIMESTAMPTZ,
|
|
9
|
-
INTERVAL
|
|
10
|
-
|
|
9
|
+
INTERVAL,
|
|
10
|
+
arrayParser
|
|
11
|
+
} from "../chunk-jnmd6w7f.js";
|
|
11
12
|
|
|
12
13
|
// packages/pgwasm/src/drizzle/driver.ts
|
|
13
14
|
import { entityKind as entityKind2 } from "drizzle-orm/entity";
|
|
@@ -22,9 +23,10 @@ import {
|
|
|
22
23
|
castToText,
|
|
23
24
|
castToTextArr,
|
|
24
25
|
genericPgCodecs,
|
|
26
|
+
makeGeometryArray,
|
|
27
|
+
parseGeometryArrayAndNormalize,
|
|
25
28
|
parseGeometryTuple,
|
|
26
29
|
parseGeometryXY,
|
|
27
|
-
parsePgArrayAndNormalize,
|
|
28
30
|
refineGenericPgCodecs,
|
|
29
31
|
textToDate,
|
|
30
32
|
textToDateWithTz
|
|
@@ -35,78 +37,90 @@ var drizzleParsers = {
|
|
|
35
37
|
[TIMESTAMPTZ]: (value) => value,
|
|
36
38
|
[INTERVAL]: (value) => value,
|
|
37
39
|
[DATE]: (value) => value,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
1182: (value) => value
|
|
40
|
+
1115: (value) => arrayParser(value, undefined, 1115),
|
|
41
|
+
1185: (value) => arrayParser(value, undefined, 1185),
|
|
42
|
+
1187: (value) => arrayParser(value, undefined, 1187),
|
|
43
|
+
1182: (value) => arrayParser(value, undefined, 1182)
|
|
43
44
|
};
|
|
44
45
|
var hasBuffer = typeof Buffer !== "undefined";
|
|
46
|
+
var normalizeNullableArray = (normalize) => arrayCompatNormalize((value) => value === null ? null : normalize(value));
|
|
45
47
|
var pgwasmCodecs = refineGenericPgCodecs({
|
|
46
48
|
bigint: {
|
|
47
49
|
cast: castToText,
|
|
48
50
|
castArray: castToTextArr,
|
|
49
51
|
normalize: BigInt,
|
|
50
|
-
normalizeArray:
|
|
52
|
+
normalizeArray: normalizeNullableArray(BigInt)
|
|
51
53
|
},
|
|
52
54
|
"bigint:string": { cast: castToText, castArray: castToTextArr },
|
|
53
|
-
"bigint:number": {
|
|
55
|
+
"bigint:number": {
|
|
56
|
+
cast: castToText,
|
|
57
|
+
castArray: castToTextArr,
|
|
58
|
+
normalize: Number,
|
|
59
|
+
normalizeArray: normalizeNullableArray(Number)
|
|
60
|
+
},
|
|
54
61
|
bigserial: {
|
|
55
62
|
normalize: BigInt,
|
|
56
|
-
normalizeArray:
|
|
63
|
+
normalizeArray: normalizeNullableArray(BigInt),
|
|
57
64
|
cast: castToText,
|
|
58
65
|
castArray: castToTextArr
|
|
59
66
|
},
|
|
60
|
-
"bigserial:number": {
|
|
67
|
+
"bigserial:number": {
|
|
68
|
+
cast: castToText,
|
|
69
|
+
castArray: castToTextArr,
|
|
70
|
+
normalize: Number,
|
|
71
|
+
normalizeArray: normalizeNullableArray(Number)
|
|
72
|
+
},
|
|
73
|
+
"numeric:number": { normalize: Number, normalizeArray: normalizeNullableArray(Number) },
|
|
74
|
+
"numeric:bigint": { normalize: BigInt, normalizeArray: normalizeNullableArray(BigInt) },
|
|
61
75
|
bytea: hasBuffer ? {
|
|
62
76
|
normalizeInJson: genericPgCodecs.bytea?.normalizeInJson,
|
|
63
77
|
normalizeArrayInJson: genericPgCodecs.bytea?.normalizeArrayInJson,
|
|
64
78
|
normalize: (value) => Buffer.from(value),
|
|
65
|
-
normalizeArray:
|
|
79
|
+
normalizeArray: normalizeNullableArray((value) => Buffer.from(value))
|
|
66
80
|
} : {
|
|
67
81
|
normalizeInJson: base64ToUint8Array,
|
|
68
82
|
normalizeArrayInJson: arrayCompatNormalize(base64ToUint8Array)
|
|
69
83
|
},
|
|
70
84
|
interval: { castArray: castToTextArr },
|
|
71
|
-
date: { castArray: castToTextArr, normalize: textToDate, normalizeArray:
|
|
85
|
+
date: { castArray: castToTextArr, normalize: textToDate, normalizeArray: normalizeNullableArray(textToDate) },
|
|
72
86
|
"date:string": { castArray: castToTextArr },
|
|
73
87
|
timestamp: {
|
|
74
88
|
castArray: castToTextArr,
|
|
75
89
|
normalize: textToDateWithTz,
|
|
76
|
-
normalizeArray:
|
|
90
|
+
normalizeArray: normalizeNullableArray(textToDateWithTz)
|
|
77
91
|
},
|
|
78
|
-
timestamptz: { castArray: castToTextArr, normalize: textToDate, normalizeArray:
|
|
92
|
+
timestamptz: { castArray: castToTextArr, normalize: textToDate, normalizeArray: normalizeNullableArray(textToDate) },
|
|
79
93
|
"timestamp:string": { castArray: castToTextArr },
|
|
80
94
|
"timestamptz:string": { castArray: castToTextArr },
|
|
81
95
|
json: { normalizeParam: (value) => typeof value === "object" ? value : JSON.stringify(value) },
|
|
82
96
|
jsonb: { normalizeParam: (value) => typeof value === "object" ? value : JSON.stringify(value) },
|
|
83
97
|
"geometry(point)": {
|
|
84
|
-
normalizeArray:
|
|
98
|
+
normalizeArray: parseGeometryArrayAndNormalize(parseGeometryXY),
|
|
85
99
|
castParam: (name) => `${name}::geometry`,
|
|
86
100
|
castArrayParam: (name, _column, dimensions) => `${name}::geometry${"[]".repeat(dimensions)}`,
|
|
87
|
-
normalizeParamArray:
|
|
101
|
+
normalizeParamArray: makeGeometryArray
|
|
88
102
|
},
|
|
89
103
|
"geometry(point):tuple": {
|
|
90
|
-
normalizeArray:
|
|
104
|
+
normalizeArray: parseGeometryArrayAndNormalize(parseGeometryTuple),
|
|
91
105
|
castParam: (name) => `${name}::geometry`,
|
|
92
106
|
castArrayParam: (name, _column, dimensions) => `${name}::geometry${"[]".repeat(dimensions)}`,
|
|
93
|
-
normalizeParamArray:
|
|
107
|
+
normalizeParamArray: makeGeometryArray
|
|
94
108
|
},
|
|
95
109
|
halfvec: {
|
|
96
110
|
castParam: (name) => `${name}::halfvec`,
|
|
97
111
|
castArrayParam: (name, _column, dimensions) => `${name}::halfvec${"[]".repeat(dimensions)}`,
|
|
98
|
-
normalizeParamArray: makePgArray
|
|
112
|
+
normalizeParamArray: (value) => makePgArray(value)
|
|
99
113
|
},
|
|
100
114
|
vector: {
|
|
101
115
|
castParam: (name) => `${name}::vector`,
|
|
102
116
|
castArrayParam: (name, _column, dimensions) => `${name}::vector${"[]".repeat(dimensions)}`,
|
|
103
|
-
normalizeParamArray: makePgArray
|
|
117
|
+
normalizeParamArray: (value) => makePgArray(value)
|
|
104
118
|
},
|
|
105
119
|
sparsevec: {
|
|
106
|
-
normalizeArray: parsePgArray,
|
|
120
|
+
normalizeArray: (value) => parsePgArray(value),
|
|
107
121
|
castParam: (name) => `${name}::sparsevec`,
|
|
108
122
|
castArrayParam: (name, _column, dimensions) => `${name}::sparsevec${"[]".repeat(dimensions)}`,
|
|
109
|
-
normalizeParamArray: makePgArray
|
|
123
|
+
normalizeParamArray: (value) => makePgArray(value)
|
|
110
124
|
}
|
|
111
125
|
});
|
|
112
126
|
|
|
@@ -139,7 +153,7 @@ class PgwasmSession extends PgAsyncSession {
|
|
|
139
153
|
});
|
|
140
154
|
return mode === "raw" ? result : result.rows;
|
|
141
155
|
};
|
|
142
|
-
return new PgAsyncPreparedQuery(executor, query, mapper, mode, this.#logger, this.#cache, queryMetadata, cacheConfig);
|
|
156
|
+
return new PgAsyncPreparedQuery(executor, query, mapper, mode, this.#logger, this.#cache, queryMetadata, cacheConfig, this.#options.paramsInErrors);
|
|
143
157
|
}
|
|
144
158
|
async transaction(transaction, config) {
|
|
145
159
|
const client = this.#client;
|
|
@@ -203,7 +217,8 @@ function construct(client, config = {}) {
|
|
|
203
217
|
const relations = config.relations ?? {};
|
|
204
218
|
const session = new PgwasmSession(client, dialect, relations, {
|
|
205
219
|
...logger ? { logger } : {},
|
|
206
|
-
...config.cache ? { cache: config.cache } : {}
|
|
220
|
+
...config.cache ? { cache: config.cache } : {},
|
|
221
|
+
...config.paramsInErrors !== undefined ? { paramsInErrors: config.paramsInErrors } : {}
|
|
207
222
|
});
|
|
208
223
|
const db = new PgwasmDatabase(dialect, session, relations);
|
|
209
224
|
const cache = config.cache;
|
|
@@ -258,4 +273,4 @@ export {
|
|
|
258
273
|
pgwasmCodecs
|
|
259
274
|
};
|
|
260
275
|
|
|
261
|
-
//# debugId=
|
|
276
|
+
//# debugId=73756805C661DAC664756E2164756E21
|