@drzl/analyzer 1.17.0 → 1.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -51,7 +51,7 @@ Per column, beyond the type: `nullable`, `hasDefault`, `defaultValue` (literal d
51
51
  `isGenerated`, `enumValues`, `maxLength` (characters), `maxBytes` (MySQL's TEXT family is a byte
52
52
  budget, which is a different measurement on the same kind of column), `min`/`max`,
53
53
  `arrayDimensions`, `format`, and `shape` for values that are not scalars (json, buffer, tuple,
54
- vector, bitstring, customType).
54
+ numberObject, vector, bitstring, customType).
55
55
 
56
56
  `DRZL_ANL_UNKNOWN_COLUMN` is reported for any column whose validator would accept anything, which
57
57
  is the shape a missing type mapping takes: nothing throws, and every row passes.
package/dist/index.cjs CHANGED
@@ -63,13 +63,18 @@ var PG_FLOAT4_INPUT_MAX = "340282356779733661637539395458142568448";
63
63
  var PG_FLOAT4_RANGE = [`-${PG_FLOAT4_INPUT_MAX}`, PG_FLOAT4_INPUT_MAX];
64
64
  var MYSQL_FLOAT_RANGE = [`-${FLOAT32_MAX}`, FLOAT32_MAX];
65
65
  var JS_SAFE_INTEGER_BOUNDS = ["-9007199254740991", "9007199254740991"];
