drizzle-kit 0.26.2-b2b714a → 0.26.2-d39c24e

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/bin.cjs +81 -22
  2. package/package.json +1 -1
package/bin.cjs CHANGED
@@ -36070,6 +36070,28 @@ var init_dist2 = __esm({
36070
36070
  }
36071
36071
  });
36072
36072
 
36073
+ // ../node_modules/.pnpm/hono@4.5.0/node_modules/hono/dist/middleware/compress/index.js
36074
+ var ENCODING_TYPES, compress;
36075
+ var init_compress = __esm({
36076
+ "../node_modules/.pnpm/hono@4.5.0/node_modules/hono/dist/middleware/compress/index.js"() {
36077
+ ENCODING_TYPES = ["gzip", "deflate"];
36078
+ compress = (options) => {
36079
+ return async function compress2(ctx, next) {
36080
+ await next();
36081
+ const accepted = ctx.req.header("Accept-Encoding");
36082
+ const encoding = (options == null ? void 0 : options.encoding) ?? ENCODING_TYPES.find((encoding2) => accepted == null ? void 0 : accepted.includes(encoding2));
36083
+ if (!encoding || !ctx.res.body) {
36084
+ return;
36085
+ }
36086
+ const stream = new CompressionStream(encoding);
36087
+ ctx.res = new Response(ctx.res.body.pipeThrough(stream), ctx.res);
36088
+ ctx.res.headers.delete("Content-Length");
36089
+ ctx.res.headers.set("Content-Encoding", encoding);
36090
+ };
36091
+ };
36092
+ }
36093
+ });
36094
+
36073
36095
  // ../node_modules/.pnpm/hono@4.5.0/node_modules/hono/dist/middleware/cors/index.js
36074
36096
  var cors;
