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,274 +1,253 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LazyDataRowMessage = void 0;
4
- exports.ensureLazyDataRows = ensureLazyDataRows;
5
- const node_path_1 = require("node:path");
1
+ import { createRequire } from "node:module";
2
+ import { dirname, join } from "node:path";
3
+ //#region src/drivers/patchPgProtocol.ts
4
+ const runtimeRequire = createRequire(import.meta.url);
6
5
  /**
7
- * Patches pg-protocol at runtime so that DataRow messages are lazy *and* their bytes are
8
- * immutable, i.e. so `WireRowData` can retain raw row payloads by reference — no per-cell
9
- * strings, no per-row copies, no arena.
10
- *
11
- * We patch at runtime (instead of shipping a patched pg-protocol) so that installing joist-orm
12
- * requires no package-manager patch steps; see JS-ROW-STORE-DESIGN.md "Distribution". Two
13
- * prototype methods are replaced, porting brianc/node-postgres#3719 (which may or may not ever
14
- * land upstream — this patch is how we run its design in production regardless):
15
- *
16
- * - `handlePacket` (stable across pg-protocol 1.10-1.15) returns a {@link LazyDataRowMessage}
17
- * for DataRow packets and delegates every other message type to the original.
18
- * - `parse` replaces the recycled-scratch buffer management: each socket chunk is parsed *in
19
- * place*, and only the one message per chunk that straddles a read boundary is reassembled
20
- * into a buffer of its own, which is handed to that message and never touched again. Every
21
- * message therefore stays valid for as long as it is held (holding one pins the ~64 KiB chunk
22
- * it came from) — versus stock pg-protocol, which copies whole chunks into a scratch buffer
23
- * and compacts it in place over the bytes earlier messages point into.
24
- *
25
- * The patch verifies itself by round-tripping synthetic DataRows through a fresh `Parser` —
26
- * including a message that straddles chunks, retained across later reads that would clobber it
27
- * under the stock buffer management. On any mismatch (i.e. a future pg-protocol internals
28
- * rewrite), it un-patches and reports failure so the driver can fall back to classic rows.
29
- *
30
- * The lazy message's memoized `fields` getter decodes identically to the original for classic
31
- * consumers, i.e. pg's own `Result.parseRow(msg.fields)`.
32
- */
6
+ * Patches pg-protocol at runtime so that DataRow messages are lazy *and* their bytes are
7
+ * immutable, i.e. so `WireRowData` can retain raw row payloads by reference — no per-cell
8
+ * strings, no per-row copies, no arena.
9
+ *
10
+ * We patch at runtime (instead of shipping a patched pg-protocol) so that installing joist-orm
11
+ * requires no package-manager patch steps; see JS-ROW-STORE-DESIGN.md "Distribution". Two
12
+ * prototype methods are replaced, porting brianc/node-postgres#3719 (which may or may not ever
13
+ * land upstream — this patch is how we run its design in production regardless):
14
+ *
15
+ * - `handlePacket` (stable across pg-protocol 1.10-1.15) returns a {@link LazyDataRowMessage}
16
+ * for DataRow packets and delegates every other message type to the original.
17
+ * - `parse` replaces the recycled-scratch buffer management: each socket chunk is parsed *in
18
+ * place*, and only the one message per chunk that straddles a read boundary is reassembled
19
+ * into a buffer of its own, which is handed to that message and never touched again. Every
20
+ * message therefore stays valid for as long as it is held (holding one pins the ~64 KiB chunk
21
+ * it came from) — versus stock pg-protocol, which copies whole chunks into a scratch buffer
22
+ * and compacts it in place over the bytes earlier messages point into.
23
+ *
24
+ * The patch verifies itself by round-tripping synthetic DataRows through a fresh `Parser` —
25
+ * including a message that straddles chunks, retained across later reads that would clobber it
26
+ * under the stock buffer management. On any mismatch (i.e. a future pg-protocol internals
27
+ * rewrite), it un-patches and reports failure so the driver can fall back to classic rows.
28
+ *
29
+ * The lazy message's memoized `fields` getter decodes identically to the original for classic
30
+ * consumers, i.e. pg's own `Result.parseRow(msg.fields)`.
31
+ */
33
32
  function ensureLazyDataRows() {
34
- patched ??= tryPatch() ? "applied" : "failed";
35
- return patched === "applied";
33
+ patched ??= tryPatch() ? "applied" : "failed";
34
+ return patched === "applied";
36
35
  }
37
36
  /** A drop-in `DataRowMessage` that defers cell decoding; lazy consumers read `bytes`/`offset`. */
