drizzle-kit 0.24.2-dab63b8 → 0.24.2-efd821d

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 +52 -14
  2. package/api.mjs +52 -14
  3. package/bin.cjs +1 -1
  4. package/package.json +1 -1
package/api.js CHANGED
@@ -28896,6 +28896,7 @@ var init_count = __esm({
28896
28896
  __publicField(this, _a136, "PgCountBuilder");
28897
28897
  __publicField(this, "session");
28898
28898
  this.params = params;
28899
+ this.mapWith(Number);
28899
28900
  this.session = params.session;
28900
28901
  this.sql = _PgCountBuilder.buildCount(
28901
28902
  params.source,
@@ -28903,15 +28904,13 @@ var init_count = __esm({
28903
28904
  );
28904
28905
  }
28905
28906
  static buildEmbeddedCount(source, filters) {
28906
- return sql`(select count(*)::int from ${source}${sql.raw(" where ").if(filters)}${filters})`;
28907
+ return sql`(select count(*) from ${source}${sql.raw(" where ").if(filters)}${filters})`;
28907
28908
  }
28908
28909
  static buildCount(source, filters) {
28909
- return sql`select count(*)::int from ${source}${sql.raw(" where ").if(filters)}${filters};`;
28910
+ return sql`select count(*) as count from ${source}${sql.raw(" where ").if(filters)}${filters};`;
28910
28911
  }
28911
28912
  then(onfulfilled, onrejected) {
28912
- return Promise.resolve(this.session.all(this.sql)).then((it) => {
28913
- return it[0]["count"];
28914
- }).then(
28913
+ return Promise.resolve(this.session.count(this.sql)).then(
28915
28914
  onfulfilled,
28916
28915
  onrejected
28917
28916
  );
@@ -29183,7 +29182,7 @@ var init_db = __esm({
29183
29182
  };
29184
29183
  }
29185
29184
  $count(source, filters) {
29186
- return new PgCountBuilder({ source, filters, dialect: this.dialect, session: this.session });
29185
+ return new PgCountBuilder({ source, filters, session: this.session });
29187
29186
  }
29188
29187
  /**
29189
29188
  * Incorporates a previously defined CTE (using `$with`) into the main query.
@@ -29903,6 +29902,12 @@ var init_session = __esm({
29903
29902
  false
29904
29903
  ).all();
29905
29904
  }
29905
+ async count(sql22) {
29906
+ const res = await this.execute(sql22);
29907
+ return Number(
29908
+ res[0]["count"]
29909
+ );
29910
+ }
29906
29911
  };
29907
29912
  __publicField(PgSession, _a157, "PgSession");
29908
29913
  PgTransaction = class extends (_b113 = PgDatabase, _a158 = entityKind, _b113) {
@@ -30150,6 +30155,12 @@ var init_session2 = __esm({
30150
30155
  }
30151
30156
  }
30152
30157
  }
30158
+ async count(sql22) {
30159
+ const res = await this.execute(sql22);
30160
+ return Number(
30161
+ res["rows"][0]["count"]
30162
+ );
30163
+ }
30153
30164
  };
30154
30165
  __publicField(_NodePgSession, _a160, "NodePgSession");
30155
30166
  NodePgSession = _NodePgSession;
@@ -51875,7 +51886,7 @@ var init_count2 = __esm({
51875
51886
  return sql`select count(*) from ${source}${sql.raw(" where ").if(filters)}${filters}`;
51876
51887
  }
51877
51888
  then(onfulfilled, onrejected) {
51878
- return Promise.resolve(this.session.values(this.sql)).then((it) => it[0][0]).then(
51889
+ return Promise.resolve(this.session.count(this.sql)).then(
51879
51890
  onfulfilled,
51880
51891
  onrejected
51881
51892
  );
@@ -52182,7 +52193,7 @@ var init_db2 = __esm({
52182
52193
  };
52183
52194
  }
52184
52195
  $count(source, filters) {
52185
- return new SQLiteCountBuilder({ source, filters, dialect: this.dialect, session: this.session });
52196
+ return new SQLiteCountBuilder({ source, filters, session: this.session });
52186
52197
  }
52187
52198
  /**
52188
52199
  * Incorporates a previously defined CTE (using `$with`) into the main query.
@@ -52621,6 +52632,10 @@ var init_session4 = __esm({
52621
52632
  values(query) {
52622
52633
  return this.prepareOneTimeQuery(this.dialect.sqlToQuery(query), void 0, "run", false).values();
52623
52634
  }
52635
+ async count(sql3) {
52636
+ const result = await this.values(sql3);
52637
+ return result[0][0];
52638
+ }
52624
52639
  /** @internal */
52625
52640
  extractRawValuesValueFromBatchResult(_result) {
52626
52641
  throw new Error("Not implemented");
@@ -82939,6 +82954,7 @@ var init_count3 = __esm({
82939
82954
  __publicField(this, _a252, "MySqlCountBuilder");
82940
82955
  __publicField(this, "session");
82941
82956
  this.params = params;
82957
+ this.mapWith(Number);
82942
82958
  this.session = params.session;
82943
82959
  this.sql = _MySqlCountBuilder.buildCount(
82944
82960
  params.source,
@@ -82946,15 +82962,13 @@ var init_count3 = __esm({
82946
82962
  );
82947
82963
  }
82948
82964
  static buildEmbeddedCount(source, filters) {
82949
- return sql`(select cast(count(*) as UNSIGNED) from ${source}${sql.raw(" where ").if(filters)}${filters})`;
82965
+ return sql`(select count(*) from ${source}${sql.raw(" where ").if(filters)}${filters})`;
82950
82966
  }
82951
82967
  static buildCount(source, filters) {
82952
- return sql`select cast(count(*) as UNSIGNED) as count from ${source}${sql.raw(" where ").if(filters)}${filters}`;
82968
+ return sql`select count(*) as count from ${source}${sql.raw(" where ").if(filters)}${filters}`;
82953
82969
  }
82954
82970
  then(onfulfilled, onrejected) {
82955
- return Promise.resolve(this.session.execute(this.sql)).then((it) => {
82956
- return it[0]["count"];
82957
- }).then(
82971
+ return Promise.resolve(this.session.count(this.sql)).then(
82958
82972
  onfulfilled,
82959
82973
  onrejected
82960
82974
  );
@@ -85373,7 +85387,7 @@ var init_db3 = __esm({
85373
85387
  };
85374
85388
  }
85375
85389
  $count(source, filters) {
85376
- return new MySqlCountBuilder({ source, filters, dialect: this.dialect, session: this.session });
85390
+ return new MySqlCountBuilder({ source, filters, session: this.session });
85377
85391
  }
85378
85392
  /**
85379
85393
  * Incorporates a previously defined CTE (using `$with`) into the main query.
@@ -85539,6 +85553,12 @@ var init_session9 = __esm({
85539
85553
  void 0
85540
85554
  ).execute();
85541
85555
  }
85556
+ async count(sql22) {
85557
+ const res = await this.execute(sql22);
85558
+ return Number(
85559
+ res[0][0]["count"]
85560
+ );
85561
+ }
85542
85562
  getSetTransactionSQL(config) {
85543
85563
  const parts = [];
85544
85564
  if (config.isolationLevel) {
@@ -91370,6 +91390,12 @@ var init_session11 = __esm({
91370
91390
  async queryObjects(query, params) {
91371
91391
  return this.client(query, params, { arrayMode: false, fullResults: true });
91372
91392
  }
91393
+ async count(sql3) {
91394
+ const res = await this.execute(sql3);
91395
+ return Number(
91396
+ res["rows"][0]["count"]
91397
+ );
91398
+ }
91373
91399
  async transaction(_transaction, _config = {}) {
91374
91400
  throw new Error("No transactions support in neon-http driver");
91375
91401
  }
@@ -92168,6 +92194,12 @@ var init_session13 = __esm({
92168
92194
  this.logger.logQuery(querySql.sql, querySql.params);
92169
92195
  return this.client.execute(querySql.sql, querySql.params, { as: "object" }).then((eQuery) => eQuery.rows);
92170
92196
  }
92197
+ async count(sql22) {
92198
+ const res = await this.execute(sql22);
92199
+ return Number(
92200
+ res["rows"][0]["count"]
92201
+ );
92202
+ }
92171
92203
  transaction(transaction) {
92172
92204
  return this.baseClient.transaction((pstx) => {
92173
92205
  const session = new _PlanetscaleSession(this.baseClient, this.dialect, pstx, this.schema, this.options);
@@ -95117,6 +95149,12 @@ var init_session15 = __esm({
95117
95149
  this.logger.logQuery(querySql.sql, querySql.params);
95118
95150
  return this.client.execute(querySql.sql, querySql.params);
95119
95151
  }
95152
+ async count(sql22) {
95153
+ const res = await this.execute(sql22);
95154
+ return Number(
95155
+ res["rows"][0]["count"]
95156
+ );
95157
+ }
95120
95158
  async transaction(transaction) {
95121
95159
  const nativeTx = await this.baseClient.begin();
95122
95160
  try {
package/api.mjs CHANGED
@@ -28901,6 +28901,7 @@ var init_count = __esm({
28901
28901
  __publicField(this, _a136, "PgCountBuilder");
28902
28902
  __publicField(this, "session");
28903
28903
  this.params = params;
28904
+ this.mapWith(Number);
28904
28905
  this.session = params.session;
28905
28906
  this.sql = _PgCountBuilder.buildCount(
28906
28907
  params.source,
@@ -28908,15 +28909,13 @@ var init_count = __esm({
28908
28909
  );
28909
28910
  }
28910
28911
  static buildEmbeddedCount(source, filters) {
28911
- return sql`(select count(*)::int from ${source}${sql.raw(" where ").if(filters)}${filters})`;
28912
+ return sql`(select count(*) from ${source}${sql.raw(" where ").if(filters)}${filters})`;
28912
28913
  }
28913
28914
  static buildCount(source, filters) {
28914
- return sql`select count(*)::int from ${source}${sql.raw(" where ").if(filters)}${filters};`;
28915
+ return sql`select count(*) as count from ${source}${sql.raw(" where ").if(filters)}${filters};`;
28915
28916
  }
28916
28917
  then(onfulfilled, onrejected) {
28917
- return Promise.resolve(this.session.all(this.sql)).then((it) => {
28918
- return it[0]["count"];
28919
- }).then(
28918
+ return Promise.resolve(this.session.count(this.sql)).then(
28920
28919
  onfulfilled,
28921
28920
  onrejected
28922
28921
  );
@@ -29188,7 +29187,7 @@ var init_db = __esm({
29188
29187
  };
29189
29188
  }
29190
29189
  $count(source, filters) {
29191
- return new PgCountBuilder({ source, filters, dialect: this.dialect, session: this.session });
29190
+ return new PgCountBuilder({ source, filters, session: this.session });
29192
29191
  }
29193
29192
  /**
29194
29193
  * Incorporates a previously defined CTE (using `$with`) into the main query.
@@ -29908,6 +29907,12 @@ var init_session = __esm({
29908
29907
  false
29909
29908
  ).all();
29910
29909
  }
29910
+ async count(sql22) {
29911
+ const res = await this.execute(sql22);
29912
+ return Number(
29913
+ res[0]["count"]
29914
+ );
29915
+ }
29911
29916
  };
29912
29917
  __publicField(PgSession, _a157, "PgSession");
29913
29918
  PgTransaction = class extends (_b113 = PgDatabase, _a158 = entityKind, _b113) {
@@ -30155,6 +30160,12 @@ var init_session2 = __esm({
30155
30160
  }
30156
30161
  }
30157
30162
  }
30163
+ async count(sql22) {
30164
+ const res = await this.execute(sql22);
30165
+ return Number(
30166
+ res["rows"][0]["count"]
30167
+ );
30168
+ }
30158
30169
  };
30159
30170
  __publicField(_NodePgSession, _a160, "NodePgSession");
30160
30171
  NodePgSession = _NodePgSession;
@@ -51879,7 +51890,7 @@ var init_count2 = __esm({
51879
51890
  return sql`select count(*) from ${source}${sql.raw(" where ").if(filters)}${filters}`;
51880
51891
  }
51881
51892
  then(onfulfilled, onrejected) {
51882
- return Promise.resolve(this.session.values(this.sql)).then((it) => it[0][0]).then(
51893
+ return Promise.resolve(this.session.count(this.sql)).then(
51883
51894
  onfulfilled,
51884
51895
  onrejected
51885
51896
  );
@@ -52186,7 +52197,7 @@ var init_db2 = __esm({
52186
52197
  };
52187
52198
  }
52188
52199
  $count(source, filters) {
52189
- return new SQLiteCountBuilder({ source, filters, dialect: this.dialect, session: this.session });
52200
+ return new SQLiteCountBuilder({ source, filters, session: this.session });
52190
52201
  }
52191
52202
  /**
52192
52203
  * Incorporates a previously defined CTE (using `$with`) into the main query.
@@ -52625,6 +52636,10 @@ var init_session4 = __esm({
52625
52636
  values(query) {
52626
52637
  return this.prepareOneTimeQuery(this.dialect.sqlToQuery(query), void 0, "run", false).values();
52627
52638
  }
52639
+ async count(sql3) {
52640
+ const result = await this.values(sql3);
52641
+ return result[0][0];
52642
+ }
52628
52643
  /** @internal */
52629
52644
  extractRawValuesValueFromBatchResult(_result) {
52630
52645
  throw new Error("Not implemented");
@@ -82943,6 +82958,7 @@ var init_count3 = __esm({
82943
82958
  __publicField(this, _a252, "MySqlCountBuilder");
82944
82959
  __publicField(this, "session");
82945
82960
  this.params = params;
82961
+ this.mapWith(Number);
82946
82962
  this.session = params.session;
82947
82963
  this.sql = _MySqlCountBuilder.buildCount(
82948
82964
  params.source,
@@ -82950,15 +82966,13 @@ var init_count3 = __esm({
82950
82966
  );
82951
82967
  }
82952
82968
  static buildEmbeddedCount(source, filters) {
82953
- return sql`(select cast(count(*) as UNSIGNED) from ${source}${sql.raw(" where ").if(filters)}${filters})`;
82969
+ return sql`(select count(*) from ${source}${sql.raw(" where ").if(filters)}${filters})`;
82954
82970
  }
82955
82971
  static buildCount(source, filters) {
82956
- return sql`select cast(count(*) as UNSIGNED) as count from ${source}${sql.raw(" where ").if(filters)}${filters}`;
82972
+ return sql`select count(*) as count from ${source}${sql.raw(" where ").if(filters)}${filters}`;
82957
82973
  }
82958
82974
  then(onfulfilled, onrejected) {
82959
- return Promise.resolve(this.session.execute(this.sql)).then((it) => {
82960
- return it[0]["count"];
82961
- }).then(
82975
+ return Promise.resolve(this.session.count(this.sql)).then(
82962
82976
  onfulfilled,
82963
82977
  onrejected
82964
82978
  );
@@ -85377,7 +85391,7 @@ var init_db3 = __esm({
85377
85391
  };
85378
85392
  }
85379
85393
  $count(source, filters) {
85380
- return new MySqlCountBuilder({ source, filters, dialect: this.dialect, session: this.session });
85394
+ return new MySqlCountBuilder({ source, filters, session: this.session });
85381
85395
  }
85382
85396
  /**
85383
85397
  * Incorporates a previously defined CTE (using `$with`) into the main query.
@@ -85543,6 +85557,12 @@ var init_session9 = __esm({
85543
85557
  void 0
85544
85558
  ).execute();
85545
85559
  }
85560
+ async count(sql22) {
85561
+ const res = await this.execute(sql22);
85562
+ return Number(
85563
+ res[0][0]["count"]
85564
+ );
85565
+ }
85546
85566
  getSetTransactionSQL(config) {
85547
85567
  const parts = [];
85548
85568
  if (config.isolationLevel) {
@@ -91374,6 +91394,12 @@ var init_session11 = __esm({
91374
91394
  async queryObjects(query, params) {
91375
91395
  return this.client(query, params, { arrayMode: false, fullResults: true });
91376
91396
  }
91397
+ async count(sql3) {
91398
+ const res = await this.execute(sql3);
91399
+ return Number(
91400
+ res["rows"][0]["count"]
91401
+ );
91402
+ }
91377
91403
  async transaction(_transaction, _config = {}) {
91378
91404
  throw new Error("No transactions support in neon-http driver");
91379
91405
  }
@@ -92172,6 +92198,12 @@ var init_session13 = __esm({
92172
92198
  this.logger.logQuery(querySql.sql, querySql.params);
92173
92199
  return this.client.execute(querySql.sql, querySql.params, { as: "object" }).then((eQuery) => eQuery.rows);
92174
92200
  }
92201
+ async count(sql22) {
92202
+ const res = await this.execute(sql22);
92203
+ return Number(
92204
+ res["rows"][0]["count"]
92205
+ );
92206
+ }
92175
92207
  transaction(transaction) {
92176
92208
  return this.baseClient.transaction((pstx) => {
92177
92209
  const session = new _PlanetscaleSession(this.baseClient, this.dialect, pstx, this.schema, this.options);
@@ -95120,6 +95152,12 @@ var init_session15 = __esm({
95120
95152
  this.logger.logQuery(querySql.sql, querySql.params);
95121
95153
  return this.client.execute(querySql.sql, querySql.params);
95122
95154
  }
95155
+ async count(sql22) {
95156
+ const res = await this.execute(sql22);
95157
+ return Number(
95158
+ res["rows"][0]["count"]
95159
+ );
95160
+ }
95123
95161
  async transaction(transaction) {
95124
95162
  const nativeTx = await this.baseClient.begin();
95125
95163
  try {
package/bin.cjs CHANGED
@@ -85221,7 +85221,7 @@ init_utils2();
85221
85221
  var version2 = async () => {
85222
85222
  const { npmVersion } = await ormCoreVersions();
85223
85223
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
85224
- const envVersion = "0.24.2-dab63b8";
85224
+ const envVersion = "0.24.2-efd821d";
85225
85225
  const kitVersion = envVersion ? `v${envVersion}` : "--";
85226
85226
  const versions = `drizzle-kit: ${kitVersion}
85227
85227
  ${ormVersion}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.24.2-dab63b8",
3
+ "version": "0.24.2-efd821d",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",