drizzle-kit 0.31.6-5a7c534 → 0.31.7-82993ae

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 (4) hide show
  1. package/api.js +55 -11
  2. package/api.mjs +55 -11
  3. package/bin.cjs +3 -3
  4. package/package.json +1 -1
package/api.js CHANGED
@@ -828,7 +828,7 @@ var version;
828
828
  var init_version = __esm({
829
829
  "../drizzle-orm/dist/version.js"() {
830
830
  "use strict";
831
- version = "0.44.7";
831
+ version = "0.45.0";
832
832
  }
833
833
  });
834
834
 
@@ -1628,6 +1628,8 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
1628
1628
  decoder2 = field;
1629
1629
  } else if (is(field, SQL)) {
1630
1630
  decoder2 = field.decoder;
1631
+ } else if (is(field, Subquery)) {
1632
+ decoder2 = field._.sql.decoder;
1631
1633
  } else {
1632
1634
  decoder2 = field.sql.decoder;
1633
1635
  }
@@ -1670,7 +1672,7 @@ function orderSelectedFields(fields, pathPrefix) {
1670
1672
  return result;
1671
1673
  }
1672
1674
  const newPath = pathPrefix ? [...pathPrefix, name3] : [name3];
1673
- if (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased)) {
1675
+ if (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased) || is(field, Subquery)) {
1674
1676
  result.push({ path: newPath, field });
1675
1677
  } else if (is(field, Table)) {
1676
1678
  result.push(...orderSelectedFields(field[Table.Symbol.Columns], newPath));
@@ -6041,8 +6043,8 @@ var init_indexes = __esm({
6041
6043
  this.config.using = using;
6042
6044
  return this;
6043
6045
  }
6044
- algorythm(algorythm) {
6045
- this.config.algorythm = algorythm;
6046
+ algorithm(algorithm) {
6047
+ this.config.algorithm = algorithm;
6046
6048
  return this;
6047
6049
  }
6048
6050
  lock(lock) {
@@ -6648,6 +6650,16 @@ var init_dialect = __esm({
6648
6650
  } else {
6649
6651
  chunk.push(field);
6650
6652
  }
6653
+ } else if (is(field, Subquery)) {
6654
+ const entries = Object.entries(field._.selectedFields);
6655
+ if (entries.length === 1) {
6656
+ const entry = entries[0][1];
6657
+ const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
6658
+ if (fieldDecoder) {
6659
+ field._.sql.decoder = fieldDecoder;
6660
+ }
6661
+ }
6662
+ chunk.push(field);
6651
6663
  }
6652
6664
  if (i8 < columnsLen - 1) {
6653
6665
  chunk.push(sql`, `);
@@ -9718,6 +9730,16 @@ var init_dialect2 = __esm({
9718
9730
  } else {
9719
9731
  chunk.push(field);
9720
9732
  }
9733
+ } else if (is(field, Subquery)) {
9734
+ const entries = Object.entries(field._.selectedFields);
9735
+ if (entries.length === 1) {
9736
+ const entry = entries[0][1];
9737
+ const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
9738
+ if (fieldDecoder) {
9739
+ field._.sql.decoder = fieldDecoder;
9740
+ }
9741
+ }
9742
+ chunk.push(field);
9721
9743
  }
9722
9744
  if (i8 < columnsLen - 1) {
9723
9745
  chunk.push(sql`, `);
@@ -15262,8 +15284,8 @@ var init_indexes3 = __esm({
15262
15284
  this.config.using = using;
15263
15285
  return this;
15264
15286
  }
15265
- algorythm(algorythm) {
15266
- this.config.algorythm = algorythm;
15287
+ algorithm(algorithm) {
15288
+ this.config.algorithm = algorithm;
15267
15289
  return this;
15268
15290
  }
15269
15291
  lock(lock) {
@@ -15882,6 +15904,16 @@ var init_dialect3 = __esm({
15882
15904
  } else {
15883
15905
  chunk.push(field);
15884
15906
  }
15907
+ } else if (is(field, Subquery)) {
15908
+ const entries = Object.entries(field._.selectedFields);
15909
+ if (entries.length === 1) {
15910
+ const entry = entries[0][1];
15911
+ const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
15912
+ if (fieldDecoder) {
15913
+ field._.sql.decoder = fieldDecoder;
15914
+ }
15915
+ }
15916
+ chunk.push(field);
15885
15917
  }
15886
15918
  if (i8 < columnsLen - 1) {
15887
15919
  chunk.push(sql`, `);
@@ -18915,6 +18947,9 @@ var init_dialect4 = __esm({
18915
18947
  new SQL(
18916
18948
  query.queryChunks.map((c6) => {
18917
18949
  if (is(c6, Column)) {
18950
+ if (c6.columnType === "SQLiteNumericBigInt") {
18951
+ return chunk.push(sql`cast(${sql.identifier(this.casing.getColumnCasing(c6))} as text)`);
18952
+ }
18918
18953
  return sql.identifier(this.casing.getColumnCasing(c6));
18919
18954
  }
18920
18955
  return c6;
@@ -18944,6 +18979,14 @@ var init_dialect4 = __esm({
18944
18979
  chunk.push(sql`${sql.identifier(tableName)}.${sql.identifier(this.casing.getColumnCasing(field))}`);
18945
18980
  }
18946
18981
  }
18982
+ } else if (is(field, Subquery)) {
18983
+ const entries = Object.entries(field._.selectedFields);
18984
+ if (entries.length === 1) {
18985
+ const entry = entries[0][1];
18986
+ const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
18987
+ if (fieldDecoder) field._.sql.decoder = fieldDecoder;
18988
+ }
18989
+ chunk.push(field);
18947
18990
  }
18948
18991
  if (i8 < columnsLen - 1) {
18949
18992
  chunk.push(sql`, `);
@@ -46309,7 +46352,7 @@ We have encountered a collision between the index name on columns ${source_defau
46309
46352
  columns: indexColumns,
46310
46353
  isUnique: value.config.unique ?? false,
46311
46354
  using: value.config.using,
46312
- algorithm: value.config.algorythm,
46355
+ algorithm: value.config.algorithm,
46313
46356
  lock: value.config.lock
46314
46357
  };
46315
46358
  });
@@ -47440,7 +47483,7 @@ The unique index ${source_default.underline.blue(
47440
47483
  columns: indexColumns,
47441
47484
  isUnique: value.config.unique ?? false,
47442
47485
  using: value.config.using,
47443
- algorithm: value.config.algorythm,
47486
+ algorithm: value.config.algorithm,
47444
47487
  lock: value.config.lock
47445
47488
  };
47446
47489
  });
@@ -97808,7 +97851,7 @@ var init_core = __esm({
97808
97851
  });
97809
97852
 
97810
97853
  // ../drizzle-orm/dist/node-postgres/session.js
97811
- var Pool2, types4, _a461, _b335, NodePgPreparedQuery, _a462, _b336, _NodePgSession, NodePgSession, _a463, _b337, _NodePgTransaction, NodePgTransaction;
97854
+ var Pool2, types4, NativePool, _a461, _b335, NodePgPreparedQuery, _a462, _b336, _NodePgSession, NodePgSession, _a463, _b337, _NodePgTransaction, NodePgTransaction;
97812
97855
  var init_session7 = __esm({
97813
97856
  "../drizzle-orm/dist/node-postgres/session.js"() {
97814
97857
  "use strict";
@@ -97822,6 +97865,7 @@ var init_session7 = __esm({
97822
97865
  init_tracing();
97823
97866
  init_utils();
97824
97867
  ({ Pool: Pool2, types: types4 } = esm_default);
97868
+ NativePool = esm_default.native ? esm_default.native.Pool : void 0;
97825
97869
  NodePgPreparedQuery = class extends (_b335 = PgPreparedQuery, _a461 = entityKind, _b335) {
97826
97870
  constructor(client, queryString, params, logger2, cache5, queryMetadata, cacheConfig, fields, name3, _isResponseInArrayMode, customResultMapper) {
97827
97871
  super({ sql: queryString, params }, cache5, queryMetadata, cacheConfig);
@@ -97991,7 +98035,7 @@ var init_session7 = __esm({
97991
98035
  );
97992
98036
  }
97993
98037
  async transaction(transaction, config) {
97994
- const session = this.client instanceof Pool2 ? new _NodePgSession(await this.client.connect(), this.dialect, this.schema, this.options) : this;
98038
+ const session = this.client instanceof Pool2 || NativePool && this.client instanceof NativePool ? new _NodePgSession(await this.client.connect(), this.dialect, this.schema, this.options) : this;
97995
98039
  const tx = new NodePgTransaction(this.dialect, session, this.schema);
97996
98040
  await tx.execute(sql`begin${config ? sql` ${tx.getTransactionConfigSQL(config)}` : void 0}`);
97997
98041
  try {
@@ -98002,7 +98046,7 @@ var init_session7 = __esm({
98002
98046
  await tx.execute(sql`rollback`);
98003
98047
  throw error2;
98004
98048
  } finally {
98005
- if (this.client instanceof Pool2) {
98049
+ if (this.client instanceof Pool2 || NativePool && this.client instanceof NativePool) {
98006
98050
  session.client.release();
98007
98051
  }
98008
98052
  }
package/api.mjs CHANGED
@@ -834,7 +834,7 @@ var version;
834
834
  var init_version = __esm({
835
835
  "../drizzle-orm/dist/version.js"() {
836
836
  "use strict";
837
- version = "0.44.7";
837
+ version = "0.45.0";
838
838
  }
839
839
  });
840
840
 
@@ -1634,6 +1634,8 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
1634
1634
  decoder2 = field;
1635
1635
  } else if (is(field, SQL)) {
1636
1636
  decoder2 = field.decoder;
1637
+ } else if (is(field, Subquery)) {
1638
+ decoder2 = field._.sql.decoder;
1637
1639
  } else {
1638
1640
  decoder2 = field.sql.decoder;
1639
1641
  }
@@ -1676,7 +1678,7 @@ function orderSelectedFields(fields, pathPrefix) {
1676
1678
  return result;
1677
1679
  }
1678
1680
  const newPath = pathPrefix ? [...pathPrefix, name3] : [name3];
1679
- if (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased)) {
1681
+ if (is(field, Column) || is(field, SQL) || is(field, SQL.Aliased) || is(field, Subquery)) {
1680
1682
  result.push({ path: newPath, field });
1681
1683
  } else if (is(field, Table)) {
1682
1684
  result.push(...orderSelectedFields(field[Table.Symbol.Columns], newPath));
@@ -6047,8 +6049,8 @@ var init_indexes = __esm({
6047
6049
  this.config.using = using;
6048
6050
  return this;
6049
6051
  }
6050
- algorythm(algorythm) {
6051
- this.config.algorythm = algorythm;
6052
+ algorithm(algorithm) {
6053
+ this.config.algorithm = algorithm;
6052
6054
  return this;
6053
6055
  }
6054
6056
  lock(lock) {
@@ -6654,6 +6656,16 @@ var init_dialect = __esm({
6654
6656
  } else {
6655
6657
  chunk.push(field);
6656
6658
  }
6659
+ } else if (is(field, Subquery)) {
6660
+ const entries = Object.entries(field._.selectedFields);
6661
+ if (entries.length === 1) {
6662
+ const entry = entries[0][1];
6663
+ const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
6664
+ if (fieldDecoder) {
6665
+ field._.sql.decoder = fieldDecoder;
6666
+ }
6667
+ }
6668
+ chunk.push(field);
6657
6669
  }
6658
6670
  if (i8 < columnsLen - 1) {
6659
6671
  chunk.push(sql`, `);
@@ -9724,6 +9736,16 @@ var init_dialect2 = __esm({
9724
9736
  } else {
9725
9737
  chunk.push(field);
9726
9738
  }
9739
+ } else if (is(field, Subquery)) {
9740
+ const entries = Object.entries(field._.selectedFields);
9741
+ if (entries.length === 1) {
9742
+ const entry = entries[0][1];
9743
+ const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
9744
+ if (fieldDecoder) {
9745
+ field._.sql.decoder = fieldDecoder;
9746
+ }
9747
+ }
9748
+ chunk.push(field);
9727
9749
  }
9728
9750
  if (i8 < columnsLen - 1) {
9729
9751
  chunk.push(sql`, `);
@@ -15268,8 +15290,8 @@ var init_indexes3 = __esm({
15268
15290
  this.config.using = using;
15269
15291
  return this;
15270
15292
  }
15271
- algorythm(algorythm) {
15272
- this.config.algorythm = algorythm;
15293
+ algorithm(algorithm) {
15294
+ this.config.algorithm = algorithm;
15273
15295
  return this;
15274
15296
  }
15275
15297
  lock(lock) {
@@ -15888,6 +15910,16 @@ var init_dialect3 = __esm({
15888
15910
  } else {
15889
15911
  chunk.push(field);
15890
15912
  }
15913
+ } else if (is(field, Subquery)) {
15914
+ const entries = Object.entries(field._.selectedFields);
15915
+ if (entries.length === 1) {
15916
+ const entry = entries[0][1];
15917
+ const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
15918
+ if (fieldDecoder) {
15919
+ field._.sql.decoder = fieldDecoder;
15920
+ }
15921
+ }
15922
+ chunk.push(field);
15891
15923
  }
15892
15924
  if (i8 < columnsLen - 1) {
15893
15925
  chunk.push(sql`, `);
@@ -18921,6 +18953,9 @@ var init_dialect4 = __esm({
18921
18953
  new SQL(
18922
18954
  query.queryChunks.map((c6) => {
18923
18955
  if (is(c6, Column)) {
18956
+ if (c6.columnType === "SQLiteNumericBigInt") {
18957
+ return chunk.push(sql`cast(${sql.identifier(this.casing.getColumnCasing(c6))} as text)`);
18958
+ }
18924
18959
  return sql.identifier(this.casing.getColumnCasing(c6));
18925
18960
  }
18926
18961
  return c6;
@@ -18950,6 +18985,14 @@ var init_dialect4 = __esm({
18950
18985
  chunk.push(sql`${sql.identifier(tableName)}.${sql.identifier(this.casing.getColumnCasing(field))}`);
18951
18986
  }
18952
18987
  }
18988
+ } else if (is(field, Subquery)) {
18989
+ const entries = Object.entries(field._.selectedFields);
18990
+ if (entries.length === 1) {
18991
+ const entry = entries[0][1];
18992
+ const fieldDecoder = is(entry, SQL) ? entry.decoder : is(entry, Column) ? { mapFromDriverValue: (v11) => entry.mapFromDriverValue(v11) } : entry.sql.decoder;
18993
+ if (fieldDecoder) field._.sql.decoder = fieldDecoder;
18994
+ }
18995
+ chunk.push(field);
18953
18996
  }
18954
18997
  if (i8 < columnsLen - 1) {
18955
18998
  chunk.push(sql`, `);
@@ -46315,7 +46358,7 @@ We have encountered a collision between the index name on columns ${source_defau
46315
46358
  columns: indexColumns,
46316
46359
  isUnique: value.config.unique ?? false,
46317
46360
  using: value.config.using,
46318
- algorithm: value.config.algorythm,
46361
+ algorithm: value.config.algorithm,
46319
46362
  lock: value.config.lock
46320
46363
  };
46321
46364
  });
@@ -47446,7 +47489,7 @@ The unique index ${source_default.underline.blue(
47446
47489
  columns: indexColumns,
47447
47490
  isUnique: value.config.unique ?? false,
47448
47491
  using: value.config.using,
47449
- algorithm: value.config.algorythm,
47492
+ algorithm: value.config.algorithm,
47450
47493
  lock: value.config.lock
47451
47494
  };
47452
47495
  });
@@ -97809,7 +97852,7 @@ var init_core = __esm({
97809
97852
  });
97810
97853
 
97811
97854
  // ../drizzle-orm/dist/node-postgres/session.js
97812
- var Pool2, types4, _a461, _b335, NodePgPreparedQuery, _a462, _b336, _NodePgSession, NodePgSession, _a463, _b337, _NodePgTransaction, NodePgTransaction;
97855
+ var Pool2, types4, NativePool, _a461, _b335, NodePgPreparedQuery, _a462, _b336, _NodePgSession, NodePgSession, _a463, _b337, _NodePgTransaction, NodePgTransaction;
97813
97856
  var init_session7 = __esm({
97814
97857
  "../drizzle-orm/dist/node-postgres/session.js"() {
97815
97858
  "use strict";
@@ -97823,6 +97866,7 @@ var init_session7 = __esm({
97823
97866
  init_tracing();
97824
97867
  init_utils();
97825
97868
  ({ Pool: Pool2, types: types4 } = esm_default);
97869
+ NativePool = esm_default.native ? esm_default.native.Pool : void 0;
97826
97870
  NodePgPreparedQuery = class extends (_b335 = PgPreparedQuery, _a461 = entityKind, _b335) {
97827
97871
  constructor(client, queryString, params, logger2, cache5, queryMetadata, cacheConfig, fields, name3, _isResponseInArrayMode, customResultMapper) {
97828
97872
  super({ sql: queryString, params }, cache5, queryMetadata, cacheConfig);
@@ -97992,7 +98036,7 @@ var init_session7 = __esm({
97992
98036
  );
97993
98037
  }
97994
98038
  async transaction(transaction, config) {
97995
- const session = this.client instanceof Pool2 ? new _NodePgSession(await this.client.connect(), this.dialect, this.schema, this.options) : this;
98039
+ const session = this.client instanceof Pool2 || NativePool && this.client instanceof NativePool ? new _NodePgSession(await this.client.connect(), this.dialect, this.schema, this.options) : this;
97996
98040
  const tx = new NodePgTransaction(this.dialect, session, this.schema);
97997
98041
  await tx.execute(sql`begin${config ? sql` ${tx.getTransactionConfigSQL(config)}` : void 0}`);
97998
98042
  try {
@@ -98003,7 +98047,7 @@ var init_session7 = __esm({
98003
98047
  await tx.execute(sql`rollback`);
98004
98048
  throw error2;
98005
98049
  } finally {
98006
- if (this.client instanceof Pool2) {
98050
+ if (this.client instanceof Pool2 || NativePool && this.client instanceof NativePool) {
98007
98051
  session.client.release();
98008
98052
  }
98009
98053
  }
package/bin.cjs CHANGED
@@ -17955,7 +17955,7 @@ We have encountered a collision between the index name on columns ${source_defau
17955
17955
  columns: indexColumns,
17956
17956
  isUnique: value.config.unique ?? false,
17957
17957
  using: value.config.using,
17958
- algorithm: value.config.algorythm,
17958
+ algorithm: value.config.algorithm,
17959
17959
  lock: value.config.lock
17960
17960
  };
17961
17961
  });
@@ -21150,7 +21150,7 @@ The unique index ${source_default.underline.blue(
21150
21150
  columns: indexColumns,
21151
21151
  isUnique: value.config.unique ?? false,
21152
21152
  using: value.config.using,
21153
- algorithm: value.config.algorythm,
21153
+ algorithm: value.config.algorithm,
21154
21154
  lock: value.config.lock
21155
21155
  };
21156
21156
  });
@@ -94332,7 +94332,7 @@ init_utils5();
94332
94332
  var version2 = async () => {
94333
94333
  const { npmVersion } = await ormCoreVersions();
94334
94334
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
94335
- const envVersion = "0.31.6-5a7c534";
94335
+ const envVersion = "0.31.7-82993ae";
94336
94336
  const kitVersion = envVersion ? `v${envVersion}` : "--";
94337
94337
  const versions = `drizzle-kit: ${kitVersion}
94338
94338
  ${ormVersion}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.31.6-5a7c534",
3
+ "version": "0.31.7-82993ae",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",