38
- class LazyDataRowMessage {
39
- length;
40
- bytes;
41
- offset;
42
- name = "dataRow";
43
- fieldCount;
44
- #fields = undefined;
45
- constructor(length,
46
- /** The row's payload bytes; immutable under our `parse` patch, so safe to retain. */
47
- bytes, offset) {
48
- this.length = length;
49
- this.bytes = bytes;
50
- this.offset = offset;
51
- this.fieldCount = bytes.readInt16BE(offset);
52
- }
53
- /** Lazily materializes the per-cell strings for classic consumers, i.e. pg's `Result.parseRow`. */
54
- get fields() {
55
- let fields = this.#fields;
56
- if (fields === undefined) {
57
- const { bytes, fieldCount } = this;
58
- fields = new Array(fieldCount);
59
- let pos = this.offset + 2;
60
- for (let i = 0; i < fieldCount; i++) {
61
- const len = bytes.readInt32BE(pos);
62
- pos += 4;
63
- if (len === -1) {
64
- fields[i] = null;
65
- }
66
- else {
67
- fields[i] = bytes.toString("utf8", pos, pos + len);
68
- pos += len;
69
- }
70
- }
71
- this.#fields = fields;
72
- }
73
- return fields;
74
- }
75
- }
76
- exports.LazyDataRowMessage = LazyDataRowMessage;
37
+ var LazyDataRowMessage = class {
38
+ length;
39
+ bytes;
40
+ offset;
41
+ name = "dataRow";
42
+ fieldCount;
43
+ #fields = void 0;
44
+ constructor(length, bytes, offset) {
45
+ this.length = length;
46
+ this.bytes = bytes;
47
+ this.offset = offset;
48
+ this.fieldCount = bytes.readInt16BE(offset);
49
+ }
50
+ /** Lazily materializes the per-cell strings for classic consumers, i.e. pg's `Result.parseRow`. */
51
+ get fields() {
52
+ let fields = this.#fields;
53
+ if (fields === void 0) {
54
+ const { bytes, fieldCount } = this;
55
+ fields = new Array(fieldCount);
56
+ let pos = this.offset + 2;
57
+ for (let i = 0; i < fieldCount; i++) {
58
+ const len = bytes.readInt32BE(pos);
59
+ pos += 4;
60
+ if (len === -1) fields[i] = null;
61
+ else {
62
+ fields[i] = bytes.toString("utf8", pos, pos + len);
63
+ pos += len;
64
+ }
65
+ }
66
+ this.#fields = fields;
67
+ }
68
+ return fields;
69
+ }
70
+ };
77
71
  let patched;
78
72
  /** The 'D' message-type byte identifying a DataRow packet. */
79
73
  const DATA_ROW_CODE = 68;
80
74
  const CODE_LENGTH = 1;
81
75
  const HEADER_LENGTH = 5;
82
76
  /** Cap on up-front allocation for a straddling message's claimed length, i.e. corrupt streams. */
83
- const MAX_EAGER_MESSAGE_LENGTH = 1024 * 1024;
77
+ const MAX_EAGER_MESSAGE_LENGTH = 1048576;
84
78
  const emptyBuffer = Buffer.allocUnsafe(0);
85
79
  /** Resolves pg's own pg-protocol Parser class and swaps in the lazy/immutable DataRow handling. */
86
80
  function tryPatch() {
87
- try {
88
- const { Parser, version } = resolvePgProtocol();
89
- // Only patch the protocol major we've verified `handlePacket`'s shape against (1.10-1.15);
90
- // anything else fails closed (the driver then uses classic rows) until explicitly vetted
91
- if (!/^1\./.test(version))
92
- return false;
93
- const originalHandlePacket = Parser.prototype.handlePacket;
94
- const originalParse = Parser.prototype.parse;
95
- if (typeof originalHandlePacket !== "function" || typeof originalParse !== "function")
96
- return false;
97
- Parser.prototype.handlePacket = function (offset, code, length, bytes) {
98
- if (code === DATA_ROW_CODE)
99
- return new LazyDataRowMessage(length, bytes, offset);
100
- return originalHandlePacket.call(this, offset, code, length, bytes);
101
- };
102
- Parser.prototype.parse = patchedParse;
103
- if (!verifyLazyDataRows(Parser) || !verifyImmutableBytes(Parser)) {
104
- Parser.prototype.handlePacket = originalHandlePacket;
105
- Parser.prototype.parse = originalParse;
106
- return false;
107
- }
108
- return true;
109
- }
110
- catch {
111
- return false;
112
- }
81
+ try {
82
+ const { Parser, version } = resolvePgProtocol();
83
+ if (!version.startsWith("1.")) return false;
84
+ const originalHandlePacket = Parser.prototype.handlePacket;
85
+ const originalParse = Parser.prototype.parse;
86
+ if (typeof originalHandlePacket !== "function" || typeof originalParse !== "function") return false;
87
+ Parser.prototype.handlePacket = function(offset, code, length, bytes) {
88
+ if (code === DATA_ROW_CODE) return new LazyDataRowMessage(length, bytes, offset);
89
+ return originalHandlePacket.call(this, offset, code, length, bytes);
90
+ };
91
+ Parser.prototype.parse = patchedParse;
92
+ if (!verifyLazyDataRows(Parser) || !verifyImmutableBytes(Parser)) {
93
+ Parser.prototype.handlePacket = originalHandlePacket;
94
+ Parser.prototype.parse = originalParse;
95
+ return false;
96
+ }
97
+ return true;
98
+ } catch {
99
+ return false;
100
+ }
113
101
  }
114
102
  /**
115
- * The ported #3719 `parse`: chunks are parsed in place, and only the message that straddles a
116
- * read boundary is reassembled into its own buffer (see `completePartial`). Partial state lives
117
- * on the parser instance under `_joist`-prefixed keys, so the stock fields are simply unused.
118
- */
103
+ * The ported #3719 `parse`: chunks are parsed in place, and only the message that straddles a
104
+ * read boundary is reassembled into its own buffer (see `completePartial`). Partial state lives
105
+ * on the parser instance under `_joist`-prefixed keys, so the stock fields are simply unused.
106
+ */
119
107
  function patchedParse(chunk, callback) {
120
- const chunkLength = chunk.byteLength;
121
- // finish the message the previous chunk cut in half, if any, before parsing this one
122
- let offset = this._joistPartialLength > 0 ? completePartial(this, chunk, callback) : 0;
123
- while (offset + HEADER_LENGTH <= chunkLength) {
124
- const code = chunk[offset];
125
- const length = chunk.readUInt32BE(offset + CODE_LENGTH);
126
- const fullMessageLength = CODE_LENGTH + length;
127
- if (fullMessageLength + offset <= chunkLength) {
128
- const message = this.handlePacket(offset + HEADER_LENGTH, code, length, chunk);
129
- callback(message);
130
- offset += fullMessageLength;
131
- }
132
- else {
133
- break;
134
- }
135
- }
136
- if (offset < chunkLength) {
137
- startPartial(this, chunk, offset);
138
- }
108
+ const chunkLength = chunk.byteLength;
109
+ let offset = this._joistPartialLength > 0 ? completePartial(this, chunk, callback) : 0;
110
+ while (offset + HEADER_LENGTH <= chunkLength) {
111
+ const code = chunk[offset];
112
+ const length = chunk.readUInt32BE(offset + CODE_LENGTH);
113
+ const fullMessageLength = CODE_LENGTH + length;
114
+ if (fullMessageLength + offset <= chunkLength) {
115
+ callback(this.handlePacket(offset + HEADER_LENGTH, code, length, chunk));
116
+ offset += fullMessageLength;
117
+ } else break;
118
+ }
119
+ if (offset < chunkLength) startPartial(this, chunk, offset);
139
120
  }
