joist-orm 2.3.0-next.41 → 2.3.0-next.43

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 (95) hide show
  1. package/build/_virtual/_rolldown/runtime.cjs +23 -0
  2. package/build/_virtual/_rolldown/runtime.js +5 -0
  3. package/build/codegen.cjs +19 -0
  4. package/build/codegen.cjs.map +1 -0
  5. package/build/codegen.d.cts +1 -0
  6. package/build/codegen.d.mts +1 -0
  7. package/build/codegen.js +11 -28
  8. package/build/codegen.js.map +1 -1
  9. package/build/drivers/PostgresDriver.cjs +290 -0
  10. package/build/drivers/PostgresDriver.cjs.map +1 -0
  11. package/build/drivers/PostgresDriver.d.cts +77 -0
  12. package/build/drivers/PostgresDriver.d.cts.map +1 -0
  13. package/build/drivers/PostgresDriver.d.mts +77 -0
  14. package/build/drivers/PostgresDriver.d.mts.map +1 -0
  15. package/build/drivers/PostgresDriver.js +249 -325
  16. package/build/drivers/PostgresDriver.js.map +1 -1
  17. package/build/drivers/WireRowData.cjs +374 -0
  18. package/build/drivers/WireRowData.cjs.map +1 -0
  19. package/build/drivers/WireRowData.d.cts +111 -0
  20. package/build/drivers/WireRowData.d.cts.map +1 -0
  21. package/build/drivers/WireRowData.d.mts +111 -0
  22. package/build/drivers/WireRowData.d.mts.map +1 -0
  23. package/build/drivers/WireRowData.js +352 -412
  24. package/build/drivers/WireRowData.js.map +1 -1
  25. package/build/drivers/binaryParsers.cjs +422 -0
  26. package/build/drivers/binaryParsers.cjs.map +1 -0
  27. package/build/drivers/{binaryParsers.d.ts → binaryParsers.d.cts} +18 -14
  28. package/build/drivers/binaryParsers.d.cts.map +1 -0
  29. package/build/drivers/binaryParsers.d.mts +80 -0
  30. package/build/drivers/binaryParsers.d.mts.map +1 -0
  31. package/build/drivers/binaryParsers.js +315 -385
  32. package/build/drivers/binaryParsers.js.map +1 -1
  33. package/build/drivers/patchPgProtocol.cjs +255 -0
  34. package/build/drivers/patchPgProtocol.cjs.map +1 -0
  35. package/build/drivers/{patchPgProtocol.d.ts → patchPgProtocol.d.cts} +18 -14
  36. package/build/drivers/patchPgProtocol.d.cts.map +1 -0
  37. package/build/drivers/patchPgProtocol.d.mts +47 -0
  38. package/build/drivers/patchPgProtocol.d.mts.map +1 -0
  39. package/build/drivers/patchPgProtocol.js +211 -232
  40. package/build/drivers/patchPgProtocol.js.map +1 -1
  41. package/build/graphql-codegen-export.cjs +10 -0
  42. package/build/graphql-codegen-export.d.cts +1 -0
  43. package/build/graphql-codegen-export.d.mts +1 -0
  44. package/build/graphql-codegen-export.js +2 -19
  45. package/build/graphql-export.cjs +10 -0
  46. package/build/graphql-export.d.cts +1 -0
  47. package/build/graphql-export.d.mts +1 -0
  48. package/build/graphql-export.js +2 -19
  49. package/build/index.cjs +41 -0
  50. package/build/index.d.cts +3 -0
  51. package/build/index.d.mts +3 -0
  52. package/build/index.js +3 -27
  53. package/build/knex-export.cjs +10 -0
  54. package/build/knex-export.d.cts +1 -0
  55. package/build/knex-export.d.mts +1 -0
  56. package/build/knex-export.js +2 -19
  57. package/build/pg-export.cjs +13 -0
  58. package/build/pg-export.d.cts +4 -0
  59. package/build/pg-export.d.mts +4 -0
  60. package/build/pg-export.js +4 -20
  61. package/build/pg-migrate.cjs +22 -0
  62. package/build/pg-migrate.cjs.map +1 -0
  63. package/build/pg-migrate.d.cts +1 -0
  64. package/build/pg-migrate.d.mts +1 -0
  65. package/build/pg-migrate.js +13 -28
  66. package/build/pg-migrate.js.map +1 -1
  67. package/build/seed.cjs +49 -0
  68. package/build/seed.cjs.map +1 -0
  69. package/build/{seed.d.ts → seed.d.cts} +5 -1
  70. package/build/seed.d.cts.map +1 -0
  71. package/build/seed.d.mts +24 -0
  72. package/build/seed.d.mts.map +1 -0
  73. package/build/seed.js +39 -45
  74. package/build/seed.js.map +1 -1
  75. package/build/tests-export.cjs +10 -0
  76. package/build/tests-export.d.cts +1 -0
  77. package/build/tests-export.d.mts +1 -0
  78. package/build/tests-export.js +2 -19
  79. package/package.json +150 -28
  80. package/build/codegen.d.ts +0 -2
  81. package/build/drivers/PostgresDriver.d.ts +0 -73
  82. package/build/drivers/WireRowData.d.ts +0 -107
  83. package/build/graphql-codegen-export.d.ts +0 -1
  84. package/build/graphql-codegen-export.js.map +0 -1
  85. package/build/graphql-export.d.ts +0 -1
  86. package/build/graphql-export.js.map +0 -1
  87. package/build/index.d.ts +0 -3
  88. package/build/index.js.map +0 -1
  89. package/build/knex-export.d.ts +0 -1
  90. package/build/knex-export.js.map +0 -1
  91. package/build/pg-export.d.ts +0 -3
  92. package/build/pg-export.js.map +0 -1
  93. package/build/pg-migrate.d.ts +0 -2
  94. package/build/tests-export.d.ts +0 -1
  95. package/build/tests-export.js.map +0 -1
