joist-orm 2.4.0 → 2.5.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.
Files changed (58) hide show
  1. package/build/drivers/PostgreJsDriver.cjs +216 -0
  2. package/build/drivers/PostgreJsDriver.cjs.map +1 -0
  3. package/build/drivers/PostgreJsDriver.d.cts +87 -0
  4. package/build/drivers/PostgreJsDriver.d.cts.map +1 -0
  5. package/build/drivers/PostgreJsDriver.d.mts +87 -0
  6. package/build/drivers/PostgreJsDriver.d.mts.map +1 -0
  7. package/build/drivers/PostgreJsDriver.js +212 -0
  8. package/build/drivers/PostgreJsDriver.js.map +1 -0
  9. package/build/drivers/PostgresDriver.cjs +165 -196
  10. package/build/drivers/PostgresDriver.cjs.map +1 -1
  11. package/build/drivers/PostgresDriver.d.cts +71 -47
  12. package/build/drivers/PostgresDriver.d.cts.map +1 -1
  13. package/build/drivers/PostgresDriver.d.mts +71 -47
  14. package/build/drivers/PostgresDriver.d.mts.map +1 -1
  15. package/build/drivers/PostgresDriver.js +164 -197
  16. package/build/drivers/PostgresDriver.js.map +1 -1
  17. package/build/drivers/WireRowData.cjs +26 -130
  18. package/build/drivers/WireRowData.cjs.map +1 -1
  19. package/build/drivers/WireRowData.d.cts +26 -33
  20. package/build/drivers/WireRowData.d.cts.map +1 -1
  21. package/build/drivers/WireRowData.d.mts +26 -33
  22. package/build/drivers/WireRowData.d.mts.map +1 -1
  23. package/build/drivers/WireRowData.js +27 -128
  24. package/build/drivers/WireRowData.js.map +1 -1
  25. package/build/drivers/binaryParsers.cjs +21 -13
  26. package/build/drivers/binaryParsers.cjs.map +1 -1
  27. package/build/drivers/binaryParsers.d.cts +16 -18
  28. package/build/drivers/binaryParsers.d.cts.map +1 -1
  29. package/build/drivers/binaryParsers.d.mts +16 -18
  30. package/build/drivers/binaryParsers.d.mts.map +1 -1
  31. package/build/drivers/binaryParsers.js +21 -13
  32. package/build/drivers/binaryParsers.js.map +1 -1
  33. package/build/drivers/patchPgProtocol.cjs.map +1 -1
  34. package/build/drivers/patchPgProtocol.d.cts +2 -3
  35. package/build/drivers/patchPgProtocol.d.cts.map +1 -1
  36. package/build/drivers/patchPgProtocol.d.mts +2 -3
  37. package/build/drivers/patchPgProtocol.d.mts.map +1 -1
  38. package/build/drivers/patchPgProtocol.js.map +1 -1
  39. package/build/drivers/postgresSql.cjs +145 -0
  40. package/build/drivers/postgresSql.cjs.map +1 -0
  41. package/build/drivers/postgresSql.d.cts +19 -0
  42. package/build/drivers/postgresSql.d.cts.map +1 -0
  43. package/build/drivers/postgresSql.d.mts +19 -0
  44. package/build/drivers/postgresSql.d.mts.map +1 -0
  45. package/build/drivers/postgresSql.js +143 -0
  46. package/build/drivers/postgresSql.js.map +1 -0
  47. package/build/index.js +1 -2
  48. package/build/pg-export.d.cts +1 -1
  49. package/build/pg-export.d.mts +1 -1
  50. package/build/postgrejs-export.cjs +3 -0
  51. package/build/postgrejs-export.d.cts +2 -0
  52. package/build/postgrejs-export.d.mts +2 -0
  53. package/build/postgrejs-export.js +1 -0
  54. package/build/seed.d.cts +1 -2
  55. package/build/seed.d.cts.map +1 -1
  56. package/build/seed.d.mts +1 -2
  57. package/build/seed.d.mts.map +1 -1
  58. package/package.json +38 -11
