@pgxsinkit/pgwasm 0.6.0-rc.1 → 0.6.0

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/NOTICE CHANGED
@@ -96,7 +96,7 @@ began as a copy of drizzle-orm's PGlite driver (`src/pglite/driver.ts`,
96
96
 
97
97
  Changes: the session, transaction and database classes are rebound from PGlite to
98
98
  pgwasm; the driver never constructs its own database; it has its own JIT capability
99
- probe; `$cache.invalidate` is bound without changing the caller's cache. The Apache-2.0 terms are
99
+ probe; its codecs and prepared-query session follow Drizzle RC6. The Apache-2.0 terms are
100
100
  permanent. A copy of the Apache License 2.0 ships with this package in
101
101
  LICENSE-APACHE-2.0 (from https://www.apache.org/licenses/LICENSE-2.0.txt).
102
102
 
package/README.md CHANGED
@@ -5,6 +5,11 @@ queries, `LISTEN`/`NOTIFY` and a Drizzle driver, in the browser and on Bun, over
5
5
  compiled Postgres build you hand it. The build is its own package; the C build is
6
6
  [`@pgxsinkit/pgwasm-c`](https://www.npmjs.com/package/@pgxsinkit/pgwasm-c).
7
7
 
8
+ **PostgreSQL versions:** pgxsinkit 0.5.x and earlier use PostgreSQL 18; 0.6.x and later use
9
+ PostgreSQL 19 or later. This includes the 0.6 release candidates. The C build's release identifies
10
+ the exact PostgreSQL version. PG18 data directories and Store backups cannot be opened with the
11
+ PG19 build; use a fresh store and re-sync, exporting any local-only data before switching.
12
+
8
13
  ```bash
9
14
  bun add @pgxsinkit/pgwasm @pgxsinkit/pgwasm-c
10
15
  ```
@@ -27,13 +32,44 @@ const { rows } = await pg.query<{ id: number; title: string }>("SELECT * FROM to
27
32
  - `idb://<name>`: IndexedDB, in a browser;
28
33
  - `file://<path>`: a directory on disk, on Bun.
29
34
 
30
- A build states which of these it supports. `opfs-ahp://` is not supported.
35
+ A build states which of these `dataDir` schemes it supports.
36
+
37
+ **OPFS-repacked is supported** through `createOpfsPgwasm` from `@pgxsinkit/pgwasm/opfs`, using an
38
+ OPFS directory handle instead of a `dataDir` scheme. It is the pgxsinkit client's default browser
39
+ store in a capable worker. The C build supports it; the entire Postgres data directory uses four
40
+ OPFS handles regardless of how many virtual files it contains.
41
+
42
+ `opfs-ahp://` refers to PGlite's old one-handle-per-file layout, which is not supported. That
43
+ restriction does not apply to OPFS-repacked.
31
44
 
32
45
  A data directory records the Postgres build that created it, and opening it with a different
33
46
  build fails with `BuildMismatchError` before anything is written. A store backup
34
47
  (`dumpDataDir()`, restored through the `loadDataDir` option) carries the same record, so it
35
48
  restores only into its own build.
36
49
 
50
+ ### OPFS-repacked
51
+
52
+ Run this in a worker where opening synchronous OPFS access handles succeeds:
53
+
54
+ ```ts
55
+ import { cBuild } from "@pgxsinkit/pgwasm-c";
56
+ import { createOpfsPgwasm } from "@pgxsinkit/pgwasm/opfs";
57
+
58
+ const root = await navigator.storage.getDirectory();
59
+ const directory = await root.getDirectoryHandle("my-app", { create: true });
60
+ const pg = await createOpfsPgwasm({ build: cBuild, directory });
61
+ try {
62
+ await pg.exec("SELECT 1");
63
+ } finally {
64
+ await pg.close();
65
+ }
66
+ ```
67
+
68
+ Give each database its own otherwise-empty directory. The factory owns initialization, durability
69
+ and handle cleanup. For automatic browser capability detection and worker placement, use
70
+ `@pgxsinkit/client`; see the [OPFS-repacked documentation](https://pgxsinkit.github.io/packages/pgwasm/#the-opfs-repacked-store-pgxsinkitpgwasmopfs)
71
+ for worker requirements, durability options and recovery.
72
+
37
73
  ## Entry points
38
74
 
39
75
  | Import | What it gives you |
@@ -42,6 +78,7 @@ restores only into its own build.
42
78
  | `@pgxsinkit/pgwasm/live` | the `live` extension: `live.query`, `live.incrementalQuery`, `live.changes` |
43
79
  | `@pgxsinkit/pgwasm/drizzle` | a Drizzle ORM driver (`drizzle(pg)`); needs `drizzle-orm` |
44
80
  | `@pgxsinkit/pgwasm/protocol` | `protocol(pg)`: wire-level access and an exclusive session, for tools such as `pg_dump` |
81
+ | `@pgxsinkit/pgwasm/opfs` | the OPFS-repacked store: `createOpfsPgwasm`, `strictSync`, errors and low-level parts |
45
82
  | `@pgxsinkit/pgwasm/fs` | the filesystem contract a custom storage implements |
46
83
  | `@pgxsinkit/pgwasm/build` | the contract a Postgres build package implements |
47
84
 
@@ -7,7 +7,7 @@ import {
7
7
  ParameterDescriptionMessage,
8
8
  CommandCompleteMessage,
9
9
  DataRowMessage
10
- } from "./chunk-t3q74nsz.js";
10
+ } from "./chunk-c06zjbcj.js";
11
11
 
12
12
  // packages/pgwasm/src/core/names.ts
13
13
  function toPostgresName(input) {
@@ -30,20 +30,31 @@ function parseResults(messages, defaultParsers, options, blob) {
30
30
  const resultSets = [];
31
31
  let current = { rows: [], fields: [] };
32
32
  let affectedRows = 0;
33
- const parsers = { ...defaultParsers, ...options?.parsers };
33
+ const parsers = options?.parsers === undefined ? defaultParsers : { ...defaultParsers, ...options.parsers };
34
34
  for (const message of messages) {
35
35
  if (message instanceof RowDescriptionMessage) {
36
36
  current.fields = message.fields.map((field) => ({ name: field.name, dataTypeID: field.dataTypeID }));
37
37
  } else if (message instanceof DataRowMessage) {
38
38
  const fields = current.fields;
39
- const typeOf = (index) => fields[index]?.dataTypeID ?? 0;
39
+ const values = message.fields;
40
40
  if (options?.rowMode === "array") {
41
- current.rows.push(message.fields.map((value, index) => parseType(value, typeOf(index), parsers)));
41
+ const row = new Array(values.length);
42
+ for (let index = 0;index < values.length; index++) {
43
+ row[index] = parseType(values[index], fields[index]?.dataTypeID ?? 0, parsers);
44
+ }
45
+ current.rows.push(row);
42
46
  } else {
43
47
  const row = {};
44
- message.fields.forEach((value, index) => {
45
- row[fields[index]?.name ?? String(index)] = parseType(value, typeOf(index), parsers);
46
- });
48
+ for (let index = 0;index < values.length; index++) {
49
+ const field = fields[index];
50
+ const name = field?.name ?? String(index);
51
+ const value = parseType(values[index], field?.dataTypeID ?? 0, parsers);
52
+ if (name === "__proto__") {
53
+ Object.defineProperty(row, name, { value, enumerable: true, writable: true, configurable: true });
54
+ } else {
55
+ row[name] = value;
56
+ }
57
+ }
47
58
  current.rows.push(row);
48
59
  }
49
60
  } else if (message instanceof CommandCompleteMessage) {
@@ -80,4 +91,4 @@ function parseDescribeStatementResults(messages) {
80
91
 
81
92
  export { toPostgresName, quoteIdentifier, randomId, parseResults, parseDescribeStatementResults };
82
93
 
83
- //# debugId=C407675D55809A7C64756E2164756E21
94
+ //# debugId=0278C8344440806064756E2164756E21
@@ -0,0 +1,11 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/core/names.ts", "../src/core/parse.ts"],
4
+ "sourcesContent": [
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
+ "// 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 // Instance parsers are already normalized; only per-query overrides need another map.\n const parsers = options?.parsers === undefined ? defaultParsers : { ...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 values = message.fields;\n if (options?.rowMode === \"array\") {\n const row = new Array<unknown>(values.length);\n for (let index = 0; index < values.length; index++) {\n row[index] = parseType(values[index]!, fields[index]?.dataTypeID ?? 0, parsers);\n }\n current.rows.push(row);\n } else {\n const row: Row = {};\n for (let index = 0; index < values.length; index++) {\n const field = fields[index];\n const name = field?.name ?? String(index);\n const value = parseType(values[index]!, field?.dataTypeID ?? 0, parsers);\n // SQL column names are data: assigning __proto__ on {} would invoke its inherited setter.\n if (name === \"__proto__\") {\n Object.defineProperty(row, name, { value, enumerable: true, writable: true, configurable: true });\n } else {\n row[name] = value;\n }\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
+ ],
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,eAAe,CAAC,MAAsB;AAAA,EACpD,OAAO,IAAI,KAAK,WAAW,KAAK,IAAI;AAAA;AAI/B,SAAS,QAAQ,GAAW;AAAA,EACjC,MAAM,QAAQ,IAAI,WAAW,EAAE;AAAA,EAC/B,OAAO,gBAAgB,KAAK;AAAA,EAC5B,OAAO,MAAM,KAAK,OAAO,CAAC,SAAS,KAAK,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,EAAE,KAAK,EAAE;AAAA;;;ACPzE,SAAS,YAAY,CAC1B,UACA,gBACA,SACA,MACoB;AAAA,EACpB,MAAM,aAAiC,CAAC;AAAA,EACxC,IAAI,UAA4B,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,EAAE;AAAA,EACvD,IAAI,eAAe;AAAA,EAEnB,MAAM,UAAU,SAAS,YAAY,YAAY,iBAAiB,KAAK,mBAAmB,QAAQ,QAAQ;AAAA,EAE1G,WAAW,WAAW,UAAU;AAAA,IAC9B,IAAI,mBAAmB,uBAAuB;AAAA,MAC5C,QAAQ,SAAS,QAAQ,OAAO,IAAI,CAAC,WAAW,EAAE,MAAM,MAAM,MAAM,YAAY,M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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
+ "debugId": "0278C8344440806064756E2164756E21",
10
+ "names": []
11
+ }
@@ -296,8 +296,11 @@ function byteLengthUtf8(str) {
296
296
  byteLength++;
297
297
  else if (code > 2047 && code <= 65535)
298
298
  byteLength += 2;
299
- if (code >= 56320 && code <= 57343)
300
- i--;
299
+ if (code >= 56320 && code <= 57343) {
300
+ const previous = str.charCodeAt(i - 1);
301
+ if (previous >= 55296 && previous <= 56319)
302
+ i--;
303
+ }
301
304
  }
302
305
  return byteLength;
303
306
  }
@@ -574,4 +577,4 @@ function strictSyncOf(pg) {
574
577
 
575
578
  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 };
576
579
 
577
- //# debugId=0D8676B0FD22483564756E2164756E21
580
+ //# debugId=A647EE3A8AD5ECE264756E2164756E21
@@ -3,12 +3,12 @@
3
3
  "sources": ["../src/protocol/wire/messages.ts", "../src/protocol/wire/string-utils.ts", "../src/protocol/wire/buffer-writer.ts", "../src/protocol/wire/serializer.ts", "../src/core/internals.ts"],
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
- "// 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",
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) {\n const previous = str.charCodeAt(i - 1);\n // Only a valid pair shares four bytes; an unpaired surrogate encodes as U+FFFD.\n if (previous >= 0xd800 && previous <= 0xdbff) i--;\n }\n }\n return byteLength;\n}\n",
7
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
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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,cAAc,eAAe,KAAK,KAAK;AAC7C,IAAM,aAAa,eAAe,KAAK,IAAI;AAC3C,IAAM,YAAY,eAAe,KAAK,GAAG;AACzC,IAAM,iBAAiB,eAAe,KAAK,QAAQ;AAG5C,IAAM,aAAY;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,MAA+B;AAAA,EACtC,MAAM,MAA+B;AAAA,EACrC,KAAK,MAA+B;AAAA,EACpC;AAAA,EACA,UAAU,MAA+B;AAAA,EACzC;AAAA,EACA;AACF;;;ACpLA,IAAM,WAAW,IAAI;AAEd,SAAS,sBAAsB,CAAC,IAAY,QAA8B;AAAA,EAC/E,SAAS,IAAI,IAAI,MAAM;AAAA;AAIlB,SAAS,gBAAgB,CAAC,IAA4B;AAAA,EAC3D,MAAM,SAAS,SAAS,IAAI,EAAE;AAAA,EAC9B,IAAI,WAAW,WAAW;AAAA,IACxB,MAAM,IAAI,UAAU,kDAAkD;AAAA,EACxE;AAAA,EACA,OAAO;AAAA;AAOT,IAAM,cAAc,IAAI;AAEjB,SAAS,kBAAkB,CAAC,IAAY,YAA8B;AAAA,EAC3E,YAAY,IAAI,IAAI,UAAU;AAAA;AAIzB,SAAS,YAAY,CAAC,IAAsC;AAAA,EACjE,OAAO,YAAY,IAAI,EAAE;AAAA;",
12
+ "debugId": "A647EE3A8AD5ECE264756E2164756E21",
13
13
  "names": []
14
14
  }
@@ -27,7 +27,7 @@ import {
27
27
  CommandCompleteMessage,
28
28
  DataRowMessage,
29
29
  NoticeMessage
30
- } from "./chunk-t3q74nsz.js";
30
+ } from "./chunk-c06zjbcj.js";
31
31
 
32
32
  // packages/pgwasm/src/protocol/wire/buffer-reader.ts
33
33
  var emptyBuffer = new ArrayBuffer(0);
@@ -64,6 +64,12 @@ class BufferReader {
64
64
  return result;
65
65
  }
66
66
  string(length) {
67
+ const offset = this.#offset;
68
+ if (Number.isInteger(offset) && offset >= 0 && Number.isInteger(length) && length >= 0 && length <= this.#bufferView.byteLength - offset) {
69
+ const bytes = new Uint8Array(this.#bufferView.buffer, offset, length);
70
+ this.#offset += length;
71
+ return this.#decoder.decode(bytes);
72
+ }
67
73
  return this.#decoder.decode(this.bytes(length));
68
74
  }
69
75
  cstring() {
@@ -375,4 +381,4 @@ class Parser2 {
375
381
 
376
382
  export { Modes2, Parser2 };
377
383
 
378
- //# debugId=7E57CFB46D6FFAF764756E2164756E21
384
+ //# debugId=224E80D76BE533DA64756E2164756E21
@@ -2,11 +2,11 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/protocol/wire/buffer-reader.ts", "../src/protocol/wire/types.ts", "../src/protocol/wire/parser.ts"],
4
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",
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 const offset = this.#offset;\n if (\n Number.isInteger(offset) &&\n offset >= 0 &&\n Number.isInteger(length) &&\n length >= 0 &&\n length <= this.#bufferView.byteLength - offset\n ) {\n // Decode while the view is borrowed; only the resulting string escapes. Binary bytes() still owns its data.\n const bytes = new Uint8Array(this.#bufferView.buffer, offset, length);\n this.#offset += length;\n return this.#decoder.decode(bytes);\n }\n // Keep slice's clipping/coercion and offset advancement for malformed input.\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
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
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
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;AAAA;AAAA,EAGT,KAAK,GAAW;AAAA,IACd,MAAM,SAAS,KAAK,YAAY,SAAS,KAAK,SAAS,KAAK;AAAA,IAC5D,KAAK,WAAW;AAAA,IAChB,OAAO;AAAA;AAAA,EAGT,MAAM,CAAC,QAAwB;AAAA,IAC7B,OAAO,KAAK,SAAS,OAAO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EX;",
10
+ "debugId": "224E80D76BE533DA64756E2164756E21",
11
11
  "names": []
12
12
  }
@@ -28,7 +28,7 @@ import {
28
28
  quoteIdentifier,
29
29
  parseResults,
30
30
  parseDescribeStatementResults
31
- } from "./chunk-zm269na3.js";
31
+ } from "./chunk-10ebj4re.js";
32
32
  import {
33
33
  parsers,
34
34
  serializers,
@@ -38,14 +38,14 @@ import {
38
38
  } from "./chunk-jnmd6w7f.js";
39
39
  import {
40
40
  Parser2
41
- } from "./chunk-s6a029ak.js";
41
+ } from "./chunk-d2kpv98r.js";
42
42
  import {
43
43
  DatabaseError2,
44
44
  NotificationResponseMessage,
45
45
  NoticeMessage,
46
46
  serialize2,
47
47
  registerProtocolAccess
48
- } from "./chunk-t3q74nsz.js";
48
+ } from "./chunk-c06zjbcj.js";
49
49
 
50
50
  // packages/pgwasm/src/core/data-dir-archive.ts
51
51
  function normalizeDataDirPath(name) {
@@ -1 +1 @@
1
- {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/core/parse.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAO,MAAM,cAAc,CAAC;AAC/D,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAa,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAElD;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,SAAS,cAAc,EAAE,EACnC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,EACzD,OAAO,CAAC,EAAE,YAAY,EACtB,IAAI,CAAC,EAAE,IAAI,GACV,OAAO,CAAC,OAAO,CAAC,EAAE,CAgDpB;AAED,kFAAkF;AAClF,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,EAAE,CAK3F"}
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/core/parse.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAO,MAAM,cAAc,CAAC;AAC/D,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAa,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAElD;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,SAAS,cAAc,EAAE,EACnC,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC,EACzD,OAAO,CAAC,EAAE,YAAY,EACtB,IAAI,CAAC,EAAE,IAAI,GACV,OAAO,CAAC,OAAO,CAAC,EAAE,CA6DpB;AAED,kFAAkF;AAClF,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,EAAE,CAK3F"}
@@ -1 +1 @@
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
+ {"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../../src/drizzle/codecs.ts"],"names":[],"mappings":"AAMA,OAAO,EAUL,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,C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20,8 +20,6 @@ import { PgDialect } from "drizzle-orm/pg-core/dialect";
20
20
  import { makePgArray, parsePgArray } from "drizzle-orm/pg-core/array";
21
21
  import {
22
22
  arrayCompatNormalize,
23
- castToText,
24
- castToTextArr,
25
23
  genericPgCodecs,
26
24
  makeGeometryArray,
27
25
  parseGeometryArrayAndNormalize,
@@ -31,7 +29,7 @@ import {
31
29
  textToDate,
32
30
  textToDateWithTz
33
31
  } from "drizzle-orm/pg-core/codecs";
34
- import { base64ToUint8Array } from "drizzle-orm/utils";
32
+ import { pgHexToUint8Array } from "drizzle-orm/utils";
35
33
  var drizzleParsers = {
36
34
  [TIMESTAMP]: (value) => value,
37
35
  [TIMESTAMPTZ]: (value) => value,
@@ -46,27 +44,19 @@ var hasBuffer = typeof Buffer !== "undefined";
46
44
  var normalizeNullableArray = (normalize) => arrayCompatNormalize((value) => value === null ? null : normalize(value));
47
45
  var pgwasmCodecs = refineGenericPgCodecs({
48
46
  bigint: {
49
- cast: castToText,
50
- castArray: castToTextArr,
51
47
  normalize: BigInt,
52
48
  normalizeArray: normalizeNullableArray(BigInt)
53
49
  },
54
- "bigint:string": { cast: castToText, castArray: castToTextArr },
50
+ "bigint:string": { normalize: String, normalizeArray: normalizeNullableArray(String) },
55
51
  "bigint:number": {
56
- cast: castToText,
57
- castArray: castToTextArr,
58
52
  normalize: Number,
59
53
  normalizeArray: normalizeNullableArray(Number)
60
54
  },
61
55
  bigserial: {
62
56
  normalize: BigInt,
63
- normalizeArray: normalizeNullableArray(BigInt),
64
- cast: castToText,
65
- castArray: castToTextArr
57
+ normalizeArray: normalizeNullableArray(BigInt)
66
58
  },
67
59
  "bigserial:number": {
68
- cast: castToText,
69
- castArray: castToTextArr,
70
60
  normalize: Number,
71
61
  normalizeArray: normalizeNullableArray(Number)
72
62
  },
@@ -78,20 +68,15 @@ var pgwasmCodecs = refineGenericPgCodecs({
78
68
  normalize: (value) => Buffer.from(value),
79
69
  normalizeArray: normalizeNullableArray((value) => Buffer.from(value))
80
70
  } : {
81
- normalizeInJson: base64ToUint8Array,
82
- normalizeArrayInJson: arrayCompatNormalize(base64ToUint8Array)
71
+ normalizeInJson: pgHexToUint8Array,
72
+ normalizeArrayInJson: arrayCompatNormalize(pgHexToUint8Array)
83
73
  },
84
- interval: { castArray: castToTextArr },
85
- date: { castArray: castToTextArr, normalize: textToDate, normalizeArray: normalizeNullableArray(textToDate) },
86
- "date:string": { castArray: castToTextArr },
74
+ date: { normalize: textToDate, normalizeArray: normalizeNullableArray(textToDate) },
87
75
  timestamp: {
88
- castArray: castToTextArr,
89
76
  normalize: textToDateWithTz,
90
77
  normalizeArray: normalizeNullableArray(textToDateWithTz)
91
78
  },
92
- timestamptz: { castArray: castToTextArr, normalize: textToDate, normalizeArray: normalizeNullableArray(textToDate) },
93
- "timestamp:string": { castArray: castToTextArr },
94
- "timestamptz:string": { castArray: castToTextArr },
79
+ timestamptz: { normalize: textToDate, normalizeArray: normalizeNullableArray(textToDate) },
95
80
  json: { normalizeParam: (value) => typeof value === "object" ? value : JSON.stringify(value) },
96
81
  jsonb: { normalizeParam: (value) => typeof value === "object" ? value : JSON.stringify(value) },
97
82
  "geometry(point)": {
@@ -125,7 +110,6 @@ var pgwasmCodecs = refineGenericPgCodecs({
125
110
  });
126
111
 
127
112
  // packages/pgwasm/src/drizzle/session.ts
128
- import { NoopCache } from "drizzle-orm/cache/core/cache";
129
113
  import { entityKind } from "drizzle-orm/entity";
130
114
  import { NoopLogger } from "drizzle-orm/logger";
131
115
  import { PgAsyncPreparedQuery, PgAsyncSession, PgAsyncTransaction } from "drizzle-orm/pg-core/async/session";
@@ -136,24 +120,22 @@ class PgwasmSession extends PgAsyncSession {
136
120
  #relations;
137
121
  #options;
138
122
  #logger;
139
- #cache;
140
123
  constructor(client, dialect, relations, options = {}) {
141
124
  super(dialect);
142
125
  this.#client = client;
143
126
  this.#relations = relations;
144
127
  this.#options = options;
145
128
  this.#logger = options.logger ?? new NoopLogger;
146
- this.#cache = options.cache ?? new NoopCache;
147
129
  }
148
- prepareQuery(query, mode, _name, mapper, queryMetadata, cacheConfig) {
130
+ prepareQuery(query, mode, _name, mapper) {
149
131
  const executor = async (params) => {
150
132
  const result = await this.#client.query(query.sql, params, {
151
133
  rowMode: mode === "arrays" ? "array" : "object",
152
- parsers: drizzleParsers
134
+ ...mode === "call" ? {} : { parsers: drizzleParsers }
153
135
  });
154
136
  return mode === "raw" ? result : result.rows;
155
137
  };
156
- return new PgAsyncPreparedQuery(executor, query, mapper, mode, this.#logger, this.#cache, queryMetadata, cacheConfig, this.#options.paramsInErrors);
138
+ return new PgAsyncPreparedQuery(executor, query, mapper, mode, this.#logger, this.#options.paramsInErrors);
157
139
  }
158
140
  async transaction(transaction, config) {
159
141
  const client = this.#client;
@@ -217,13 +199,9 @@ function construct(client, config = {}) {
217
199
  const relations = config.relations ?? {};
218
200
  const session = new PgwasmSession(client, dialect, relations, {
219
201
  ...logger ? { logger } : {},
220
- ...config.cache ? { cache: config.cache } : {},
221
202
  ...config.paramsInErrors !== undefined ? { paramsInErrors: config.paramsInErrors } : {}
222
203
  });
223
204
  const db = new PgwasmDatabase(dialect, session, relations);
224
- const cache = config.cache;
225
- if (cache)
226
- db.$cache = { invalidate: (params) => cache.onMutate(params) };
227
205
  return Object.assign(db, { $client: client });
228
206
  }
229
207
 
@@ -273,4 +251,4 @@ export {
273
251
  pgwasmCodecs
274
252
  };
275
253
 
276
- //# debugId=73756805C661DAC664756E2164756E21
254
+ //# debugId=EA54608DFCE3360564756E2164756E21
@@ -2,11 +2,11 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/drizzle/driver.ts", "../src/drizzle/codecs.ts", "../src/drizzle/session.ts"],
4
4
  "sourcesContent": [
5
- "// Began as a copy of drizzle-orm's PGlite driver (`src/pglite/*.ts` at 1.0.0-rc.4; Apache-2.0, © Drizzle Team\n// and contributors — see NOTICE). Changes: rebound from PGlite to pgwasm; the driver never constructs its\n// own database; its own JIT capability probe; `$cache.invalidate` bound without changing the caller's\n// cache object. Owned outright (ADR-0062).\n\nimport { entityKind } from \"drizzle-orm/entity\";\nimport { DefaultLogger, type Logger } from \"drizzle-orm/logger\";\nimport { PgAsyncDatabase } from \"drizzle-orm/pg-core/async/db\";\nimport { PgDialect } from \"drizzle-orm/pg-core/dialect\";\nimport type { DrizzlePgConfig } from \"drizzle-orm/pg-core/utils\";\nimport type { AnyRelations, EmptyRelations } from \"drizzle-orm/relations\";\n\nimport { PgwasmError } from \"../errors\";\nimport type { Pgwasm } from \"../interface\";\nimport { pgwasmCodecs } from \"./codecs\";\nimport { PgwasmSession, type PgwasmQueryResultHKT, type PgwasmSessionClient } from \"./session\";\n\nexport class PgwasmDatabase<TRelations extends AnyRelations = EmptyRelations> extends PgAsyncDatabase<\n PgwasmQueryResultHKT,\n TRelations\n> {\n static override readonly [entityKind]: string = \"PgwasmDatabase\";\n}\n\n/**\n * Whether to use JIT row mappers: only when asked for (`jit: true`) and `new Function` works here. JIT\n * mappers are compiled with it, and a strict content security policy (an MV3 extension page's) makes it\n * throw; the driver then falls back to the premade mappers instead of failing every query.\n */\nexport function jitMappersUsable(requested: boolean | undefined): boolean {\n if (requested !== true) return false;\n try {\n // oxlint-disable-next-line typescript/no-implied-eval -- the probe: does this context allow it at all\n const identity = new Function(\"input\", '\"use strict\"; return input;') as (input: unknown) => unknown;\n return identity(true) === true;\n } catch {\n return false;\n }\n}\n\nfunction construct<TRelations extends AnyRelations, TClient extends PgwasmSessionClient>(\n client: TClient,\n config: DrizzlePgConfig<TRelations> = {},\n): PgwasmDatabase<TRelations> & { $client: TClient } {\n const dialect = new PgDialect({\n useJitMappers: jitMappersUsable(config.jit),\n codecs: config.codecs ?? pgwasmCodecs,\n });\n const logger: Logger | undefined =\n config.logger === true ? new DefaultLogger() : config.logger === false ? undefined : config.logger;\n const relations = (config.relations ?? {}) as TRelations;\n const session = new PgwasmSession<TRelations>(client, dialect, relations, {\n ...(logger ? { logger } : {}),\n ...(config.cache ? { cache: config.cache } : {}),\n ...(config.paramsInErrors !== undefined ? { paramsInErrors: config.paramsInErrors } : {}),\n });\n const db = new PgwasmDatabase<TRelations>(dialect, session, relations);\n // `db.$cache.invalidate` is the cache's own invalidation; with no cache it stays the no-op it starts as.\n const cache = config.cache;\n if (cache) db.$cache = { invalidate: (params) => cache.onMutate(params) };\n return Object.assign(db, { $client: client });\n}\n\n/** drizzle's object form: its config, with the pgwasm database as `client`. */\nexport type PgwasmDrizzleConfig<\n TRelations extends AnyRelations = EmptyRelations,\n TClient extends Pgwasm = Pgwasm,\n> = DrizzlePgConfig<TRelations> & { client: TClient };\n\n/** The form of a `drizzle()` call that would have the driver open its own database. */\nexport type UnsupportedDrizzleForm = \"connection\" | \"connection string\" | \"no client\";\n\n/**\n * A `drizzle()` call without a pgwasm database: `drizzle({ connection })`, `drizzle(\"…\")`, `drizzle()`, or a\n * `client` that is not a pgwasm database. The driver never opens its own database: create one with\n * `createPgwasm()` and pass it in.\n */\nexport class UnsupportedDrizzleConfigError extends PgwasmError {\n override name = \"UnsupportedDrizzleConfigError\";\n readonly form: UnsupportedDrizzleForm;\n\n constructor(form: UnsupportedDrizzleForm) {\n const given =\n form === \"connection\"\n ? \"drizzle({ connection })\"\n : form === \"connection string\"\n ? \"drizzle(connectionString)\"\n : \"a drizzle() call without a pgwasm database\";\n super(\n `@pgxsinkit/pgwasm/drizzle does not open its own database, so ${given} is not supported: create the ` +\n \"database with createPgwasm() and pass it as drizzle(pg, config) or drizzle({ client: pg, ...config }).\",\n );\n this.form = form;\n }\n}\n\nfunction isPgwasm(value: unknown): value is Pgwasm {\n return typeof value === \"object\" && value !== null && typeof (value as Partial<Pgwasm>).query === \"function\";\n}\n\n/**\n * A Drizzle database over a pgwasm database: `drizzle(pg, config)`, or drizzle's object form\n * `drizzle({ client: pg, ...config })`, which is the same thing. The driver never opens its own database, so\n * the forms that would (`{ connection }`, a connection string) are not accepted; at runtime they throw\n * {@link UnsupportedDrizzleConfigError}.\n */\nexport function drizzle<TRelations extends AnyRelations = EmptyRelations, TClient extends Pgwasm = Pgwasm>(\n client: TClient,\n config?: DrizzlePgConfig<TRelations>,\n): PgwasmDatabase<TRelations> & { $client: TClient };\nexport function drizzle<TRelations extends AnyRelations = EmptyRelations, TClient extends Pgwasm = Pgwasm>(\n config: PgwasmDrizzleConfig<TRelations, TClient>,\n): PgwasmDatabase<TRelations> & { $client: TClient };\nexport function drizzle<TRelations extends AnyRelations = EmptyRelations>(\n clientOrConfig: Pgwasm | PgwasmDrizzleConfig<TRelations>,\n config?: DrizzlePgConfig<TRelations>,\n): PgwasmDatabase<TRelations> & { $client: Pgwasm } {\n const given: unknown = clientOrConfig;\n if (isPgwasm(given)) return construct(given, config);\n if (typeof given === \"string\") throw new UnsupportedDrizzleConfigError(\"connection string\");\n if (typeof given === \"object\" && given !== null) {\n const { client, ...rest } = given as Partial<PgwasmDrizzleConfig<TRelations>> & { connection?: unknown };\n // A `connection` next to a pgwasm `client` is ignored, as drizzle's own drivers do.\n if (isPgwasm(client)) return construct(client, rest);\n if (client === undefined && \"connection\" in given) throw new UnsupportedDrizzleConfigError(\"connection\");\n }\n throw new UnsupportedDrizzleConfigError(\"no client\");\n}\n\nconst unavailable: PgwasmSessionClient = {\n query: () => {\n throw new Error(\"drizzle.mock() has no database: build queries with it, run them elsewhere.\");\n },\n};\n\n/** A Drizzle database with no database behind it, for building SQL (`.toSQL()`). */\ndrizzle.mock = function mock<TRelations extends AnyRelations = EmptyRelations>(\n config?: DrizzlePgConfig<TRelations>,\n): PgwasmDatabase<TRelations> & { $client: \"$client is not available on drizzle.mock()\" } {\n const db = construct(unavailable, config);\n return Object.assign(db, { $client: \"$client is not available on drizzle.mock()\" as const });\n};\n",
6
- "// Began as a copy of drizzle-orm's PGlite driver (`src/pglite/*.ts` at 1.0.0-rc.4; Apache-2.0, © Drizzle Team\n// and contributors — see NOTICE). Changes: rebound from PGlite to pgwasm; the driver never constructs its\n// own database. Owned outright (ADR-0062).\n\nimport type { NormalizeCodec } from \"drizzle-orm/codecs\";\nimport { makePgArray, parsePgArray } from \"drizzle-orm/pg-core/array\";\nimport {\n arrayCompatNormalize,\n castToText,\n castToTextArr,\n genericPgCodecs,\n makeGeometryArray,\n parseGeometryArrayAndNormalize,\n parseGeometryTuple,\n parseGeometryXY,\n refineGenericPgCodecs,\n textToDate,\n textToDateWithTz,\n type PgCodecs,\n} from \"drizzle-orm/pg-core/codecs\";\nimport { base64ToUint8Array } from \"drizzle-orm/utils\";\n\nimport { arrayParser, DATE, INTERVAL, TIMESTAMP, TIMESTAMPTZ, type Parser } from \"../types\";\n\n/**\n * The identity parsers the driver passes with every query: these types reach drizzle as Postgres'\n * text, and drizzle's codecs turn them into values. Array parsers keep each element's text while\n * preserving PostgreSQL nulls and dimensions; the scalar Date parser must not run before Drizzle's\n * mode-specific normalizer. Numeric arrays use pgwasm's native precision-preserving parser.\n */\nexport const drizzleParsers: Readonly<Record<number, Parser>> = {\n [TIMESTAMP]: (value) => value,\n [TIMESTAMPTZ]: (value) => value,\n [INTERVAL]: (value) => value,\n [DATE]: (value) => value,\n 1115: (value) => arrayParser(value, undefined, 1115), // timestamp[]\n 1185: (value) => arrayParser(value, undefined, 1185), // timestamptz[]\n 1187: (value) => arrayParser(value, undefined, 1187), // interval[]\n 1182: (value) => arrayParser(value, undefined, 1182), // date[]\n};\n\nconst hasBuffer = typeof Buffer !== \"undefined\";\nconst normalizeNullableArray = (normalize: NormalizeCodec) =>\n arrayCompatNormalize((value) => (value === null ? null : normalize(value)));\n\n/** drizzle's codecs for pgwasm's value formats (the text protocol, pgwasm's default parsers). */\nexport const pgwasmCodecs: PgCodecs = refineGenericPgCodecs({\n bigint: {\n cast: castToText,\n castArray: castToTextArr,\n normalize: BigInt,\n normalizeArray: normalizeNullableArray(BigInt),\n },\n \"bigint:string\": { cast: castToText, castArray: castToTextArr },\n \"bigint:number\": {\n cast: castToText,\n castArray: castToTextArr,\n normalize: Number,\n normalizeArray: normalizeNullableArray(Number),\n },\n bigserial: {\n normalize: BigInt,\n normalizeArray: normalizeNullableArray(BigInt),\n cast: castToText,\n castArray: castToTextArr,\n },\n \"bigserial:number\": {\n cast: castToText,\n castArray: castToTextArr,\n normalize: Number,\n normalizeArray: normalizeNullableArray(Number),\n },\n \"numeric:number\": { normalize: Number, normalizeArray: normalizeNullableArray(Number) },\n \"numeric:bigint\": { normalize: BigInt, normalizeArray: normalizeNullableArray(BigInt) },\n bytea: hasBuffer\n ? {\n normalizeInJson: genericPgCodecs.bytea?.normalizeInJson,\n normalizeArrayInJson: genericPgCodecs.bytea?.normalizeArrayInJson,\n normalize: (value: Uint8Array) => Buffer.from(value),\n normalizeArray: normalizeNullableArray((value: Uint8Array) => Buffer.from(value)),\n }\n : {\n normalizeInJson: base64ToUint8Array,\n normalizeArrayInJson: arrayCompatNormalize(base64ToUint8Array),\n },\n interval: { castArray: castToTextArr },\n date: { castArray: castToTextArr, normalize: textToDate, normalizeArray: normalizeNullableArray(textToDate) },\n \"date:string\": { castArray: castToTextArr },\n timestamp: {\n castArray: castToTextArr,\n normalize: textToDateWithTz,\n normalizeArray: normalizeNullableArray(textToDateWithTz),\n },\n timestamptz: { castArray: castToTextArr, normalize: textToDate, normalizeArray: normalizeNullableArray(textToDate) },\n \"timestamp:string\": { castArray: castToTextArr },\n \"timestamptz:string\": { castArray: castToTextArr },\n json: { normalizeParam: (value: unknown) => (typeof value === \"object\" ? value : JSON.stringify(value)) },\n jsonb: { normalizeParam: (value: unknown) => (typeof value === \"object\" ? value : JSON.stringify(value)) },\n \"geometry(point)\": {\n normalizeArray: parseGeometryArrayAndNormalize(parseGeometryXY),\n castParam: (name: string) => `${name}::geometry`,\n castArrayParam: (name: string, _column: unknown, dimensions: number) =>\n `${name}::geometry${\"[]\".repeat(dimensions)}`,\n normalizeParamArray: makeGeometryArray,\n },\n \"geometry(point):tuple\": {\n normalizeArray: parseGeometryArrayAndNormalize(parseGeometryTuple),\n castParam: (name: string) => `${name}::geometry`,\n castArrayParam: (name: string, _column: unknown, dimensions: number) =>\n `${name}::geometry${\"[]\".repeat(dimensions)}`,\n normalizeParamArray: makeGeometryArray,\n },\n halfvec: {\n castParam: (name: string) => `${name}::halfvec`,\n castArrayParam: (name: string, _column: unknown, dimensions: number) =>\n `${name}::halfvec${\"[]\".repeat(dimensions)}`,\n // Codec callbacks receive array dimensions as their second argument, not a text delimiter.\n normalizeParamArray: (value) => makePgArray(value),\n },\n vector: {\n castParam: (name: string) => `${name}::vector`,\n castArrayParam: (name: string, _column: unknown, dimensions: number) => `${name}::vector${\"[]\".repeat(dimensions)}`,\n normalizeParamArray: (value) => makePgArray(value),\n },\n sparsevec: {\n normalizeArray: (value) => parsePgArray(value),\n castParam: (name: string) => `${name}::sparsevec`,\n castArrayParam: (name: string, _column: unknown, dimensions: number) =>\n `${name}::sparsevec${\"[]\".repeat(dimensions)}`,\n normalizeParamArray: (value) => makePgArray(value),\n },\n});\n",
7
- "// Began as a copy of drizzle-orm's PGlite driver (`src/pglite/*.ts` at 1.0.0-rc.4; Apache-2.0, © Drizzle Team\n// and contributors — see NOTICE). Changes: rebound from PGlite to pgwasm; the driver never constructs its\n// own database. Owned outright (ADR-0062).\n\nimport type { Cache } from \"drizzle-orm/cache/core/cache\";\nimport { NoopCache } from \"drizzle-orm/cache/core/cache\";\nimport type { QueryMetadata, WithCacheConfig } from \"drizzle-orm/cache/core/types\";\nimport { entityKind } from \"drizzle-orm/entity\";\nimport { NoopLogger, type Logger } from \"drizzle-orm/logger\";\nimport { PgAsyncPreparedQuery, PgAsyncSession, PgAsyncTransaction } from \"drizzle-orm/pg-core/async/session\";\nimport type { PgDialect } from \"drizzle-orm/pg-core/dialect\";\nimport type { PgQueryResultHKT, PgTransactionConfig, PreparedQueryConfig } from \"drizzle-orm/pg-core/session\";\nimport type { AnyRelations } from \"drizzle-orm/relations\";\nimport { sql, type Query } from \"drizzle-orm/sql/sql\";\nimport type { Assume } from \"drizzle-orm/utils\";\n\nimport type { Pgwasm, Results, Row, Transaction } from \"../interface\";\nimport { drizzleParsers } from \"./codecs\";\n\n/** What a session runs statements on: a database, or a transaction's handle. */\nexport type PgwasmSessionClient = Pick<Pgwasm, \"query\"> & Partial<Pick<Pgwasm, \"transaction\">>;\n\nexport interface PgwasmSessionOptions {\n logger?: Logger;\n cache?: Cache;\n paramsInErrors?: boolean;\n}\n\nexport interface PgwasmQueryResultHKT extends PgQueryResultHKT {\n type: Results<Assume<this[\"row\"], Row>>;\n}\n\nexport class PgwasmSession<TRelations extends AnyRelations> extends PgAsyncSession<PgwasmQueryResultHKT, TRelations> {\n static override readonly [entityKind]: string = \"PgwasmSession\";\n readonly #client: PgwasmSessionClient;\n readonly #relations: TRelations;\n readonly #options: PgwasmSessionOptions;\n readonly #logger: Logger;\n readonly #cache: Cache;\n\n constructor(\n client: PgwasmSessionClient,\n dialect: PgDialect,\n relations: TRelations,\n options: PgwasmSessionOptions = {},\n ) {\n super(dialect);\n this.#client = client;\n this.#relations = relations;\n this.#options = options;\n this.#logger = options.logger ?? new NoopLogger();\n this.#cache = options.cache ?? new NoopCache();\n }\n\n prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(\n query: Query,\n mode: \"arrays\" | \"objects\" | \"raw\",\n _name: string | boolean,\n mapper: ((rows: unknown[]) => unknown) | undefined,\n queryMetadata?: QueryMetadata,\n cacheConfig?: WithCacheConfig,\n ): PgAsyncPreparedQuery<T> {\n const executor = async (params?: unknown[]) => {\n const result = await this.#client.query(query.sql, params, {\n rowMode: mode === \"arrays\" ? \"array\" : \"object\",\n parsers: drizzleParsers,\n });\n return mode === \"raw\" ? result : result.rows;\n };\n return new PgAsyncPreparedQuery<T>(\n executor,\n query,\n mapper,\n mode,\n this.#logger,\n this.#cache,\n queryMetadata,\n cacheConfig,\n this.#options.paramsInErrors,\n );\n }\n\n async transaction<T>(\n transaction: (tx: PgwasmTransaction<TRelations>) => Promise<T>,\n config?: PgTransactionConfig,\n ): Promise<T> {\n const client = this.#client;\n if (client.transaction === undefined) {\n throw new Error(\"A transaction's session cannot begin another transaction; nest with tx.transaction().\");\n }\n return await client.transaction(async (handle: Transaction) => {\n const session = new PgwasmSession(handle, this.dialect, this.#relations, this.#options);\n const tx = new PgwasmTransaction(this.dialect, session, this.#relations, undefined, false);\n if (config) await tx.setTransaction(config);\n return await transaction(tx);\n });\n }\n}\n\nexport class PgwasmTransaction<TRelations extends AnyRelations> extends PgAsyncTransaction<\n PgwasmQueryResultHKT,\n TRelations\n> {\n static override readonly [entityKind]: string = \"PgwasmTransaction\";\n readonly #dialect: PgDialect;\n readonly #session: PgwasmSession<TRelations>;\n\n constructor(\n dialect: PgDialect,\n session: PgwasmSession<TRelations>,\n relations: TRelations,\n nestedIndex: number | undefined,\n parseRqbJson: boolean | undefined,\n ) {\n super(dialect, session, relations, nestedIndex, parseRqbJson);\n this.#dialect = dialect;\n this.#session = session;\n }\n\n async transaction<T>(transaction: (tx: PgwasmTransaction<TRelations>) => Promise<T>): Promise<T> {\n const savepointName = `sp${this.nestedIndex + 1}`;\n const tx = new PgwasmTransaction(this.#dialect, this.#session, this._.relations, this.nestedIndex + 1, false);\n await tx.execute(sql.raw(`savepoint ${savepointName}`));\n try {\n const result = await transaction(tx);\n await tx.execute(sql.raw(`release savepoint ${savepointName}`));\n return result;\n } catch (error) {\n await tx.execute(sql.raw(`rollback to savepoint ${savepointName}`));\n throw error;\n }\n }\n}\n"
5
+ "// Began as a copy of drizzle-orm's PGlite driver (`src/pglite/*.ts` at 1.0.0-rc.4; Apache-2.0, © Drizzle Team\n// and contributors — see NOTICE). Changes: rebound from PGlite to pgwasm; the driver never constructs its\n// own database; its own JIT capability probe. Owned outright (ADR-0062).\n\nimport { entityKind } from \"drizzle-orm/entity\";\nimport { DefaultLogger, type Logger } from \"drizzle-orm/logger\";\nimport { PgAsyncDatabase } from \"drizzle-orm/pg-core/async/db\";\nimport { PgDialect } from \"drizzle-orm/pg-core/dialect\";\nimport type { DrizzlePgConfig } from \"drizzle-orm/pg-core/utils\";\nimport type { AnyRelations, EmptyRelations } from \"drizzle-orm/relations\";\n\nimport { PgwasmError } from \"../errors\";\nimport type { Pgwasm } from \"../interface\";\nimport { pgwasmCodecs } from \"./codecs\";\nimport { PgwasmSession, type PgwasmQueryResultHKT, type PgwasmSessionClient } from \"./session\";\n\nexport class PgwasmDatabase<TRelations extends AnyRelations = EmptyRelations> extends PgAsyncDatabase<\n PgwasmQueryResultHKT,\n TRelations\n> {\n static override readonly [entityKind]: string = \"PgwasmDatabase\";\n}\n\n/**\n * Whether to use JIT row mappers: only when asked for (`jit: true`) and `new Function` works here. JIT\n * mappers are compiled with it, and a strict content security policy (an MV3 extension page's) makes it\n * throw; the driver then falls back to the premade mappers instead of failing every query.\n */\nexport function jitMappersUsable(requested: boolean | undefined): boolean {\n if (requested !== true) return false;\n try {\n // oxlint-disable-next-line typescript/no-implied-eval -- the probe: does this context allow it at all\n const identity = new Function(\"input\", '\"use strict\"; return input;') as (input: unknown) => unknown;\n return identity(true) === true;\n } catch {\n return false;\n }\n}\n\nfunction construct<TRelations extends AnyRelations, TClient extends PgwasmSessionClient>(\n client: TClient,\n config: DrizzlePgConfig<TRelations> = {},\n): PgwasmDatabase<TRelations> & { $client: TClient } {\n const dialect = new PgDialect({\n useJitMappers: jitMappersUsable(config.jit),\n codecs: config.codecs ?? pgwasmCodecs,\n });\n const logger: Logger | undefined =\n config.logger === true ? new DefaultLogger() : config.logger === false ? undefined : config.logger;\n const relations = (config.relations ?? {}) as TRelations;\n const session = new PgwasmSession<TRelations>(client, dialect, relations, {\n ...(logger ? { logger } : {}),\n ...(config.paramsInErrors !== undefined ? { paramsInErrors: config.paramsInErrors } : {}),\n });\n const db = new PgwasmDatabase<TRelations>(dialect, session, relations);\n return Object.assign(db, { $client: client });\n}\n\n/** drizzle's object form: its config, with the pgwasm database as `client`. */\nexport type PgwasmDrizzleConfig<\n TRelations extends AnyRelations = EmptyRelations,\n TClient extends Pgwasm = Pgwasm,\n> = DrizzlePgConfig<TRelations> & { client: TClient };\n\n/** The form of a `drizzle()` call that would have the driver open its own database. */\nexport type UnsupportedDrizzleForm = \"connection\" | \"connection string\" | \"no client\";\n\n/**\n * A `drizzle()` call without a pgwasm database: `drizzle({ connection })`, `drizzle(\"…\")`, `drizzle()`, or a\n * `client` that is not a pgwasm database. The driver never opens its own database: create one with\n * `createPgwasm()` and pass it in.\n */\nexport class UnsupportedDrizzleConfigError extends PgwasmError {\n override name = \"UnsupportedDrizzleConfigError\";\n readonly form: UnsupportedDrizzleForm;\n\n constructor(form: UnsupportedDrizzleForm) {\n const given =\n form === \"connection\"\n ? \"drizzle({ connection })\"\n : form === \"connection string\"\n ? \"drizzle(connectionString)\"\n : \"a drizzle() call without a pgwasm database\";\n super(\n `@pgxsinkit/pgwasm/drizzle does not open its own database, so ${given} is not supported: create the ` +\n \"database with createPgwasm() and pass it as drizzle(pg, config) or drizzle({ client: pg, ...config }).\",\n );\n this.form = form;\n }\n}\n\nfunction isPgwasm(value: unknown): value is Pgwasm {\n return typeof value === \"object\" && value !== null && typeof (value as Partial<Pgwasm>).query === \"function\";\n}\n\n/**\n * A Drizzle database over a pgwasm database: `drizzle(pg, config)`, or drizzle's object form\n * `drizzle({ client: pg, ...config })`, which is the same thing. The driver never opens its own database, so\n * the forms that would (`{ connection }`, a connection string) are not accepted; at runtime they throw\n * {@link UnsupportedDrizzleConfigError}.\n */\nexport function drizzle<TRelations extends AnyRelations = EmptyRelations, TClient extends Pgwasm = Pgwasm>(\n client: TClient,\n config?: DrizzlePgConfig<TRelations>,\n): PgwasmDatabase<TRelations> & { $client: TClient };\nexport function drizzle<TRelations extends AnyRelations = EmptyRelations, TClient extends Pgwasm = Pgwasm>(\n config: PgwasmDrizzleConfig<TRelations, TClient>,\n): PgwasmDatabase<TRelations> & { $client: TClient };\nexport function drizzle<TRelations extends AnyRelations = EmptyRelations>(\n clientOrConfig: Pgwasm | PgwasmDrizzleConfig<TRelations>,\n config?: DrizzlePgConfig<TRelations>,\n): PgwasmDatabase<TRelations> & { $client: Pgwasm } {\n const given: unknown = clientOrConfig;\n if (isPgwasm(given)) return construct(given, config);\n if (typeof given === \"string\") throw new UnsupportedDrizzleConfigError(\"connection string\");\n if (typeof given === \"object\" && given !== null) {\n const { client, ...rest } = given as Partial<PgwasmDrizzleConfig<TRelations>> & { connection?: unknown };\n // A `connection` next to a pgwasm `client` is ignored, as drizzle's own drivers do.\n if (isPgwasm(client)) return construct(client, rest);\n if (client === undefined && \"connection\" in given) throw new UnsupportedDrizzleConfigError(\"connection\");\n }\n throw new UnsupportedDrizzleConfigError(\"no client\");\n}\n\nconst unavailable: PgwasmSessionClient = {\n query: () => {\n throw new Error(\"drizzle.mock() has no database: build queries with it, run them elsewhere.\");\n },\n};\n\n/** A Drizzle database with no database behind it, for building SQL (`.toSQL()`). */\ndrizzle.mock = function mock<TRelations extends AnyRelations = EmptyRelations>(\n config?: DrizzlePgConfig<TRelations>,\n): PgwasmDatabase<TRelations> & { $client: \"$client is not available on drizzle.mock()\" } {\n const db = construct(unavailable, config);\n return Object.assign(db, { $client: \"$client is not available on drizzle.mock()\" as const });\n};\n",
6
+ "// Began as a copy of drizzle-orm's PGlite driver (`src/pglite/*.ts` at 1.0.0-rc.4; Apache-2.0, © Drizzle Team\n// and contributors — see NOTICE). Changes: rebound from PGlite to pgwasm; the driver never constructs its\n// own database. Owned outright (ADR-0062).\n\nimport type { NormalizeCodec } from \"drizzle-orm/codecs\";\nimport { makePgArray, parsePgArray } from \"drizzle-orm/pg-core/array\";\nimport {\n arrayCompatNormalize,\n genericPgCodecs,\n makeGeometryArray,\n parseGeometryArrayAndNormalize,\n parseGeometryTuple,\n parseGeometryXY,\n refineGenericPgCodecs,\n textToDate,\n textToDateWithTz,\n type PgCodecs,\n} from \"drizzle-orm/pg-core/codecs\";\nimport { pgHexToUint8Array } from \"drizzle-orm/utils\";\n\nimport { arrayParser, DATE, INTERVAL, TIMESTAMP, TIMESTAMPTZ, type Parser } from \"../types\";\n\n/**\n * The identity parsers the driver passes with every query: these types reach drizzle as Postgres'\n * text, and drizzle's codecs turn them into values. Array parsers keep each element's text while\n * preserving PostgreSQL nulls and dimensions; the scalar Date parser must not run before Drizzle's\n * mode-specific normalizer. Numeric arrays use pgwasm's native precision-preserving parser.\n */\nexport const drizzleParsers: Readonly<Record<number, Parser>> = {\n [TIMESTAMP]: (value) => value,\n [TIMESTAMPTZ]: (value) => value,\n [INTERVAL]: (value) => value,\n [DATE]: (value) => value,\n 1115: (value) => arrayParser(value, undefined, 1115), // timestamp[]\n 1185: (value) => arrayParser(value, undefined, 1185), // timestamptz[]\n 1187: (value) => arrayParser(value, undefined, 1187), // interval[]\n 1182: (value) => arrayParser(value, undefined, 1182), // date[]\n};\n\nconst hasBuffer = typeof Buffer !== \"undefined\";\nconst normalizeNullableArray = (normalize: NormalizeCodec) =>\n arrayCompatNormalize((value) => (value === null ? null : normalize(value)));\n\n/** drizzle's codecs for pgwasm's value formats (the text protocol, pgwasm's default parsers). */\nexport const pgwasmCodecs: PgCodecs = refineGenericPgCodecs({\n bigint: {\n normalize: BigInt,\n normalizeArray: normalizeNullableArray(BigInt),\n },\n \"bigint:string\": { normalize: String, normalizeArray: normalizeNullableArray(String) },\n \"bigint:number\": {\n normalize: Number,\n normalizeArray: normalizeNullableArray(Number),\n },\n bigserial: {\n normalize: BigInt,\n normalizeArray: normalizeNullableArray(BigInt),\n },\n \"bigserial:number\": {\n normalize: Number,\n normalizeArray: normalizeNullableArray(Number),\n },\n \"numeric:number\": { normalize: Number, normalizeArray: normalizeNullableArray(Number) },\n \"numeric:bigint\": { normalize: BigInt, normalizeArray: normalizeNullableArray(BigInt) },\n bytea: hasBuffer\n ? {\n normalizeInJson: genericPgCodecs.bytea?.normalizeInJson,\n normalizeArrayInJson: genericPgCodecs.bytea?.normalizeArrayInJson,\n normalize: (value: Uint8Array) => Buffer.from(value),\n normalizeArray: normalizeNullableArray((value: Uint8Array) => Buffer.from(value)),\n }\n : {\n normalizeInJson: pgHexToUint8Array,\n normalizeArrayInJson: arrayCompatNormalize(pgHexToUint8Array),\n },\n date: { normalize: textToDate, normalizeArray: normalizeNullableArray(textToDate) },\n timestamp: {\n normalize: textToDateWithTz,\n normalizeArray: normalizeNullableArray(textToDateWithTz),\n },\n timestamptz: { normalize: textToDate, normalizeArray: normalizeNullableArray(textToDate) },\n json: { normalizeParam: (value: unknown) => (typeof value === \"object\" ? value : JSON.stringify(value)) },\n jsonb: { normalizeParam: (value: unknown) => (typeof value === \"object\" ? value : JSON.stringify(value)) },\n \"geometry(point)\": {\n normalizeArray: parseGeometryArrayAndNormalize(parseGeometryXY),\n castParam: (name: string) => `${name}::geometry`,\n castArrayParam: (name: string, _column: unknown, dimensions: number) =>\n `${name}::geometry${\"[]\".repeat(dimensions)}`,\n normalizeParamArray: makeGeometryArray,\n },\n \"geometry(point):tuple\": {\n normalizeArray: parseGeometryArrayAndNormalize(parseGeometryTuple),\n castParam: (name: string) => `${name}::geometry`,\n castArrayParam: (name: string, _column: unknown, dimensions: number) =>\n `${name}::geometry${\"[]\".repeat(dimensions)}`,\n normalizeParamArray: makeGeometryArray,\n },\n halfvec: {\n castParam: (name: string) => `${name}::halfvec`,\n castArrayParam: (name: string, _column: unknown, dimensions: number) =>\n `${name}::halfvec${\"[]\".repeat(dimensions)}`,\n // Codec callbacks receive array dimensions as their second argument, not a text delimiter.\n normalizeParamArray: (value) => makePgArray(value),\n },\n vector: {\n castParam: (name: string) => `${name}::vector`,\n castArrayParam: (name: string, _column: unknown, dimensions: number) => `${name}::vector${\"[]\".repeat(dimensions)}`,\n normalizeParamArray: (value) => makePgArray(value),\n },\n sparsevec: {\n normalizeArray: (value) => parsePgArray(value),\n castParam: (name: string) => `${name}::sparsevec`,\n castArrayParam: (name: string, _column: unknown, dimensions: number) =>\n `${name}::sparsevec${\"[]\".repeat(dimensions)}`,\n normalizeParamArray: (value) => makePgArray(value),\n },\n});\n",
7
+ "// Began as a copy of drizzle-orm's PGlite driver (`src/pglite/*.ts` at 1.0.0-rc.4; Apache-2.0, © Drizzle Team\n// and contributors — see NOTICE). Changes: rebound from PGlite to pgwasm; the driver never constructs its\n// own database. Owned outright (ADR-0062).\n\nimport { entityKind } from \"drizzle-orm/entity\";\nimport { NoopLogger, type Logger } from \"drizzle-orm/logger\";\nimport { PgAsyncPreparedQuery, PgAsyncSession, PgAsyncTransaction } from \"drizzle-orm/pg-core/async/session\";\nimport type { PgDialect } from \"drizzle-orm/pg-core/dialect\";\nimport type { PgQueryResultHKT, PgTransactionConfig, PreparedQueryConfig } from \"drizzle-orm/pg-core/session\";\nimport type { AnyRelations } from \"drizzle-orm/relations\";\nimport { sql, type Query } from \"drizzle-orm/sql/sql\";\nimport type { Assume } from \"drizzle-orm/utils\";\n\nimport type { Pgwasm, Results, Row, Transaction } from \"../interface\";\nimport { drizzleParsers } from \"./codecs\";\n\n/** What a session runs statements on: a database, or a transaction's handle. */\nexport type PgwasmSessionClient = Pick<Pgwasm, \"query\"> & Partial<Pick<Pgwasm, \"transaction\">>;\n\nexport interface PgwasmSessionOptions {\n logger?: Logger;\n paramsInErrors?: boolean;\n}\n\nexport interface PgwasmQueryResultHKT extends PgQueryResultHKT {\n type: Results<Assume<this[\"row\"], Row>>;\n}\n\nexport class PgwasmSession<TRelations extends AnyRelations> extends PgAsyncSession<PgwasmQueryResultHKT, TRelations> {\n static override readonly [entityKind]: string = \"PgwasmSession\";\n readonly #client: PgwasmSessionClient;\n readonly #relations: TRelations;\n readonly #options: PgwasmSessionOptions;\n readonly #logger: Logger;\n\n constructor(\n client: PgwasmSessionClient,\n dialect: PgDialect,\n relations: TRelations,\n options: PgwasmSessionOptions = {},\n ) {\n super(dialect);\n this.#client = client;\n this.#relations = relations;\n this.#options = options;\n this.#logger = options.logger ?? new NoopLogger();\n }\n\n prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(\n query: Query,\n mode: \"arrays\" | \"objects\" | \"raw\" | \"call\",\n _name: string | boolean,\n mapper: ((rows: unknown[]) => unknown) | undefined,\n ): PgAsyncPreparedQuery<T> {\n const executor = async (params?: unknown[]) => {\n const result = await this.#client.query(query.sql, params, {\n rowMode: mode === \"arrays\" ? \"array\" : \"object\",\n ...(mode === \"call\" ? {} : { parsers: drizzleParsers }),\n });\n return mode === \"raw\" ? result : result.rows;\n };\n return new PgAsyncPreparedQuery<T>(executor, query, mapper, mode, this.#logger, this.#options.paramsInErrors);\n }\n\n async transaction<T>(\n transaction: (tx: PgwasmTransaction<TRelations>) => Promise<T>,\n config?: PgTransactionConfig,\n ): Promise<T> {\n const client = this.#client;\n if (client.transaction === undefined) {\n throw new Error(\"A transaction's session cannot begin another transaction; nest with tx.transaction().\");\n }\n return await client.transaction(async (handle: Transaction) => {\n const session = new PgwasmSession(handle, this.dialect, this.#relations, this.#options);\n const tx = new PgwasmTransaction(this.dialect, session, this.#relations, undefined, false);\n if (config) await tx.setTransaction(config);\n return await transaction(tx);\n });\n }\n}\n\nexport class PgwasmTransaction<TRelations extends AnyRelations> extends PgAsyncTransaction<\n PgwasmQueryResultHKT,\n TRelations\n> {\n static override readonly [entityKind]: string = \"PgwasmTransaction\";\n readonly #dialect: PgDialect;\n readonly #session: PgwasmSession<TRelations>;\n\n constructor(\n dialect: PgDialect,\n session: PgwasmSession<TRelations>,\n relations: TRelations,\n nestedIndex: number | undefined,\n parseRqbJson: boolean | undefined,\n ) {\n super(dialect, session, relations, nestedIndex, parseRqbJson);\n this.#dialect = dialect;\n this.#session = session;\n }\n\n async transaction<T>(transaction: (tx: PgwasmTransaction<TRelations>) => Promise<T>): Promise<T> {\n const savepointName = `sp${this.nestedIndex + 1}`;\n const tx = new PgwasmTransaction(this.#dialect, this.#session, this._.relations, this.nestedIndex + 1, false);\n await tx.execute(sql.raw(`savepoint ${savepointName}`));\n try {\n const result = await transaction(tx);\n await tx.execute(sql.raw(`release savepoint ${savepointName}`));\n return result;\n } catch (error) {\n await tx.execute(sql.raw(`rollback to savepoint ${savepointName}`));\n throw error;\n }\n }\n}\n"
8
8
  ],
9
- "mappings": ";;;;;;;;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MAAM,QAAiB;AAAA,EACvB,IAAI,SAAS,KAAK;AAAA,IAAG,OAAO,UAAU,OAAO,MAAM;AAAA,EACnD,IAAI,OAAO,UAAU;AAAA,IAAU,MAAM,IAAI,8BAA8B,mBAAmB;AAAA,EAC1F,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAAA,IAC/C,QAAQ,WAAW,SAAS;AAAA,IAE5B,IAAI,SAAS,MAAM;AAAA,MAAG,OAAO,UAAU,QAAQ,IAAI;AAAA,IACnD,IAAI,WAAW,aAAa,gBAAgB;AAAA,MAAO,MAAM,IAAI,8BAA8B,YAAY;AAAA,EACzG;AAAA,EACA,MAAM,IAAI,8BAA8B,WAAW;AAAA;AAGrD,IAAM,cAAmC;AAAA,EACvC,OAAO,MAAM;AAAA,IACX,MAAM,IAAI,MAAM,4EAA4E;AAAA;AAEhG;AAGA,QAAQ,OAAO,SAAS,IAAsD,CAC5E,QACwF;AAAA,EACxF,MAAM,KAAK,UAAU,aAAa,MAAM;AAAA,EACxC,OAAO,OAAO,OAAO,IAAI,EAAE,SAAS,6CAAsD,CAAC;AAAA;",
10
+ "debugId": "EA54608DFCE3360564756E2164756E21",
11
11
  "names": []
12
12
  }
@@ -1,5 +1,3 @@
1
- import type { Cache } from "drizzle-orm/cache/core/cache";
2
- import type { QueryMetadata, WithCacheConfig } from "drizzle-orm/cache/core/types";
3
1
  import { entityKind } from "drizzle-orm/entity";
4
2
  import { type Logger } from "drizzle-orm/logger";
5
3
  import { PgAsyncPreparedQuery, PgAsyncSession, PgAsyncTransaction } from "drizzle-orm/pg-core/async/session";
@@ -13,7 +11,6 @@ import type { Pgwasm, Results, Row } from "../interface";
13
11
  export type PgwasmSessionClient = Pick<Pgwasm, "query"> & Partial<Pick<Pgwasm, "transaction">>;
14
12
  export interface PgwasmSessionOptions {
15
13
  logger?: Logger;
16
- cache?: Cache;
17
14
  paramsInErrors?: boolean;
18
15
  }
19
16
  export interface PgwasmQueryResultHKT extends PgQueryResultHKT {
@@ -23,7 +20,7 @@ export declare class PgwasmSession<TRelations extends AnyRelations> extends PgAs
23
20
  #private;
24
21
  static readonly [entityKind]: string;
25
22
  constructor(client: PgwasmSessionClient, dialect: PgDialect, relations: TRelations, options?: PgwasmSessionOptions);
26
- prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, mode: "arrays" | "objects" | "raw", _name: string | boolean, mapper: ((rows: unknown[]) => unknown) | undefined, queryMetadata?: QueryMetadata, cacheConfig?: WithCacheConfig): PgAsyncPreparedQuery<T>;
23
+ prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, mode: "arrays" | "objects" | "raw" | "call", _name: string | boolean, mapper: ((rows: unknown[]) => unknown) | undefined): PgAsyncPreparedQuery<T>;
27
24
  transaction<T>(transaction: (tx: PgwasmTransaction<TRelations>) => Promise<T>, config?: PgTransactionConfig): Promise<T>;
28
25
  }
29
26
  export declare class PgwasmTransaction<TRelations extends AnyRelations> extends PgAsyncTransaction<PgwasmQueryResultHKT, TRelations> {
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/drizzle/session.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC7G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAC9G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,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AmB,GAC3B,OAAO,CAAC,CAAC,CAAC,CAWZ;CACF;AAED,qBAAa,iBAAiB,CAAC,UAAU,SAAS,YAAY,CAAE,SAAQ,kBAAkB,CACxF,oBAAoB,EACpB,UAAU,CACX;;IACC,gBAAyB,CAAC,UAAU,CAAC,EAAE,MAAM,CAAuB;IAIpE,YACE,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,EAClC,SAAS,EAAE,UAAU,EACrB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,YAAY,EAAE,OAAO,GAAG,SAAS,EAKlC;IAEK,WAAW,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,EAAE,iBAAiB,CAAC,UAAU,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAY/F;CACF"}
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  identifier2,
4
4
  raw2,
5
5
  createPgwasm2
6
- } from "./chunk-8q0zqcbv.js";
6
+ } from "./chunk-garmxqte.js";
7
7
  import {
8
8
  PgwasmError2,
9
9
  UnsupportedDataDirError2,
@@ -26,7 +26,7 @@ import {
26
26
  } from "./chunk-jnmd6w7f.js";
27
27
  import {
28
28
  DatabaseError2
29
- } from "./chunk-t3q74nsz.js";
29
+ } from "./chunk-c06zjbcj.js";
30
30
  export {
31
31
  BackupFormatError2 as BackupFormatError,
32
32
  BuildMarkerUnreadableError2 as BuildMarkerUnreadableError,
@@ -2,14 +2,14 @@
2
2
  import {
3
3
  randomId,
4
4
  parseDescribeStatementResults
5
- } from "../chunk-zm269na3.js";
5
+ } from "../chunk-10ebj4re.js";
6
6
  import {
7
7
  TEXT
8
8
  } from "../chunk-jnmd6w7f.js";
9
9
  import {
10
10
  serialize2,
11
11
  protocolAccessOf
12
- } from "../chunk-t3q74nsz.js";
12
+ } from "../chunk-c06zjbcj.js";
13
13
 
14
14
  // packages/pgwasm/src/live/debounce-mutex.ts
15
15
  function debounceMutex(fn) {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  createPgwasm2
4
- } from "../chunk-8q0zqcbv.js";
4
+ } from "../chunk-garmxqte.js";
5
5
  import {
6
6
  UnsupportedFeatureError2
7
7
  } from "../chunk-cpsnmzrf.js";
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  registerStrictSync,
13
13
  strictSyncOf
14
- } from "../chunk-t3q74nsz.js";
14
+ } from "../chunk-c06zjbcj.js";
15
15
 
16
16
  // packages/pgwasm/src/opfs/core/errors.ts
17
17
  var FS_ERRNO = {
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  Modes2,
4
4
  Parser2
5
- } from "../chunk-s6a029ak.js";
5
+ } from "../chunk-d2kpv98r.js";
6
6
  import {
7
7
  exports_messages,
8
8
  serialize2,
9
9
  protocolAccessOf
10
- } from "../chunk-t3q74nsz.js";
10
+ } from "../chunk-c06zjbcj.js";
11
11
  // packages/pgwasm/src/protocol/index.ts
12
12
  function protocol(pg) {
13
13
  return protocolAccessOf(pg);
@@ -1 +1 @@
1
- {"version":3,"file":"buffer-reader.d.ts","sourceRoot":"","sources":["../../../src/protocol/wire/buffer-reader.ts"],"names":[],"mappings":"AAMA,sEAAsE;AACtE,qBAAa,YAAY;;IAKvB,YAAY,MAAM,SAAI,EAErB;IAED,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAGvD;IAED,KAAK,IAAI,MAAM,CAId;IAED,MAAM,IAAI,MAAM,CAIf;IAED,IAAI,IAAI,MAAM,CAIb;IAED,KAAK,IAAI,MAAM,CAId;IAED,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7B;IAED,OAAO,IAAI,MAAM,CAShB;IAED,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAIhC;CACF"}
1
+ {"version":3,"file":"buffer-reader.d.ts","sourceRoot":"","sources":["../../../src/protocol/wire/buffer-reader.ts"],"names":[],"mappings":"AAMA,sEAAsE;AACtE,qBAAa,YAAY;;IAKvB,YAAY,MAAM,SAAI,EAErB;IAED,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAGvD;IAED,KAAK,IAAI,MAAM,CAId;IAED,MAAM,IAAI,MAAM,CAIf;IAED,IAAI,IAAI,MAAM,CAIb;IAED,KAAK,IAAI,MAAM,CAId;IAED,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAgB7B;IAED,OAAO,IAAI,MAAM,CAShB;IAED,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAIhC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"string-utils.d.ts","sourceRoot":"","sources":["../../../src/protocol/wire/string-utils.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CASlD"}
1
+ {"version":3,"file":"string-utils.d.ts","sourceRoot":"","sources":["../../../src/protocol/wire/string-utils.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAalD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgxsinkit/pgwasm",
3
- "version": "0.6.0-rc.1",
3
+ "version": "0.6.0",
4
4
  "keywords": [
5
5
  "tanstack-intent"
6
6
  ],
@@ -12,7 +12,7 @@ description: >-
12
12
  metadata:
13
13
  type: task
14
14
  library: "@pgxsinkit/pgwasm"
15
- library_version: "0.6.0-rc.1"
15
+ library_version: "0.6.0"
16
16
  source: https://pgxsinkit.github.io/packages/pgwasm/
17
17
  ---
18
18
 
package/src/core/parse.ts CHANGED
@@ -24,21 +24,34 @@ export function parseResults(
24
24
  const resultSets: Results<unknown>[] = [];
25
25
  let current: Results<unknown> = { rows: [], fields: [] };
26
26
  let affectedRows = 0;
27
- const parsers = { ...defaultParsers, ...options?.parsers };
27
+ // Instance parsers are already normalized; only per-query overrides need another map.
28
+ const parsers = options?.parsers === undefined ? defaultParsers : { ...defaultParsers, ...options.parsers };
28
29
 
29
30
  for (const message of messages) {
30
31
  if (message instanceof RowDescriptionMessage) {
31
32
  current.fields = message.fields.map((field) => ({ name: field.name, dataTypeID: field.dataTypeID }));
32
33
  } else if (message instanceof DataRowMessage) {
33
34
  const fields = current.fields;
34
- const typeOf = (index: number) => fields[index]?.dataTypeID ?? 0;
35
+ const values = message.fields;
35
36
  if (options?.rowMode === "array") {
36
- current.rows.push(message.fields.map((value, index) => parseType(value, typeOf(index), parsers)));
37
+ const row = new Array<unknown>(values.length);
38
+ for (let index = 0; index < values.length; index++) {
39
+ row[index] = parseType(values[index]!, fields[index]?.dataTypeID ?? 0, parsers);
40
+ }
41
+ current.rows.push(row);
37
42
  } else {
38
43
  const row: Row = {};
39
- message.fields.forEach((value, index) => {
40
- row[fields[index]?.name ?? String(index)] = parseType(value, typeOf(index), parsers);
41
- });
44
+ for (let index = 0; index < values.length; index++) {
45
+ const field = fields[index];
46
+ const name = field?.name ?? String(index);
47
+ const value = parseType(values[index]!, field?.dataTypeID ?? 0, parsers);
48
+ // SQL column names are data: assigning __proto__ on {} would invoke its inherited setter.
49
+ if (name === "__proto__") {
50
+ Object.defineProperty(row, name, { value, enumerable: true, writable: true, configurable: true });
51
+ } else {
52
+ row[name] = value;
53
+ }
54
+ }
42
55
  current.rows.push(row);
43
56
  }
44
57
  } else if (message instanceof CommandCompleteMessage) {
@@ -6,8 +6,6 @@ import type { NormalizeCodec } from "drizzle-orm/codecs";
6
6
  import { makePgArray, parsePgArray } from "drizzle-orm/pg-core/array";
7
7
  import {
8
8
  arrayCompatNormalize,
9
- castToText,
10
- castToTextArr,
11
9
  genericPgCodecs,
12
10
  makeGeometryArray,
13
11
  parseGeometryArrayAndNormalize,
@@ -18,7 +16,7 @@ import {
18
16
  textToDateWithTz,
19
17
  type PgCodecs,
20
18
  } from "drizzle-orm/pg-core/codecs";
21
- import { base64ToUint8Array } from "drizzle-orm/utils";
19
+ import { pgHexToUint8Array } from "drizzle-orm/utils";
22
20
 
23
21
  import { arrayParser, DATE, INTERVAL, TIMESTAMP, TIMESTAMPTZ, type Parser } from "../types";
24
22
 
@@ -46,27 +44,19 @@ const normalizeNullableArray = (normalize: NormalizeCodec) =>
46
44
  /** drizzle's codecs for pgwasm's value formats (the text protocol, pgwasm's default parsers). */
47
45
  export const pgwasmCodecs: PgCodecs = refineGenericPgCodecs({
48
46
  bigint: {
49
- cast: castToText,
50
- castArray: castToTextArr,
51
47
  normalize: BigInt,
52
48
  normalizeArray: normalizeNullableArray(BigInt),
53
49
  },
54
- "bigint:string": { cast: castToText, castArray: castToTextArr },
50
+ "bigint:string": { normalize: String, normalizeArray: normalizeNullableArray(String) },
55
51
  "bigint:number": {
56
- cast: castToText,
57
- castArray: castToTextArr,
58
52
  normalize: Number,
59
53
  normalizeArray: normalizeNullableArray(Number),
60
54
  },
61
55
  bigserial: {
62
56
  normalize: BigInt,
63
57
  normalizeArray: normalizeNullableArray(BigInt),
64
- cast: castToText,
65
- castArray: castToTextArr,
66
58
  },
67
59
  "bigserial:number": {
68
- cast: castToText,
69
- castArray: castToTextArr,
70
60
  normalize: Number,
71
61
  normalizeArray: normalizeNullableArray(Number),
72
62
  },
@@ -80,20 +70,15 @@ export const pgwasmCodecs: PgCodecs = refineGenericPgCodecs({
80
70
  normalizeArray: normalizeNullableArray((value: Uint8Array) => Buffer.from(value)),
81
71
  }
82
72
  : {
83
- normalizeInJson: base64ToUint8Array,
84
- normalizeArrayInJson: arrayCompatNormalize(base64ToUint8Array),
73
+ normalizeInJson: pgHexToUint8Array,
74
+ normalizeArrayInJson: arrayCompatNormalize(pgHexToUint8Array),
85
75
  },
86
- interval: { castArray: castToTextArr },
87
- date: { castArray: castToTextArr, normalize: textToDate, normalizeArray: normalizeNullableArray(textToDate) },
88
- "date:string": { castArray: castToTextArr },
76
+ date: { normalize: textToDate, normalizeArray: normalizeNullableArray(textToDate) },
89
77
  timestamp: {
90
- castArray: castToTextArr,
91
78
  normalize: textToDateWithTz,
92
79
  normalizeArray: normalizeNullableArray(textToDateWithTz),
93
80
  },
94
- timestamptz: { castArray: castToTextArr, normalize: textToDate, normalizeArray: normalizeNullableArray(textToDate) },
95
- "timestamp:string": { castArray: castToTextArr },
96
- "timestamptz:string": { castArray: castToTextArr },
81
+ timestamptz: { normalize: textToDate, normalizeArray: normalizeNullableArray(textToDate) },
97
82
  json: { normalizeParam: (value: unknown) => (typeof value === "object" ? value : JSON.stringify(value)) },
98
83
  jsonb: { normalizeParam: (value: unknown) => (typeof value === "object" ? value : JSON.stringify(value)) },
99
84
  "geometry(point)": {
@@ -1,7 +1,6 @@
1
1
  // Began as a copy of drizzle-orm's PGlite driver (`src/pglite/*.ts` at 1.0.0-rc.4; Apache-2.0, © Drizzle Team
2
2
  // and contributors — see NOTICE). Changes: rebound from PGlite to pgwasm; the driver never constructs its
3
- // own database; its own JIT capability probe; `$cache.invalidate` bound without changing the caller's
4
- // cache object. Owned outright (ADR-0062).
3
+ // own database; its own JIT capability probe. Owned outright (ADR-0062).
5
4
 
6
5
  import { entityKind } from "drizzle-orm/entity";
7
6
  import { DefaultLogger, type Logger } from "drizzle-orm/logger";
@@ -51,13 +50,9 @@ function construct<TRelations extends AnyRelations, TClient extends PgwasmSessio
51
50
  const relations = (config.relations ?? {}) as TRelations;
52
51
  const session = new PgwasmSession<TRelations>(client, dialect, relations, {
53
52
  ...(logger ? { logger } : {}),
54
- ...(config.cache ? { cache: config.cache } : {}),
55
53
  ...(config.paramsInErrors !== undefined ? { paramsInErrors: config.paramsInErrors } : {}),
56
54
  });
57
55
  const db = new PgwasmDatabase<TRelations>(dialect, session, relations);
58
- // `db.$cache.invalidate` is the cache's own invalidation; with no cache it stays the no-op it starts as.
59
- const cache = config.cache;
60
- if (cache) db.$cache = { invalidate: (params) => cache.onMutate(params) };
61
56
  return Object.assign(db, { $client: client });
62
57
  }
63
58
 
@@ -2,9 +2,6 @@
2
2
  // and contributors — see NOTICE). Changes: rebound from PGlite to pgwasm; the driver never constructs its
3
3
  // own database. Owned outright (ADR-0062).
4
4
 
5
- import type { Cache } from "drizzle-orm/cache/core/cache";
6
- import { NoopCache } from "drizzle-orm/cache/core/cache";
7
- import type { QueryMetadata, WithCacheConfig } from "drizzle-orm/cache/core/types";
8
5
  import { entityKind } from "drizzle-orm/entity";
9
6
  import { NoopLogger, type Logger } from "drizzle-orm/logger";
10
7
  import { PgAsyncPreparedQuery, PgAsyncSession, PgAsyncTransaction } from "drizzle-orm/pg-core/async/session";
@@ -22,7 +19,6 @@ export type PgwasmSessionClient = Pick<Pgwasm, "query"> & Partial<Pick<Pgwasm, "
22
19
 
23
20
  export interface PgwasmSessionOptions {
24
21
  logger?: Logger;
25
- cache?: Cache;
26
22
  paramsInErrors?: boolean;
27
23
  }
28
24
 
@@ -36,7 +32,6 @@ export class PgwasmSession<TRelations extends AnyRelations> extends PgAsyncSessi
36
32
  readonly #relations: TRelations;
37
33
  readonly #options: PgwasmSessionOptions;
38
34
  readonly #logger: Logger;
39
- readonly #cache: Cache;
40
35
 
41
36
  constructor(
42
37
  client: PgwasmSessionClient,
@@ -49,35 +44,22 @@ export class PgwasmSession<TRelations extends AnyRelations> extends PgAsyncSessi
49
44
  this.#relations = relations;
50
45
  this.#options = options;
51
46
  this.#logger = options.logger ?? new NoopLogger();
52
- this.#cache = options.cache ?? new NoopCache();
53
47
  }
54
48
 
55
49
  prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(
56
50
  query: Query,
57
- mode: "arrays" | "objects" | "raw",
51
+ mode: "arrays" | "objects" | "raw" | "call",
58
52
  _name: string | boolean,
59
53
  mapper: ((rows: unknown[]) => unknown) | undefined,
60
- queryMetadata?: QueryMetadata,
61
- cacheConfig?: WithCacheConfig,
62
54
  ): PgAsyncPreparedQuery<T> {
63
55
  const executor = async (params?: unknown[]) => {
64
56
  const result = await this.#client.query(query.sql, params, {
65
57
  rowMode: mode === "arrays" ? "array" : "object",
66
- parsers: drizzleParsers,
58
+ ...(mode === "call" ? {} : { parsers: drizzleParsers }),
67
59
  });
68
60
  return mode === "raw" ? result : result.rows;
69
61
  };
70
- return new PgAsyncPreparedQuery<T>(
71
- executor,
72
- query,
73
- mapper,
74
- mode,
75
- this.#logger,
76
- this.#cache,
77
- queryMetadata,
78
- cacheConfig,
79
- this.#options.paramsInErrors,
80
- );
62
+ return new PgAsyncPreparedQuery<T>(executor, query, mapper, mode, this.#logger, this.#options.paramsInErrors);
81
63
  }
82
64
 
83
65
  async transaction<T>(
@@ -44,6 +44,20 @@ export class BufferReader {
44
44
  }
45
45
 
46
46
  string(length: number): string {
47
+ const offset = this.#offset;
48
+ if (
49
+ Number.isInteger(offset) &&
50
+ offset >= 0 &&
51
+ Number.isInteger(length) &&
52
+ length >= 0 &&
53
+ length <= this.#bufferView.byteLength - offset
54
+ ) {
55
+ // Decode while the view is borrowed; only the resulting string escapes. Binary bytes() still owns its data.
56
+ const bytes = new Uint8Array(this.#bufferView.buffer, offset, length);
57
+ this.#offset += length;
58
+ return this.#decoder.decode(bytes);
59
+ }
60
+ // Keep slice's clipping/coercion and offset advancement for malformed input.
47
61
  return this.#decoder.decode(this.bytes(length));
48
62
  }
49
63
 
@@ -12,7 +12,11 @@ export function byteLengthUtf8(str: string): number {
12
12
  const code = str.charCodeAt(i);
13
13
  if (code > 0x7f && code <= 0x7ff) byteLength++;
14
14
  else if (code > 0x7ff && code <= 0xffff) byteLength += 2;
15
- if (code >= 0xdc00 && code <= 0xdfff) i--; // trail surrogate
15
+ if (code >= 0xdc00 && code <= 0xdfff) {
16
+ const previous = str.charCodeAt(i - 1);
17
+ // Only a valid pair shares four bytes; an unpaired surrogate encodes as U+FFFD.
18
+ if (previous >= 0xd800 && previous <= 0xdbff) i--;
19
+ }
16
20
  }
17
21
  return byteLength;
18
22
  }
@@ -1,11 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/core/names.ts", "../src/core/parse.ts"],
4
- "sourcesContent": [
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
- "// 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
- ],
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,eAAe,CAAC,M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