140
121
  /** Copies the trailing bytes of `chunk` that do not yet form a whole message into their own buffer. */
141
122
  function startPartial(parser, chunk, offset) {
142
- const remaining = chunk.byteLength - offset;
143
- parser._joistPartial = emptyBuffer;
144
- parser._joistPartialLength = 0;
145
- // the length is only known once the header is complete
146
- parser._joistPartialTotal = remaining >= HEADER_LENGTH ? CODE_LENGTH + chunk.readUInt32BE(offset + CODE_LENGTH) : -1;
147
- growPartial(parser, remaining);
148
- chunk.copy(parser._joistPartial, 0, offset);
149
- parser._joistPartialLength = remaining;
123
+ const remaining = chunk.byteLength - offset;
124
+ parser._joistPartial = emptyBuffer;
125
+ parser._joistPartialLength = 0;
126
+ parser._joistPartialTotal = remaining >= HEADER_LENGTH ? CODE_LENGTH + chunk.readUInt32BE(offset + CODE_LENGTH) : -1;
127
+ growPartial(parser, remaining);
128
+ chunk.copy(parser._joistPartial, 0, offset);
129
+ parser._joistPartialLength = remaining;
150
130
  }
151
131
  /**
152
- * Fills the straddling message from the head of `chunk` and emits it once whole, returning the
153
- * offset in `chunk` where parsing continues. The buffer is handed to the message and forgotten,
154
- * so nothing is ever parsed twice out of the same bytes and the message stays valid when held.
155
- */
132
+ * Fills the straddling message from the head of `chunk` and emits it once whole, returning the
133
+ * offset in `chunk` where parsing continues. The buffer is handed to the message and forgotten,
134
+ * so nothing is ever parsed twice out of the same bytes and the message stays valid when held.
135
+ */
156
136
  function completePartial(parser, chunk, callback) {
157
- let consumed = 0;
158
- if (parser._joistPartialTotal === -1) {
159
- // the header itself was split, so complete it before its length can be read
160
- consumed = Math.min(HEADER_LENGTH - parser._joistPartialLength, chunk.byteLength);
161
- chunk.copy(parser._joistPartial, parser._joistPartialLength, 0, consumed);
162
- parser._joistPartialLength += consumed;
163
- if (parser._joistPartialLength < HEADER_LENGTH)
164
- return consumed;
165
- parser._joistPartialTotal = CODE_LENGTH + parser._joistPartial.readUInt32BE(CODE_LENGTH);
166
- }
167
- if (parser._joistPartialLength < parser._joistPartialTotal) {
168
- const available = Math.min(parser._joistPartialTotal - parser._joistPartialLength, chunk.byteLength - consumed);
169
- growPartial(parser, parser._joistPartialLength + available);
170
- chunk.copy(parser._joistPartial, parser._joistPartialLength, consumed, consumed + available);
171
- parser._joistPartialLength += available;
172
- consumed += available;
173
- if (parser._joistPartialLength < parser._joistPartialTotal)
174
- return consumed;
175
- }
176
- const partial = parser._joistPartial;
177
- parser._joistPartial = emptyBuffer;
178
- parser._joistPartialLength = 0;
179
- parser._joistPartialTotal = -1;
180
- const message = parser.handlePacket(HEADER_LENGTH, partial[0], partial.readUInt32BE(CODE_LENGTH), partial);
181
- callback(message);
182
- return consumed;
137
+ let consumed = 0;
138
+ if (parser._joistPartialTotal === -1) {
139
+ consumed = Math.min(HEADER_LENGTH - parser._joistPartialLength, chunk.byteLength);
140
+ chunk.copy(parser._joistPartial, parser._joistPartialLength, 0, consumed);
141
+ parser._joistPartialLength += consumed;
142
+ if (parser._joistPartialLength < HEADER_LENGTH) return consumed;
143
+ parser._joistPartialTotal = CODE_LENGTH + parser._joistPartial.readUInt32BE(CODE_LENGTH);
144
+ }
145
+ if (parser._joistPartialLength < parser._joistPartialTotal) {
146
+ const available = Math.min(parser._joistPartialTotal - parser._joistPartialLength, chunk.byteLength - consumed);
147
+ growPartial(parser, parser._joistPartialLength + available);
148
+ chunk.copy(parser._joistPartial, parser._joistPartialLength, consumed, consumed + available);
149
+ parser._joistPartialLength += available;
150
+ consumed += available;
151
+ if (parser._joistPartialLength < parser._joistPartialTotal) return consumed;
152
+ }
153
+ const partial = parser._joistPartial;
154
+ parser._joistPartial = emptyBuffer;
155
+ parser._joistPartialLength = 0;
156
+ parser._joistPartialTotal = -1;
157
+ callback(parser.handlePacket(HEADER_LENGTH, partial[0], partial.readUInt32BE(CODE_LENGTH), partial));
158
+ return consumed;
183
159
  }
