drizzle-kit 0.20.14-05603dc → 0.20.14-09c7020

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 +16 -13
  2. package/package.json +1 -1
package/bin.cjs CHANGED
@@ -60338,7 +60338,7 @@ __export(studio_exports, {
60338
60338
  drizzleForSQLite: () => drizzleForSQLite,
60339
60339
  prepareServer: () => prepareServer
60340
60340
  });
60341
- var import_node_https, drizzleForPostgres, drizzleForMySQL, drizzleForSQLite, proxySchema, jsonStringify, prepareServer;
60341
+ var import_node_https, drizzleForPostgres, drizzleForMySQL, prepareParams, drizzleForSQLite, proxySchema, jsonStringify, prepareServer;
60342
60342
  var init_studio = __esm({
60343
60343
  "src/serializer/studio.ts"() {
60344
60344
  init_dist();
@@ -60384,6 +60384,14 @@ var init_studio = __esm({
60384
60384
  proxy
60385
60385
  };
60386
60386
  };
60387
+ prepareParams = (params) => {
60388
+ return params.map((param) => {
60389
+ if (param && typeof param === "object" && "type" in param && "value" in param && param.type === "binary") {
60390
+ return Buffer.from(typeof param.value === "object" ? JSON.stringify(param.value) : param.value);
60391
+ }
60392
+ return param;
60393
+ });
60394
+ };
60387
60395
  drizzleForSQLite = async (config) => {
60388
60396
  const { driver: driver2, dbCredentials } = config;
60389
60397
  if (driver2 === "d1") {
@@ -60400,13 +60408,7 @@ var init_studio = __esm({
60400
60408
  const Database = await import("better-sqlite3");
60401
60409
  const client = new Database.default(dbCredentials.url);
60402
60410
  const proxy = async (params) => {
60403
- const buf = Buffer.from("kbcberc");
60404
- const preparedParams = params.params.map((param) => {
60405
- if (typeof param === "object" && "type" in param && "value" in param && param.type === "binary") {
60406
- return Buffer.from(typeof param.value === "object" ? JSON.stringify(param.value) : param.value);
60407
- }
60408
- return param;
60409
- });
60411
+ const preparedParams = prepareParams(params.params);
60410
60412
  if (params.method === "values" || params.method === "get" || params.method === "all") {
60411
60413
  return client.prepare(params.sql).raw(params.mode === "array").all(preparedParams);
60412
60414
  }
@@ -60422,9 +60424,10 @@ var init_studio = __esm({
60422
60424
  const { createClient } = await import("@libsql/client");
60423
60425
  const client = createClient(dbCredentials);
60424
60426
  const proxy = async (params) => {
60427
+ const preparedParams = prepareParams(params.params);
60425
60428
  const result = await client.execute({
60426
60429
  sql: params.sql,
60427
- args: params.params
60430
+ args: preparedParams
60428
60431
  });
60429
60432
  if (params.mode === "array") {
60430
60433
  return result.rows.map((row) => Object.values(row));
@@ -60458,10 +60461,10 @@ var init_studio = __esm({
60458
60461
  if (typeof value === "bigint") {
60459
60462
  return value.toString();
60460
60463
  }
60461
- if (typeof value === "object" && value !== null && "type" in value && "data" in value && value.type === "Buffer") {
60462
- return Buffer.from(value.data).toString("base64");
60463
- } else {
60464
- console.log(value);
60464
+ if (value && typeof value === "object" && "type" in value && "data" in value && (value.type === "Buffer" || value.type === "ArrayBuffer")) {
60465
+ return Buffer.from(
60466
+ value
60467
+ ).toString("base64");
60465
60468
  }
60466
60469
  return value;
60467
60470
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drizzle-kit",
3
- "version": "0.20.14-05603dc",
3
+ "version": "0.20.14-09c7020",
4
4
  "repository": "https://github.com/drizzle-team/drizzle-kit-mirror",
5
5
  "author": "Drizzle Team",
6
6
  "license": "MIT",