@@ -1,81 +1,105 @@
1
- import { Driver, DriverQueryResult, EntityManager, IdAssigner, JoinRowTodo, ParsedFindQuery, PreloadPlugin, RuntimeConfig, Todo } from "joist-core";
1
+ import { BinaryParse } from "./binaryParsers.cjs";
2
+ import { Driver, DriverQueryResult, EntityManager, IdAssigner, JoinRowTodo, ParsedFindQuery, PreloadPlugin, RowData, RuntimeConfig, Todo } from "joist-core";
2
3
  import pg from "pg";
3
4
  //#region src/drivers/PostgresDriver.d.ts
4
- interface PostgresDriverOpts {
5
+ export interface PostgresDriverOpts {
5
6
  idAssigner?: IdAssigner;
6
7
  /** Sets a default `PreloadPlugin` for any `EntityManager` that uses this driver. */
7
8
  preloadPlugin?: PreloadPlugin;
8
- /** Called after each query is executed, useful for testing/debugging. */
9
+ /** Observes SQL before submission; node-pg does not expose a query event. */
9
10
  onQuery?: (sql: string) => void;
10
11
  /**
11
- * Experimental: keeps entity find results as raw wire bytes and decodes each row/column cell
12
- * lazily on field access, instead of eagerly materializing POJO rows.
12
+ * Keeps entity find results as raw wire bytes and decodes cells on field access. Defaults to false.
13
13
  *
14
- * Applies to unpaginated `em.find`, `em.load`, and o2m/o2o/recursive relation loads against
15
- * the pure-JS pg client. Other loaders deliberately stay classic: paginated finds (small
16
- * pages, measured neutral), m2m join-table rows (narrow + fully read, where materialized rows
17
- * measured faster, and `JoinRows` owns/mutates them), lazy columns, and id/count loaders.
14
+ * Applies to em.find, em.load and o2m/o2o/recursive relation loads.
15
+ * Other loaders deliberately stay classic: m2m join-table
16
+ * rows (narrow, fully read and mutated by JoinRows), lazy columns, and id/count loaders.
18
17
  *
19
- * Lazy queries also request *binary* result format (prototype), decoding int/bool/float/text
20
- * cells — and, via the fast paths `setupLatestPgTypes` registers, date/timestamptz cells —
21
- * wire-bytes -> value with no intermediate strings; numeric/exotic cells render to pg's
22
- * canonical text and reuse the active text parsers for parity. `JOIST_LAZY_BINARY=0`
23
- * reverts lazy queries to text-format results. It
24
- * uses classic rows when the choice is knowable up-front (patching pg-protocol failed, or the
25
- * client is unsupported, i.e. pg-native — both warn once). If a connection turns out
26
- * mid-query to use an unpatched pg-protocol copy (a duplicate `pg` install), the query fails
27
- * with a descriptive error — a misconfiguration CI builds/smoketests will catch immediately.
28
- * Note deferred decoding also defers custom-parser errors from `await em.find` to first field
29
- * access. See JS-ROW-STORE-DESIGN.md.
18
+ * Binary cells use Joist's parser registry; JOIST_LAZY_BINARY=0 requests text results instead.
19
+ * If patching pg-protocol fails or the client is unsupported (i.e. pg-native), we warn and
20
+ * use classic rows. An unpatched duplicate pg-protocol discovered mid-query fails loudly
21
+ * rather than silently degrading. Deferred parsing also defers custom-parser errors from
22
+ * await em.find to field access. See JS-ROW-STORE-DESIGN.md.
30
23
  */
31
24
  lazyRows?: boolean;
32
25
  }
33
- /**
34
- * Implements the `Driver` interface for Postgres.
35
- *
36
- * This is the canonical driver implementation and leverages several aspects of
37
- * Postgres for the best performance, i.e.:
38
- *
39
- * - Deferred foreign key constraints are used to allow bulk inserting/updating
40
- * all entities without any topographic sorting/ordering issues.
41
- *
42
- * - Sequences are used to bulk-assign + then bulk-insert all entities, to again
43
- * avoid issues with ordering issues (cannot bulk insert A w/o knowing the id of B).
44
- *
45
- * - We use a pg-specific bulk update syntax.
46
- *
47
- * Query pipelining is enabled for clients created after driver construction unless the pool was
48
- * configured with `pipeline: false`.
49
- */
50
- declare class PostgresDriver implements Driver<pg.PoolClient> {
26
+ /** PostgreSQL over node-pg, with optional patched lazy row decoding. */
27
+ export declare class PostgresDriver implements Driver<pg.PoolClient> {
51
28
  #private;
52
29
  readonly pool: pg.Pool;
30
+ private readonly onQuery;
53
31
  readonly lazyRows: boolean;
54
- /** Defined only when `lazyRows` is enabled; its presence is the capability signal the EM checks. */
32
+ /** Its presence is the lazy-read capability signal checked by EntityManager. */
55
33
  readonly executeFindRowData: Driver["executeFindRowData"];
56
34
  constructor(pool: pg.Pool, opts?: PostgresDriverOpts);
35
+ /** Uses the transaction's socket when a transaction is active. */
36
+ private query;
37
+ /** Executes an entity find with the EntityManager's default limit. */
57
38
  executeFind(em: EntityManager, parsed: ParsedFindQuery, settings: {
58
39
  limit?: number;
59
40
  offset?: number;
60
41
  }): Promise<any[]>;
61
- /** Returns PostgreSQL's native command count and raw rows, including null counts for DDL. */
62
- executeQuery(em: EntityManager, sql: string, bindings: readonly any[]): Promise<DriverQueryResult>;
63
- transaction<T>(em: EntityManager, fn: (txn: pg.PoolClient) => Promise<T>): Promise<T>;
42
+ /** Returns native command counts and rows, including null counts for DDL. */
43
+ executeQuery(em: EntityManager, sql: string, bindings: readonly unknown[]): Promise<DriverQueryResult>;
44
+ /** Assigns identifiers with the configured strategy before dependent writes. */
64
45
  assignNewIds(_: EntityManager, todos: Record<string, Todo>): Promise<void>;
46
+ /** Flushes PostgreSQL operations on the active node-pg transaction. */
65
47
  flush(em: EntityManager, entityTodos: Record<string, Todo>, joinRows: Record<string, JoinRowTodo>): Promise<void>;
66
48
  get defaultPlugins(): {
67
49
  preloadPlugin: any;
68
50
  };
69
- private getMaybeInTxnClient;
51
+ /** Decodes immutable pg-protocol rows, falling back only for known unsupported clients. */
52
+ private findRowData;
53
+ /**
54
+ * Runs hooks and SQL on one checked-out native pg client.
55
+ *
56
+ * Nested calls reuse the active transaction rather than starting a second one.
57
+ */
58
+ transaction<T>(em: EntityManager, fn: (txn: pg.PoolClient) => Promise<T>): Promise<T>;
70
59
  }
71
60
  /**
72
61
  * Configures the `pg` driver with the best type parsers.
73
62
  *
74
63
  * In particular, pg's default `TIMESTAMPTZ` parser is very inefficient, and even just
75
- * pulling in the latest `pg-types` and installing the fixed parser makes a noticable
76
- * difference.
64
+ * pulling in the latest `pg-types` and installing the fixed parser makes a noticeable difference.
65
+ */
66
+ export declare function setupLatestPgTypes(temporal: RuntimeConfig["temporal"]): void;
67
+ /**
68
+ * Executes `sql` on an already-checked-out client, returning a {@link RowData} instead of
69
+ * materialized POJO rows.
70
+ *
71
+ * Uses a `pg` Query subclass that records each DataRow's raw payload bytes into the result
72
+ * (via the lazy DataRow message from `patchPgProtocol`) and never materializes per-cell
73
+ * strings or per-row objects. If the client's connection turns out to use an unpatched
74
+ * pg-protocol copy (i.e. the app's pool was built from a different `pg` install than the one
75
+ * joist-orm patched), the query fails with a descriptive error — a misconfiguration any CI
76
+ * build/smoketest will surface immediately, so we fail loudly rather than silently degrade.
77
+ * The rows already streamed are discarded; the connection itself stays usable.
78
+ *
79
+ * By default the query requests binary result format via the extended protocol.
80
+ * Pass `binary: false` for classic text-format results, or set `JOIST_LAZY_BINARY=0`
81
+ * for A/B benchmarking or as an escape hatch.
82
+ */
83
+ export declare function executeRowDataQuery(client: pg.PoolClient, sql: string, bindings: readonly any[], opts?: {
84
+ binary?: boolean;
85
+ }): Promise<RowData>;
86
+ /**
87
+ * Resolves each column's decoder from the query's RowDescription.
88
+ *
89
+ * Binary-format fields decode through Joist's own binary registry only (see
90
+ * `setBinaryTypeParser`) — `pg.types`/`TypeOverrides` are never consulted, and a column whose
91
+ * oid has no registered binary parser fails the query here, before any rows arrive, rather
92
+ * than guessing at a lossy decoding. Text-format fields (the `binary: false` escape hatch)
93
+ * decode by utf8-slicing the cell into the active text parser, resolved via `getTypeParser`
94
+ * (i.e. the pool/client `TypeOverrides` chain) or the global registry.
77
95
  */
78
- declare function setupLatestPgTypes(temporal: RuntimeConfig["temporal"]): void;
96
+ export declare function pgColumnDecoders(fields: Array<{
97
+ name: string;
98
+ dataTypeID: number;
99
+ format?: string;
100
+ }>, getTypeParser?: (dataTypeID: number) => (value: any) => any): {
101
+ name: string;
102
+ decode: BinaryParse;
103
+ }[];
79
104
  //#endregion
80
- export { PostgresDriver, PostgresDriverOpts, setupLatestPgTypes };
81
105
  //# sourceMappingURL=PostgresDriver.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PostgresDriver.d.cts","names":[],"sources":["../../src/drivers/PostgresDriver.ts"],"mappings":";;;UAwCiB;EACf,aAAa;;EAEb,gBAAgB;;EAEhB,WAAW;;;;;;;;;;;;;;;;;;;;;;EAsBX;;;;;;;;;;;;;;;;;;;cA2BW,0BAA0B,OAAO,GAAG;;WAUpC,MAAM,GAAG;WANX;;WAEA,oBAAoB;EAG7B,YACW,MAAM,GAAG,MAClB,OAAO;EAwBH,YACJ,IAAI,eACJ,QAAQ,iBACR;IAAY;IAAgB;MAC3B;;EAoCG,aAAa,IAAI,eAAe,aAAa,2BAA2B,QAAQ;EAQhF,YAAY,GAAG,IAAI,eAAe,KAAK,KAAK,GAAG,eAAe,QAAQ,KAAK,QAAQ;EA8BnF,aAAa,GAAG,eAAe,OAAO,eAAe,QAAQ;EAI7D,MACJ,IAAI,eACJ,aAAa,eAAe,OAC5B,UAAU,eAAe,eACxB;MAoBC;IACO;;UAGH;;;;;;;;;iBAgLM,mBAAmB,UAAU"}
1
+ {"version":3,"file":"PostgresDriver.d.cts","names":["_$__binaryParsers_ts0.BinaryParse"],"sources":["../../src/drivers/PostgresDriver.ts"],"mappings":";;;;iBAgCiB;EACf,aAAa;;EAEb,gBAAgB;;EAEhB,WAAW;;;;;;;;;;;;;;EAcX;;;qBAIW,0BAA0B,OAAO,GAAG;;WAUpC,MAAM,GAAG;mBANH;WACR;;WAEA,oBAAoB;EAE7B,YACW,MAAM,GAAG,MAClB,OAAO;;UAuBD;;EAMF,YACJ,IAAI,eACJ,QAAQ,iBACR;IAAY;IAAgB;MAC3B;;EAMG,aAAa,IAAI,eAAe,aAAa,+BAA+B,QAAQ;;EAMpF,aAAa,GAAG,eAAe,OAAO,eAAe,QAAQ;;EAK7D,MACJ,IAAI,eACJ,aAAa,eAAe,OAC5B,UAAU,eAAe,eACxB;MAMC;IACO;;;UAIG;;;;;;EAiCR,YAAY,GAAG,IAAI,eAAe,KAAK,KAAK,GAAG,eAAe,QAAQ,KAAK,QAAQ;;;;;;;;wBAmC3E,mBAAmB,UAAU;;;;;;;;;;;;;;;;;wBAmH7B,oBACd,QAAQ,GAAG,YACX,aACA,0BACA;EAAS;IACR,QAAQ;;;;;;;;;;;wBAuCK,iBACd,QAAQ;EAAQ;EAAc;EAAoB;IAClD,iBAAiB,wBAAwB;;UADjCA"}
@@ -1,81 +1,105 @@
1
- import { Driver, DriverQueryResult, EntityManager, IdAssigner, JoinRowTodo, ParsedFindQuery, PreloadPlugin, RuntimeConfig, Todo } from "joist-core";
1
+ import { BinaryParse } from "./binaryParsers.mjs";
2
+ import { Driver, DriverQueryResult, EntityManager, IdAssigner, JoinRowTodo, ParsedFindQuery, PreloadPlugin, RowData, RuntimeConfig, Todo } from "joist-core";
2
3
  import pg from "pg";
3
4
  //#region src/drivers/PostgresDriver.d.ts
4
- interface PostgresDriverOpts {
5
+ export interface PostgresDriverOpts {
5
6
  idAssigner?: IdAssigner;
6
7
  /** Sets a default `PreloadPlugin` for any `EntityManager` that uses this driver. */
7
8
  preloadPlugin?: PreloadPlugin;
8
- /** Called after each query is executed, useful for testing/debugging. */
9
+ /** Observes SQL before submission; node-pg does not expose a query event. */
9
10
  onQuery?: (sql: string) => void;
10
11
  /**
11
- * Experimental: keeps entity find results as raw wire bytes and decodes each row/column cell
12
- * lazily on field access, instead of eagerly materializing POJO rows.
12
+ * Keeps entity find results as raw wire bytes and decodes cells on field access. Defaults to false.
13
13
  *
14
- * Applies to unpaginated `em.find`, `em.load`, and o2m/o2o/recursive relation loads against
15
- * the pure-JS pg client. Other loaders deliberately stay classic: paginated finds (small
16
- * pages, measured neutral), m2m join-table rows (narrow + fully read, where materialized rows
17
- * measured faster, and `JoinRows` owns/mutates them), lazy columns, and id/count loaders.
14
+ * Applies to em.find, em.load and o2m/o2o/recursive relation loads.
15
+ * Other loaders deliberately stay classic: m2m join-table
16
+ * rows (narrow, fully read and mutated by JoinRows), lazy columns, and id/count loaders.
18
17
  *
19
- * Lazy queries also request *binary* result format (prototype), decoding int/bool/float/text
20
- * cells — and, via the fast paths `setupLatestPgTypes` registers, date/timestamptz cells —
21
- * wire-bytes -> value with no intermediate strings; numeric/exotic cells render to pg's
22
- * canonical text and reuse the active text parsers for parity. `JOIST_LAZY_BINARY=0`
23
- * reverts lazy queries to text-format results. It
24
- * uses classic rows when the choice is knowable up-front (patching pg-protocol failed, or the
25
- * client is unsupported, i.e. pg-native — both warn once). If a connection turns out
26
- * mid-query to use an unpatched pg-protocol copy (a duplicate `pg` install), the query fails
27
- * with a descriptive error — a misconfiguration CI builds/smoketests will catch immediately.
28
- * Note deferred decoding also defers custom-parser errors from `await em.find` to first field
29
- * access. See JS-ROW-STORE-DESIGN.md.
18
+ * Binary cells use Joist's parser registry; JOIST_LAZY_BINARY=0 requests text results instead.
19
+ * If patching pg-protocol fails or the client is unsupported (i.e. pg-native), we warn and
20
+ * use classic rows. An unpatched duplicate pg-protocol discovered mid-query fails loudly
21
+ * rather than silently degrading. Deferred parsing also defers custom-parser errors from
22
+ * await em.find to field access. See JS-ROW-STORE-DESIGN.md.
30
23
  */
31
24
  lazyRows?: boolean;
32
25
  }
33
- /**
34
- * Implements the `Driver` interface for Postgres.
35
- *
36
- * This is the canonical driver implementation and leverages several aspects of
37
- * Postgres for the best performance, i.e.:
38
- *
39
- * - Deferred foreign key constraints are used to allow bulk inserting/updating
40
- * all entities without any topographic sorting/ordering issues.
41
- *
42
- * - Sequences are used to bulk-assign + then bulk-insert all entities, to again
43
- * avoid issues with ordering issues (cannot bulk insert A w/o knowing the id of B).
44
- *
45
- * - We use a pg-specific bulk update syntax.
46
- *
47
- * Query pipelining is enabled for clients created after driver construction unless the pool was
48
- * configured with `pipeline: false`.
49
- */
50
- declare class PostgresDriver implements Driver<pg.PoolClient> {
26
+ /** PostgreSQL over node-pg, with optional patched lazy row decoding. */
27
+ export declare class PostgresDriver implements Driver<pg.PoolClient> {
51
28
  #private;
52
29
  readonly pool: pg.Pool;
30
+ private readonly onQuery;
53
31
  readonly lazyRows: boolean;
54
- /** Defined only when `lazyRows` is enabled; its presence is the capability signal the EM checks. */
32
+ /** Its presence is the lazy-read capability signal checked by EntityManager. */
55
33
  readonly executeFindRowData: Driver["executeFindRowData"];
56
34
  constructor(pool: pg.Pool, opts?: PostgresDriverOpts);
35
+ /** Uses the transaction's socket when a transaction is active. */
36
+ private query;
37
+ /** Executes an entity find with the EntityManager's default limit. */
57
38
  executeFind(em: EntityManager, parsed: ParsedFindQuery, settings: {
58
39
  limit?: number;
59
40
  offset?: number;
60
41
  }): Promise<any[]>;
61
- /** Returns PostgreSQL's native command count and raw rows, including null counts for DDL. */
62
- executeQuery(em: EntityManager, sql: string, bindings: readonly any[]): Promise<DriverQueryResult>;
63
- transaction<T>(em: EntityManager, fn: (txn: pg.PoolClient) => Promise<T>): Promise<T>;
42
+ /** Returns native command counts and rows, including null counts for DDL. */
43
+ executeQuery(em: EntityManager, sql: string, bindings: readonly unknown[]): Promise<DriverQueryResult>;
44
+ /** Assigns identifiers with the configured strategy before dependent writes. */
64
45
  assignNewIds(_: EntityManager, todos: Record<string, Todo>): Promise<void>;
46
+ /** Flushes PostgreSQL operations on the active node-pg transaction. */
65
47
  flush(em: EntityManager, entityTodos: Record<string, Todo>, joinRows: Record<string, JoinRowTodo>): Promise<void>;
66
48
  get defaultPlugins(): {
67
49
  preloadPlugin: any;
68
50
  };
69
- private getMaybeInTxnClient;
51
+ /** Decodes immutable pg-protocol rows, falling back only for known unsupported clients. */
52
+ private findRowData;
53
+ /**
54
+ * Runs hooks and SQL on one checked-out native pg client.
55
+ *
56
+ * Nested calls reuse the active transaction rather than starting a second one.
57
+ */
58
+ transaction<T>(em: EntityManager, fn: (txn: pg.PoolClient) => Promise<T>): Promise<T>;
70
59
  }
71
60
  /**
72
61
  * Configures the `pg` driver with the best type parsers.
73
62
  *
74
63
  * In particular, pg's default `TIMESTAMPTZ` parser is very inefficient, and even just
75
- * pulling in the latest `pg-types` and installing the fixed parser makes a noticable
76
- * difference.
64
+ * pulling in the latest `pg-types` and installing the fixed parser makes a noticeable difference.
65
+ */
66
+ export declare function setupLatestPgTypes(temporal: RuntimeConfig["temporal"]): void;
67
+ /**
68
+ * Executes `sql` on an already-checked-out client, returning a {@link RowData} instead of
69
+ * materialized POJO rows.
70
+ *
71
+ * Uses a `pg` Query subclass that records each DataRow's raw payload bytes into the result
72
+ * (via the lazy DataRow message from `patchPgProtocol`) and never materializes per-cell
73
+ * strings or per-row objects. If the client's connection turns out to use an unpatched
74
+ * pg-protocol copy (i.e. the app's pool was built from a different `pg` install than the one
75
+ * joist-orm patched), the query fails with a descriptive error — a misconfiguration any CI
76
+ * build/smoketest will surface immediately, so we fail loudly rather than silently degrade.
77
+ * The rows already streamed are discarded; the connection itself stays usable.
78
+ *
79
+ * By default the query requests binary result format via the extended protocol.
80
+ * Pass `binary: false` for classic text-format results, or set `JOIST_LAZY_BINARY=0`
81
+ * for A/B benchmarking or as an escape hatch.
82
+ */
83
+ export declare function executeRowDataQuery(client: pg.PoolClient, sql: string, bindings: readonly any[], opts?: {
84
+ binary?: boolean;
85
+ }): Promise<RowData>;
86
+ /**
87
+ * Resolves each column's decoder from the query's RowDescription.
88
+ *
89
+ * Binary-format fields decode through Joist's own binary registry only (see
90
+ * `setBinaryTypeParser`) — `pg.types`/`TypeOverrides` are never consulted, and a column whose
91
+ * oid has no registered binary parser fails the query here, before any rows arrive, rather
92
+ * than guessing at a lossy decoding. Text-format fields (the `binary: false` escape hatch)
93
+ * decode by utf8-slicing the cell into the active text parser, resolved via `getTypeParser`
94
+ * (i.e. the pool/client `TypeOverrides` chain) or the global registry.
77
95
  */
78
- declare function setupLatestPgTypes(temporal: RuntimeConfig["temporal"]): void;
96
+ export declare function pgColumnDecoders(fields: Array<{
97
+ name: string;
98
+ dataTypeID: number;
99
+ format?: string;
100
+ }>, getTypeParser?: (dataTypeID: number) => (value: any) => any): {
101
+ name: string;
102
+ decode: BinaryParse;
103
+ }[];
79
104
  //#endregion
80
- export { PostgresDriver, PostgresDriverOpts, setupLatestPgTypes };
81
105
  //# sourceMappingURL=PostgresDriver.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PostgresDriver.d.mts","names":[],"sources":["../../src/drivers/PostgresDriver.ts"],"mappings":";;;UAwCiB;EACf,aAAa;;EAEb,gBAAgB;;EAEhB,WAAW;;;;;;;;;;;;;;;;;;;;;;EAsBX;;;;;;;;;;;;;;;;;;;cA2BW,0BAA0B,OAAO,GAAG;;WAUpC,MAAM,GAAG;WANX;;WAEA,oBAAoB;EAG7B,YACW,MAAM,GAAG,MAClB,OAAO;EAwBH,YACJ,IAAI,eACJ,QAAQ,iBACR;IAAY;IAAgB;MAC3B;;EAoCG,aAAa,IAAI,eAAe,aAAa,2BAA2B,QAAQ;EAQhF,YAAY,GAAG,IAAI,eAAe,KAAK,KAAK,GAAG,eAAe,QAAQ,KAAK,QAAQ;EA8BnF,aAAa,GAAG,eAAe,OAAO,eAAe,QAAQ;EAI7D,MACJ,IAAI,eACJ,aAAa,eAAe,OAC5B,UAAU,eAAe,eACxB;MAoBC;IACO;;UAGH;;;;;;;;;iBAgLM,mBAAmB,UAAU"}
1
+ {"version":3,"file":"PostgresDriver.d.mts","names":["_$__binaryParsers_ts0.BinaryParse"],"sources":["../../src/drivers/PostgresDriver.ts"],"mappings":";;;;iBAgCiB;EACf,aAAa;;EAEb,gBAAgB;;EAEhB,WAAW;;;;;;;;;;;;;;EAcX;;;qBAIW,0BAA0B,OAAO,GAAG;;WAUpC,MAAM,GAAG;mBANH;WACR;;WAEA,oBAAoB;EAE7B,YACW,MAAM,GAAG,MAClB,OAAO;;UAuBD;;EAMF,YACJ,IAAI,eACJ,QAAQ,iBACR;IAAY;IAAgB;MAC3B;;EAMG,aAAa,IAAI,eAAe,aAAa,+BAA+B,QAAQ;;EAMpF,aAAa,GAAG,eAAe,OAAO,eAAe,QAAQ;;EAK7D,MACJ,IAAI,eACJ,aAAa,eAAe,OAC5B,UAAU,eAAe,eACxB;MAMC;IACO;;;UAIG;;;;;;EAiCR,YAAY,GAAG,IAAI,eAAe,KAAK,KAAK,GAAG,eAAe,QAAQ,KAAK,QAAQ;;;;;;;;wBAmC3E,mBAAmB,UAAU;;;;;;;;;;;;;;;;;wBAmH7B,oBACd,QAAQ,GAAG,YACX,aACA,0BACA;EAAS;IACR,QAAQ;;;;;;;;;;;wBAuCK,iBACd,QAAQ;EAAQ;EAAc;EAAoB;IAClD,iBAAiB,wBAAwB;;UADjCA"}