36075
36097
  var init_cors = __esm({
@@ -45025,8 +45047,8 @@ var require_sender = __commonJS({
45025
45047
  * @param {Function} [cb] Callback
45026
45048
  * @private
45027
45049
  */
45028
- dispatch(data, compress, options, cb) {
45029
- if (!compress) {
45050
+ dispatch(data, compress2, options, cb) {
45051
+ if (!compress2) {
45030
45052
  this.sendFrame(_Sender.frame(data, options), cb);
45031
45053
  return;
45032
45054
  }
@@ -56570,9 +56592,9 @@ var require_node2json = __commonJS({
56570
56592
  "../node_modules/.pnpm/fast-xml-parser@4.2.5/node_modules/fast-xml-parser/src/xmlparser/node2json.js"(exports2) {
56571
56593
  "use strict";
56572
56594
  function prettify(node, options) {
56573
- return compress(node, options);
56595
+ return compress2(node, options);
56574
56596
  }
56575
- function compress(arr, options, jPath) {
56597
+ function compress2(arr, options, jPath) {
56576
56598
  let text;
56577
56599
  const compressedObj = {};
56578
56600
  for (let i2 = 0; i2 < arr.length; i2++) {
@@ -56591,7 +56613,7 @@ var require_node2json = __commonJS({
56591
56613
  } else if (property === void 0) {
56592
56614
  continue;
56593
56615
  } else if (tagObj[property]) {
56594
- let val2 = compress(tagObj[property], options, newJpath);
56616
+ let val2 = compress2(tagObj[property], options, newJpath);
56595
56617
  const isLeaf = isLeafTag(val2, options);
56596
56618
  if (tagObj[":@"]) {
56597
56619
  assignAttributes(val2, tagObj[":@"], newJpath, options);
@@ -64994,7 +65016,7 @@ var init_connections = __esm({
64994
65016
  }
64995
65017
  if (driver2 === "pglite") {
64996
65018
  assertPackages("@electric-sql/pglite");
64997
- const { PGlite } = await import("@electric-sql/pglite");
65019
+ const { PGlite, types: types3 } = await import("@electric-sql/pglite");
64998
65020
  const { drizzle } = await import("drizzle-orm/pglite");
64999
65021
  const { migrate: migrate2 } = await import("drizzle-orm/pglite/migrator");
65000
65022
  const pglite = new PGlite(normalisePGliteUrl(credentials2.url));
@@ -65003,19 +65025,24 @@ var init_connections = __esm({
65003
65025
  const migrateFn = async (config) => {
65004
65026
  return migrate2(drzl, config);
65005
65027
  };
65028
+ const parsers = {
65029
+ [types3.TIMESTAMP]: (value) => value,
65030
+ [types3.TIMESTAMPTZ]: (value) => value,
65031
+ [types3.INTERVAL]: (value) => value,
65032
+ [types3.DATE]: (value) => value
65033
+ };
65006
65034
  const query = async (sql, params = []) => {
65007
- const result = await pglite.query(sql, params);
65035
+ const result = await pglite.query(sql, params, {
65036
+ parsers
65037
+ });
65008
65038
  return result.rows;
65009
65039
  };
65010
65040
  const proxy = async (params) => {
65011
65041
  const preparedParams = preparePGliteParams(params.params);
65012
- if (params.method === "values" || params.method === "get" || params.method === "all") {
65013
- const result2 = await pglite.query(params.sql, preparedParams, {
65014
- rowMode: params.mode
65015
- });
65016
- return result2.rows;
65017
- }
65018
- const result = await pglite.query(params.sql, preparedParams);
65042
+ const result = await pglite.query(params.sql, preparedParams, {
65043
+ rowMode: params.mode,
65044
+ parsers
65045
+ });
65019
65046
  return result.rows;
65020
65047
  };
65021
65048
  return { query, proxy, migrate: migrateFn };
@@ -65024,11 +65051,15 @@ var init_connections = __esm({
65024
65051
  }
65025
65052
  if (await checkPackage("pg")) {
65026
65053
  console.log(withStyle.info(`Using 'pg' driver for database querying`));
65027
- const pg = await import("pg");
65054
+ const { default: pg } = await import("pg");
65028
65055
  const { drizzle } = await import("drizzle-orm/node-postgres");
65029
65056
  const { migrate: migrate2 } = await import("drizzle-orm/node-postgres/migrator");
65030
65057
  const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
65031
- const client = "url" in credentials2 ? new pg.default.Pool({ connectionString: credentials2.url, max: 1 }) : new pg.default.Pool({ ...credentials2, ssl, max: 1 });
65058
+ pg.types.setTypeParser(pg.types.builtins.TIMESTAMPTZ, (val2) => val2);
65059
+ pg.types.setTypeParser(pg.types.builtins.TIMESTAMP, (val2) => val2);
65060
+ pg.types.setTypeParser(pg.types.builtins.DATE, (val2) => val2);
65061
+ pg.types.setTypeParser(pg.types.builtins.INTERVAL, (val2) => val2);
65062
+ const client = "url" in credentials2 ? new pg.Pool({ connectionString: credentials2.url, max: 1 }) : new pg.Pool({ ...credentials2, ssl, max: 1 });
65032
65063
  const db = drizzle(client);
65033
65064
  const migrateFn = async (config) => {
65034
65065
  return migrate2(db, config);
@@ -65055,6 +65086,13 @@ var init_connections = __esm({
65055
65086
  const { drizzle } = await import("drizzle-orm/postgres-js");
65056
65087
  const { migrate: migrate2 } = await import("drizzle-orm/postgres-js/migrator");
65057
65088
  const client = "url" in credentials2 ? postgres.default(credentials2.url, { max: 1 }) : postgres.default({ ...credentials2, max: 1 });
65089
+ const transparentParser = (val2) => val2;
65090
+ for (const type of ["1184", "1082", "1083", "1114"]) {
65091
+ client.options.parsers[type] = transparentParser;
65092
+ client.options.serializers[type] = transparentParser;
65093
+ }
65094
+ client.options.serializers["114"] = transparentParser;
65095
+ client.options.serializers["3802"] = transparentParser;
65058
65096
  const db = drizzle(client);
65059
65097
  const migrateFn = async (config) => {
65060
65098
  return migrate2(db, config);
@@ -65080,10 +65118,14 @@ var init_connections = __esm({
65080
65118
  "'@vercel/postgres' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
65081
65119
  )
65082
65120
  );
65083
- const { VercelPool } = await import("@vercel/postgres");
65121
+ const { VercelPool, types: types3 } = await import("@vercel/postgres");
65084
65122
  const { drizzle } = await import("drizzle-orm/vercel-postgres");
65085
65123
  const { migrate: migrate2 } = await import("drizzle-orm/vercel-postgres/migrator");
65086
65124
  const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
65125
+ types3.setTypeParser(types3.builtins.TIMESTAMPTZ, (val2) => val2);
65126
+ types3.setTypeParser(types3.builtins.TIMESTAMP, (val2) => val2);
65127
+ types3.setTypeParser(types3.builtins.DATE, (val2) => val2);
65128
+ types3.setTypeParser(types3.builtins.INTERVAL, (val2) => val2);
65087
65129
  const client = "url" in credentials2 ? new VercelPool({ connectionString: credentials2.url }) : new VercelPool({ ...credentials2, ssl });
65088
65130
  await client.connect();
65089
65131
  const db = drizzle(client);
@@ -65115,10 +65157,14 @@ var init_connections = __esm({
65115
65157
  "'@neondatabase/serverless' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
65116
65158
  )
65117
65159
  );
65118
- const { Pool, neonConfig } = await import("@neondatabase/serverless");
65160
+ const { Pool, neonConfig, types: types3 } = await import("@neondatabase/serverless");
65119
65161
  const { drizzle } = await import("drizzle-orm/neon-serverless");
65120
65162
  const { migrate: migrate2 } = await import("drizzle-orm/neon-serverless/migrator");
65121
65163
  const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
65164
+ types3.setTypeParser(types3.builtins.TIMESTAMPTZ, (val2) => val2);
65165
+ types3.setTypeParser(types3.builtins.TIMESTAMP, (val2) => val2);
65166
+ types3.setTypeParser(types3.builtins.DATE, (val2) => val2);
65167
+ types3.setTypeParser(types3.builtins.INTERVAL, (val2) => val2);
65122
65168
  const client = "url" in credentials2 ? new Pool({ connectionString: credentials2.url, max: 1 }) : new Pool({ ...credentials2, max: 1, ssl });
65123
65169
  neonConfig.webSocketConstructor = wrapper_default;
65124
65170
  const db = drizzle(client);
@@ -65175,16 +65221,27 @@ var init_connections = __esm({
65175
65221
  const migrateFn = async (config) => {
65176
65222
  return migrate2(db, config);
65177
65223
  };
65224
+ const typeCast = (field, next) => {
65225
+ if (field.type === "TIMESTAMP" || field.type === "DATETIME" || field.type === "DATE") {
65226
+ return field.string();
65227
+ }
65228
+ return next();
65229
+ };
65178
65230
  await connection.connect();
65179
65231
  const query = async (sql, params) => {
65180
- const res = await connection.execute(sql, params);
65232
+ const res = await connection.execute({
65233
+ sql,
65234
+ values: params,
65235
+ typeCast
65236
+ });
65181
65237
  return res[0];
65182
65238
  };
65183
65239
  const proxy = async (params) => {
65184
65240
  const result2 = await connection.query({
65185
65241
  sql: params.sql,
65186
65242
  values: params.params,
65187
- rowsAsArray: params.mode === "array"
65243
+ rowsAsArray: params.mode === "array",
65244
+ typeCast
65188
65245
  });
65189
65246
  return result2[0];
65190
65247
  };
@@ -65460,6 +65517,7 @@ var init_studio2 = __esm({
65460
65517
  import_sqlite_core3 = require("drizzle-orm/sqlite-core");
65461
65518
  import_fs10 = __toESM(require("fs"));
65462
65519
  init_dist2();
65520
+ init_compress();
65463
65521
  init_cors();
65464
65522
  import_node_https2 = require("node:https");
65465
65523
  init_global();
@@ -65780,11 +65838,12 @@ var init_studio2 = __esm({
65780
65838
  schemaFiles
65781
65839
  }, app) => {
65782
65840
  app = app !== void 0 ? app : new Hono2();
65783
- app.use(cors());
65841
+ app.use(compress());
65784
65842
  app.use(async (ctx, next) => {
65785
65843
  await next();
65786
65844
  ctx.header("Access-Control-Allow-Private-Network", "true");
65787
65845
  });
65846
+ app.use(cors());
65788
65847
  app.onError((err2, ctx) => {
65789
65848
  console.error(err2);
65790
65849
  return ctx.json({
@@ -88580,7 +88639,7 @@ init_utils2();
88580
88639
  var version2 = async () => {
88581
88640
  const { npmVersion } = await ormCoreVersions();
88582
88641
  const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
88583
- const envVersion = "0.26.2-b2b714a";
88642
+ const envVersion = "0.26.2-d39c24e";
88584
88643
  const kitVersion = envVersion ? `v${envVersion}` : "--";
88585
88644
  const versions = `drizzle-kit: ${kitVersion}
88586
88645
  ${ormVersion}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.26.2-b2b714a",
3
+ "version": "0.26.2-d39c24e",
4
4
  "homepage": "https://orm.drizzle.team",
5
5
  "keywords": [
6
6
  "drizzle",