@@ -1,3 +1,4 @@
1
+ //#region src/drivers/binaryParsers.d.ts
1
2
  /**
2
3
  * Joist's registry of PostgreSQL *binary-format* cell parsers, used by `WireRowData` for lazy
3
4
  * `em.find`/`em.load` results (which request binary output; see `executeRowDataQuery`).
@@ -22,11 +23,11 @@
22
23
  * `Temporal.PlainDate`/`ZonedDateTime`/etc. directly, and the temporal mappers pass
23
24
  * already-constructed instances through.
24
25
  */
25
- export declare function setBinaryTypeParser(oid: number, parse: BinaryParse): void;
26
+ declare function setBinaryTypeParser(oid: number, parse: BinaryParse): void;
26
27
  /** Returns the registered binary parser for `oid`, i.e. for tests to save/restore. */
27
- export declare function getBinaryTypeParser(oid: number): BinaryParse | undefined;
28
+ declare function getBinaryTypeParser(oid: number): BinaryParse | undefined;
28
29
  /** Decodes one binary cell directly from the payload chunk; `length` is the cell's byte length. */
29
- export type BinaryParse = (chunk: Buffer, start: number, length: number) => any;
30
+ type BinaryParse = (chunk: Buffer, start: number, length: number) => any;
30
31
  /**
31
32
  * Auto-registers binary parsers for the database's text-like dynamic-oid types — native enums
32
33
  * and citext, plus their array types — so apps get those for free.
@@ -35,19 +36,19 @@ export type BinaryParse = (chunk: Buffer, start: number, length: number) => any;
35
36
  * directly (i.e. at boot) if they want the registrations eagerly. Explicit
36
37
  * `setBinaryTypeParser` registrations are never overwritten.
37
38
  */