184
160
  /** Sizes the partial buffer to hold at least `needed` bytes, i.e. the whole message when known. */
185
161
  function growPartial(parser, needed) {
186
- if (needed <= parser._joistPartial.byteLength)
187
- return;
188
- const total = parser._joistPartialTotal;
189
- // grow geometrically, jumping straight to the message's full length when known and modest
190
- const whole = total === -1 ? HEADER_LENGTH : Math.min(total, MAX_EAGER_MESSAGE_LENGTH);
191
- let capacity = Math.max(needed, whole, parser._joistPartial.byteLength * 2);
192
- if (total !== -1 && capacity > total)
193
- capacity = total;
194
- const grown = Buffer.allocUnsafe(capacity);
195
- parser._joistPartial.copy(grown, 0, 0, parser._joistPartialLength);
196
- parser._joistPartial = grown;
162
+ if (needed <= parser._joistPartial.byteLength) return;
163
+ const total = parser._joistPartialTotal;
164
+ let capacity = Math.max(needed, total === -1 ? HEADER_LENGTH : Math.min(total, MAX_EAGER_MESSAGE_LENGTH), parser._joistPartial.byteLength * 2);
165
+ if (total !== -1 && capacity > total) capacity = total;
166
+ const grown = Buffer.allocUnsafe(capacity);
167
+ parser._joistPartial.copy(grown, 0, 0, parser._joistPartialLength);
168
+ parser._joistPartial = grown;
197
169
  }
198
170
  /** Loads the Parser class + version from the pg-protocol instance that `pg` itself resolves to. */
199
171
  function resolvePgProtocol() {
200
- // Resolve pg-protocol relative to pg, so that we patch the copy pg's Connections actually
201
- // use, even if the dependency tree has multiple pg-protocol installs
202
- const pgPath = require.resolve("pg");
203
- const parserPath = require.resolve("pg-protocol/dist/parser.js", { paths: [(0, node_path_1.dirname)(pgPath)] });
204
- // An absolute-path require bypasses the package's exports map, so this is always readable
205
- const { version } = require((0, node_path_1.join)((0, node_path_1.dirname)(parserPath), "..", "package.json"));
206
- return { Parser: require(parserPath).Parser, version };
172
+ const pgPath = runtimeRequire.resolve("pg");
173
+ const parserPath = runtimeRequire.resolve("pg-protocol/dist/parser.js", { paths: [dirname(pgPath)] });
174
+ const { version } = runtimeRequire(join(dirname(parserPath), "..", "package.json"));
175
+ return {
176
+ Parser: runtimeRequire(parserPath).Parser,
177
+ version
178
+ };
207
179
  }
208
180
  /** Round-trips a synthetic two-cell DataRow (utf8 + NULL) through a fresh patched Parser. */
209
181
  function verifyLazyDataRows(Parser) {
210
- const cell = Buffer.from("wörld", "utf8");
211
- const payload = Buffer.concat([
212
- Buffer.from([0, 2]), // int16 fieldCount
213
- int32(cell.length),
214
- cell,
215
- int32(-1), // NULL cell
216
- ]);
217
- const frame = Buffer.concat([Buffer.from("D"), int32(payload.length + 4), payload]);
218
- let ok = false;
219
- new Parser().parse(frame, (msg) => {
220
- ok =
221
- msg.name === "dataRow" &&
222
- msg.fieldCount === 2 &&
223
- msg.bytes !== undefined &&
224
- typeof msg.offset === "number" &&
225
- msg.fields.length === 2 &&
226
- msg.fields[0] === "wörld" &&
227
- msg.fields[1] === null;
228
- });
229
- return ok;
182
+ const cell = Buffer.from("wörld", "utf8");
183
+ const payload = Buffer.concat([
184
+ Buffer.from([0, 2]),
185
+ int32(cell.length),
186
+ cell,
187
+ int32(-1)
188
+ ]);
189
+ const frame = Buffer.concat([
190
+ Buffer.from("D"),
191
+ int32(payload.length + 4),
192
+ payload
193
+ ]);
194
+ let ok = false;
195
+ new Parser().parse(frame, (msg) => {
196
+ ok = msg.name === "dataRow" && msg.fieldCount === 2 && msg.bytes !== void 0 && typeof msg.offset === "number" && msg.fields.length === 2 && msg.fields[0] === "wörld" && msg.fields[1] === null;
197
+ });
198
+ return ok;
230
199
  }