66
- var TUPLE_CLASS_SHAPES = {
66
+ var GEOMETRIC_CLASS_SHAPES = {
67
67
  // `line()` is the trap here: its `drizzle:entityKind` is `PgLine` while its constructor is
68
68
  // `PgLineTuple`, and this path matches on the constructor.
69
69
  PgPointTuple: { kind: "tuple", length: 2 },
70
- PgLineTuple: { kind: "tuple", length: 3 }
70
+ PgLineTuple: { kind: "tuple", length: 3 },
71
+ // The object modes. `line({ mode: 'abc' })` is a `PgLineABC` and not a `PgLineObject`, and any
72
+ // mode but `'tuple'` builds the object class: `point({ mode: 'abc' })` is a `PgPointObject` too.
73
+ PgPointObject: { kind: "numberObject", fields: ["x", "y"] },
74
+ PgLineABC: { kind: "numberObject", fields: ["a", "b", "c"] }
71
75
  };
72
76
  var V1_ONLY_ENTITY_KINDS = /^(?:MsSql|Cockroach)/;
77
+ var NUMBER_VECTOR_CLASSES = /* @__PURE__ */ new Set(["PgVector", "PgHalfVector"]);
73
78
  var BYTE_STRING_CLASSES = /* @__PURE__ */ new Set([
74
79
  "MySqlBinary",
75
80
  "MySqlVarBinary",
@@ -190,18 +195,38 @@ function describeV1Column(column) {
190
195
  };
191
196
  break;
192
197
  }
198
+ // Two modes per builder, and v1 states which in the JS half of the dataType it already
199
+ // carries: the tuple modes say `array point` / `array line` / `array geometry` and the object
200
+ // modes say `object point` / `object line` / `object geometry`. Read off real 1.0.0-rc.4
201
+ // columns rather than assumed. Both used to reach these arms and be called tuples, so a select
202
+ // schema for `point({ mode: 'xy' })` rejected every row the driver returned, on the major that
203
+ // describes the column outright.
204
+ //
205
+ // `js` rather than the codec, which also distinguishes them here (`point:tuple` against
206
+ // `point`): three dialects state a semantic with no codec at all on this release, so the codec
207
+ // is the weaker of the two signals and this file already prefers `js` elsewhere for the same
208
+ // reason.
193
209
  case "point":
194
210
  case "geometry":
195
- out.tsType = "[number, number]";
211
+ out.tsType = js === "object" ? "{ x: number; y: number }" : "[number, number]";
196
212
  out.dbType = semantic.toUpperCase();
197
- out.shape = { kind: "tuple", length: 2 };
213
+ out.shape = js === "object" ? { kind: "numberObject", fields: ["x", "y"] } : { kind: "tuple", length: 2 };
198
214
  break;
199
215
  case "line":
200
- out.tsType = "[number, number, number]";
216
+ out.tsType = js === "object" ? "{ a: number; b: number; c: number }" : "[number, number, number]";
201
217
  out.dbType = "LINE";
202
- out.shape = { kind: "tuple", length: 3 };
218
+ out.shape = js === "object" ? { kind: "numberObject", fields: ["a", "b", "c"] } : { kind: "tuple", length: 3 };
203
219
  break;
220
+ // `halfvec` beside `vector`, because they differ in storage width and in nothing a validator
221
+ // can see: `mapFromDriverValue` on both hands back `[1, 2, 3]`. It had no arm and came back
222
+ // `unknown` on this path too, which the fuzzer found.
223
+ //
224
+ // `sparsevec` is deliberately not here. Its name says vector and its value is the string
225
+ // `{1:1.5,3:2}/3`, so typing it `number[]` for symmetry would reject every row the database
226
+ // returns. Its codec already answers `string` on its own, which is the same conclusion reached
227
+ // without this arm.
204
228
  case "vector":
229
+ case "halfvec":
205
230
  out.tsType = "number[]";
206
231
  out.dbType = "VECTOR";
207
232
  out.shape = { kind: "numberVector", length: declaredLength(column) };
@@ -578,7 +603,37 @@ var _SchemaAnalyzer = class _SchemaAnalyzer {
578
603
  // 0.4x gives an enum its own class, which had no arm here at all, so an enum column came
579
604
  // back `unknown` and every generator emitted a schema that accepted anything. The values
580
605
  // were on the column the whole time, in `enumValues`, waiting for a type to attach to.
606
+ //
607
+ // The MySQL and SingleStore classes were added later than the Postgres one, and their
608
+ // absence showed up somewhere unexpected: the emitted validator was already right, because
609
+ // every generator reads `enumValues` before it reads `tsType`, so the only thing wrong was
610
+ // the description. That description reached the user anyway, through the untyped-column
611
+ // warning, which said an enum column "will accept any value" while the emitted schema
612
+ // accepted exactly three. A warning that is wrong about the one thing it names is worse
613
+ // than no warning, because it teaches the reader to skip the true ones.
614
+ //
615
+ // v1 already answered `string` here, so this is also the two majors agreeing again rather
616
+ // than a new opinion; the cross-major diff carried the disagreement as a filed defect.
581
617
  case "PgEnumColumn":
618
+ case "MySqlEnumColumn":
619
+ case "SingleStoreEnumColumn":
620
+ return { tsType: "string", dbType: "TEXT" };
621
+ // The pgvector family, found by the analyzer fuzzer: all three came back `unknown` on this
622
+ // path, so their validators accepted anything. The answers are drizzle's own mappers rather
623
+ // than the type names, and the three do not agree with each other:
624
+ //
625
+ // vector(3) SELECT gives [1,2,3] INSERT sends "[1,2,3]"
626
+ // halfvec(3) SELECT gives [1,2,3] INSERT sends "[1,2,3]"
627
+ // sparsevec(3) SELECT gives "{1:1.5,3:2}/3" INSERT sends "{1:1.5,3:2}/3"
628
+ //
629
+ // So the two dense ones are number arrays and the sparse one is a string. Typing `sparsevec`
630
+ // as a vector for symmetry would reject every row the database returns, which is the defect
631
+ // this family was filed under to begin with. The `shape` carries the dimension count where
632
+ // one is declared, as the codec path already did for `vector`.
633
+ case "PgVector":
634
+ case "PgHalfVector":
635
+ return { tsType: "number[]", dbType: "VECTOR" };
636
+ case "PgSparseVector":
582
637
  return { tsType: "string", dbType: "TEXT" };
583
638
  case "PgInteger":
584
639
  case "PgSmallInt":
@@ -645,6 +700,15 @@ var _SchemaAnalyzer = class _SchemaAnalyzer {
645
700
  return { tsType: "[number, number]", dbType: "POINT" };
646
701
  case "PgLineTuple":
647
702
  return { tsType: "[number, number, number]", dbType: "LINE" };
703
+ // The object modes, which the same regex answered `string` for and which are not tuples
704
+ // either. `point({ mode: 'xy' })` returns `{ x, y }` and `line({ mode: 'abc' })` returns
705
+ // `{ a, b, c }`, read back from PGlite through drizzle 0.45.2; the same column refuses
706
+ // `[1, 2]` and `'1,2'`, both of which `mapToDriverValue` renders `(undefined,undefined)`.
707
+ // v1 says the same thing about the same two columns through `dataType: 'object point'`.
708
+ case "PgPointObject":
709
+ return { tsType: "{ x: number; y: number }", dbType: "POINT" };
710
+ case "PgLineABC":
711
+ return { tsType: "{ a: number; b: number; c: number }", dbType: "LINE" };
648
712
  case "PgJson":
649
713
  case "PgJsonb":
650
714
  return { tsType: "any", dbType: ctor === "PgJsonb" ? "JSONB" : "JSON" };
@@ -665,7 +729,6 @@ var _SchemaAnalyzer = class _SchemaAnalyzer {
665
729
  if (/^Pg/.test(ctor)) {
666
730
  if (/Text|Varchar|Char|Uuid/i.test(ctor)) return { tsType: "string", dbType: "TEXT" };
667
731
  if (/Inet|Cidr|Macaddr8?|Uuid/i.test(ctor)) return { tsType: "string", dbType: "TEXT" };
668
- if (/Point|Line/i.test(ctor)) return { tsType: "string", dbType: "TEXT" };
669
732
  if (/TimestampString|DateString/i.test(ctor))
670
733
  return { tsType: "string", dbType: "TIMESTAMP" };
671
734
  if (/Timestamptz/i.test(ctor)) return { tsType: "Date", dbType: "TIMESTAMPTZ" };
@@ -787,7 +850,7 @@ var _SchemaAnalyzer = class _SchemaAnalyzer {
787
850
  const sqlType = sqlKind.startsWith("MySql") && typeof col?.getSQLType === "function" ? String(col.getSQLType()).toLowerCase() : void 0;
788
851
  const byteCap = sqlType ? MYSQL_TEXT_CAPS[sqlType] : void 0;
789
852
  const ctorName = String(col?.constructor?.name ?? "");
790
- const fallbackShape = dbType === "JSON" || dbType === "JSONB" || col?.config?.mode === "json" ? { kind: "json" } : BYTE_STRING_CLASSES.has(ctorName) ? { kind: "byteString", length: declaredLength(col) } : TUPLE_CLASS_SHAPES[ctorName];
853
+ const fallbackShape = dbType === "JSON" || dbType === "JSONB" || col?.config?.mode === "json" ? { kind: "json" } : BYTE_STRING_CLASSES.has(ctorName) ? { kind: "byteString", length: declaredLength(col) } : NUMBER_VECTOR_CLASSES.has(ctorName) ? { kind: "numberVector", length: declaredLength(col) } : GEOMETRIC_CLASS_SHAPES[ctorName];
791
854
  if (fallbackShape?.kind === "byteString") delete constraints.maxLength;
792
855
  const shape = (v1?.shape ?? fallbackShape)?.kind;
793
856
  const finalTs = v1?.tsType ?? tsType;
package/dist/index.d.cts CHANGED
@@ -121,11 +121,33 @@ type ColumnShape =
121
121
  | {
122
122
  kind: 'json';
123
123
  }
124
- /** `point`, `line`, `geometry`: a fixed-length tuple of numbers. */
124
+ /** `point`, `line`, `geometry` in their tuple modes: a fixed-length tuple of numbers. */
125
125
  | {
126
126
  kind: 'tuple';
127
127
  length: number;
128
128
  }
129
+ /**
130
+ * The same three columns in their object modes: an object of named number fields.
131
+ *
132
+ * `point({ mode: 'xy' })` hands back `{ x, y }`, `line({ mode: 'abc' })` hands back
133
+ * `{ a, b, c }`, and `geometry({ type: 'point', mode: 'xy' })` hands back `{ x, y }`. The names
134
+ * are carried rather than derived from a length, because the two arities have different keys and
135
+ * nothing else on the column states them.
136
+ *
137
+ * Not a tuple, on either major, and the difference is a value the database refuses. Asked of
138
+ * PGlite through drizzle 0.45.2 and again through 1.0.0-rc.4: `mapToDriverValue` reads `.x`/`.y`
139
+ * off whatever it is handed, so `[1, 2]` and `'1,2'` both become the literal
140
+ * `(undefined,undefined)` and Postgres answers `invalid input syntax for type point`, while
141
+ * `{ x: 1.5, y: -2.25 }` is stored as `(1.5,-2.25)` and read back unchanged.
142
+ *
143
+ * Every field is required and unlisted keys are ignored, both measured on the same server:
144
+ * `{ x: 1 }` renders `(1,undefined)` and is refused, and `{ x: 1, y: 2, z: 3 }` is accepted and
145
+ * stored as `(1,2)`.
146
+ */
147
+ | {
148
+ kind: 'numberObject';
149
+ fields: string[];
150
+ }
129
151
  /** `vector`, `halfvec`: a numeric vector, with a fixed length where one is declared. */
130
152
  | {
131
153
  kind: 'numberVector';
package/dist/index.d.ts CHANGED
@@ -121,11 +121,33 @@ type ColumnShape =
121
121
  | {
122
122
  kind: 'json';
123
123
  }
124
- /** `point`, `line`, `geometry`: a fixed-length tuple of numbers. */
124
+ /** `point`, `line`, `geometry` in their tuple modes: a fixed-length tuple of numbers. */
125
125
  | {
126
126
  kind: 'tuple';
127
127
  length: number;
128
128
  }
129
+ /**
130
+ * The same three columns in their object modes: an object of named number fields.
131
+ *
132
+ * `point({ mode: 'xy' })` hands back `{ x, y }`, `line({ mode: 'abc' })` hands back
133
+ * `{ a, b, c }`, and `geometry({ type: 'point', mode: 'xy' })` hands back `{ x, y }`. The names
134
+ * are carried rather than derived from a length, because the two arities have different keys and
135
+ * nothing else on the column states them.
136
+ *
137
+ * Not a tuple, on either major, and the difference is a value the database refuses. Asked of
138
+ * PGlite through drizzle 0.45.2 and again through 1.0.0-rc.4: `mapToDriverValue` reads `.x`/`.y`
139
+ * off whatever it is handed, so `[1, 2]` and `'1,2'` both become the literal
140
+ * `(undefined,undefined)` and Postgres answers `invalid input syntax for type point`, while
141
+ * `{ x: 1.5, y: -2.25 }` is stored as `(1.5,-2.25)` and read back unchanged.
142
+ *
143
+ * Every field is required and unlisted keys are ignored, both measured on the same server:
144
+ * `{ x: 1 }` renders `(1,undefined)` and is refused, and `{ x: 1, y: 2, z: 3 }` is accepted and
145
+ * stored as `(1,2)`.
146
+ */
147
+ | {
148
+ kind: 'numberObject';
149
+ fields: string[];
150
+ }
129
151
  /** `vector`, `halfvec`: a numeric vector, with a fixed length where one is declared. */
130
152
  | {
131
153
  kind: 'numberVector';
package/dist/index.js CHANGED
@@ -22,13 +22,18 @@ var PG_FLOAT4_INPUT_MAX = "340282356779733661637539395458142568448";
22
22
  var PG_FLOAT4_RANGE = [`-${PG_FLOAT4_INPUT_MAX}`, PG_FLOAT4_INPUT_MAX];
23
23
  var MYSQL_FLOAT_RANGE = [`-${FLOAT32_MAX}`, FLOAT32_MAX];
24
24
  var JS_SAFE_INTEGER_BOUNDS = ["-9007199254740991", "9007199254740991"];
25
- var TUPLE_CLASS_SHAPES = {
25
+ var GEOMETRIC_CLASS_SHAPES = {
26
26
  // `line()` is the trap here: its `drizzle:entityKind` is `PgLine` while its constructor is
27
27
  // `PgLineTuple`, and this path matches on the constructor.
28
28
  PgPointTuple: { kind: "tuple", length: 2 },
29
- PgLineTuple: { kind: "tuple", length: 3 }
29
+ PgLineTuple: { kind: "tuple", length: 3 },
30
+ // The object modes. `line({ mode: 'abc' })` is a `PgLineABC` and not a `PgLineObject`, and any
31
+ // mode but `'tuple'` builds the object class: `point({ mode: 'abc' })` is a `PgPointObject` too.
32
+ PgPointObject: { kind: "numberObject", fields: ["x", "y"] },
33
+ PgLineABC: { kind: "numberObject", fields: ["a", "b", "c"] }
30
34
  };
31
35
  var V1_ONLY_ENTITY_KINDS = /^(?:MsSql|Cockroach)/;
36
+ var NUMBER_VECTOR_CLASSES = /* @__PURE__ */ new Set(["PgVector", "PgHalfVector"]);
32
37
  var BYTE_STRING_CLASSES = /* @__PURE__ */ new Set([
33
38
  "MySqlBinary",
34
39
  "MySqlVarBinary",
@@ -149,18 +154,38 @@ function describeV1Column(column) {
149
154
  };
150
155
  break;
151
156
  }
157
+ // Two modes per builder, and v1 states which in the JS half of the dataType it already
158
+ // carries: the tuple modes say `array point` / `array line` / `array geometry` and the object
159
+ // modes say `object point` / `object line` / `object geometry`. Read off real 1.0.0-rc.4
160
+ // columns rather than assumed. Both used to reach these arms and be called tuples, so a select
161
+ // schema for `point({ mode: 'xy' })` rejected every row the driver returned, on the major that
162
+ // describes the column outright.
163
+ //
164
+ // `js` rather than the codec, which also distinguishes them here (`point:tuple` against
165
+ // `point`): three dialects state a semantic with no codec at all on this release, so the codec
166
+ // is the weaker of the two signals and this file already prefers `js` elsewhere for the same
167
+ // reason.
152
168
  case "point":
153
169
  case "geometry":
154
- out.tsType = "[number, number]";
170
+ out.tsType = js === "object" ? "{ x: number; y: number }" : "[number, number]";
155
171
  out.dbType = semantic.toUpperCase();
156
- out.shape = { kind: "tuple", length: 2 };
172
+ out.shape = js === "object" ? { kind: "numberObject", fields: ["x", "y"] } : { kind: "tuple", length: 2 };
157
173
  break;
158
174
  case "line":
159
- out.tsType = "[number, number, number]";
175
+ out.tsType = js === "object" ? "{ a: number; b: number; c: number }" : "[number, number, number]";
160
176
  out.dbType = "LINE";
161
- out.shape = { kind: "tuple", length: 3 };
177
+ out.shape = js === "object" ? { kind: "numberObject", fields: ["a", "b", "c"] } : { kind: "tuple", length: 3 };
162
178
  break;
179
+ // `halfvec` beside `vector`, because they differ in storage width and in nothing a validator
180
+ // can see: `mapFromDriverValue` on both hands back `[1, 2, 3]`. It had no arm and came back
181
+ // `unknown` on this path too, which the fuzzer found.
182
+ //
183
+ // `sparsevec` is deliberately not here. Its name says vector and its value is the string
184
+ // `{1:1.5,3:2}/3`, so typing it `number[]` for symmetry would reject every row the database
185
+ // returns. Its codec already answers `string` on its own, which is the same conclusion reached
186
+ // without this arm.
163
187
  case "vector":
188
+ case "halfvec":
164
189
  out.tsType = "number[]";
165
190
  out.dbType = "VECTOR";
166
191
  out.shape = { kind: "numberVector", length: declaredLength(column) };
@@ -537,7 +562,37 @@ var _SchemaAnalyzer = class _SchemaAnalyzer {
537
562
  // 0.4x gives an enum its own class, which had no arm here at all, so an enum column came
538
563
  // back `unknown` and every generator emitted a schema that accepted anything. The values
539
564
  // were on the column the whole time, in `enumValues`, waiting for a type to attach to.
565
+ //
566
+ // The MySQL and SingleStore classes were added later than the Postgres one, and their
567
+ // absence showed up somewhere unexpected: the emitted validator was already right, because
568
+ // every generator reads `enumValues` before it reads `tsType`, so the only thing wrong was
569
+ // the description. That description reached the user anyway, through the untyped-column
570
+ // warning, which said an enum column "will accept any value" while the emitted schema
571
+ // accepted exactly three. A warning that is wrong about the one thing it names is worse
572
+ // than no warning, because it teaches the reader to skip the true ones.
573
+ //
574
+ // v1 already answered `string` here, so this is also the two majors agreeing again rather
575
+ // than a new opinion; the cross-major diff carried the disagreement as a filed defect.
540
576
  case "PgEnumColumn":
577
+ case "MySqlEnumColumn":
578
+ case "SingleStoreEnumColumn":
579
+ return { tsType: "string", dbType: "TEXT" };
580
+ // The pgvector family, found by the analyzer fuzzer: all three came back `unknown` on this
581
+ // path, so their validators accepted anything. The answers are drizzle's own mappers rather
582
+ // than the type names, and the three do not agree with each other:
583
+ //
584
+ // vector(3) SELECT gives [1,2,3] INSERT sends "[1,2,3]"
585
+ // halfvec(3) SELECT gives [1,2,3] INSERT sends "[1,2,3]"
586
+ // sparsevec(3) SELECT gives "{1:1.5,3:2}/3" INSERT sends "{1:1.5,3:2}/3"
587
+ //
588
+ // So the two dense ones are number arrays and the sparse one is a string. Typing `sparsevec`
589
+ // as a vector for symmetry would reject every row the database returns, which is the defect
590
+ // this family was filed under to begin with. The `shape` carries the dimension count where
591
+ // one is declared, as the codec path already did for `vector`.
592
+ case "PgVector":
593
+ case "PgHalfVector":
594
+ return { tsType: "number[]", dbType: "VECTOR" };
595
+ case "PgSparseVector":
541
596
  return { tsType: "string", dbType: "TEXT" };
542
597
  case "PgInteger":
543
598
  case "PgSmallInt":
@@ -604,6 +659,15 @@ var _SchemaAnalyzer = class _SchemaAnalyzer {
604
659
  return { tsType: "[number, number]", dbType: "POINT" };
605
660
  case "PgLineTuple":
606
661
  return { tsType: "[number, number, number]", dbType: "LINE" };
662
+ // The object modes, which the same regex answered `string` for and which are not tuples
663
+ // either. `point({ mode: 'xy' })` returns `{ x, y }` and `line({ mode: 'abc' })` returns
664
+ // `{ a, b, c }`, read back from PGlite through drizzle 0.45.2; the same column refuses
665
+ // `[1, 2]` and `'1,2'`, both of which `mapToDriverValue` renders `(undefined,undefined)`.
666
+ // v1 says the same thing about the same two columns through `dataType: 'object point'`.
667
+ case "PgPointObject":
668
+ return { tsType: "{ x: number; y: number }", dbType: "POINT" };
669
+ case "PgLineABC":
670
+ return { tsType: "{ a: number; b: number; c: number }", dbType: "LINE" };
607
671
  case "PgJson":
608
672
  case "PgJsonb":
609
673
  return { tsType: "any", dbType: ctor === "PgJsonb" ? "JSONB" : "JSON" };
@@ -624,7 +688,6 @@ var _SchemaAnalyzer = class _SchemaAnalyzer {
624
688
  if (/^Pg/.test(ctor)) {
625
689
  if (/Text|Varchar|Char|Uuid/i.test(ctor)) return { tsType: "string", dbType: "TEXT" };
626
690
  if (/Inet|Cidr|Macaddr8?|Uuid/i.test(ctor)) return { tsType: "string", dbType: "TEXT" };
627
- if (/Point|Line/i.test(ctor)) return { tsType: "string", dbType: "TEXT" };
628
691
  if (/TimestampString|DateString/i.test(ctor))
629
692
  return { tsType: "string", dbType: "TIMESTAMP" };
630
693
  if (/Timestamptz/i.test(ctor)) return { tsType: "Date", dbType: "TIMESTAMPTZ" };
@@ -746,7 +809,7 @@ var _SchemaAnalyzer = class _SchemaAnalyzer {
746
809
  const sqlType = sqlKind.startsWith("MySql") && typeof col?.getSQLType === "function" ? String(col.getSQLType()).toLowerCase() : void 0;
747
810
  const byteCap = sqlType ? MYSQL_TEXT_CAPS[sqlType] : void 0;
748
811
  const ctorName = String(col?.constructor?.name ?? "");
749
- const fallbackShape = dbType === "JSON" || dbType === "JSONB" || col?.config?.mode === "json" ? { kind: "json" } : BYTE_STRING_CLASSES.has(ctorName) ? { kind: "byteString", length: declaredLength(col) } : TUPLE_CLASS_SHAPES[ctorName];
812
+ const fallbackShape = dbType === "JSON" || dbType === "JSONB" || col?.config?.mode === "json" ? { kind: "json" } : BYTE_STRING_CLASSES.has(ctorName) ? { kind: "byteString", length: declaredLength(col) } : NUMBER_VECTOR_CLASSES.has(ctorName) ? { kind: "numberVector", length: declaredLength(col) } : GEOMETRIC_CLASS_SHAPES[ctorName];
750
813
  if (fallbackShape?.kind === "byteString") delete constraints.maxLength;
751
814
  const shape = (v1?.shape ?? fallbackShape)?.kind;
752
815
  const finalTs = v1?.tsType ?? tsType;
package/package.json CHANGED
@@ -1,16 +1,22 @@
1
1
  {
2
2
  "name": "@drzl/analyzer",
3
- "version": "1.17.0",
3
+ "version": "1.17.2",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
- "main": "dist/index.js",
8
- "types": "dist/index.d.ts",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
9
10
  "exports": {
10
11
  ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js",
13
- "require": "./dist/index.cjs"
12
+ "import": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "require": {
17
+ "types": "./dist/index.d.cts",
18
+ "default": "./dist/index.cjs"
19
+ }
14
20
  }
15
21
  },
16
22
  "files": [
@@ -22,6 +28,7 @@
22
28
  },
23
29
  "devDependencies": {
24
30
  "drizzle-orm": "^0.45.2",
31
+ "drizzle-orm-v1": "npm:drizzle-orm@1.0.0-rc.4",
25
32
  "tsup": "^8.5.1",
26
33
  "typescript": "^5.9.3"
27
34
  },
@@ -45,6 +52,8 @@
45
52
  "scripts": {
46
53
  "build": "tsup src/index.ts --dts --format esm,cjs --clean",
47
54
  "lint": "eslint . --ext .ts",
48
- "test": "vitest run --testTimeout=20000"
55
+ "test": "vitest run --testTimeout=20000",
56
+ "fuzz": "node test/fuzz/run.mjs",
57
+ "fuzz:gate": "node test/fuzz/run.mjs --gate"
49
58
  }
50
59
  }