38
- export declare function registerDatabaseBinaryParsers(pool: {
39
- query(sql: string): Promise<{
40
- rows: any[];
41
- }>;
39
+ declare function registerDatabaseBinaryParsers(pool: {
40
+ query(sql: string): Promise<{
41
+ rows: any[];
42
+ }>;
42
43
  }): Promise<void>;
43
44
  /**
44
45
  * Sets the session `TimeZone` used to zone temporal-mode `timestamptz` loads; normally captured
45
46
  * automatically by {@link registerDatabaseBinaryParsers}. One zone per process — pools with
46
47
  * differing session TimeZones are not supported by the binary path.
47
48
  */
48
- export declare function setSessionTimeZone(timeZone: string): void;
49
+ declare function setSessionTimeZone(timeZone: string): void;
49
50
  /** Decodes a cell's bytes as utf8 text, i.e. for text-like custom types (enums, citext, domains). */
50
- export declare function binaryTextParser(chunk: Buffer, start: number, length: number): string;
51
+ declare function binaryTextParser(chunk: Buffer, start: number, length: number): string;
51
52
  /**
52
53
  * Decodes a binary array cell into a JS array of element values.
53
54
  *
@@ -56,13 +57,13 @@ export declare function binaryTextParser(chunk: Buffer, start: number, length: n
56
57
  * mode-appropriate temporal types) work without separate element wiring. Registered for the
57
58
  * standard `_type` oids below; register it for custom array oids as needed.
58
59
  */
59
- export declare function binaryArrayParser(chunk: Buffer, start: number, length: number): any[];
60
+ declare function binaryArrayParser(chunk: Buffer, start: number, length: number): any[];
60
61
  /** Decodes binary `date` cells to `Date`s, matching postgres-date's text semantics; Date mode. */
61
- export declare function binaryDateToDate(chunk: Buffer, start: number): any;
62
+ declare function binaryDateToDate(chunk: Buffer, start: number): any;
62
63
  /** Decodes binary `timestamp` (without zone) cells to local-time `Date`s; Date mode. */
63
- export declare function binaryTimestampToDate(chunk: Buffer, start: number): any;
64
+ declare function binaryTimestampToDate(chunk: Buffer, start: number): any;
64
65
  /** Decodes binary `timestamptz` cells to `Date`s (µs floor to ms, like the text parse); Date mode. */
65
- export declare function binaryTimestamptzToDate(chunk: Buffer, start: number): any;
66
+ declare function binaryTimestamptzToDate(chunk: Buffer, start: number): any;
66
67
  /**
67
68
  * Registers the Temporal-mode binary parsers: date/time/timestamp/timestamptz cells construct
68
69
  * `Temporal` values *directly* from the wire µs/days — no intermediate strings, no
@@ -73,4 +74,7 @@ export declare function binaryTimestamptzToDate(chunk: Buffer, start: number): a
73
74
  * session zone's offset at each instant (see `setSessionTimeZone`; the configured
74
75
  * `temporal.timeZone` only governs `now`-conversions, not loads).
75
76
  */
76
- export declare function registerTemporalBinaryParsers(): void;
77
+ declare function registerTemporalBinaryParsers(): void;
78
+ //#endregion
79
+ export { BinaryParse, binaryArrayParser, binaryDateToDate, binaryTextParser, binaryTimestampToDate, binaryTimestamptzToDate, getBinaryTypeParser, registerDatabaseBinaryParsers, registerTemporalBinaryParsers, setBinaryTypeParser, setSessionTimeZone };
80
+ //# sourceMappingURL=binaryParsers.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binaryParsers.d.cts","names":[],"sources":["../../src/drivers/binaryParsers.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;iBA0BgB,oBAAoB,aAAa,OAAO;;iBAKxC,oBAAoB,cAAc;;KAKtC,eAAe,OAAO,QAAQ,eAAe;;;;;;;;;iBAUnC,8BAA8B;EAClD,MAAM,cAAc;IAAU;;IAC5B;;;;;;iBA6BY,mBAAmB;;iBAOnB,iBAAiB,OAAO,QAAQ,eAAe;;;;;;;;;iBAY/C,kBAAkB,OAAO,QAAQ,eAAe;;iBAgChD,iBAAiB,OAAO,QAAQ;;iBAYhC,sBAAsB,OAAO,QAAQ;;iBAqBrC,wBAAwB,OAAO,QAAQ;;;;;;;;;;;iBAoBvC"}
@@ -0,0 +1,80 @@
1
+ //#region src/drivers/binaryParsers.d.ts
2
+ /**
3
+ * Joist's registry of PostgreSQL *binary-format* cell parsers, used by `WireRowData` for lazy
4
+ * `em.find`/`em.load` results (which request binary output; see `executeRowDataQuery`).
5
+ *
6
+ * This registry is deliberately **separate from `pg.types`**: `pg.types.setTypeParser` and
7
+ * pool/client `TypeOverrides` continue to govern classic *text* results (knex, `pool.query`,
8
+ * non-lazy drivers), while binary cells decode wire-bytes -> values directly — ints via
9
+ * `readInt32BE`, timestamps via µs arithmetic, Temporal values constructed without ever
10
+ * materializing a string. There is no fallback from one registry to the other:
11
+ *
12
+ * - Built-in parsers cover the standard scalar/array types below; `setupLatestPgTypes`
13
+ * registers the date/time parsers appropriate to Date-vs-Temporal mode.
14
+ * - Custom/extension types (native enums, citext, domains, hstore, ...) must be registered
15
+ * explicitly with {@link setBinaryTypeParser} — text-like types can use
16
+ * {@link binaryTextParser}, arrays of registered elements can use {@link binaryArrayParser}.
17
+ * - A query selecting a column whose oid has no registered parser **fails** with a descriptive
18
+ * error (see `WireRowData.setRowDescription`), rather than guessing at a lossy decoding.
19
+ *
20
+ * Values produced here should match what the classic text path produces for the same column
21
+ * (i.e. `numeric` stays a string, `int8` stays a string, Date-mode timestamps become `Date`s),
22
+ * so entities hydrate identically in either mode; Temporal-mode parsers construct
23
+ * `Temporal.PlainDate`/`ZonedDateTime`/etc. directly, and the temporal mappers pass
24
+ * already-constructed instances through.
25
+ */
26
+ declare function setBinaryTypeParser(oid: number, parse: BinaryParse): void;
27
+ /** Returns the registered binary parser for `oid`, i.e. for tests to save/restore. */
28
+ declare function getBinaryTypeParser(oid: number): BinaryParse | undefined;
29
+ /** Decodes one binary cell directly from the payload chunk; `length` is the cell's byte length. */
30
+ type BinaryParse = (chunk: Buffer, start: number, length: number) => any;
31
+ /**
32
+ * Auto-registers binary parsers for the database's text-like dynamic-oid types — native enums
33
+ * and citext, plus their array types — so apps get those for free.
34
+ *
35
+ * `PostgresDriver` calls this lazily before its first lazy query; apps can also call it
36
+ * directly (i.e. at boot) if they want the registrations eagerly. Explicit
37
+ * `setBinaryTypeParser` registrations are never overwritten.
38
+ */
39
+ declare function registerDatabaseBinaryParsers(pool: {
40
+ query(sql: string): Promise<{
41
+ rows: any[];
42
+ }>;
43
+ }): Promise<void>;
44
+ /**
45
+ * Sets the session `TimeZone` used to zone temporal-mode `timestamptz` loads; normally captured
46
+ * automatically by {@link registerDatabaseBinaryParsers}. One zone per process — pools with
47
+ * differing session TimeZones are not supported by the binary path.
48
+ */
49
+ declare function setSessionTimeZone(timeZone: string): void;
50
+ /** Decodes a cell's bytes as utf8 text, i.e. for text-like custom types (enums, citext, domains). */
51
+ declare function binaryTextParser(chunk: Buffer, start: number, length: number): string;
52
+ /**
53
+ * Decodes a binary array cell into a JS array of element values.
54
+ *
55
+ * The element oid is embedded in the wire format, and each element decodes through this
56
+ * registry — so arrays of any registered type (including custom-registered oids and the
57
+ * mode-appropriate temporal types) work without separate element wiring. Registered for the
58
+ * standard `_type` oids below; register it for custom array oids as needed.
59
+ */
60
+ declare function binaryArrayParser(chunk: Buffer, start: number, length: number): any[];
61
+ /** Decodes binary `date` cells to `Date`s, matching postgres-date's text semantics; Date mode. */
62
+ declare function binaryDateToDate(chunk: Buffer, start: number): any;
63
+ /** Decodes binary `timestamp` (without zone) cells to local-time `Date`s; Date mode. */
64
+ declare function binaryTimestampToDate(chunk: Buffer, start: number): any;
65
+ /** Decodes binary `timestamptz` cells to `Date`s (µs floor to ms, like the text parse); Date mode. */
66
+ declare function binaryTimestamptzToDate(chunk: Buffer, start: number): any;
67
+ /**
68
+ * Registers the Temporal-mode binary parsers: date/time/timestamp/timestamptz cells construct
69
+ * `Temporal` values *directly* from the wire µs/days — no intermediate strings, no
70
+ * `temporalMappers.fromDb` parsing (the mappers pass already-constructed instances through).
71
+ *
72
+ * `timestamptz` matches the text path's zoning exactly: classic parsing zones the value by the
73
+ * offset the session's `TimeZone` rendered (normalizing `+00` to `UTC`), so we compute the
74
+ * session zone's offset at each instant (see `setSessionTimeZone`; the configured
75
+ * `temporal.timeZone` only governs `now`-conversions, not loads).
76
+ */
77
+ declare function registerTemporalBinaryParsers(): void;
78
+ //#endregion
79
+ export { BinaryParse, binaryArrayParser, binaryDateToDate, binaryTextParser, binaryTimestampToDate, binaryTimestamptzToDate, getBinaryTypeParser, registerDatabaseBinaryParsers, registerTemporalBinaryParsers, setBinaryTypeParser, setSessionTimeZone };
80
+ //# sourceMappingURL=binaryParsers.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binaryParsers.d.mts","names":[],"sources":["../../src/drivers/binaryParsers.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;iBA0BgB,oBAAoB,aAAa,OAAO;;iBAKxC,oBAAoB,cAAc;;KAKtC,eAAe,OAAO,QAAQ,eAAe;;;;;;;;;iBAUnC,8BAA8B;EAClD,MAAM,cAAc;IAAU;;IAC5B;;;;;;iBA6BY,mBAAmB;;iBAOnB,iBAAiB,OAAO,QAAQ,eAAe;;;;;;;;;iBAY/C,kBAAkB,OAAO,QAAQ,eAAe;;iBAgChD,iBAAiB,OAAO,QAAQ;;iBAYhC,sBAAsB,OAAO,QAAQ;;iBAqBrC,wBAAwB,OAAO,QAAQ;;;;;;;;;;;iBAoBvC"}