231
200
  /**
232
- * Verifies a straddling DataRow's bytes survive later parser reads.
233
- *
234
- * We retain a message that straddles two chunks, drive a third read shaped to trigger the stock
235
- * parser's move-to-front compaction over its bytes, and only then decode the retained message's
236
- * cell (the `fields` getter memoizes, so it must not be read earlier). Under our `parse` patch
237
- * the straddler owns its buffer, so the cell decodes intact.
238
- */
201
+ * Verifies a straddling DataRow's bytes survive later parser reads.
202
+ *
203
+ * We retain a message that straddles two chunks, drive a third read shaped to trigger the stock
204
+ * parser's move-to-front compaction over its bytes, and only then decode the retained message's
205
+ * cell (the `fields` getter memoizes, so it must not be read earlier). Under our `parse` patch
206
+ * the straddler owns its buffer, so the cell decodes intact.
207
+ */
239
208
  function verifyImmutableBytes(Parser) {
240
- const cellB = "b".repeat(85);
241
- const frameA = dataRowFrame("aaaa"); // 15 bytes, fully inside chunk1
242
- const frameB = dataRowFrame(cellB); // 96 bytes, straddles chunk1/chunk2
243
- const frameC = dataRowFrame("c".repeat(45)); // 56 bytes, straddles chunk2/chunk3
244
- const chunk1 = Buffer.concat([frameA, frameB.subarray(0, 50)]);
245
- const chunk2 = Buffer.concat([frameB.subarray(50), frameC.subarray(0, 30)]);
246
- const chunk3 = Buffer.from(frameC.subarray(30));
247
- const messages = [];
248
- const parser = new Parser();
249
- function collect(msg) {
250
- messages.push(msg);
251
- }
252
- parser.parse(chunk1, collect);
253
- parser.parse(chunk2, collect);
254
- parser.parse(chunk3, collect);
255
- try {
256
- return messages.length === 3 && messages[1].name === "dataRow" && messages[1].fields[0] === cellB;
257
- }
258
- catch {
259
- return false;
260
- }
209
+ const cellB = "b".repeat(85);
210
+ const frameA = dataRowFrame("aaaa");
211
+ const frameB = dataRowFrame(cellB);
212
+ const frameC = dataRowFrame("c".repeat(45));
213
+ const chunk1 = Buffer.concat([frameA, frameB.subarray(0, 50)]);
214
+ const chunk2 = Buffer.concat([frameB.subarray(50), frameC.subarray(0, 30)]);
215
+ const chunk3 = Buffer.from(frameC.subarray(30));
216
+ const messages = [];
217
+ const parser = new Parser();
218
+ function collect(msg) {
219
+ messages.push(msg);
220
+ }
221
+ parser.parse(chunk1, collect);
222
+ parser.parse(chunk2, collect);
223
+ parser.parse(chunk3, collect);
224
+ try {
225
+ return messages.length === 3 && messages[1].name === "dataRow" && messages[1].fields[0] === cellB;
226
+ } catch {
227
+ return false;
228
+ }
261
229
  }
262
230
  /** Builds a complete one-cell DataRow frame (code + int32 length + payload) for `cell`. */
263
231
  function dataRowFrame(cell) {
264
- const bytes = Buffer.from(cell, "utf8");
265
- const payload = Buffer.concat([Buffer.from([0, 1]), int32(bytes.length), bytes]);
266
- return Buffer.concat([Buffer.from("D"), int32(payload.length + 4), payload]);
232
+ const bytes = Buffer.from(cell, "utf8");
233
+ const payload = Buffer.concat([
234
+ Buffer.from([0, 1]),
235
+ int32(bytes.length),
236
+ bytes
237
+ ]);
238
+ return Buffer.concat([
239
+ Buffer.from("D"),
240
+ int32(payload.length + 4),
241
+ payload
242
+ ]);
267
243
  }
268
244
  /** Returns a 4-byte big-endian buffer for `value`. */
269
245
  function int32(value) {
270
- const buffer = Buffer.alloc(4);
271
- buffer.writeInt32BE(value);
272
- return buffer;
246
+ const buffer = Buffer.alloc(4);
247
+ buffer.writeInt32BE(value);
248
+ return buffer;
273
249
  }
250
+ //#endregion
251
+ export { LazyDataRowMessage, ensureLazyDataRows };
252
+
274
253
  //# sourceMappingURL=patchPgProtocol.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"patchPgProtocol.js","sourceRoot":"","sources":["../../src/drivers/patchPgProtocol.ts"],"names":[],"mappings":";;;;AAAA,yCAA0C;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;IACE,OAAO,KAAK,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC9C,OAAO,OAAO,KAAK,SAAS,CAAC;AAC/B,CAAC;AAED,kGAAkG;AAClG;IAMoB,MAAM;IAEN,KAAK;IACL,MAAM;IARR,IAAI,GAAG,SAAS,CAAC;IACjB,UAAU,CAAS;IACnC,OAAO,GAAkC,SAAS,CAAC;IAEnD,YACkB,MAAc;IAC9B,qFAAqF;IACrE,KAAa,EACb,MAAc;sBAHd,MAAM;qB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,SAAS,KAAK,CAAC,KAAa;IAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAC3B,OAAO,MAAM,CAAC;AAChB,CAAC"}
