drizzle-kit 0.20.0-13160ca → 0.20.0-3d76318

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/utils.js CHANGED
@@ -20582,9 +20582,9 @@ var require_pg_types = __commonJS({
20582
20582
  }
20583
20583
  });
20584
20584
 
20585
- // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/defaults.js
20585
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/defaults.js
20586
20586
  var require_defaults = __commonJS({
20587
- "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/defaults.js"(exports, module2) {
20587
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/defaults.js"(exports, module2) {
20588
20588
  "use strict";
20589
20589
  module2.exports = {
20590
20590
  // database host. defaults to localhost
@@ -20644,11 +20644,10 @@ var require_defaults = __commonJS({
20644
20644
  }
20645
20645
  });
20646
20646
 
20647
- // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/utils.js
20647
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/utils.js
20648
20648
  var require_utils2 = __commonJS({
20649
- "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/utils.js"(exports, module2) {
20649
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/utils.js"(exports, module2) {
20650
20650
  "use strict";
20651
- var crypto = require("crypto");
20652
20651
  var defaults3 = require_defaults();
20653
20652
  function escapeElement(elementRepresentation) {
20654
20653
  var escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
@@ -20763,30 +20762,138 @@ var require_utils2 = __commonJS({
20763
20762
  }
20764
20763
  return config;
20765
20764
  }
20766
- var md5 = function(string) {
20767
- return crypto.createHash("md5").update(string, "utf-8").digest("hex");
20765
+ var escapeIdentifier = function(str) {
20766
+ return '"' + str.replace(/"/g, '""') + '"';
20768
20767
  };
20769
- var postgresMd5PasswordHash = function(user, password, salt) {
20770
- var inner = md5(password + user);
20771
- var outer = md5(Buffer.concat([Buffer.from(inner), salt]));
20772
- return "md5" + outer;
20768
+ var escapeLiteral = function(str) {
20769
+ var hasBackslash = false;
20770
+ var escaped = "'";
20771
+ for (var i = 0; i < str.length; i++) {
20772
+ var c = str[i];
20773
+ if (c === "'") {
20774
+ escaped += c + c;
20775
+ } else if (c === "\\") {
20776
+ escaped += c + c;
20777
+ hasBackslash = true;
20778
+ } else {
20779
+ escaped += c;
20780
+ }
20781
+ }
20782
+ escaped += "'";
20783
+ if (hasBackslash === true) {
20784
+ escaped = " E" + escaped;
20785
+ }
20786
+ return escaped;
20773
20787
  };
20774
20788
  module2.exports = {
20775
20789
  prepareValue: function prepareValueWrapper(value) {
20776
20790
  return prepareValue(value);
20777
20791
  },
20778
20792
  normalizeQueryConfig,
20793
+ escapeIdentifier,
20794
+ escapeLiteral
20795
+ };
20796
+ }
20797
+ });
20798
+
20799
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/utils-legacy.js
20800
+ var require_utils_legacy = __commonJS({
20801
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/utils-legacy.js"(exports, module2) {
20802
+ "use strict";
20803
+ var nodeCrypto = require("crypto");
20804
+ function md5(string) {
20805
+ return nodeCrypto.createHash("md5").update(string, "utf-8").digest("hex");
20806
+ }
20807
+ function postgresMd5PasswordHash(user, password, salt) {
20808
+ var inner = md5(password + user);
20809
+ var outer = md5(Buffer.concat([Buffer.from(inner), salt]));
20810
+ return "md5" + outer;
20811
+ }
20812
+ function sha256(text) {
20813
+ return nodeCrypto.createHash("sha256").update(text).digest();
20814
+ }
20815
+ function hmacSha256(key, msg) {
20816
+ return nodeCrypto.createHmac("sha256", key).update(msg).digest();
20817
+ }
20818
+ async function deriveKey(password, salt, iterations) {
20819
+ return nodeCrypto.pbkdf2Sync(password, salt, iterations, 32, "sha256");
20820
+ }
20821
+ module2.exports = {
20779
20822
  postgresMd5PasswordHash,
20823
+ randomBytes: nodeCrypto.randomBytes,
20824
+ deriveKey,
20825
+ sha256,
20826
+ hmacSha256,
20780
20827
  md5
20781
20828
  };
20782
20829
  }
20783
20830
  });
20784
20831
 
20785
- // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/sasl.js
20832
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/utils-webcrypto.js
20833
+ var require_utils_webcrypto = __commonJS({
20834
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/utils-webcrypto.js"(exports, module2) {
20835
+ var nodeCrypto = require("crypto");
20836
+ module2.exports = {
20837
+ postgresMd5PasswordHash,
20838
+ randomBytes,
20839
+ deriveKey,
20840
+ sha256,
20841
+ hmacSha256,
20842
+ md5
20843
+ };
20844
+ var webCrypto = nodeCrypto.webcrypto || globalThis.crypto;
20845
+ var subtleCrypto = webCrypto.subtle;
20846
+ var textEncoder = new TextEncoder();
20847
+ function randomBytes(length) {
20848
+ return webCrypto.getRandomValues(Buffer.alloc(length));
20849
+ }
20850
+ async function md5(string) {
20851
+ try {
20852
+ return nodeCrypto.createHash("md5").update(string, "utf-8").digest("hex");
20853
+ } catch (e) {
20854
+ const data = typeof string === "string" ? textEncoder.encode(string) : string;
20855
+ const hash = await subtleCrypto.digest("MD5", data);
20856
+ return Array.from(new Uint8Array(hash)).map((b) => b.toString(16).padStart(2, "0")).join("");
20857
+ }
20858
+ }
20859
+ async function postgresMd5PasswordHash(user, password, salt) {
20860
+ var inner = await md5(password + user);
20861
+ var outer = await md5(Buffer.concat([Buffer.from(inner), salt]));
20862
+ return "md5" + outer;
20863
+ }
20864
+ async function sha256(text) {
20865
+ return await subtleCrypto.digest("SHA-256", text);
20866
+ }
20867
+ async function hmacSha256(keyBuffer, msg) {
20868
+ const key = await subtleCrypto.importKey("raw", keyBuffer, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
20869
+ return await subtleCrypto.sign("HMAC", key, textEncoder.encode(msg));
20870
+ }
20871
+ async function deriveKey(password, salt, iterations) {
20872
+ const key = await subtleCrypto.importKey("raw", textEncoder.encode(password), "PBKDF2", false, ["deriveBits"]);
20873
+ const params = { name: "PBKDF2", hash: "SHA-256", salt, iterations };
20874
+ return await subtleCrypto.deriveBits(params, key, 32 * 8, ["deriveBits"]);
20875
+ }
20876
+ }
20877
+ });
20878
+
20879
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/utils.js
20880
+ var require_utils3 = __commonJS({
20881
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/utils.js"(exports, module2) {
20882
+ "use strict";
20883
+ var useLegacyCrypto = parseInt(process.versions && process.versions.node && process.versions.node.split(".")[0]) < 15;
20884
+ if (useLegacyCrypto) {
20885
+ module2.exports = require_utils_legacy();
20886
+ } else {
20887
+ module2.exports = require_utils_webcrypto();
20888
+ }
20889
+ }
20890
+ });
20891
+
20892
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/sasl.js
20786
20893
  var require_sasl = __commonJS({
20787
- "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/sasl.js"(exports, module2) {
20894
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/sasl.js"(exports, module2) {
20788
20895
  "use strict";
20789
- var crypto = require("crypto");
20896
+ var crypto = require_utils3();
20790
20897
  function startSession(mechanisms) {
20791
20898
  if (mechanisms.indexOf("SCRAM-SHA-256") === -1) {
20792
20899
  throw new Error("SASL: Only mechanism SCRAM-SHA-256 is currently supported");
@@ -20799,13 +20906,16 @@ var require_sasl = __commonJS({
20799
20906
  message: "SASLInitialResponse"
20800
20907
  };
20801
20908
  }
20802
- function continueSession(session, password, serverData) {
20909
+ async function continueSession(session, password, serverData) {
20803
20910
  if (session.message !== "SASLInitialResponse") {
20804
20911
  throw new Error("SASL: Last message was not SASLInitialResponse");
20805
20912
  }
20806
20913
  if (typeof password !== "string") {
20807
20914
  throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");
20808
20915
  }
20916
+ if (password === "") {
20917
+ throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string");
20918
+ }
20809
20919
  if (typeof serverData !== "string") {
20810
20920
  throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string");
20811
20921
  }
@@ -20815,21 +20925,20 @@ var require_sasl = __commonJS({
20815
20925
  } else if (sv.nonce.length === session.clientNonce.length) {
20816
20926
  throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short");
20817
20927
  }
20818
- var saltBytes = Buffer.from(sv.salt, "base64");
20819
- var saltedPassword = Hi(password, saltBytes, sv.iteration);
20820
- var clientKey = hmacSha256(saltedPassword, "Client Key");
20821
- var storedKey = sha256(clientKey);
20822
20928
  var clientFirstMessageBare = "n=*,r=" + session.clientNonce;
20823
20929
  var serverFirstMessage = "r=" + sv.nonce + ",s=" + sv.salt + ",i=" + sv.iteration;
20824
20930
  var clientFinalMessageWithoutProof = "c=biws,r=" + sv.nonce;
20825
20931
  var authMessage = clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageWithoutProof;
20826
- var clientSignature = hmacSha256(storedKey, authMessage);
20827
- var clientProofBytes = xorBuffers(clientKey, clientSignature);
20828
- var clientProof = clientProofBytes.toString("base64");
20829
- var serverKey = hmacSha256(saltedPassword, "Server Key");
20830
- var serverSignatureBytes = hmacSha256(serverKey, authMessage);
20932
+ var saltBytes = Buffer.from(sv.salt, "base64");
20933
+ var saltedPassword = await crypto.deriveKey(password, saltBytes, sv.iteration);
20934
+ var clientKey = await crypto.hmacSha256(saltedPassword, "Client Key");
20935
+ var storedKey = await crypto.sha256(clientKey);
20936
+ var clientSignature = await crypto.hmacSha256(storedKey, authMessage);
20937
+ var clientProof = xorBuffers(Buffer.from(clientKey), Buffer.from(clientSignature)).toString("base64");
20938
+ var serverKey = await crypto.hmacSha256(saltedPassword, "Server Key");
20939
+ var serverSignatureBytes = await crypto.hmacSha256(serverKey, authMessage);
20831
20940
  session.message = "SASLResponse";
20832
- session.serverSignature = serverSignatureBytes.toString("base64");
20941
+ session.serverSignature = Buffer.from(serverSignatureBytes).toString("base64");
20833
20942
  session.response = clientFinalMessageWithoutProof + ",p=" + clientProof;
20834
20943
  }
20835
20944
  function finalizeSession(session, serverData) {
@@ -20922,21 +21031,6 @@ var require_sasl = __commonJS({
20922
21031
  }
20923
21032
  return Buffer.from(a.map((_, i) => a[i] ^ b[i]));
20924
21033
  }
20925
- function sha256(text) {
20926
- return crypto.createHash("sha256").update(text).digest();
20927
- }
20928
- function hmacSha256(key, msg) {
20929
- return crypto.createHmac("sha256", key).update(msg).digest();
20930
- }
20931
- function Hi(password, saltBytes, iterations) {
20932
- var ui1 = hmacSha256(password, Buffer.concat([saltBytes, Buffer.from([0, 0, 0, 1])]));
20933
- var ui = ui1;
20934
- for (var i = 0; i < iterations - 1; i++) {
20935
- ui1 = hmacSha256(password, ui1);
20936
- ui = xorBuffers(ui, ui1);
20937
- }
20938
- return ui;
20939
- }
20940
21034
  module2.exports = {
20941
21035
  startSession,
20942
21036
  continueSession,
@@ -20945,303 +21039,9 @@ var require_sasl = __commonJS({
20945
21039
  }
20946
21040
  });
20947
21041
 
20948
- // node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js
20949
- var require_split2 = __commonJS({
20950
- "node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js"(exports, module2) {
20951
- "use strict";
20952
- var { Transform: Transform2 } = require("stream");
20953
- var { StringDecoder } = require("string_decoder");
20954
- var kLast = Symbol("last");
20955
- var kDecoder = Symbol("decoder");
20956
- function transform(chunk, enc, cb) {
20957
- let list;
20958
- if (this.overflow) {
20959
- const buf = this[kDecoder].write(chunk);
20960
- list = buf.split(this.matcher);
20961
- if (list.length === 1)
20962
- return cb();
20963
- list.shift();
20964
- this.overflow = false;
20965
- } else {
20966
- this[kLast] += this[kDecoder].write(chunk);
20967
- list = this[kLast].split(this.matcher);
20968
- }
20969
- this[kLast] = list.pop();
20970
- for (let i = 0; i < list.length; i++) {
20971
- try {
20972
- push(this, this.mapper(list[i]));
20973
- } catch (error2) {
20974
- return cb(error2);
20975
- }
20976
- }
20977
- this.overflow = this[kLast].length > this.maxLength;
20978
- if (this.overflow && !this.skipOverflow) {
20979
- cb(new Error("maximum buffer reached"));
20980
- return;
20981
- }
20982
- cb();
20983
- }
20984
- function flush(cb) {
20985
- this[kLast] += this[kDecoder].end();
20986
- if (this[kLast]) {
20987
- try {
20988
- push(this, this.mapper(this[kLast]));
20989
- } catch (error2) {
20990
- return cb(error2);
20991
- }
20992
- }
20993
- cb();
20994
- }
20995
- function push(self2, val) {
20996
- if (val !== void 0) {
20997
- self2.push(val);
20998
- }
20999
- }
21000
- function noop2(incoming) {
21001
- return incoming;
21002
- }
21003
- function split(matcher, mapper, options) {
21004
- matcher = matcher || /\r?\n/;
21005
- mapper = mapper || noop2;
21006
- options = options || {};
21007
- switch (arguments.length) {
21008
- case 1:
21009
- if (typeof matcher === "function") {
21010
- mapper = matcher;
21011
- matcher = /\r?\n/;
21012
- } else if (typeof matcher === "object" && !(matcher instanceof RegExp) && !matcher[Symbol.split]) {
21013
- options = matcher;
21014
- matcher = /\r?\n/;
21015
- }
21016
- break;
21017
- case 2:
21018
- if (typeof matcher === "function") {
21019
- options = mapper;
21020
- mapper = matcher;
21021
- matcher = /\r?\n/;
21022
- } else if (typeof mapper === "object") {
21023
- options = mapper;
21024
- mapper = noop2;
21025
- }
21026
- }
21027
- options = Object.assign({}, options);
21028
- options.autoDestroy = true;
21029
- options.transform = transform;
21030
- options.flush = flush;
21031
- options.readableObjectMode = true;
21032
- const stream = new Transform2(options);
21033
- stream[kLast] = "";
21034
- stream[kDecoder] = new StringDecoder("utf8");
21035
- stream.matcher = matcher;
21036
- stream.mapper = mapper;
21037
- stream.maxLength = options.maxLength;
21038
- stream.skipOverflow = options.skipOverflow || false;
21039
- stream.overflow = false;
21040
- stream._destroy = function(err2, cb) {
21041
- this._writableState.errorEmitted = false;
21042
- cb(err2);
21043
- };
21044
- return stream;
21045
- }
21046
- module2.exports = split;
21047
- }
21048
- });
21049
-
21050
- // node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/helper.js
21051
- var require_helper = __commonJS({
21052
- "node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/helper.js"(exports, module2) {
21053
- "use strict";
21054
- var path4 = require("path");
21055
- var Stream = require("stream").Stream;
21056
- var split = require_split2();
21057
- var util2 = require("util");
21058
- var defaultPort = 5432;
21059
- var isWin = process.platform === "win32";
21060
- var warnStream = process.stderr;
21061
- var S_IRWXG = 56;
21062
- var S_IRWXO = 7;
21063
- var S_IFMT = 61440;
21064
- var S_IFREG = 32768;
21065
- function isRegFile(mode) {
21066
- return (mode & S_IFMT) == S_IFREG;
21067
- }
21068
- var fieldNames = ["host", "port", "database", "user", "password"];
21069
- var nrOfFields = fieldNames.length;
21070
- var passKey = fieldNames[nrOfFields - 1];
21071
- function warn() {
21072
- var isWritable = warnStream instanceof Stream && true === warnStream.writable;
21073
- if (isWritable) {
21074
- var args = Array.prototype.slice.call(arguments).concat("\n");
21075
- warnStream.write(util2.format.apply(util2, args));
21076
- }
21077
- }
21078
- Object.defineProperty(module2.exports, "isWin", {
21079
- get: function() {
21080
- return isWin;
21081
- },
21082
- set: function(val) {
21083
- isWin = val;
21084
- }
21085
- });
21086
- module2.exports.warnTo = function(stream) {
21087
- var old = warnStream;
21088
- warnStream = stream;
21089
- return old;
21090
- };
21091
- module2.exports.getFileName = function(rawEnv) {
21092
- var env2 = rawEnv || process.env;
21093
- var file = env2.PGPASSFILE || (isWin ? path4.join(env2.APPDATA || "./", "postgresql", "pgpass.conf") : path4.join(env2.HOME || "./", ".pgpass"));
21094
- return file;
21095
- };
21096
- module2.exports.usePgPass = function(stats, fname) {
21097
- if (Object.prototype.hasOwnProperty.call(process.env, "PGPASSWORD")) {
21098
- return false;
21099
- }
21100
- if (isWin) {
21101
- return true;
21102
- }
21103
- fname = fname || "<unkn>";
21104
- if (!isRegFile(stats.mode)) {
21105
- warn('WARNING: password file "%s" is not a plain file', fname);
21106
- return false;
21107
- }
21108
- if (stats.mode & (S_IRWXG | S_IRWXO)) {
21109
- warn('WARNING: password file "%s" has group or world access; permissions should be u=rw (0600) or less', fname);
21110
- return false;
21111
- }
21112
- return true;
21113
- };
21114
- var matcher = module2.exports.match = function(connInfo, entry) {
21115
- return fieldNames.slice(0, -1).reduce(function(prev, field, idx) {
21116
- if (idx == 1) {
21117
- if (Number(connInfo[field] || defaultPort) === Number(entry[field])) {
21118
- return prev && true;
21119
- }
21120
- }
21121
- return prev && (entry[field] === "*" || entry[field] === connInfo[field]);
21122
- }, true);
21123
- };
21124
- module2.exports.getPassword = function(connInfo, stream, cb) {
21125
- var pass;
21126
- var lineStream = stream.pipe(split());
21127
- function onLine(line) {
21128
- var entry = parseLine(line);
21129
- if (entry && isValidEntry(entry) && matcher(connInfo, entry)) {
21130
- pass = entry[passKey];
21131
- lineStream.end();
21132
- }
21133
- }
21134
- var onEnd = function() {
21135
- stream.destroy();
21136
- cb(pass);
21137
- };
21138
- var onErr = function(err2) {
21139
- stream.destroy();
21140
- warn("WARNING: error on reading file: %s", err2);
21141
- cb(void 0);
21142
- };
21143
- stream.on("error", onErr);
21144
- lineStream.on("data", onLine).on("end", onEnd).on("error", onErr);
21145
- };
21146
- var parseLine = module2.exports.parseLine = function(line) {
21147
- if (line.length < 11 || line.match(/^\s+#/)) {
21148
- return null;
21149
- }
21150
- var curChar = "";
21151
- var prevChar = "";
21152
- var fieldIdx = 0;
21153
- var startIdx = 0;
21154
- var endIdx = 0;
21155
- var obj = {};
21156
- var isLastField = false;
21157
- var addToObj = function(idx, i0, i1) {
21158
- var field = line.substring(i0, i1);
21159
- if (!Object.hasOwnProperty.call(process.env, "PGPASS_NO_DEESCAPE")) {
21160
- field = field.replace(/\\([:\\])/g, "$1");
21161
- }
21162
- obj[fieldNames[idx]] = field;
21163
- };
21164
- for (var i = 0; i < line.length - 1; i += 1) {
21165
- curChar = line.charAt(i + 1);
21166
- prevChar = line.charAt(i);
21167
- isLastField = fieldIdx == nrOfFields - 1;
21168
- if (isLastField) {
21169
- addToObj(fieldIdx, startIdx);
21170
- break;
21171
- }
21172
- if (i >= 0 && curChar == ":" && prevChar !== "\\") {
21173
- addToObj(fieldIdx, startIdx, i + 1);
21174
- startIdx = i + 2;
21175
- fieldIdx += 1;
21176
- }
21177
- }
21178
- obj = Object.keys(obj).length === nrOfFields ? obj : null;
21179
- return obj;
21180
- };
21181
- var isValidEntry = module2.exports.isValidEntry = function(entry) {
21182
- var rules = {
21183
- // host
21184
- 0: function(x) {
21185
- return x.length > 0;
21186
- },
21187
- // port
21188
- 1: function(x) {
21189
- if (x === "*") {
21190
- return true;
21191
- }
21192
- x = Number(x);
21193
- return isFinite(x) && x > 0 && x < 9007199254740992 && Math.floor(x) === x;
21194
- },
21195
- // database
21196
- 2: function(x) {
21197
- return x.length > 0;
21198
- },
21199
- // username
21200
- 3: function(x) {
21201
- return x.length > 0;
21202
- },
21203
- // password
21204
- 4: function(x) {
21205
- return x.length > 0;
21206
- }
21207
- };
21208
- for (var idx = 0; idx < fieldNames.length; idx += 1) {
21209
- var rule = rules[idx];
21210
- var value = entry[fieldNames[idx]] || "";
21211
- var res = rule(value);
21212
- if (!res) {
21213
- return false;
21214
- }
21215
- }
21216
- return true;
21217
- };
21218
- }
21219
- });
21220
-
21221
- // node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js
21222
- var require_lib = __commonJS({
21223
- "node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module2) {
21224
- "use strict";
21225
- var path4 = require("path");
21226
- var fs6 = require("fs");
21227
- var helper = require_helper();
21228
- module2.exports = function(connInfo, cb) {
21229
- var file = helper.getFileName();
21230
- fs6.stat(file, function(err2, stat) {
21231
- if (err2 || !helper.usePgPass(stat, file)) {
21232
- return cb(void 0);
21233
- }
21234
- var st = fs6.createReadStream(file);
21235
- helper.getPassword(connInfo, st, cb);
21236
- });
21237
- };
21238
- module2.exports.warnTo = helper.warnTo;
21239
- }
21240
- });
21241
-
21242
- // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/type-overrides.js
21042
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/type-overrides.js
21243
21043
  var require_type_overrides = __commonJS({
21244
- "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/type-overrides.js"(exports, module2) {
21044
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/type-overrides.js"(exports, module2) {
21245
21045
  "use strict";
21246
21046
  var types = require_pg_types();
21247
21047
  function TypeOverrides(userTypes) {
@@ -21359,9 +21159,9 @@ var require_pg_connection_string = __commonJS({
21359
21159
  }
21360
21160
  });
21361
21161
 
21362
- // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/connection-parameters.js
21162
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/connection-parameters.js
21363
21163
  var require_connection_parameters = __commonJS({
21364
- "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/connection-parameters.js"(exports, module2) {
21164
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/connection-parameters.js"(exports, module2) {
21365
21165
  "use strict";
21366
21166
  var dns = require("dns");
21367
21167
  var defaults3 = require_defaults();
@@ -21498,9 +21298,9 @@ var require_connection_parameters = __commonJS({
21498
21298
  }
21499
21299
  });
21500
21300
 
21501
- // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/result.js
21301
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/result.js
21502
21302
  var require_result = __commonJS({
21503
- "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/result.js"(exports, module2) {
21303
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/result.js"(exports, module2) {
21504
21304
  "use strict";
21505
21305
  var types = require_pg_types();
21506
21306
  var matchRegexp = /^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/;
@@ -21518,6 +21318,7 @@ var require_result = __commonJS({
21518
21318
  if (this.rowAsArray) {
21519
21319
  this.parseRow = this._parseRowAsArray;
21520
21320
  }
21321
+ this._prebuiltEmptyResultObject = null;
21521
21322
  }
21522
21323
  // adds a command complete message
21523
21324
  addCommandComplete(msg) {
@@ -21550,14 +21351,12 @@ var require_result = __commonJS({
21550
21351
  return row;
21551
21352
  }
21552
21353
  parseRow(rowData) {
21553
- var row = {};
21354
+ var row = { ...this._prebuiltEmptyResultObject };
21554
21355
  for (var i = 0, len = rowData.length; i < len; i++) {
21555
21356
  var rawValue = rowData[i];
21556
21357
  var field = this.fields[i].name;
21557
21358
  if (rawValue !== null) {
21558
21359
  row[field] = this._parsers[i](rawValue);
21559
- } else {
21560
- row[field] = null;
21561
21360
  }
21562
21361
  }
21563
21362
  return row;
@@ -21578,15 +21377,23 @@ var require_result = __commonJS({
21578
21377
  this._parsers[i] = types.getTypeParser(desc.dataTypeID, desc.format || "text");
21579
21378
  }
21580
21379
  }
21380
+ this._createPrebuiltEmptyResultObject();
21381
+ }
21382
+ _createPrebuiltEmptyResultObject() {
21383
+ var row = {};
21384
+ for (var i = 0; i < this.fields.length; i++) {
21385
+ row[this.fields[i].name] = null;
21386
+ }
21387
+ this._prebuiltEmptyResultObject = { ...row };
21581
21388
  }
21582
21389
  };
21583
21390
  module2.exports = Result;
21584
21391
  }
21585
21392
  });
21586
21393
 
21587
- // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/query.js
21394
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/query.js
21588
21395
  var require_query = __commonJS({
21589
- "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/query.js"(exports, module2) {
21396
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/query.js"(exports, module2) {
21590
21397
  "use strict";
21591
21398
  var { EventEmitter } = require("events");
21592
21399
  var Result = require_result();
@@ -22612,13 +22419,50 @@ var require_dist = __commonJS({
22612
22419
  }
22613
22420
  });
22614
22421
 
22615
- // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/connection.js
22422
+ // node_modules/.pnpm/pg-cloudflare@1.1.1/node_modules/pg-cloudflare/dist/empty.js
22423
+ var empty_exports = {};
22424
+ __export(empty_exports, {
22425
+ default: () => empty_default
22426
+ });
22427
+ var empty_default;
22428
+ var init_empty = __esm({
22429
+ "node_modules/.pnpm/pg-cloudflare@1.1.1/node_modules/pg-cloudflare/dist/empty.js"() {
22430
+ empty_default = {};
22431
+ }
22432
+ });
22433
+
22434
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/stream.js
22435
+ var require_stream = __commonJS({
22436
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/stream.js"(exports, module2) {
22437
+ module2.exports.getStream = function getStream(ssl) {
22438
+ const net = require("net");
22439
+ if (typeof net.Socket === "function") {
22440
+ return new net.Socket();
22441
+ } else {
22442
+ const { CloudflareSocket } = (init_empty(), __toCommonJS(empty_exports));
22443
+ return new CloudflareSocket(ssl);
22444
+ }
22445
+ };
22446
+ module2.exports.getSecureStream = function getSecureStream(options) {
22447
+ var tls = require("tls");
22448
+ if (tls.connect) {
22449
+ return tls.connect(options);
22450
+ } else {
22451
+ options.socket.startTls(options);
22452
+ return options.socket;
22453
+ }
22454
+ };
22455
+ }
22456
+ });
22457
+
22458
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/connection.js
22616
22459
  var require_connection = __commonJS({
22617
- "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/connection.js"(exports, module2) {
22460
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/connection.js"(exports, module2) {
22618
22461
  "use strict";
22619
22462
  var net = require("net");
22620
22463
  var EventEmitter = require("events").EventEmitter;
22621
22464
  var { parse, serialize } = require_dist();
22465
+ var { getStream, getSecureStream } = require_stream();
22622
22466
  var flushBuffer = serialize.flush();
22623
22467
  var syncBuffer = serialize.sync();
22624
22468
  var endBuffer = serialize.end();
@@ -22626,7 +22470,10 @@ var require_connection = __commonJS({
22626
22470
  constructor(config) {
22627
22471
  super();
22628
22472
  config = config || {};
22629
- this.stream = config.stream || new net.Socket();
22473
+ this.stream = config.stream || getStream(config.ssl);
22474
+ if (typeof this.stream === "function") {
22475
+ this.stream = this.stream(config);
22476
+ }
22630
22477
  this._keepAlive = config.keepAlive;
22631
22478
  this._keepAliveInitialDelayMillis = config.keepAliveInitialDelayMillis;
22632
22479
  this.lastBuffer = false;
@@ -22677,7 +22524,6 @@ var require_connection = __commonJS({
22677
22524
  self2.stream.end();
22678
22525
  return self2.emit("error", new Error("There was an error establishing an SSL connection"));
22679
22526
  }
22680
- var tls = require("tls");
22681
22527
  const options = {
22682
22528
  socket: self2.stream
22683
22529
  };
@@ -22687,11 +22533,12 @@ var require_connection = __commonJS({
22687
22533
  options.key = self2.ssl.key;
22688
22534
  }
22689
22535
  }
22690
- if (net.isIP(host) === 0) {
22536
+ var net2 = require("net");
22537
+ if (net2.isIP && net2.isIP(host) === 0) {
22691
22538
  options.servername = host;
22692
22539
  }
22693
22540
  try {
22694
- self2.stream = tls.connect(options);
22541
+ self2.stream = getSecureStream(options);
22695
22542
  } catch (err2) {
22696
22543
  return self2.emit("error", err2);
22697
22544
  }
@@ -22701,9 +22548,6 @@ var require_connection = __commonJS({
22701
22548
  });
22702
22549
  }
22703
22550
  attachListeners(stream) {
22704
- stream.on("end", () => {
22705
- this.emit("end");
22706
- });
22707
22551
  parse(stream, (msg) => {
22708
22552
  var eventName = msg.name === "error" ? "errorMessage" : msg.name;
22709
22553
  if (this._emitMessage) {
@@ -22758,7 +22602,6 @@ var require_connection = __commonJS({
22758
22602
  }
22759
22603
  sync() {
22760
22604
  this._ending = true;
22761
- this._send(flushBuffer);
22762
22605
  this._send(syncBuffer);
22763
22606
  }
22764
22607
  ref() {
@@ -22797,20 +22640,313 @@ var require_connection = __commonJS({
22797
22640
  }
22798
22641
  });
22799
22642
 
22800
- // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/client.js
22643
+ // node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js
22644
+ var require_split2 = __commonJS({
22645
+ "node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js"(exports, module2) {
22646
+ "use strict";
22647
+ var { Transform: Transform2 } = require("stream");
22648
+ var { StringDecoder } = require("string_decoder");
22649
+ var kLast = Symbol("last");
22650
+ var kDecoder = Symbol("decoder");
22651
+ function transform(chunk, enc, cb) {
22652
+ let list;
22653
+ if (this.overflow) {
22654
+ const buf = this[kDecoder].write(chunk);
22655
+ list = buf.split(this.matcher);
22656
+ if (list.length === 1)
22657
+ return cb();
22658
+ list.shift();
22659
+ this.overflow = false;
22660
+ } else {
22661
+ this[kLast] += this[kDecoder].write(chunk);
22662
+ list = this[kLast].split(this.matcher);
22663
+ }
22664
+ this[kLast] = list.pop();
22665
+ for (let i = 0; i < list.length; i++) {
22666
+ try {
22667
+ push(this, this.mapper(list[i]));
22668
+ } catch (error2) {
22669
+ return cb(error2);
22670
+ }
22671
+ }
22672
+ this.overflow = this[kLast].length > this.maxLength;
22673
+ if (this.overflow && !this.skipOverflow) {
22674
+ cb(new Error("maximum buffer reached"));
22675
+ return;
22676
+ }
22677
+ cb();
22678
+ }
22679
+ function flush(cb) {
22680
+ this[kLast] += this[kDecoder].end();
22681
+ if (this[kLast]) {
22682
+ try {
22683
+ push(this, this.mapper(this[kLast]));
22684
+ } catch (error2) {
22685
+ return cb(error2);
22686
+ }
22687
+ }
22688
+ cb();
22689
+ }
22690
+ function push(self2, val) {
22691
+ if (val !== void 0) {
22692
+ self2.push(val);
22693
+ }
22694
+ }
22695
+ function noop2(incoming) {
22696
+ return incoming;
22697
+ }
22698
+ function split(matcher, mapper, options) {
22699
+ matcher = matcher || /\r?\n/;
22700
+ mapper = mapper || noop2;
22701
+ options = options || {};
22702
+ switch (arguments.length) {
22703
+ case 1:
22704
+ if (typeof matcher === "function") {
22705
+ mapper = matcher;
22706
+ matcher = /\r?\n/;
22707
+ } else if (typeof matcher === "object" && !(matcher instanceof RegExp) && !matcher[Symbol.split]) {
22708
+ options = matcher;
22709
+ matcher = /\r?\n/;
22710
+ }
22711
+ break;
22712
+ case 2:
22713
+ if (typeof matcher === "function") {
22714
+ options = mapper;
22715
+ mapper = matcher;
22716
+ matcher = /\r?\n/;
22717
+ } else if (typeof mapper === "object") {
22718
+ options = mapper;
22719
+ mapper = noop2;
22720
+ }
22721
+ }
22722
+ options = Object.assign({}, options);
22723
+ options.autoDestroy = true;
22724
+ options.transform = transform;
22725
+ options.flush = flush;
22726
+ options.readableObjectMode = true;
22727
+ const stream = new Transform2(options);
22728
+ stream[kLast] = "";
22729
+ stream[kDecoder] = new StringDecoder("utf8");
22730
+ stream.matcher = matcher;
22731
+ stream.mapper = mapper;
22732
+ stream.maxLength = options.maxLength;
22733
+ stream.skipOverflow = options.skipOverflow || false;
22734
+ stream.overflow = false;
22735
+ stream._destroy = function(err2, cb) {
22736
+ this._writableState.errorEmitted = false;
22737
+ cb(err2);
22738
+ };
22739
+ return stream;
22740
+ }
22741
+ module2.exports = split;
22742
+ }
22743
+ });
22744
+
22745
+ // node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/helper.js
22746
+ var require_helper = __commonJS({
22747
+ "node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/helper.js"(exports, module2) {
22748
+ "use strict";
22749
+ var path4 = require("path");
22750
+ var Stream = require("stream").Stream;
22751
+ var split = require_split2();
22752
+ var util2 = require("util");
22753
+ var defaultPort = 5432;
22754
+ var isWin = process.platform === "win32";
22755
+ var warnStream = process.stderr;
22756
+ var S_IRWXG = 56;
22757
+ var S_IRWXO = 7;
22758
+ var S_IFMT = 61440;
22759
+ var S_IFREG = 32768;
22760
+ function isRegFile(mode) {
22761
+ return (mode & S_IFMT) == S_IFREG;
22762
+ }
22763
+ var fieldNames = ["host", "port", "database", "user", "password"];
22764
+ var nrOfFields = fieldNames.length;
22765
+ var passKey = fieldNames[nrOfFields - 1];
22766
+ function warn() {
22767
+ var isWritable = warnStream instanceof Stream && true === warnStream.writable;
22768
+ if (isWritable) {
22769
+ var args = Array.prototype.slice.call(arguments).concat("\n");
22770
+ warnStream.write(util2.format.apply(util2, args));
22771
+ }
22772
+ }
22773
+ Object.defineProperty(module2.exports, "isWin", {
22774
+ get: function() {
22775
+ return isWin;
22776
+ },
22777
+ set: function(val) {
22778
+ isWin = val;
22779
+ }
22780
+ });
22781
+ module2.exports.warnTo = function(stream) {
22782
+ var old = warnStream;
22783
+ warnStream = stream;
22784
+ return old;
22785
+ };
22786
+ module2.exports.getFileName = function(rawEnv) {
22787
+ var env2 = rawEnv || process.env;
22788
+ var file = env2.PGPASSFILE || (isWin ? path4.join(env2.APPDATA || "./", "postgresql", "pgpass.conf") : path4.join(env2.HOME || "./", ".pgpass"));
22789
+ return file;
22790
+ };
22791
+ module2.exports.usePgPass = function(stats, fname) {
22792
+ if (Object.prototype.hasOwnProperty.call(process.env, "PGPASSWORD")) {
22793
+ return false;
22794
+ }
22795
+ if (isWin) {
22796
+ return true;
22797
+ }
22798
+ fname = fname || "<unkn>";
22799
+ if (!isRegFile(stats.mode)) {
22800
+ warn('WARNING: password file "%s" is not a plain file', fname);
22801
+ return false;
22802
+ }
22803
+ if (stats.mode & (S_IRWXG | S_IRWXO)) {
22804
+ warn('WARNING: password file "%s" has group or world access; permissions should be u=rw (0600) or less', fname);
22805
+ return false;
22806
+ }
22807
+ return true;
22808
+ };
22809
+ var matcher = module2.exports.match = function(connInfo, entry) {
22810
+ return fieldNames.slice(0, -1).reduce(function(prev, field, idx) {
22811
+ if (idx == 1) {
22812
+ if (Number(connInfo[field] || defaultPort) === Number(entry[field])) {
22813
+ return prev && true;
22814
+ }
22815
+ }
22816
+ return prev && (entry[field] === "*" || entry[field] === connInfo[field]);
22817
+ }, true);
22818
+ };
22819
+ module2.exports.getPassword = function(connInfo, stream, cb) {
22820
+ var pass;
22821
+ var lineStream = stream.pipe(split());
22822
+ function onLine(line) {
22823
+ var entry = parseLine(line);
22824
+ if (entry && isValidEntry(entry) && matcher(connInfo, entry)) {
22825
+ pass = entry[passKey];
22826
+ lineStream.end();
22827
+ }
22828
+ }
22829
+ var onEnd = function() {
22830
+ stream.destroy();
22831
+ cb(pass);
22832
+ };
22833
+ var onErr = function(err2) {
22834
+ stream.destroy();
22835
+ warn("WARNING: error on reading file: %s", err2);
22836
+ cb(void 0);
22837
+ };
22838
+ stream.on("error", onErr);
22839
+ lineStream.on("data", onLine).on("end", onEnd).on("error", onErr);
22840
+ };
22841
+ var parseLine = module2.exports.parseLine = function(line) {
22842
+ if (line.length < 11 || line.match(/^\s+#/)) {
22843
+ return null;
22844
+ }
22845
+ var curChar = "";
22846
+ var prevChar = "";
22847
+ var fieldIdx = 0;
22848
+ var startIdx = 0;
22849
+ var endIdx = 0;
22850
+ var obj = {};
22851
+ var isLastField = false;
22852
+ var addToObj = function(idx, i0, i1) {
22853
+ var field = line.substring(i0, i1);
22854
+ if (!Object.hasOwnProperty.call(process.env, "PGPASS_NO_DEESCAPE")) {
22855
+ field = field.replace(/\\([:\\])/g, "$1");
22856
+ }
22857
+ obj[fieldNames[idx]] = field;
22858
+ };
22859
+ for (var i = 0; i < line.length - 1; i += 1) {
22860
+ curChar = line.charAt(i + 1);
22861
+ prevChar = line.charAt(i);
22862
+ isLastField = fieldIdx == nrOfFields - 1;
22863
+ if (isLastField) {
22864
+ addToObj(fieldIdx, startIdx);
22865
+ break;
22866
+ }
22867
+ if (i >= 0 && curChar == ":" && prevChar !== "\\") {
22868
+ addToObj(fieldIdx, startIdx, i + 1);
22869
+ startIdx = i + 2;
22870
+ fieldIdx += 1;
22871
+ }
22872
+ }
22873
+ obj = Object.keys(obj).length === nrOfFields ? obj : null;
22874
+ return obj;
22875
+ };
22876
+ var isValidEntry = module2.exports.isValidEntry = function(entry) {
22877
+ var rules = {
22878
+ // host
22879
+ 0: function(x) {
22880
+ return x.length > 0;
22881
+ },
22882
+ // port
22883
+ 1: function(x) {
22884
+ if (x === "*") {
22885
+ return true;
22886
+ }
22887
+ x = Number(x);
22888
+ return isFinite(x) && x > 0 && x < 9007199254740992 && Math.floor(x) === x;
22889
+ },
22890
+ // database
22891
+ 2: function(x) {
22892
+ return x.length > 0;
22893
+ },
22894
+ // username
22895
+ 3: function(x) {
22896
+ return x.length > 0;
22897
+ },
22898
+ // password
22899
+ 4: function(x) {
22900
+ return x.length > 0;
22901
+ }
22902
+ };
22903
+ for (var idx = 0; idx < fieldNames.length; idx += 1) {
22904
+ var rule = rules[idx];
22905
+ var value = entry[fieldNames[idx]] || "";
22906
+ var res = rule(value);
22907
+ if (!res) {
22908
+ return false;
22909
+ }
22910
+ }
22911
+ return true;
22912
+ };
22913
+ }
22914
+ });
22915
+
22916
+ // node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js
22917
+ var require_lib = __commonJS({
22918
+ "node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module2) {
22919
+ "use strict";
22920
+ var path4 = require("path");
22921
+ var fs6 = require("fs");
22922
+ var helper = require_helper();
22923
+ module2.exports = function(connInfo, cb) {
22924
+ var file = helper.getFileName();
22925
+ fs6.stat(file, function(err2, stat) {
22926
+ if (err2 || !helper.usePgPass(stat, file)) {
22927
+ return cb(void 0);
22928
+ }
22929
+ var st = fs6.createReadStream(file);
22930
+ helper.getPassword(connInfo, st, cb);
22931
+ });
22932
+ };
22933
+ module2.exports.warnTo = helper.warnTo;
22934
+ }
22935
+ });
22936
+
22937
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/client.js
22801
22938
  var require_client = __commonJS({
22802
- "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/client.js"(exports, module2) {
22939
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/client.js"(exports, module2) {
22803
22940
  "use strict";
22804
22941
  var EventEmitter = require("events").EventEmitter;
22805
- var util2 = require("util");
22806
22942
  var utils = require_utils2();
22807
22943
  var sasl = require_sasl();
22808
- var pgPass = require_lib();
22809
22944
  var TypeOverrides = require_type_overrides();
22810
22945
  var ConnectionParameters = require_connection_parameters();
22811
22946
  var Query = require_query();
22812
22947
  var defaults3 = require_defaults();
22813
22948
  var Connection = require_connection();
22949
+ var crypto = require_utils3();
22814
22950
  var Client2 = class extends EventEmitter {
22815
22951
  constructor(config) {
22816
22952
  super();
@@ -22830,6 +22966,7 @@ var require_client = __commonJS({
22830
22966
  this._Promise = c.Promise || global.Promise;
22831
22967
  this._types = new TypeOverrides(c.types);
22832
22968
  this._ending = false;
22969
+ this._ended = false;
22833
22970
  this._connecting = false;
22834
22971
  this._connected = false;
22835
22972
  this._connectionError = false;
@@ -22905,6 +23042,7 @@ var require_client = __commonJS({
22905
23042
  const error2 = this._ending ? new Error("Connection terminated") : new Error("Connection terminated unexpectedly");
22906
23043
  clearTimeout(this.connectionTimeoutHandle);
22907
23044
  this._errorAllQueries(error2);
23045
+ this._ended = true;
22908
23046
  if (!this._ending) {
22909
23047
  if (this._connecting && !this._connectionError) {
22910
23048
  if (this._connectionCallback) {
@@ -22979,12 +23117,17 @@ var require_client = __commonJS({
22979
23117
  } else if (this.password !== null) {
22980
23118
  cb();
22981
23119
  } else {
22982
- pgPass(this.connectionParameters, (pass) => {
22983
- if (void 0 !== pass) {
22984
- this.connectionParameters.password = this.password = pass;
22985
- }
22986
- cb();
22987
- });
23120
+ try {
23121
+ const pgPass = require_lib();
23122
+ pgPass(this.connectionParameters, (pass) => {
23123
+ if (void 0 !== pass) {
23124
+ this.connectionParameters.password = this.password = pass;
23125
+ }
23126
+ cb();
23127
+ });
23128
+ } catch (e) {
23129
+ this.emit("error", e);
23130
+ }
22988
23131
  }
22989
23132
  }
22990
23133
  _handleAuthCleartextPassword(msg) {
@@ -22993,24 +23136,40 @@ var require_client = __commonJS({
22993
23136
  });
22994
23137
  }
22995
23138
  _handleAuthMD5Password(msg) {
22996
- this._checkPgPass(() => {
22997
- const hashedPassword = utils.postgresMd5PasswordHash(this.user, this.password, msg.salt);
22998
- this.connection.password(hashedPassword);
23139
+ this._checkPgPass(async () => {
23140
+ try {
23141
+ const hashedPassword = await crypto.postgresMd5PasswordHash(this.user, this.password, msg.salt);
23142
+ this.connection.password(hashedPassword);
23143
+ } catch (e) {
23144
+ this.emit("error", e);
23145
+ }
22999
23146
  });
23000
23147
  }
23001
23148
  _handleAuthSASL(msg) {
23002
23149
  this._checkPgPass(() => {
23003
- this.saslSession = sasl.startSession(msg.mechanisms);
23004
- this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism, this.saslSession.response);
23150
+ try {
23151
+ this.saslSession = sasl.startSession(msg.mechanisms);
23152
+ this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism, this.saslSession.response);
23153
+ } catch (err2) {
23154
+ this.connection.emit("error", err2);
23155
+ }
23005
23156
  });
23006
23157
  }
23007
- _handleAuthSASLContinue(msg) {
23008
- sasl.continueSession(this.saslSession, this.password, msg.data);
23009
- this.connection.sendSCRAMClientFinalMessage(this.saslSession.response);
23158
+ async _handleAuthSASLContinue(msg) {
23159
+ try {
23160
+ await sasl.continueSession(this.saslSession, this.password, msg.data);
23161
+ this.connection.sendSCRAMClientFinalMessage(this.saslSession.response);
23162
+ } catch (err2) {
23163
+ this.connection.emit("error", err2);
23164
+ }
23010
23165
  }
23011
23166
  _handleAuthSASLFinal(msg) {
23012
- sasl.finalizeSession(this.saslSession, msg.data);
23013
- this.saslSession = null;
23167
+ try {
23168
+ sasl.finalizeSession(this.saslSession, msg.data);
23169
+ this.saslSession = null;
23170
+ } catch (err2) {
23171
+ this.connection.emit("error", err2);
23172
+ }
23014
23173
  }
23015
23174
  _handleBackendKeyData(msg) {
23016
23175
  this.processID = msg.processID;
@@ -23152,30 +23311,14 @@ var require_client = __commonJS({
23152
23311
  getTypeParser(oid, format) {
23153
23312
  return this._types.getTypeParser(oid, format);
23154
23313
  }
23155
- // Ported from PostgreSQL 9.2.4 source code in src/interfaces/libpq/fe-exec.c
23314
+ // escapeIdentifier and escapeLiteral moved to utility functions & exported
23315
+ // on PG
23316
+ // re-exported here for backwards compatibility
23156
23317
  escapeIdentifier(str) {
23157
- return '"' + str.replace(/"/g, '""') + '"';
23318
+ return utils.escapeIdentifier(str);
23158
23319
  }
23159
- // Ported from PostgreSQL 9.2.4 source code in src/interfaces/libpq/fe-exec.c
23160
23320
  escapeLiteral(str) {
23161
- var hasBackslash = false;
23162
- var escaped = "'";
23163
- for (var i = 0; i < str.length; i++) {
23164
- var c = str[i];
23165
- if (c === "'") {
23166
- escaped += c + c;
23167
- } else if (c === "\\") {
23168
- escaped += c + c;
23169
- hasBackslash = true;
23170
- } else {
23171
- escaped += c;
23172
- }
23173
- }
23174
- escaped += "'";
23175
- if (hasBackslash === true) {
23176
- escaped = " E" + escaped;
23177
- }
23178
- return escaped;
23321
+ return utils.escapeLiteral(str);
23179
23322
  }
23180
23323
  _pulseQueryQueue() {
23181
23324
  if (this.readyForQuery === true) {
@@ -23217,6 +23360,9 @@ var require_client = __commonJS({
23217
23360
  if (!query.callback) {
23218
23361
  result = new this._Promise((resolve, reject) => {
23219
23362
  query.callback = (err2, res) => err2 ? reject(err2) : resolve(res);
23363
+ }).catch((err2) => {
23364
+ Error.captureStackTrace(err2);
23365
+ throw err2;
23220
23366
  });
23221
23367
  }
23222
23368
  }
@@ -23271,7 +23417,7 @@ var require_client = __commonJS({
23271
23417
  }
23272
23418
  end(cb) {
23273
23419
  this._ending = true;
23274
- if (!this.connection._connecting) {
23420
+ if (!this.connection._connecting || this._ended) {
23275
23421
  if (cb) {
23276
23422
  cb();
23277
23423
  } else {
@@ -23297,9 +23443,9 @@ var require_client = __commonJS({
23297
23443
  }
23298
23444
  });
23299
23445
 
23300
- // node_modules/.pnpm/pg-pool@3.6.1_pg@8.8.0/node_modules/pg-pool/index.js
23446
+ // node_modules/.pnpm/pg-pool@3.6.1_pg@8.11.3/node_modules/pg-pool/index.js
23301
23447
  var require_pg_pool = __commonJS({
23302
- "node_modules/.pnpm/pg-pool@3.6.1_pg@8.8.0/node_modules/pg-pool/index.js"(exports, module2) {
23448
+ "node_modules/.pnpm/pg-pool@3.6.1_pg@8.11.3/node_modules/pg-pool/index.js"(exports, module2) {
23303
23449
  "use strict";
23304
23450
  var EventEmitter = require("events").EventEmitter;
23305
23451
  var NOOP = function() {
@@ -23680,72 +23826,9 @@ var require_pg_pool = __commonJS({
23680
23826
  }
23681
23827
  });
23682
23828
 
23683
- // node_modules/.pnpm/pg@8.8.0/node_modules/pg/package.json
23684
- var require_package = __commonJS({
23685
- "node_modules/.pnpm/pg@8.8.0/node_modules/pg/package.json"(exports, module2) {
23686
- module2.exports = {
23687
- name: "pg",
23688
- version: "8.8.0",
23689
- description: "PostgreSQL client - pure javascript & libpq with the same API",
23690
- keywords: [
23691
- "database",
23692
- "libpq",
23693
- "pg",
23694
- "postgre",
23695
- "postgres",
23696
- "postgresql",
23697
- "rdbms"
23698
- ],
23699
- homepage: "https://github.com/brianc/node-postgres",
23700
- repository: {
23701
- type: "git",
23702
- url: "git://github.com/brianc/node-postgres.git",
23703
- directory: "packages/pg"
23704
- },
23705
- author: "Brian Carlson <brian.m.carlson@gmail.com>",
23706
- main: "./lib",
23707
- dependencies: {
23708
- "buffer-writer": "2.0.0",
23709
- "packet-reader": "1.0.0",
23710
- "pg-connection-string": "^2.5.0",
23711
- "pg-pool": "^3.5.2",
23712
- "pg-protocol": "^1.5.0",
23713
- "pg-types": "^2.1.0",
23714
- pgpass: "1.x"
23715
- },
23716
- devDependencies: {
23717
- async: "2.6.4",
23718
- bluebird: "3.5.2",
23719
- co: "4.6.0",
23720
- "pg-copy-streams": "0.3.0"
23721
- },
23722
- peerDependencies: {
23723
- "pg-native": ">=3.0.1"
23724
- },
23725
- peerDependenciesMeta: {
23726
- "pg-native": {
23727
- optional: true
23728
- }
23729
- },
23730
- scripts: {
23731
- test: "make test-all"
23732
- },
23733
- files: [
23734
- "lib",
23735
- "SPONSORS.md"
23736
- ],
23737
- license: "MIT",
23738
- engines: {
23739
- node: ">= 8.0.0"
23740
- },
23741
- gitHead: "c99fb2c127ddf8d712500db2c7b9a5491a178655"
23742
- };
23743
- }
23744
- });
23745
-
23746
- // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/native/query.js
23829
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/native/query.js
23747
23830
  var require_query2 = __commonJS({
23748
- "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/native/query.js"(exports, module2) {
23831
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/native/query.js"(exports, module2) {
23749
23832
  "use strict";
23750
23833
  var EventEmitter = require("events").EventEmitter;
23751
23834
  var util2 = require("util");
@@ -23885,13 +23968,17 @@ var require_query2 = __commonJS({
23885
23968
  }
23886
23969
  });
23887
23970
 
23888
- // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/native/client.js
23971
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/native/client.js
23889
23972
  var require_client2 = __commonJS({
23890
- "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/native/client.js"(exports, module2) {
23973
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/native/client.js"(exports, module2) {
23891
23974
  "use strict";
23892
- var Native = require("pg-native");
23975
+ var Native;
23976
+ try {
23977
+ Native = require("pg-native");
23978
+ } catch (e) {
23979
+ throw e;
23980
+ }
23893
23981
  var TypeOverrides = require_type_overrides();
23894
- var pkg = require_package();
23895
23982
  var EventEmitter = require("events").EventEmitter;
23896
23983
  var util2 = require("util");
23897
23984
  var ConnectionParameters = require_connection_parameters();
@@ -23910,6 +23997,8 @@ var require_client2 = __commonJS({
23910
23997
  this._connected = false;
23911
23998
  this._queryable = true;
23912
23999
  var cp = this.connectionParameters = new ConnectionParameters(config);
24000
+ if (config.nativeConnectionString)
24001
+ cp.nativeConnectionString = config.nativeConnectionString;
23913
24002
  this.user = cp.user;
23914
24003
  Object.defineProperty(this, "password", {
23915
24004
  configurable: true,
@@ -23946,6 +24035,8 @@ var require_client2 = __commonJS({
23946
24035
  }
23947
24036
  this._connecting = true;
23948
24037
  this.connectionParameters.getLibpqConnectionString(function(err2, conString) {
24038
+ if (self2.connectionParameters.nativeConnectionString)
24039
+ conString = self2.connectionParameters.nativeConnectionString;
23949
24040
  if (err2)
23950
24041
  return cb(err2);
23951
24042
  self2.native.connect(conString, function(err3) {
@@ -24008,6 +24099,9 @@ var require_client2 = __commonJS({
24008
24099
  result = new this._Promise((resolve, reject) => {
24009
24100
  resolveOut = resolve;
24010
24101
  rejectOut = reject;
24102
+ }).catch((err2) => {
24103
+ Error.captureStackTrace(err2);
24104
+ throw err2;
24011
24105
  });
24012
24106
  query.callback = (err2, res) => err2 ? rejectOut(err2) : resolveOut(res);
24013
24107
  }
@@ -24118,23 +24212,24 @@ var require_client2 = __commonJS({
24118
24212
  }
24119
24213
  });
24120
24214
 
24121
- // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/native/index.js
24215
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/native/index.js
24122
24216
  var require_native = __commonJS({
24123
- "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/native/index.js"(exports, module2) {
24217
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/native/index.js"(exports, module2) {
24124
24218
  "use strict";
24125
24219
  module2.exports = require_client2();
24126
24220
  }
24127
24221
  });
24128
24222
 
24129
- // node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/index.js
24223
+ // node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/index.js
24130
24224
  var require_lib2 = __commonJS({
24131
- "node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/index.js"(exports, module2) {
24225
+ "node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/index.js"(exports, module2) {
24132
24226
  "use strict";
24133
24227
  var Client2 = require_client();
24134
24228
  var defaults3 = require_defaults();
24135
24229
  var Connection = require_connection();
24136
24230
  var Pool = require_pg_pool();
24137
24231
  var { DatabaseError } = require_dist();
24232
+ var { escapeIdentifier, escapeLiteral } = require_utils2();
24138
24233
  var poolFactory = (Client3) => {
24139
24234
  return class BoundPool extends Pool {
24140
24235
  constructor(options) {
@@ -24151,6 +24246,8 @@ var require_lib2 = __commonJS({
24151
24246
  this.Connection = Connection;
24152
24247
  this.types = require_pg_types();
24153
24248
  this.DatabaseError = DatabaseError;
24249
+ this.escapeIdentifier = escapeIdentifier;
24250
+ this.escapeLiteral = escapeLiteral;
24154
24251
  };
24155
24252
  if (typeof process.env.NODE_PG_FORCE_NATIVE !== "undefined") {
24156
24253
  module2.exports = new PG(require_native());
@@ -41265,9 +41362,12 @@ var init_session = __esm({
41265
41362
  };
41266
41363
  _a = import_drizzle_orm9.entityKind;
41267
41364
  SQLiteWranglerD1Session[_a] = "SQLiteD1Session";
41268
- PreparedQuery = class extends import_sqlite_core3.PreparedQuery {
41365
+ PreparedQuery = class extends import_sqlite_core3.SQLitePreparedQuery {
41269
41366
  constructor(stmt, configPath, dbName, queryString, params, logger, fields, executeMethod, customResultMapper) {
41270
- super("async", executeMethod);
41367
+ super("async", executeMethod, {
41368
+ sql: queryString,
41369
+ params
41370
+ });
41271
41371
  this.stmt = stmt;
41272
41372
  this.configPath = configPath;
41273
41373
  this.dbName = dbName;
@@ -41326,7 +41426,11 @@ var init_session = __esm({
41326
41426
  async values(placeholderValues) {
41327
41427
  const params = (0, import_drizzle_orm11.fillPlaceholders)(this.params, placeholderValues ?? {});
41328
41428
  this.logger.logQuery(this.queryString, params);
41329
- const wranglerRes = await this.stmt(this.queryString, this.configPath, this.dbName);
41429
+ const wranglerRes = await this.stmt(
41430
+ this.queryString,
41431
+ this.configPath,
41432
+ this.dbName
41433
+ );
41330
41434
  return this.d1ToRawMapping(wranglerRes.results);
41331
41435
  }
41332
41436
  };
@@ -43439,7 +43543,7 @@ var require_glob_parent = __commonJS({
43439
43543
  });
43440
43544
 
43441
43545
  // node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/utils.js
43442
- var require_utils3 = __commonJS({
43546
+ var require_utils4 = __commonJS({
43443
43547
  "node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/utils.js"(exports) {
43444
43548
  "use strict";
43445
43549
  exports.isInteger = (num) => {
@@ -43526,7 +43630,7 @@ var require_utils3 = __commonJS({
43526
43630
  var require_stringify = __commonJS({
43527
43631
  "node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/stringify.js"(exports, module2) {
43528
43632
  "use strict";
43529
- var utils = require_utils3();
43633
+ var utils = require_utils4();
43530
43634
  module2.exports = (ast, options = {}) => {
43531
43635
  let stringify = (node, parent = {}) => {
43532
43636
  let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
@@ -43992,7 +44096,7 @@ var require_compile = __commonJS({
43992
44096
  "node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/compile.js"(exports, module2) {
43993
44097
  "use strict";
43994
44098
  var fill = require_fill_range();
43995
- var utils = require_utils3();
44099
+ var utils = require_utils4();
43996
44100
  var compile = (ast, options = {}) => {
43997
44101
  let walk = (node, parent = {}) => {
43998
44102
  let invalidBlock = utils.isInvalidBrace(parent);
@@ -44044,7 +44148,7 @@ var require_expand = __commonJS({
44044
44148
  "use strict";
44045
44149
  var fill = require_fill_range();
44046
44150
  var stringify = require_stringify();
44047
- var utils = require_utils3();
44151
+ var utils = require_utils4();
44048
44152
  var append = (queue = "", stash = "", enclose = false) => {
44049
44153
  let result = [];
44050
44154
  queue = [].concat(queue);
@@ -44741,7 +44845,7 @@ var require_constants2 = __commonJS({
44741
44845
  });
44742
44846
 
44743
44847
  // node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js
44744
- var require_utils4 = __commonJS({
44848
+ var require_utils5 = __commonJS({
44745
44849
  "node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js"(exports) {
44746
44850
  "use strict";
44747
44851
  var path4 = require("path");
@@ -44807,7 +44911,7 @@ var require_utils4 = __commonJS({
44807
44911
  var require_scan = __commonJS({
44808
44912
  "node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/scan.js"(exports, module2) {
44809
44913
  "use strict";
44810
- var utils = require_utils4();
44914
+ var utils = require_utils5();
44811
44915
  var {
44812
44916
  CHAR_ASTERISK,
44813
44917
  /* * */
@@ -45141,7 +45245,7 @@ var require_parse2 = __commonJS({
45141
45245
  "node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js"(exports, module2) {
45142
45246
  "use strict";
45143
45247
  var constants = require_constants2();
45144
- var utils = require_utils4();
45248
+ var utils = require_utils5();
45145
45249
  var {
45146
45250
  MAX_LENGTH,
45147
45251
  POSIX_REGEX_SOURCE,
@@ -45924,7 +46028,7 @@ var require_picomatch = __commonJS({
45924
46028
  var path4 = require("path");
45925
46029
  var scan = require_scan();
45926
46030
  var parse = require_parse2();
45927
- var utils = require_utils4();
46031
+ var utils = require_utils5();
45928
46032
  var constants = require_constants2();
45929
46033
  var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
45930
46034
  var picomatch = (glob2, options, returnState = false) => {
@@ -46076,7 +46180,7 @@ var require_micromatch = __commonJS({
46076
46180
  var util2 = require("util");
46077
46181
  var braces = require_braces();
46078
46182
  var picomatch = require_picomatch2();
46079
- var utils = require_utils4();
46183
+ var utils = require_utils5();
46080
46184
  var isEmptyString = (val) => val === "" || val === "./";
46081
46185
  var micromatch = (list, patterns, options) => {
46082
46186
  patterns = [].concat(patterns);
@@ -46380,7 +46484,7 @@ var require_pattern = __commonJS({
46380
46484
  });
46381
46485
 
46382
46486
  // node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/utils/stream.js
46383
- var require_stream = __commonJS({
46487
+ var require_stream2 = __commonJS({
46384
46488
  "node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/utils/stream.js"(exports) {
46385
46489
  "use strict";
46386
46490
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -46420,7 +46524,7 @@ var require_string2 = __commonJS({
46420
46524
  });
46421
46525
 
46422
46526
  // node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/utils/index.js
46423
- var require_utils5 = __commonJS({
46527
+ var require_utils6 = __commonJS({
46424
46528
  "node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/utils/index.js"(exports) {
46425
46529
  "use strict";
46426
46530
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -46435,7 +46539,7 @@ var require_utils5 = __commonJS({
46435
46539
  exports.path = path4;
46436
46540
  var pattern = require_pattern();
46437
46541
  exports.pattern = pattern;
46438
- var stream = require_stream();
46542
+ var stream = require_stream2();
46439
46543
  exports.stream = stream;
46440
46544
  var string = require_string2();
46441
46545
  exports.string = string;
@@ -46448,7 +46552,7 @@ var require_tasks = __commonJS({
46448
46552
  "use strict";
46449
46553
  Object.defineProperty(exports, "__esModule", { value: true });
46450
46554
  exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
46451
- var utils = require_utils5();
46555
+ var utils = require_utils6();
46452
46556
  function generate(input, settings) {
46453
46557
  const patterns = processPatterns(input, settings);
46454
46558
  const ignore = processPatterns(settings.ignore, settings);
@@ -46794,7 +46898,7 @@ var require_fs3 = __commonJS({
46794
46898
  });
46795
46899
 
46796
46900
  // node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/index.js
46797
- var require_utils6 = __commonJS({
46901
+ var require_utils7 = __commonJS({
46798
46902
  "node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports) {
46799
46903
  "use strict";
46800
46904
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -46829,7 +46933,7 @@ var require_async2 = __commonJS({
46829
46933
  var fsStat = require_out();
46830
46934
  var rpl = require_run_parallel();
46831
46935
  var constants_1 = require_constants3();
46832
- var utils = require_utils6();
46936
+ var utils = require_utils7();
46833
46937
  var common = require_common2();
46834
46938
  function read(directory, settings, callback) {
46835
46939
  if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
@@ -46938,7 +47042,7 @@ var require_sync2 = __commonJS({
46938
47042
  exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
46939
47043
  var fsStat = require_out();
46940
47044
  var constants_1 = require_constants3();
46941
- var utils = require_utils6();
47045
+ var utils = require_utils7();
46942
47046
  var common = require_common2();
46943
47047
  function read(directory, settings) {
46944
47048
  if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
@@ -47539,7 +47643,7 @@ var require_async4 = __commonJS({
47539
47643
  });
47540
47644
 
47541
47645
  // node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/stream.js
47542
- var require_stream2 = __commonJS({
47646
+ var require_stream3 = __commonJS({
47543
47647
  "node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/stream.js"(exports) {
47544
47648
  "use strict";
47545
47649
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -47702,7 +47806,7 @@ var require_out3 = __commonJS({
47702
47806
  Object.defineProperty(exports, "__esModule", { value: true });
47703
47807
  exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0;
47704
47808
  var async_1 = require_async4();
47705
- var stream_1 = require_stream2();
47809
+ var stream_1 = require_stream3();
47706
47810
  var sync_1 = require_sync4();
47707
47811
  var settings_1 = require_settings3();
47708
47812
  exports.Settings = settings_1.default;
@@ -47742,7 +47846,7 @@ var require_reader2 = __commonJS({
47742
47846
  Object.defineProperty(exports, "__esModule", { value: true });
47743
47847
  var path4 = require("path");
47744
47848
  var fsStat = require_out();
47745
- var utils = require_utils5();
47849
+ var utils = require_utils6();
47746
47850
  var Reader = class {
47747
47851
  constructor(_settings) {
47748
47852
  this._settings = _settings;
@@ -47775,7 +47879,7 @@ var require_reader2 = __commonJS({
47775
47879
  });
47776
47880
 
47777
47881
  // node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/readers/stream.js
47778
- var require_stream3 = __commonJS({
47882
+ var require_stream4 = __commonJS({
47779
47883
  "node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/readers/stream.js"(exports) {
47780
47884
  "use strict";
47781
47885
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -47838,7 +47942,7 @@ var require_async5 = __commonJS({
47838
47942
  Object.defineProperty(exports, "__esModule", { value: true });
47839
47943
  var fsWalk = require_out3();
47840
47944
  var reader_1 = require_reader2();
47841
- var stream_1 = require_stream3();
47945
+ var stream_1 = require_stream4();
47842
47946
  var ReaderAsync = class extends reader_1.default {
47843
47947
  constructor() {
47844
47948
  super(...arguments);
@@ -47875,7 +47979,7 @@ var require_matcher = __commonJS({
47875
47979
  "node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/providers/matchers/matcher.js"(exports) {
47876
47980
  "use strict";
47877
47981
  Object.defineProperty(exports, "__esModule", { value: true });
47878
- var utils = require_utils5();
47982
+ var utils = require_utils6();
47879
47983
  var Matcher = class {
47880
47984
  constructor(_patterns, _settings, _micromatchOptions) {
47881
47985
  this._patterns = _patterns;
@@ -47963,7 +48067,7 @@ var require_deep = __commonJS({
47963
48067
  "node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/providers/filters/deep.js"(exports) {
47964
48068
  "use strict";
47965
48069
  Object.defineProperty(exports, "__esModule", { value: true });
47966
- var utils = require_utils5();
48070
+ var utils = require_utils6();
47967
48071
  var partial_1 = require_partial();
47968
48072
  var DeepFilter = class {
47969
48073
  constructor(_settings, _micromatchOptions) {
@@ -48028,7 +48132,7 @@ var require_entry = __commonJS({
48028
48132
  "node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/providers/filters/entry.js"(exports) {
48029
48133
  "use strict";
48030
48134
  Object.defineProperty(exports, "__esModule", { value: true });
48031
- var utils = require_utils5();
48135
+ var utils = require_utils6();
48032
48136
  var EntryFilter = class {
48033
48137
  constructor(_settings, _micromatchOptions) {
48034
48138
  this._settings = _settings;
@@ -48094,7 +48198,7 @@ var require_error = __commonJS({
48094
48198
  "node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/providers/filters/error.js"(exports) {
48095
48199
  "use strict";
48096
48200
  Object.defineProperty(exports, "__esModule", { value: true });
48097
- var utils = require_utils5();
48201
+ var utils = require_utils6();
48098
48202
  var ErrorFilter = class {
48099
48203
  constructor(_settings) {
48100
48204
  this._settings = _settings;
@@ -48115,7 +48219,7 @@ var require_entry2 = __commonJS({
48115
48219
  "node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/providers/transformers/entry.js"(exports) {
48116
48220
  "use strict";
48117
48221
  Object.defineProperty(exports, "__esModule", { value: true });
48118
- var utils = require_utils5();
48222
+ var utils = require_utils6();
48119
48223
  var EntryTransformer = class {
48120
48224
  constructor(_settings) {
48121
48225
  this._settings = _settings;
@@ -48226,12 +48330,12 @@ var require_async6 = __commonJS({
48226
48330
  });
48227
48331
 
48228
48332
  // node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/providers/stream.js
48229
- var require_stream4 = __commonJS({
48333
+ var require_stream5 = __commonJS({
48230
48334
  "node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/providers/stream.js"(exports) {
48231
48335
  "use strict";
48232
48336
  Object.defineProperty(exports, "__esModule", { value: true });
48233
48337
  var stream_1 = require("stream");
48234
- var stream_2 = require_stream3();
48338
+ var stream_2 = require_stream4();
48235
48339
  var provider_1 = require_provider();
48236
48340
  var ProviderStream = class extends provider_1.default {
48237
48341
  constructor() {
@@ -48402,10 +48506,10 @@ var require_out4 = __commonJS({
48402
48506
  "use strict";
48403
48507
  var taskManager = require_tasks();
48404
48508
  var async_1 = require_async6();
48405
- var stream_1 = require_stream4();
48509
+ var stream_1 = require_stream5();
48406
48510
  var sync_1 = require_sync6();
48407
48511
  var settings_1 = require_settings4();
48408
- var utils = require_utils5();
48512
+ var utils = require_utils6();
48409
48513
  async function FastGlob(source, options) {
48410
48514
  assertPatternsInput2(source);
48411
48515
  const works = getWorks(source, async_1.default, options);
@@ -56712,14 +56816,17 @@ var init_studioUtils = __esm({
56712
56816
  import_sqlite_core5 = require("drizzle-orm/sqlite-core");
56713
56817
  init_utils();
56714
56818
  init_utils3();
56819
+ init_global();
56715
56820
  init_serializer();
56716
- drizzleDb = async (drizzleConfig, models, logger, pgClient) => {
56821
+ drizzleDb = async (drizzleConfig, models, logger) => {
56717
56822
  if (drizzleConfig.driver === "pg") {
56718
56823
  const { drizzle: drizzle2 } = await import("drizzle-orm/node-postgres");
56719
- if (!pgClient)
56720
- throw new Error("pg client not provided");
56824
+ const pg = await Promise.resolve().then(() => __toESM(require_lib2()));
56825
+ const db = drizzle2(new pg.default.Pool(drizzleConfig.dbCredentials), {
56826
+ logger
56827
+ });
56721
56828
  return {
56722
- db: drizzle2(pgClient, { logger }),
56829
+ db,
56723
56830
  type: "pg",
56724
56831
  schema: models.pgSchema
56725
56832
  };
@@ -56727,12 +56834,7 @@ var init_studioUtils = __esm({
56727
56834
  const { drizzle: drizzle2 } = await import("drizzle-orm/mysql2");
56728
56835
  const { createPool } = await Promise.resolve().then(() => __toESM(require_promise()));
56729
56836
  const client = createPool({
56730
- uri: drizzleConfig.dbCredentials.type === "url" ? drizzleConfig.dbCredentials.connectionString : void 0,
56731
- host: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.host : void 0,
56732
- port: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.port : void 0,
56733
- user: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.user : void 0,
56734
- database: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.database : void 0,
56735
- password: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.password : void 0,
56837
+ ...drizzleConfig.dbCredentials,
56736
56838
  connectionLimit: 1
56737
56839
  });
56738
56840
  return {
@@ -57174,8 +57276,7 @@ var init_utils5 = __esm({
57174
57276
  // @ts-ignore I don't know how to fix it yet. But will find a way
57175
57277
  connection,
57176
57278
  { pgSchema: models },
57177
- false,
57178
- client
57279
+ false
57179
57280
  );
57180
57281
  }
57181
57282
  return response;