1
+ {"version":3,"file":"patchPgProtocol.js","names":["#fields"],"sources":["../../src/drivers/patchPgProtocol.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport { dirname, join } from \"node:path\";\n\nconst runtimeRequire = createRequire(import.meta.url);\n\n/**\n * Patches pg-protocol at runtime so that DataRow messages are lazy *and* their bytes are\n * immutable, i.e. so `WireRowData` can retain raw row payloads by reference — no per-cell\n * strings, no per-row copies, no arena.\n *\n * We patch at runtime (instead of shipping a patched pg-protocol) so that installing joist-orm\n * requires no package-manager patch steps; see JS-ROW-STORE-DESIGN.md \"Distribution\". Two\n * prototype methods are replaced, porting brianc/node-postgres#3719 (which may or may not ever\n * land upstream — this patch is how we run its design in production regardless):\n *\n * - `handlePacket` (stable across pg-protocol 1.10-1.15) returns a {@link LazyDataRowMessage}\n * for DataRow packets and delegates every other message type to the original.\n * - `parse` replaces the recycled-scratch buffer management: each socket chunk is parsed *in\n * place*, and only the one message per chunk that straddles a read boundary is reassembled\n * into a buffer of its own, which is handed to that message and never touched again. Every\n * message therefore stays valid for as long as it is held (holding one pins the ~64 KiB chunk\n * it came from) — versus stock pg-protocol, which copies whole chunks into a scratch buffer\n * and compacts it in place over the bytes earlier messages point into.\n *\n * The patch verifies itself by round-tripping synthetic DataRows through a fresh `Parser` —\n * including a message that straddles chunks, retained across later reads that would clobber it\n * under the stock buffer management. On any mismatch (i.e. a future pg-protocol internals\n * rewrite), it un-patches and reports failure so the driver can fall back to classic rows.\n *\n * The lazy message's memoized `fields` getter decodes identically to the original for classic\n * consumers, i.e. pg's own `Result.parseRow(msg.fields)`.\n */\nexport function ensureLazyDataRows(): boolean {\n patched ??= tryPatch() ? \"applied\" : \"failed\";\n return patched === \"applied\";\n}\n\n/** A drop-in `DataRowMessage` that defers cell decoding; lazy consumers read `bytes`/`offset`. */\nexport class LazyDataRowMessage {\n public readonly name = \"dataRow\";\n public readonly fieldCount: number;\n #fields: (string | null)[] | undefined = undefined;\n\n constructor(\n public readonly length: number,\n /** The row's payload bytes; immutable under our `parse` patch, so safe to retain. */\n public readonly bytes: Buffer,\n public readonly offset: number,\n ) {\n this.fieldCount = bytes.readInt16BE(offset);\n }\n\n /** Lazily materializes the per-cell strings for classic consumers, i.e. pg's `Result.parseRow`. */\n get fields(): (string | null)[] {\n let fields = this.#fields;\n if (fields === undefined) {\n const { bytes, fieldCount } = this;\n fields = new Array(fieldCount);\n let pos = this.offset + 2;\n for (let i = 0; i < fieldCount; i++) {\n const len = bytes.readInt32BE(pos);\n pos += 4;\n if (len === -1) {\n fields[i] = null;\n } else {\n fields[i] = bytes.toString(\"utf8\", pos, pos + len);\n pos += len;\n }\n }\n this.#fields = fields;\n }\n return fields;\n }\n}\n\nlet patched: \"applied\" | \"failed\" | undefined;\n\n/** The 'D' message-type byte identifying a DataRow packet. */\nconst DATA_ROW_CODE = 68;\nconst CODE_LENGTH = 1;\nconst HEADER_LENGTH = 5;\n/** Cap on up-front allocation for a straddling message's claimed length, i.e. corrupt streams. */\nconst MAX_EAGER_MESSAGE_LENGTH = 1024 * 1024;\nconst emptyBuffer = Buffer.allocUnsafe(0);\n\n/** Resolves pg's own pg-protocol Parser class and swaps in the lazy/immutable DataRow handling. */\nfunction tryPatch(): boolean {\n try {\n const { Parser, version } = resolvePgProtocol();\n // Only patch the protocol major we've verified `handlePacket`'s shape against (1.10-1.15);\n // anything else fails closed (the driver then uses classic rows) until explicitly vetted\n if (!version.startsWith(\"1.\")) return false;\n const originalHandlePacket = Parser.prototype.handlePacket;\n const originalParse = Parser.prototype.parse;\n if (typeof originalHandlePacket !== \"function\" || typeof originalParse !== \"function\") return false;\n Parser.prototype.handlePacket = function (offset: number, code: number, length: number, bytes: Buffer) {\n if (code === DATA_ROW_CODE) return new LazyDataRowMessage(length, bytes, offset);\n return originalHandlePacket.call(this, offset, code, length, bytes);\n };\n Parser.prototype.parse = patchedParse;\n if (!verifyLazyDataRows(Parser) || !verifyImmutableBytes(Parser)) {\n Parser.prototype.handlePacket = originalHandlePacket;\n Parser.prototype.parse = originalParse;\n return false;\n }\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * The ported #3719 `parse`: chunks are parsed in place, and only the message that straddles a\n * read boundary is reassembled into its own buffer (see `completePartial`). Partial state lives\n * on the parser instance under `_joist`-prefixed keys, so the stock fields are simply unused.\n */\nfunction patchedParse(this: any, chunk: Buffer, callback: (msg: any) => void): void {\n const chunkLength = chunk.byteLength;\n // finish the message the previous chunk cut in half, if any, before parsing this one\n let offset = this._joistPartialLength > 0 ? completePartial(this, chunk, callback) : 0;\n while (offset + HEADER_LENGTH <= chunkLength) {\n const code = chunk[offset];\n const length = chunk.readUInt32BE(offset + CODE_LENGTH);\n const fullMessageLength = CODE_LENGTH + length;\n if (fullMessageLength + offset <= chunkLength) {\n const message = this.handlePacket(offset + HEADER_LENGTH, code, length, chunk);\n callback(message);\n offset += fullMessageLength;\n } else {\n break;\n }\n }\n if (offset < chunkLength) {\n startPartial(this, chunk, offset);\n }\n}\n\n/** Copies the trailing bytes of `chunk` that do not yet form a whole message into their own buffer. */\nfunction startPartial(parser: any, chunk: Buffer, offset: number): void {\n const remaining = chunk.byteLength - offset;\n parser._joistPartial = emptyBuffer;\n parser._joistPartialLength = 0;\n // the length is only known once the header is complete\n parser._joistPartialTotal = remaining >= HEADER_LENGTH ? CODE_LENGTH + chunk.readUInt32BE(offset + CODE_LENGTH) : -1;\n growPartial(parser, remaining);\n chunk.copy(parser._joistPartial, 0, offset);\n parser._joistPartialLength = remaining;\n}\n\n/**\n * Fills the straddling message from the head of `chunk` and emits it once whole, returning the\n * offset in `chunk` where parsing continues. The buffer is handed to the message and forgotten,\n * so nothing is ever parsed twice out of the same bytes and the message stays valid when held.\n */\nfunction completePartial(parser: any, chunk: Buffer, callback: (msg: any) => void): number {\n let consumed = 0;\n if (parser._joistPartialTotal === -1) {\n // the header itself was split, so complete it before its length can be read\n consumed = Math.min(HEADER_LENGTH - parser._joistPartialLength, chunk.byteLength);\n chunk.copy(parser._joistPartial, parser._joistPartialLength, 0, consumed);\n parser._joistPartialLength += consumed;\n if (parser._joistPartialLength < HEADER_LENGTH) return consumed;\n parser._joistPartialTotal = CODE_LENGTH + parser._joistPartial.readUInt32BE(CODE_LENGTH);\n }\n if (parser._joistPartialLength < parser._joistPartialTotal) {\n const available = Math.min(parser._joistPartialTotal - parser._joistPartialLength, chunk.byteLength - consumed);\n growPartial(parser, parser._joistPartialLength + available);\n chunk.copy(parser._joistPartial, parser._joistPartialLength, consumed, consumed + available);\n parser._joistPartialLength += available;\n consumed += available;\n if (parser._joistPartialLength < parser._joistPartialTotal) return consumed;\n }\n const partial = parser._joistPartial;\n parser._joistPartial = emptyBuffer;\n parser._joistPartialLength = 0;\n parser._joistPartialTotal = -1;\n const message = parser.handlePacket(HEADER_LENGTH, partial[0], partial.readUInt32BE(CODE_LENGTH), partial);\n callback(message);\n return consumed;\n}\n\n/** Sizes the partial buffer to hold at least `needed` bytes, i.e. the whole message when known. */\nfunction growPartial(parser: any, needed: number): void {\n if (needed <= parser._joistPartial.byteLength) return;\n const total = parser._joistPartialTotal;\n // grow geometrically, jumping straight to the message's full length when known and modest\n const whole = total === -1 ? HEADER_LENGTH : Math.min(total, MAX_EAGER_MESSAGE_LENGTH);\n let capacity = Math.max(needed, whole, parser._joistPartial.byteLength * 2);\n if (total !== -1 && capacity > total) capacity = total;\n const grown = Buffer.allocUnsafe(capacity);\n parser._joistPartial.copy(grown, 0, 0, parser._joistPartialLength);\n parser._joistPartial = grown;\n}\n\n/** Loads the Parser class + version from the pg-protocol instance that `pg` itself resolves to. */\nfunction resolvePgProtocol(): { Parser: any; version: string } {\n // Resolve pg-protocol relative to pg, so that we patch the copy pg's Connections actually\n // use, even if the dependency tree has multiple pg-protocol installs\n const pgPath = runtimeRequire.resolve(\"pg\");\n const parserPath = runtimeRequire.resolve(\"pg-protocol/dist/parser.js\", { paths: [dirname(pgPath)] });\n // An absolute-path require bypasses the package's exports map, so this is always readable\n const { version } = runtimeRequire(join(dirname(parserPath), \"..\", \"package.json\"));\n return { Parser: runtimeRequire(parserPath).Parser, version };\n}\n\n/** Round-trips a synthetic two-cell DataRow (utf8 + NULL) through a fresh patched Parser. */\nfunction verifyLazyDataRows(Parser: any): boolean {\n const cell = Buffer.from(\"wörld\", \"utf8\");\n const payload = Buffer.concat([\n Buffer.from([0, 2]), // int16 fieldCount\n int32(cell.length),\n cell,\n int32(-1), // NULL cell\n ]);\n const frame = Buffer.concat([Buffer.from(\"D\"), int32(payload.length + 4), payload]);\n let ok = false;\n new Parser().parse(frame, (msg: any) => {\n ok =\n msg.name === \"dataRow\" &&\n msg.fieldCount === 2 &&\n msg.bytes !== undefined &&\n typeof msg.offset === \"number\" &&\n msg.fields.length === 2 &&\n msg.fields[0] === \"wörld\" &&\n msg.fields[1] === null;\n });\n return ok;\n}\n\n/**\n * Verifies a straddling DataRow's bytes survive later parser reads.\n *\n * We retain a message that straddles two chunks, drive a third read shaped to trigger the stock\n * parser's move-to-front compaction over its bytes, and only then decode the retained message's\n * cell (the `fields` getter memoizes, so it must not be read earlier). Under our `parse` patch\n * the straddler owns its buffer, so the cell decodes intact.\n */\nfunction verifyImmutableBytes(Parser: any): boolean {\n const cellB = \"b\".repeat(85);\n const frameA = dataRowFrame(\"aaaa\"); // 15 bytes, fully inside chunk1\n const frameB = dataRowFrame(cellB); // 96 bytes, straddles chunk1/chunk2\n const frameC = dataRowFrame(\"c\".repeat(45)); // 56 bytes, straddles chunk2/chunk3\n const chunk1 = Buffer.concat([frameA, frameB.subarray(0, 50)]);\n const chunk2 = Buffer.concat([frameB.subarray(50), frameC.subarray(0, 30)]);\n const chunk3 = Buffer.from(frameC.subarray(30));\n const messages: any[] = [];\n const parser = new Parser();\n function collect(msg: any): void {\n messages.push(msg);\n }\n parser.parse(chunk1, collect);\n parser.parse(chunk2, collect);\n parser.parse(chunk3, collect);\n try {\n return messages.length === 3 && messages[1].name === \"dataRow\" && messages[1].fields[0] === cellB;\n } catch {\n return false;\n }\n}\n\n/** Builds a complete one-cell DataRow frame (code + int32 length + payload) for `cell`. */\nfunction dataRowFrame(cell: string): Buffer {\n const bytes = Buffer.from(cell, \"utf8\");\n const payload = Buffer.concat([Buffer.from([0, 1]), int32(bytes.length), bytes]);\n return Buffer.concat([Buffer.from(\"D\"), int32(payload.length + 4), payload]);\n}\n\n/** Returns a 4-byte big-endian buffer for `value`. */\nfunction int32(value: number): Buffer {\n const buffer = Buffer.alloc(4);\n buffer.writeInt32BE(value);\n return buffer;\n}\n"],"mappings":";;;AAGA,MAAM,iBAAiB,cAAc,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BpD,SAAgB,qBAA8B;CAC5C,YAAY,SAAS,IAAI,YAAY;CACrC,OAAO,YAAY;AACrB;;AAGA,IAAa,qBAAb,MAAgC;CAMZ;CAEA;CACA;CARlB,OAAuB;CACvB;CACA,UAAyC,KAAA;CAEzC,YACE,QAEA,OACA,QACA;EAJgB,KAAA,SAAA;EAEA,KAAA,QAAA;EACA,KAAA,SAAA;EAEhB,KAAK,aAAa,MAAM,YAAY,MAAM;CAC5C;;CAGA,IAAI,SAA4B;EAC9B,IAAI,SAAS,KAAKA;EAClB,IAAI,WAAW,KAAA,GAAW;GACxB,MAAM,EAAE,OAAO,eAAe;GAC9B,SAAS,IAAI,MAAM,UAAU;GAC7B,IAAI,MAAM,KAAK,SAAS;GACxB,KAAK,IAAI,IAAI,GAAG,IAAI,YAAY,KAAK;IACnC,MAAM,MAAM,MAAM,YAAY,GAAG;IACjC,OAAO;IACP,IAAI,QAAQ,IACV,OAAO,KAAK;SACP;KACL,OAAO,KAAK,MAAM,SAAS,QAAQ,KAAK,MAAM,GAAG;KACjD,OAAO;IACT;GACF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C,MAAM,SAAS,aAAa,KAAK;CACjC,MAAM,SAAS,aAAa,IAAI,OAAO,EAAE,CAAC;CAC1C,MAAM,SAAS,OAAO,OAAO,CAAC,QAAQ,OAAO,SAAS,GAAG,EAAE,CAAC,CAAC;CAC7D,MAAM,SAAS,OAAO,OAAO,CAAC,OAAO,SAAS,EAAE,GAAG,OAAO,SAAS,GAAG,EAAE,CAAC,CAAC;CAC1E,MAAM,SAAS,OAAO,KAAK,OAAO,SAAS,EAAE,CAAC;CAC9C,MAAM,WAAkB,CAAC;CACzB,MAAM,SAAS,IAAI,OAAO;CAC1B,SAAS,QAAQ,KAAgB;EAC/B,SAAS,KAAK,GAAG;CACnB;CACA,OAAO,MAAM,QAAQ,OAAO;CAC5B,OAAO,MAAM,QAAQ,OAAO;CAC5B,OAAO,MAAM,QAAQ,OAAO;CAC5B,IAAI;EACF,OAAO,SAAS,WAAW,KAAK,SAAS,EAAE,CAAC,SAAS,aAAa,SAAS,EAAE,CAAC,OAAO,OAAO;CAC9F,QAAQ;EACN,OAAO;CACT;AACF;;AAGA,SAAS,aAAa,MAAsB;CAC1C,MAAM,QAAQ,OAAO,KAAK,MAAM,MAAM;CACtC,MAAM,UAAU,OAAO,OAAO;EAAC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;EAAG,MAAM,MAAM,MAAM;EAAG;CAAK,CAAC;CAC/E,OAAO,OAAO,OAAO;EAAC,OAAO,KAAK,GAAG;EAAG,MAAM,QAAQ,SAAS,CAAC;EAAG;CAAO,CAAC;AAC7E;;AAGA,SAAS,MAAM,OAAuB;CACpC,MAAM,SAAS,OAAO,MAAM,CAAC;CAC7B,OAAO,aAAa,KAAK;CACzB,OAAO;AACT"}
@@ -0,0 +1,10 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ var joist_graphql_codegen = require("joist-graphql-codegen");
3
+ Object.keys(joist_graphql_codegen).forEach(function(k) {
4
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
+ enumerable: true,
6
+ get: function() {
7
+ return joist_graphql_codegen[k];
8
+ }
9
+ });
10
+ });
@@ -0,0 +1 @@
1
+ export * from "joist-graphql-codegen";
@@ -0,0 +1 @@
1
+ export * from "joist-graphql-codegen";
@@ -1,19 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- // Re-export everything from joist-graphql-codegen
18
- __exportStar(require("joist-graphql-codegen"), exports);
19
- //# sourceMappingURL=graphql-codegen-export.js.map
1
+ export * from "joist-graphql-codegen";
2
+ export {};
@@ -0,0 +1,10 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ var joist_graphql_resolver_utils = require("joist-graphql-resolver-utils");
3
+ Object.keys(joist_graphql_resolver_utils).forEach(function(k) {
4
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
+ enumerable: true,
6
+ get: function() {
7
+ return joist_graphql_resolver_utils[k];
8
+ }
9
+ });
10
+ });
@@ -0,0 +1 @@
1
+ export * from "joist-graphql-resolver-utils";
@@ -0,0 +1 @@
1
+ export * from "joist-graphql-resolver-utils";