drizzle-kit 0.20.0-572b8ee → 0.20.0-588929f
Sign up to get free protection for your applications and to get access to all the features.
- package/{index.cjs → bin.cjs} +986 -676
- package/cli/utils.d.ts +11 -0
- package/cli/validations/mysql.d.ts +77 -126
- package/cli/validations/studio.d.ts +118 -73
- package/global.d.ts +1 -0
- package/index.d.mts +105 -0
- package/index.d.ts +2 -2
- package/index.js +31 -0
- package/index.mjs +7 -0
- package/orm-extenstions/d1-driver/session.d.ts +2 -3
- package/package.json +24 -8
- package/serializer/studioUtils.d.ts +20 -3
- package/utils.d.ts +1 -2
- package/utils.js +1071 -956
package/{index.cjs → bin.cjs}
RENAMED
@@ -4542,6 +4542,9 @@ Is ${source_default.bold.blue(
|
|
4542
4542
|
});
|
4543
4543
|
|
4544
4544
|
// src/global.ts
|
4545
|
+
function assertUnreachable(x) {
|
4546
|
+
throw new Error("Didn't expect to get here");
|
4547
|
+
}
|
4545
4548
|
var originUUID, snapshotVersion;
|
4546
4549
|
var init_global = __esm({
|
4547
4550
|
"src/global.ts"() {
|
@@ -4555,7 +4558,7 @@ var index, fk, column, tableV3, compositePK, uniqueConstraint, tableV4, table, d
|
|
4555
4558
|
var init_mysqlSchema = __esm({
|
4556
4559
|
"src/serializer/mysqlSchema.ts"() {
|
4557
4560
|
init_global();
|
4558
|
-
|
4561
|
+
init_utils5();
|
4559
4562
|
init_lib();
|
4560
4563
|
index = objectType({
|
4561
4564
|
name: stringType(),
|
@@ -4835,7 +4838,7 @@ var indexV2, columnV2, tableV2, enumSchema, pgSchemaV2, references, columnV1, ta
|
|
4835
4838
|
var init_pgSchema = __esm({
|
4836
4839
|
"src/serializer/pgSchema.ts"() {
|
4837
4840
|
init_global();
|
4838
|
-
|
4841
|
+
init_utils5();
|
4839
4842
|
init_lib();
|
4840
4843
|
indexV2 = objectType({
|
4841
4844
|
name: stringType(),
|
@@ -5193,7 +5196,7 @@ var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dia
|
|
5193
5196
|
var init_sqliteSchema = __esm({
|
5194
5197
|
"src/serializer/sqliteSchema.ts"() {
|
5195
5198
|
init_global();
|
5196
|
-
|
5199
|
+
init_utils5();
|
5197
5200
|
init_lib();
|
5198
5201
|
index3 = objectType({
|
5199
5202
|
name: stringType(),
|
@@ -11376,9 +11379,6 @@ var init_utils = __esm({
|
|
11376
11379
|
readDrizzleConfig = async (configPath) => {
|
11377
11380
|
const defaultTsConfigExists = (0, import_fs.existsSync)((0, import_path.join)((0, import_path.resolve)("drizzle.config.ts")));
|
11378
11381
|
const defaultJsConfigExists = (0, import_fs.existsSync)((0, import_path.join)((0, import_path.resolve)("drizzle.config.js")));
|
11379
|
-
const defaultJsonConfigExists = (0, import_fs.existsSync)(
|
11380
|
-
(0, import_path.join)((0, import_path.resolve)("drizzle.config.json"))
|
11381
|
-
);
|
11382
11382
|
const defaultConfigPath = defaultTsConfigExists ? "drizzle.config.ts" : defaultJsConfigExists ? "drizzle.config.js" : "drizzle.config.json";
|
11383
11383
|
if (configPath) {
|
11384
11384
|
console.log(
|
@@ -11483,7 +11483,7 @@ var init_outputs = __esm({
|
|
11483
11483
|
connection: {
|
11484
11484
|
driver: () => withStyle.error(`Only "mysql2" is available options for "--driver"`),
|
11485
11485
|
required: () => withStyle.error(
|
11486
|
-
`Either "
|
11486
|
+
`Either "uri" or "host", "database" are required for database connection`
|
11487
11487
|
)
|
11488
11488
|
}
|
11489
11489
|
},
|
@@ -14815,7 +14815,7 @@ var init_migrate = __esm({
|
|
14815
14815
|
init_pgSchema();
|
14816
14816
|
init_sqliteSchema();
|
14817
14817
|
init_mysqlSchema();
|
14818
|
-
|
14818
|
+
init_utils5();
|
14819
14819
|
init_words();
|
14820
14820
|
init_outputs();
|
14821
14821
|
prepareAndMigratePg = async (config) => {
|
@@ -17189,7 +17189,7 @@ var init_snapshotsDiffer = __esm({
|
|
17189
17189
|
init_lib();
|
17190
17190
|
init_jsonDiffer();
|
17191
17191
|
init_jsonStatements();
|
17192
|
-
|
17192
|
+
init_utils5();
|
17193
17193
|
init_sqliteSchema();
|
17194
17194
|
init_mysqlSchema();
|
17195
17195
|
makeChanged = (schema4) => {
|
@@ -17811,7 +17811,7 @@ var init_pgUp = __esm({
|
|
17811
17811
|
import_fs5 = require("fs");
|
17812
17812
|
init_global();
|
17813
17813
|
init_pgSchema();
|
17814
|
-
|
17814
|
+
init_utils5();
|
17815
17815
|
upPgHandlerV4toV5 = (obj) => {
|
17816
17816
|
const mappedTables = {};
|
17817
17817
|
for (const [key, table4] of Object.entries(obj.tables)) {
|
@@ -18048,7 +18048,7 @@ var init_mysqlUp = __esm({
|
|
18048
18048
|
init_source();
|
18049
18049
|
import_fs6 = __toESM(require("fs"));
|
18050
18050
|
init_mysqlSchema();
|
18051
|
-
|
18051
|
+
init_utils5();
|
18052
18052
|
upMysqlHandler = (out) => {
|
18053
18053
|
};
|
18054
18054
|
upMySqlHandlerV4toV5 = (obj) => {
|
@@ -18161,7 +18161,7 @@ var init_upFolders = __esm({
|
|
18161
18161
|
init_mysqlSchema();
|
18162
18162
|
init_sqliteSchema();
|
18163
18163
|
init_snapshotsDiffer();
|
18164
|
-
|
18164
|
+
init_utils5();
|
18165
18165
|
init_words();
|
18166
18166
|
init_pgUp();
|
18167
18167
|
init_pgSchema();
|
@@ -21596,9 +21596,9 @@ var require_pg_types = __commonJS({
|
|
21596
21596
|
}
|
21597
21597
|
});
|
21598
21598
|
|
21599
|
-
// node_modules/.pnpm/pg@8.
|
21599
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/defaults.js
|
21600
21600
|
var require_defaults = __commonJS({
|
21601
|
-
"node_modules/.pnpm/pg@8.
|
21601
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/defaults.js"(exports, module2) {
|
21602
21602
|
"use strict";
|
21603
21603
|
module2.exports = {
|
21604
21604
|
// database host. defaults to localhost
|
@@ -21658,11 +21658,10 @@ var require_defaults = __commonJS({
|
|
21658
21658
|
}
|
21659
21659
|
});
|
21660
21660
|
|
21661
|
-
// node_modules/.pnpm/pg@8.
|
21661
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/utils.js
|
21662
21662
|
var require_utils2 = __commonJS({
|
21663
|
-
"node_modules/.pnpm/pg@8.
|
21663
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/utils.js"(exports, module2) {
|
21664
21664
|
"use strict";
|
21665
|
-
var crypto = require("crypto");
|
21666
21665
|
var defaults3 = require_defaults();
|
21667
21666
|
function escapeElement(elementRepresentation) {
|
21668
21667
|
var escaped = elementRepresentation.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
@@ -21777,30 +21776,138 @@ var require_utils2 = __commonJS({
|
|
21777
21776
|
}
|
21778
21777
|
return config;
|
21779
21778
|
}
|
21780
|
-
var
|
21781
|
-
return
|
21779
|
+
var escapeIdentifier = function(str) {
|
21780
|
+
return '"' + str.replace(/"/g, '""') + '"';
|
21782
21781
|
};
|
21783
|
-
var
|
21784
|
-
var
|
21785
|
-
var
|
21786
|
-
|
21782
|
+
var escapeLiteral = function(str) {
|
21783
|
+
var hasBackslash = false;
|
21784
|
+
var escaped = "'";
|
21785
|
+
for (var i = 0; i < str.length; i++) {
|
21786
|
+
var c = str[i];
|
21787
|
+
if (c === "'") {
|
21788
|
+
escaped += c + c;
|
21789
|
+
} else if (c === "\\") {
|
21790
|
+
escaped += c + c;
|
21791
|
+
hasBackslash = true;
|
21792
|
+
} else {
|
21793
|
+
escaped += c;
|
21794
|
+
}
|
21795
|
+
}
|
21796
|
+
escaped += "'";
|
21797
|
+
if (hasBackslash === true) {
|
21798
|
+
escaped = " E" + escaped;
|
21799
|
+
}
|
21800
|
+
return escaped;
|
21787
21801
|
};
|
21788
21802
|
module2.exports = {
|
21789
21803
|
prepareValue: function prepareValueWrapper(value) {
|
21790
21804
|
return prepareValue(value);
|
21791
21805
|
},
|
21792
21806
|
normalizeQueryConfig,
|
21807
|
+
escapeIdentifier,
|
21808
|
+
escapeLiteral
|
21809
|
+
};
|
21810
|
+
}
|
21811
|
+
});
|
21812
|
+
|
21813
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/utils-legacy.js
|
21814
|
+
var require_utils_legacy = __commonJS({
|
21815
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/utils-legacy.js"(exports, module2) {
|
21816
|
+
"use strict";
|
21817
|
+
var nodeCrypto = require("crypto");
|
21818
|
+
function md5(string) {
|
21819
|
+
return nodeCrypto.createHash("md5").update(string, "utf-8").digest("hex");
|
21820
|
+
}
|
21821
|
+
function postgresMd5PasswordHash(user, password, salt) {
|
21822
|
+
var inner = md5(password + user);
|
21823
|
+
var outer = md5(Buffer.concat([Buffer.from(inner), salt]));
|
21824
|
+
return "md5" + outer;
|
21825
|
+
}
|
21826
|
+
function sha256(text) {
|
21827
|
+
return nodeCrypto.createHash("sha256").update(text).digest();
|
21828
|
+
}
|
21829
|
+
function hmacSha256(key, msg) {
|
21830
|
+
return nodeCrypto.createHmac("sha256", key).update(msg).digest();
|
21831
|
+
}
|
21832
|
+
async function deriveKey(password, salt, iterations) {
|
21833
|
+
return nodeCrypto.pbkdf2Sync(password, salt, iterations, 32, "sha256");
|
21834
|
+
}
|
21835
|
+
module2.exports = {
|
21793
21836
|
postgresMd5PasswordHash,
|
21837
|
+
randomBytes: nodeCrypto.randomBytes,
|
21838
|
+
deriveKey,
|
21839
|
+
sha256,
|
21840
|
+
hmacSha256,
|
21794
21841
|
md5
|
21795
21842
|
};
|
21796
21843
|
}
|
21797
21844
|
});
|
21798
21845
|
|
21799
|
-
// node_modules/.pnpm/pg@8.
|
21846
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/utils-webcrypto.js
|
21847
|
+
var require_utils_webcrypto = __commonJS({
|
21848
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/utils-webcrypto.js"(exports, module2) {
|
21849
|
+
var nodeCrypto = require("crypto");
|
21850
|
+
module2.exports = {
|
21851
|
+
postgresMd5PasswordHash,
|
21852
|
+
randomBytes,
|
21853
|
+
deriveKey,
|
21854
|
+
sha256,
|
21855
|
+
hmacSha256,
|
21856
|
+
md5
|
21857
|
+
};
|
21858
|
+
var webCrypto = nodeCrypto.webcrypto || globalThis.crypto;
|
21859
|
+
var subtleCrypto = webCrypto.subtle;
|
21860
|
+
var textEncoder = new TextEncoder();
|
21861
|
+
function randomBytes(length) {
|
21862
|
+
return webCrypto.getRandomValues(Buffer.alloc(length));
|
21863
|
+
}
|
21864
|
+
async function md5(string) {
|
21865
|
+
try {
|
21866
|
+
return nodeCrypto.createHash("md5").update(string, "utf-8").digest("hex");
|
21867
|
+
} catch (e) {
|
21868
|
+
const data = typeof string === "string" ? textEncoder.encode(string) : string;
|
21869
|
+
const hash = await subtleCrypto.digest("MD5", data);
|
21870
|
+
return Array.from(new Uint8Array(hash)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
21871
|
+
}
|
21872
|
+
}
|
21873
|
+
async function postgresMd5PasswordHash(user, password, salt) {
|
21874
|
+
var inner = await md5(password + user);
|
21875
|
+
var outer = await md5(Buffer.concat([Buffer.from(inner), salt]));
|
21876
|
+
return "md5" + outer;
|
21877
|
+
}
|
21878
|
+
async function sha256(text) {
|
21879
|
+
return await subtleCrypto.digest("SHA-256", text);
|
21880
|
+
}
|
21881
|
+
async function hmacSha256(keyBuffer, msg) {
|
21882
|
+
const key = await subtleCrypto.importKey("raw", keyBuffer, { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
21883
|
+
return await subtleCrypto.sign("HMAC", key, textEncoder.encode(msg));
|
21884
|
+
}
|
21885
|
+
async function deriveKey(password, salt, iterations) {
|
21886
|
+
const key = await subtleCrypto.importKey("raw", textEncoder.encode(password), "PBKDF2", false, ["deriveBits"]);
|
21887
|
+
const params = { name: "PBKDF2", hash: "SHA-256", salt, iterations };
|
21888
|
+
return await subtleCrypto.deriveBits(params, key, 32 * 8, ["deriveBits"]);
|
21889
|
+
}
|
21890
|
+
}
|
21891
|
+
});
|
21892
|
+
|
21893
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/utils.js
|
21894
|
+
var require_utils3 = __commonJS({
|
21895
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/utils.js"(exports, module2) {
|
21896
|
+
"use strict";
|
21897
|
+
var useLegacyCrypto = parseInt(process.versions && process.versions.node && process.versions.node.split(".")[0]) < 15;
|
21898
|
+
if (useLegacyCrypto) {
|
21899
|
+
module2.exports = require_utils_legacy();
|
21900
|
+
} else {
|
21901
|
+
module2.exports = require_utils_webcrypto();
|
21902
|
+
}
|
21903
|
+
}
|
21904
|
+
});
|
21905
|
+
|
21906
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/sasl.js
|
21800
21907
|
var require_sasl = __commonJS({
|
21801
|
-
"node_modules/.pnpm/pg@8.
|
21908
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/crypto/sasl.js"(exports, module2) {
|
21802
21909
|
"use strict";
|
21803
|
-
var crypto =
|
21910
|
+
var crypto = require_utils3();
|
21804
21911
|
function startSession(mechanisms) {
|
21805
21912
|
if (mechanisms.indexOf("SCRAM-SHA-256") === -1) {
|
21806
21913
|
throw new Error("SASL: Only mechanism SCRAM-SHA-256 is currently supported");
|
@@ -21813,13 +21920,16 @@ var require_sasl = __commonJS({
|
|
21813
21920
|
message: "SASLInitialResponse"
|
21814
21921
|
};
|
21815
21922
|
}
|
21816
|
-
function continueSession(session, password, serverData) {
|
21923
|
+
async function continueSession(session, password, serverData) {
|
21817
21924
|
if (session.message !== "SASLInitialResponse") {
|
21818
21925
|
throw new Error("SASL: Last message was not SASLInitialResponse");
|
21819
21926
|
}
|
21820
21927
|
if (typeof password !== "string") {
|
21821
21928
|
throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");
|
21822
21929
|
}
|
21930
|
+
if (password === "") {
|
21931
|
+
throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string");
|
21932
|
+
}
|
21823
21933
|
if (typeof serverData !== "string") {
|
21824
21934
|
throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string");
|
21825
21935
|
}
|
@@ -21829,21 +21939,20 @@ var require_sasl = __commonJS({
|
|
21829
21939
|
} else if (sv.nonce.length === session.clientNonce.length) {
|
21830
21940
|
throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short");
|
21831
21941
|
}
|
21832
|
-
var saltBytes = Buffer.from(sv.salt, "base64");
|
21833
|
-
var saltedPassword = Hi(password, saltBytes, sv.iteration);
|
21834
|
-
var clientKey = hmacSha256(saltedPassword, "Client Key");
|
21835
|
-
var storedKey = sha256(clientKey);
|
21836
21942
|
var clientFirstMessageBare = "n=*,r=" + session.clientNonce;
|
21837
21943
|
var serverFirstMessage = "r=" + sv.nonce + ",s=" + sv.salt + ",i=" + sv.iteration;
|
21838
21944
|
var clientFinalMessageWithoutProof = "c=biws,r=" + sv.nonce;
|
21839
21945
|
var authMessage = clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageWithoutProof;
|
21840
|
-
var
|
21841
|
-
var
|
21842
|
-
var
|
21843
|
-
var
|
21844
|
-
var
|
21946
|
+
var saltBytes = Buffer.from(sv.salt, "base64");
|
21947
|
+
var saltedPassword = await crypto.deriveKey(password, saltBytes, sv.iteration);
|
21948
|
+
var clientKey = await crypto.hmacSha256(saltedPassword, "Client Key");
|
21949
|
+
var storedKey = await crypto.sha256(clientKey);
|
21950
|
+
var clientSignature = await crypto.hmacSha256(storedKey, authMessage);
|
21951
|
+
var clientProof = xorBuffers(Buffer.from(clientKey), Buffer.from(clientSignature)).toString("base64");
|
21952
|
+
var serverKey = await crypto.hmacSha256(saltedPassword, "Server Key");
|
21953
|
+
var serverSignatureBytes = await crypto.hmacSha256(serverKey, authMessage);
|
21845
21954
|
session.message = "SASLResponse";
|
21846
|
-
session.serverSignature = serverSignatureBytes.toString("base64");
|
21955
|
+
session.serverSignature = Buffer.from(serverSignatureBytes).toString("base64");
|
21847
21956
|
session.response = clientFinalMessageWithoutProof + ",p=" + clientProof;
|
21848
21957
|
}
|
21849
21958
|
function finalizeSession(session, serverData) {
|
@@ -21936,21 +22045,6 @@ var require_sasl = __commonJS({
|
|
21936
22045
|
}
|
21937
22046
|
return Buffer.from(a.map((_, i) => a[i] ^ b[i]));
|
21938
22047
|
}
|
21939
|
-
function sha256(text) {
|
21940
|
-
return crypto.createHash("sha256").update(text).digest();
|
21941
|
-
}
|
21942
|
-
function hmacSha256(key, msg) {
|
21943
|
-
return crypto.createHmac("sha256", key).update(msg).digest();
|
21944
|
-
}
|
21945
|
-
function Hi(password, saltBytes, iterations) {
|
21946
|
-
var ui1 = hmacSha256(password, Buffer.concat([saltBytes, Buffer.from([0, 0, 0, 1])]));
|
21947
|
-
var ui = ui1;
|
21948
|
-
for (var i = 0; i < iterations - 1; i++) {
|
21949
|
-
ui1 = hmacSha256(password, ui1);
|
21950
|
-
ui = xorBuffers(ui, ui1);
|
21951
|
-
}
|
21952
|
-
return ui;
|
21953
|
-
}
|
21954
22048
|
module2.exports = {
|
21955
22049
|
startSession,
|
21956
22050
|
continueSession,
|
@@ -21959,303 +22053,9 @@ var require_sasl = __commonJS({
|
|
21959
22053
|
}
|
21960
22054
|
});
|
21961
22055
|
|
21962
|
-
// node_modules/.pnpm/
|
21963
|
-
var require_split2 = __commonJS({
|
21964
|
-
"node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js"(exports, module2) {
|
21965
|
-
"use strict";
|
21966
|
-
var { Transform: Transform2 } = require("stream");
|
21967
|
-
var { StringDecoder } = require("string_decoder");
|
21968
|
-
var kLast = Symbol("last");
|
21969
|
-
var kDecoder = Symbol("decoder");
|
21970
|
-
function transform(chunk, enc, cb) {
|
21971
|
-
let list;
|
21972
|
-
if (this.overflow) {
|
21973
|
-
const buf = this[kDecoder].write(chunk);
|
21974
|
-
list = buf.split(this.matcher);
|
21975
|
-
if (list.length === 1)
|
21976
|
-
return cb();
|
21977
|
-
list.shift();
|
21978
|
-
this.overflow = false;
|
21979
|
-
} else {
|
21980
|
-
this[kLast] += this[kDecoder].write(chunk);
|
21981
|
-
list = this[kLast].split(this.matcher);
|
21982
|
-
}
|
21983
|
-
this[kLast] = list.pop();
|
21984
|
-
for (let i = 0; i < list.length; i++) {
|
21985
|
-
try {
|
21986
|
-
push(this, this.mapper(list[i]));
|
21987
|
-
} catch (error2) {
|
21988
|
-
return cb(error2);
|
21989
|
-
}
|
21990
|
-
}
|
21991
|
-
this.overflow = this[kLast].length > this.maxLength;
|
21992
|
-
if (this.overflow && !this.skipOverflow) {
|
21993
|
-
cb(new Error("maximum buffer reached"));
|
21994
|
-
return;
|
21995
|
-
}
|
21996
|
-
cb();
|
21997
|
-
}
|
21998
|
-
function flush(cb) {
|
21999
|
-
this[kLast] += this[kDecoder].end();
|
22000
|
-
if (this[kLast]) {
|
22001
|
-
try {
|
22002
|
-
push(this, this.mapper(this[kLast]));
|
22003
|
-
} catch (error2) {
|
22004
|
-
return cb(error2);
|
22005
|
-
}
|
22006
|
-
}
|
22007
|
-
cb();
|
22008
|
-
}
|
22009
|
-
function push(self2, val) {
|
22010
|
-
if (val !== void 0) {
|
22011
|
-
self2.push(val);
|
22012
|
-
}
|
22013
|
-
}
|
22014
|
-
function noop2(incoming) {
|
22015
|
-
return incoming;
|
22016
|
-
}
|
22017
|
-
function split(matcher, mapper, options) {
|
22018
|
-
matcher = matcher || /\r?\n/;
|
22019
|
-
mapper = mapper || noop2;
|
22020
|
-
options = options || {};
|
22021
|
-
switch (arguments.length) {
|
22022
|
-
case 1:
|
22023
|
-
if (typeof matcher === "function") {
|
22024
|
-
mapper = matcher;
|
22025
|
-
matcher = /\r?\n/;
|
22026
|
-
} else if (typeof matcher === "object" && !(matcher instanceof RegExp) && !matcher[Symbol.split]) {
|
22027
|
-
options = matcher;
|
22028
|
-
matcher = /\r?\n/;
|
22029
|
-
}
|
22030
|
-
break;
|
22031
|
-
case 2:
|
22032
|
-
if (typeof matcher === "function") {
|
22033
|
-
options = mapper;
|
22034
|
-
mapper = matcher;
|
22035
|
-
matcher = /\r?\n/;
|
22036
|
-
} else if (typeof mapper === "object") {
|
22037
|
-
options = mapper;
|
22038
|
-
mapper = noop2;
|
22039
|
-
}
|
22040
|
-
}
|
22041
|
-
options = Object.assign({}, options);
|
22042
|
-
options.autoDestroy = true;
|
22043
|
-
options.transform = transform;
|
22044
|
-
options.flush = flush;
|
22045
|
-
options.readableObjectMode = true;
|
22046
|
-
const stream = new Transform2(options);
|
22047
|
-
stream[kLast] = "";
|
22048
|
-
stream[kDecoder] = new StringDecoder("utf8");
|
22049
|
-
stream.matcher = matcher;
|
22050
|
-
stream.mapper = mapper;
|
22051
|
-
stream.maxLength = options.maxLength;
|
22052
|
-
stream.skipOverflow = options.skipOverflow || false;
|
22053
|
-
stream.overflow = false;
|
22054
|
-
stream._destroy = function(err2, cb) {
|
22055
|
-
this._writableState.errorEmitted = false;
|
22056
|
-
cb(err2);
|
22057
|
-
};
|
22058
|
-
return stream;
|
22059
|
-
}
|
22060
|
-
module2.exports = split;
|
22061
|
-
}
|
22062
|
-
});
|
22063
|
-
|
22064
|
-
// node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/helper.js
|
22065
|
-
var require_helper = __commonJS({
|
22066
|
-
"node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/helper.js"(exports, module2) {
|
22067
|
-
"use strict";
|
22068
|
-
var path4 = require("path");
|
22069
|
-
var Stream = require("stream").Stream;
|
22070
|
-
var split = require_split2();
|
22071
|
-
var util2 = require("util");
|
22072
|
-
var defaultPort = 5432;
|
22073
|
-
var isWin = process.platform === "win32";
|
22074
|
-
var warnStream = process.stderr;
|
22075
|
-
var S_IRWXG = 56;
|
22076
|
-
var S_IRWXO = 7;
|
22077
|
-
var S_IFMT = 61440;
|
22078
|
-
var S_IFREG = 32768;
|
22079
|
-
function isRegFile(mode) {
|
22080
|
-
return (mode & S_IFMT) == S_IFREG;
|
22081
|
-
}
|
22082
|
-
var fieldNames = ["host", "port", "database", "user", "password"];
|
22083
|
-
var nrOfFields = fieldNames.length;
|
22084
|
-
var passKey = fieldNames[nrOfFields - 1];
|
22085
|
-
function warn() {
|
22086
|
-
var isWritable = warnStream instanceof Stream && true === warnStream.writable;
|
22087
|
-
if (isWritable) {
|
22088
|
-
var args = Array.prototype.slice.call(arguments).concat("\n");
|
22089
|
-
warnStream.write(util2.format.apply(util2, args));
|
22090
|
-
}
|
22091
|
-
}
|
22092
|
-
Object.defineProperty(module2.exports, "isWin", {
|
22093
|
-
get: function() {
|
22094
|
-
return isWin;
|
22095
|
-
},
|
22096
|
-
set: function(val) {
|
22097
|
-
isWin = val;
|
22098
|
-
}
|
22099
|
-
});
|
22100
|
-
module2.exports.warnTo = function(stream) {
|
22101
|
-
var old = warnStream;
|
22102
|
-
warnStream = stream;
|
22103
|
-
return old;
|
22104
|
-
};
|
22105
|
-
module2.exports.getFileName = function(rawEnv) {
|
22106
|
-
var env2 = rawEnv || process.env;
|
22107
|
-
var file = env2.PGPASSFILE || (isWin ? path4.join(env2.APPDATA || "./", "postgresql", "pgpass.conf") : path4.join(env2.HOME || "./", ".pgpass"));
|
22108
|
-
return file;
|
22109
|
-
};
|
22110
|
-
module2.exports.usePgPass = function(stats, fname) {
|
22111
|
-
if (Object.prototype.hasOwnProperty.call(process.env, "PGPASSWORD")) {
|
22112
|
-
return false;
|
22113
|
-
}
|
22114
|
-
if (isWin) {
|
22115
|
-
return true;
|
22116
|
-
}
|
22117
|
-
fname = fname || "<unkn>";
|
22118
|
-
if (!isRegFile(stats.mode)) {
|
22119
|
-
warn('WARNING: password file "%s" is not a plain file', fname);
|
22120
|
-
return false;
|
22121
|
-
}
|
22122
|
-
if (stats.mode & (S_IRWXG | S_IRWXO)) {
|
22123
|
-
warn('WARNING: password file "%s" has group or world access; permissions should be u=rw (0600) or less', fname);
|
22124
|
-
return false;
|
22125
|
-
}
|
22126
|
-
return true;
|
22127
|
-
};
|
22128
|
-
var matcher = module2.exports.match = function(connInfo, entry) {
|
22129
|
-
return fieldNames.slice(0, -1).reduce(function(prev, field, idx) {
|
22130
|
-
if (idx == 1) {
|
22131
|
-
if (Number(connInfo[field] || defaultPort) === Number(entry[field])) {
|
22132
|
-
return prev && true;
|
22133
|
-
}
|
22134
|
-
}
|
22135
|
-
return prev && (entry[field] === "*" || entry[field] === connInfo[field]);
|
22136
|
-
}, true);
|
22137
|
-
};
|
22138
|
-
module2.exports.getPassword = function(connInfo, stream, cb) {
|
22139
|
-
var pass;
|
22140
|
-
var lineStream = stream.pipe(split());
|
22141
|
-
function onLine(line) {
|
22142
|
-
var entry = parseLine(line);
|
22143
|
-
if (entry && isValidEntry(entry) && matcher(connInfo, entry)) {
|
22144
|
-
pass = entry[passKey];
|
22145
|
-
lineStream.end();
|
22146
|
-
}
|
22147
|
-
}
|
22148
|
-
var onEnd = function() {
|
22149
|
-
stream.destroy();
|
22150
|
-
cb(pass);
|
22151
|
-
};
|
22152
|
-
var onErr = function(err2) {
|
22153
|
-
stream.destroy();
|
22154
|
-
warn("WARNING: error on reading file: %s", err2);
|
22155
|
-
cb(void 0);
|
22156
|
-
};
|
22157
|
-
stream.on("error", onErr);
|
22158
|
-
lineStream.on("data", onLine).on("end", onEnd).on("error", onErr);
|
22159
|
-
};
|
22160
|
-
var parseLine = module2.exports.parseLine = function(line) {
|
22161
|
-
if (line.length < 11 || line.match(/^\s+#/)) {
|
22162
|
-
return null;
|
22163
|
-
}
|
22164
|
-
var curChar = "";
|
22165
|
-
var prevChar = "";
|
22166
|
-
var fieldIdx = 0;
|
22167
|
-
var startIdx = 0;
|
22168
|
-
var endIdx = 0;
|
22169
|
-
var obj = {};
|
22170
|
-
var isLastField = false;
|
22171
|
-
var addToObj = function(idx, i0, i1) {
|
22172
|
-
var field = line.substring(i0, i1);
|
22173
|
-
if (!Object.hasOwnProperty.call(process.env, "PGPASS_NO_DEESCAPE")) {
|
22174
|
-
field = field.replace(/\\([:\\])/g, "$1");
|
22175
|
-
}
|
22176
|
-
obj[fieldNames[idx]] = field;
|
22177
|
-
};
|
22178
|
-
for (var i = 0; i < line.length - 1; i += 1) {
|
22179
|
-
curChar = line.charAt(i + 1);
|
22180
|
-
prevChar = line.charAt(i);
|
22181
|
-
isLastField = fieldIdx == nrOfFields - 1;
|
22182
|
-
if (isLastField) {
|
22183
|
-
addToObj(fieldIdx, startIdx);
|
22184
|
-
break;
|
22185
|
-
}
|
22186
|
-
if (i >= 0 && curChar == ":" && prevChar !== "\\") {
|
22187
|
-
addToObj(fieldIdx, startIdx, i + 1);
|
22188
|
-
startIdx = i + 2;
|
22189
|
-
fieldIdx += 1;
|
22190
|
-
}
|
22191
|
-
}
|
22192
|
-
obj = Object.keys(obj).length === nrOfFields ? obj : null;
|
22193
|
-
return obj;
|
22194
|
-
};
|
22195
|
-
var isValidEntry = module2.exports.isValidEntry = function(entry) {
|
22196
|
-
var rules = {
|
22197
|
-
// host
|
22198
|
-
0: function(x) {
|
22199
|
-
return x.length > 0;
|
22200
|
-
},
|
22201
|
-
// port
|
22202
|
-
1: function(x) {
|
22203
|
-
if (x === "*") {
|
22204
|
-
return true;
|
22205
|
-
}
|
22206
|
-
x = Number(x);
|
22207
|
-
return isFinite(x) && x > 0 && x < 9007199254740992 && Math.floor(x) === x;
|
22208
|
-
},
|
22209
|
-
// database
|
22210
|
-
2: function(x) {
|
22211
|
-
return x.length > 0;
|
22212
|
-
},
|
22213
|
-
// username
|
22214
|
-
3: function(x) {
|
22215
|
-
return x.length > 0;
|
22216
|
-
},
|
22217
|
-
// password
|
22218
|
-
4: function(x) {
|
22219
|
-
return x.length > 0;
|
22220
|
-
}
|
22221
|
-
};
|
22222
|
-
for (var idx = 0; idx < fieldNames.length; idx += 1) {
|
22223
|
-
var rule = rules[idx];
|
22224
|
-
var value = entry[fieldNames[idx]] || "";
|
22225
|
-
var res = rule(value);
|
22226
|
-
if (!res) {
|
22227
|
-
return false;
|
22228
|
-
}
|
22229
|
-
}
|
22230
|
-
return true;
|
22231
|
-
};
|
22232
|
-
}
|
22233
|
-
});
|
22234
|
-
|
22235
|
-
// node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js
|
22236
|
-
var require_lib = __commonJS({
|
22237
|
-
"node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module2) {
|
22238
|
-
"use strict";
|
22239
|
-
var path4 = require("path");
|
22240
|
-
var fs8 = require("fs");
|
22241
|
-
var helper = require_helper();
|
22242
|
-
module2.exports = function(connInfo, cb) {
|
22243
|
-
var file = helper.getFileName();
|
22244
|
-
fs8.stat(file, function(err2, stat) {
|
22245
|
-
if (err2 || !helper.usePgPass(stat, file)) {
|
22246
|
-
return cb(void 0);
|
22247
|
-
}
|
22248
|
-
var st = fs8.createReadStream(file);
|
22249
|
-
helper.getPassword(connInfo, st, cb);
|
22250
|
-
});
|
22251
|
-
};
|
22252
|
-
module2.exports.warnTo = helper.warnTo;
|
22253
|
-
}
|
22254
|
-
});
|
22255
|
-
|
22256
|
-
// node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/type-overrides.js
|
22056
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/type-overrides.js
|
22257
22057
|
var require_type_overrides = __commonJS({
|
22258
|
-
"node_modules/.pnpm/pg@8.
|
22058
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/type-overrides.js"(exports, module2) {
|
22259
22059
|
"use strict";
|
22260
22060
|
var types = require_pg_types();
|
22261
22061
|
function TypeOverrides(userTypes) {
|
@@ -22373,9 +22173,9 @@ var require_pg_connection_string = __commonJS({
|
|
22373
22173
|
}
|
22374
22174
|
});
|
22375
22175
|
|
22376
|
-
// node_modules/.pnpm/pg@8.
|
22176
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/connection-parameters.js
|
22377
22177
|
var require_connection_parameters = __commonJS({
|
22378
|
-
"node_modules/.pnpm/pg@8.
|
22178
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/connection-parameters.js"(exports, module2) {
|
22379
22179
|
"use strict";
|
22380
22180
|
var dns = require("dns");
|
22381
22181
|
var defaults3 = require_defaults();
|
@@ -22512,9 +22312,9 @@ var require_connection_parameters = __commonJS({
|
|
22512
22312
|
}
|
22513
22313
|
});
|
22514
22314
|
|
22515
|
-
// node_modules/.pnpm/pg@8.
|
22315
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/result.js
|
22516
22316
|
var require_result = __commonJS({
|
22517
|
-
"node_modules/.pnpm/pg@8.
|
22317
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/result.js"(exports, module2) {
|
22518
22318
|
"use strict";
|
22519
22319
|
var types = require_pg_types();
|
22520
22320
|
var matchRegexp = /^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/;
|
@@ -22532,6 +22332,7 @@ var require_result = __commonJS({
|
|
22532
22332
|
if (this.rowAsArray) {
|
22533
22333
|
this.parseRow = this._parseRowAsArray;
|
22534
22334
|
}
|
22335
|
+
this._prebuiltEmptyResultObject = null;
|
22535
22336
|
}
|
22536
22337
|
// adds a command complete message
|
22537
22338
|
addCommandComplete(msg) {
|
@@ -22564,14 +22365,12 @@ var require_result = __commonJS({
|
|
22564
22365
|
return row;
|
22565
22366
|
}
|
22566
22367
|
parseRow(rowData) {
|
22567
|
-
var row = {};
|
22368
|
+
var row = { ...this._prebuiltEmptyResultObject };
|
22568
22369
|
for (var i = 0, len = rowData.length; i < len; i++) {
|
22569
22370
|
var rawValue = rowData[i];
|
22570
22371
|
var field = this.fields[i].name;
|
22571
22372
|
if (rawValue !== null) {
|
22572
22373
|
row[field] = this._parsers[i](rawValue);
|
22573
|
-
} else {
|
22574
|
-
row[field] = null;
|
22575
22374
|
}
|
22576
22375
|
}
|
22577
22376
|
return row;
|
@@ -22592,15 +22391,23 @@ var require_result = __commonJS({
|
|
22592
22391
|
this._parsers[i] = types.getTypeParser(desc.dataTypeID, desc.format || "text");
|
22593
22392
|
}
|
22594
22393
|
}
|
22394
|
+
this._createPrebuiltEmptyResultObject();
|
22395
|
+
}
|
22396
|
+
_createPrebuiltEmptyResultObject() {
|
22397
|
+
var row = {};
|
22398
|
+
for (var i = 0; i < this.fields.length; i++) {
|
22399
|
+
row[this.fields[i].name] = null;
|
22400
|
+
}
|
22401
|
+
this._prebuiltEmptyResultObject = { ...row };
|
22595
22402
|
}
|
22596
22403
|
};
|
22597
22404
|
module2.exports = Result;
|
22598
22405
|
}
|
22599
22406
|
});
|
22600
22407
|
|
22601
|
-
// node_modules/.pnpm/pg@8.
|
22408
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/query.js
|
22602
22409
|
var require_query = __commonJS({
|
22603
|
-
"node_modules/.pnpm/pg@8.
|
22410
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/query.js"(exports, module2) {
|
22604
22411
|
"use strict";
|
22605
22412
|
var { EventEmitter } = require("events");
|
22606
22413
|
var Result = require_result();
|
@@ -23626,13 +23433,50 @@ var require_dist = __commonJS({
|
|
23626
23433
|
}
|
23627
23434
|
});
|
23628
23435
|
|
23629
|
-
// node_modules/.pnpm/pg@
|
23436
|
+
// node_modules/.pnpm/pg-cloudflare@1.1.1/node_modules/pg-cloudflare/dist/empty.js
|
23437
|
+
var empty_exports = {};
|
23438
|
+
__export(empty_exports, {
|
23439
|
+
default: () => empty_default
|
23440
|
+
});
|
23441
|
+
var empty_default;
|
23442
|
+
var init_empty = __esm({
|
23443
|
+
"node_modules/.pnpm/pg-cloudflare@1.1.1/node_modules/pg-cloudflare/dist/empty.js"() {
|
23444
|
+
empty_default = {};
|
23445
|
+
}
|
23446
|
+
});
|
23447
|
+
|
23448
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/stream.js
|
23449
|
+
var require_stream = __commonJS({
|
23450
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/stream.js"(exports, module2) {
|
23451
|
+
module2.exports.getStream = function getStream(ssl) {
|
23452
|
+
const net = require("net");
|
23453
|
+
if (typeof net.Socket === "function") {
|
23454
|
+
return new net.Socket();
|
23455
|
+
} else {
|
23456
|
+
const { CloudflareSocket } = (init_empty(), __toCommonJS(empty_exports));
|
23457
|
+
return new CloudflareSocket(ssl);
|
23458
|
+
}
|
23459
|
+
};
|
23460
|
+
module2.exports.getSecureStream = function getSecureStream(options) {
|
23461
|
+
var tls = require("tls");
|
23462
|
+
if (tls.connect) {
|
23463
|
+
return tls.connect(options);
|
23464
|
+
} else {
|
23465
|
+
options.socket.startTls(options);
|
23466
|
+
return options.socket;
|
23467
|
+
}
|
23468
|
+
};
|
23469
|
+
}
|
23470
|
+
});
|
23471
|
+
|
23472
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/connection.js
|
23630
23473
|
var require_connection = __commonJS({
|
23631
|
-
"node_modules/.pnpm/pg@8.
|
23474
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/connection.js"(exports, module2) {
|
23632
23475
|
"use strict";
|
23633
23476
|
var net = require("net");
|
23634
23477
|
var EventEmitter = require("events").EventEmitter;
|
23635
23478
|
var { parse, serialize } = require_dist();
|
23479
|
+
var { getStream, getSecureStream } = require_stream();
|
23636
23480
|
var flushBuffer = serialize.flush();
|
23637
23481
|
var syncBuffer = serialize.sync();
|
23638
23482
|
var endBuffer = serialize.end();
|
@@ -23640,7 +23484,10 @@ var require_connection = __commonJS({
|
|
23640
23484
|
constructor(config) {
|
23641
23485
|
super();
|
23642
23486
|
config = config || {};
|
23643
|
-
this.stream = config.stream ||
|
23487
|
+
this.stream = config.stream || getStream(config.ssl);
|
23488
|
+
if (typeof this.stream === "function") {
|
23489
|
+
this.stream = this.stream(config);
|
23490
|
+
}
|
23644
23491
|
this._keepAlive = config.keepAlive;
|
23645
23492
|
this._keepAliveInitialDelayMillis = config.keepAliveInitialDelayMillis;
|
23646
23493
|
this.lastBuffer = false;
|
@@ -23691,7 +23538,6 @@ var require_connection = __commonJS({
|
|
23691
23538
|
self2.stream.end();
|
23692
23539
|
return self2.emit("error", new Error("There was an error establishing an SSL connection"));
|
23693
23540
|
}
|
23694
|
-
var tls = require("tls");
|
23695
23541
|
const options = {
|
23696
23542
|
socket: self2.stream
|
23697
23543
|
};
|
@@ -23701,11 +23547,12 @@ var require_connection = __commonJS({
|
|
23701
23547
|
options.key = self2.ssl.key;
|
23702
23548
|
}
|
23703
23549
|
}
|
23704
|
-
|
23550
|
+
var net2 = require("net");
|
23551
|
+
if (net2.isIP && net2.isIP(host) === 0) {
|
23705
23552
|
options.servername = host;
|
23706
23553
|
}
|
23707
23554
|
try {
|
23708
|
-
self2.stream =
|
23555
|
+
self2.stream = getSecureStream(options);
|
23709
23556
|
} catch (err2) {
|
23710
23557
|
return self2.emit("error", err2);
|
23711
23558
|
}
|
@@ -23715,9 +23562,6 @@ var require_connection = __commonJS({
|
|
23715
23562
|
});
|
23716
23563
|
}
|
23717
23564
|
attachListeners(stream) {
|
23718
|
-
stream.on("end", () => {
|
23719
|
-
this.emit("end");
|
23720
|
-
});
|
23721
23565
|
parse(stream, (msg) => {
|
23722
23566
|
var eventName = msg.name === "error" ? "errorMessage" : msg.name;
|
23723
23567
|
if (this._emitMessage) {
|
@@ -23772,7 +23616,6 @@ var require_connection = __commonJS({
|
|
23772
23616
|
}
|
23773
23617
|
sync() {
|
23774
23618
|
this._ending = true;
|
23775
|
-
this._send(flushBuffer);
|
23776
23619
|
this._send(syncBuffer);
|
23777
23620
|
}
|
23778
23621
|
ref() {
|
@@ -23811,20 +23654,313 @@ var require_connection = __commonJS({
|
|
23811
23654
|
}
|
23812
23655
|
});
|
23813
23656
|
|
23814
|
-
// node_modules/.pnpm/
|
23657
|
+
// node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js
|
23658
|
+
var require_split2 = __commonJS({
|
23659
|
+
"node_modules/.pnpm/split2@4.2.0/node_modules/split2/index.js"(exports, module2) {
|
23660
|
+
"use strict";
|
23661
|
+
var { Transform: Transform2 } = require("stream");
|
23662
|
+
var { StringDecoder } = require("string_decoder");
|
23663
|
+
var kLast = Symbol("last");
|
23664
|
+
var kDecoder = Symbol("decoder");
|
23665
|
+
function transform(chunk, enc, cb) {
|
23666
|
+
let list;
|
23667
|
+
if (this.overflow) {
|
23668
|
+
const buf = this[kDecoder].write(chunk);
|
23669
|
+
list = buf.split(this.matcher);
|
23670
|
+
if (list.length === 1)
|
23671
|
+
return cb();
|
23672
|
+
list.shift();
|
23673
|
+
this.overflow = false;
|
23674
|
+
} else {
|
23675
|
+
this[kLast] += this[kDecoder].write(chunk);
|
23676
|
+
list = this[kLast].split(this.matcher);
|
23677
|
+
}
|
23678
|
+
this[kLast] = list.pop();
|
23679
|
+
for (let i = 0; i < list.length; i++) {
|
23680
|
+
try {
|
23681
|
+
push(this, this.mapper(list[i]));
|
23682
|
+
} catch (error2) {
|
23683
|
+
return cb(error2);
|
23684
|
+
}
|
23685
|
+
}
|
23686
|
+
this.overflow = this[kLast].length > this.maxLength;
|
23687
|
+
if (this.overflow && !this.skipOverflow) {
|
23688
|
+
cb(new Error("maximum buffer reached"));
|
23689
|
+
return;
|
23690
|
+
}
|
23691
|
+
cb();
|
23692
|
+
}
|
23693
|
+
function flush(cb) {
|
23694
|
+
this[kLast] += this[kDecoder].end();
|
23695
|
+
if (this[kLast]) {
|
23696
|
+
try {
|
23697
|
+
push(this, this.mapper(this[kLast]));
|
23698
|
+
} catch (error2) {
|
23699
|
+
return cb(error2);
|
23700
|
+
}
|
23701
|
+
}
|
23702
|
+
cb();
|
23703
|
+
}
|
23704
|
+
function push(self2, val) {
|
23705
|
+
if (val !== void 0) {
|
23706
|
+
self2.push(val);
|
23707
|
+
}
|
23708
|
+
}
|
23709
|
+
function noop2(incoming) {
|
23710
|
+
return incoming;
|
23711
|
+
}
|
23712
|
+
function split(matcher, mapper, options) {
|
23713
|
+
matcher = matcher || /\r?\n/;
|
23714
|
+
mapper = mapper || noop2;
|
23715
|
+
options = options || {};
|
23716
|
+
switch (arguments.length) {
|
23717
|
+
case 1:
|
23718
|
+
if (typeof matcher === "function") {
|
23719
|
+
mapper = matcher;
|
23720
|
+
matcher = /\r?\n/;
|
23721
|
+
} else if (typeof matcher === "object" && !(matcher instanceof RegExp) && !matcher[Symbol.split]) {
|
23722
|
+
options = matcher;
|
23723
|
+
matcher = /\r?\n/;
|
23724
|
+
}
|
23725
|
+
break;
|
23726
|
+
case 2:
|
23727
|
+
if (typeof matcher === "function") {
|
23728
|
+
options = mapper;
|
23729
|
+
mapper = matcher;
|
23730
|
+
matcher = /\r?\n/;
|
23731
|
+
} else if (typeof mapper === "object") {
|
23732
|
+
options = mapper;
|
23733
|
+
mapper = noop2;
|
23734
|
+
}
|
23735
|
+
}
|
23736
|
+
options = Object.assign({}, options);
|
23737
|
+
options.autoDestroy = true;
|
23738
|
+
options.transform = transform;
|
23739
|
+
options.flush = flush;
|
23740
|
+
options.readableObjectMode = true;
|
23741
|
+
const stream = new Transform2(options);
|
23742
|
+
stream[kLast] = "";
|
23743
|
+
stream[kDecoder] = new StringDecoder("utf8");
|
23744
|
+
stream.matcher = matcher;
|
23745
|
+
stream.mapper = mapper;
|
23746
|
+
stream.maxLength = options.maxLength;
|
23747
|
+
stream.skipOverflow = options.skipOverflow || false;
|
23748
|
+
stream.overflow = false;
|
23749
|
+
stream._destroy = function(err2, cb) {
|
23750
|
+
this._writableState.errorEmitted = false;
|
23751
|
+
cb(err2);
|
23752
|
+
};
|
23753
|
+
return stream;
|
23754
|
+
}
|
23755
|
+
module2.exports = split;
|
23756
|
+
}
|
23757
|
+
});
|
23758
|
+
|
23759
|
+
// node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/helper.js
|
23760
|
+
var require_helper = __commonJS({
|
23761
|
+
"node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/helper.js"(exports, module2) {
|
23762
|
+
"use strict";
|
23763
|
+
var path4 = require("path");
|
23764
|
+
var Stream = require("stream").Stream;
|
23765
|
+
var split = require_split2();
|
23766
|
+
var util2 = require("util");
|
23767
|
+
var defaultPort = 5432;
|
23768
|
+
var isWin = process.platform === "win32";
|
23769
|
+
var warnStream = process.stderr;
|
23770
|
+
var S_IRWXG = 56;
|
23771
|
+
var S_IRWXO = 7;
|
23772
|
+
var S_IFMT = 61440;
|
23773
|
+
var S_IFREG = 32768;
|
23774
|
+
function isRegFile(mode) {
|
23775
|
+
return (mode & S_IFMT) == S_IFREG;
|
23776
|
+
}
|
23777
|
+
var fieldNames = ["host", "port", "database", "user", "password"];
|
23778
|
+
var nrOfFields = fieldNames.length;
|
23779
|
+
var passKey = fieldNames[nrOfFields - 1];
|
23780
|
+
function warn() {
|
23781
|
+
var isWritable = warnStream instanceof Stream && true === warnStream.writable;
|
23782
|
+
if (isWritable) {
|
23783
|
+
var args = Array.prototype.slice.call(arguments).concat("\n");
|
23784
|
+
warnStream.write(util2.format.apply(util2, args));
|
23785
|
+
}
|
23786
|
+
}
|
23787
|
+
Object.defineProperty(module2.exports, "isWin", {
|
23788
|
+
get: function() {
|
23789
|
+
return isWin;
|
23790
|
+
},
|
23791
|
+
set: function(val) {
|
23792
|
+
isWin = val;
|
23793
|
+
}
|
23794
|
+
});
|
23795
|
+
module2.exports.warnTo = function(stream) {
|
23796
|
+
var old = warnStream;
|
23797
|
+
warnStream = stream;
|
23798
|
+
return old;
|
23799
|
+
};
|
23800
|
+
module2.exports.getFileName = function(rawEnv) {
|
23801
|
+
var env2 = rawEnv || process.env;
|
23802
|
+
var file = env2.PGPASSFILE || (isWin ? path4.join(env2.APPDATA || "./", "postgresql", "pgpass.conf") : path4.join(env2.HOME || "./", ".pgpass"));
|
23803
|
+
return file;
|
23804
|
+
};
|
23805
|
+
module2.exports.usePgPass = function(stats, fname) {
|
23806
|
+
if (Object.prototype.hasOwnProperty.call(process.env, "PGPASSWORD")) {
|
23807
|
+
return false;
|
23808
|
+
}
|
23809
|
+
if (isWin) {
|
23810
|
+
return true;
|
23811
|
+
}
|
23812
|
+
fname = fname || "<unkn>";
|
23813
|
+
if (!isRegFile(stats.mode)) {
|
23814
|
+
warn('WARNING: password file "%s" is not a plain file', fname);
|
23815
|
+
return false;
|
23816
|
+
}
|
23817
|
+
if (stats.mode & (S_IRWXG | S_IRWXO)) {
|
23818
|
+
warn('WARNING: password file "%s" has group or world access; permissions should be u=rw (0600) or less', fname);
|
23819
|
+
return false;
|
23820
|
+
}
|
23821
|
+
return true;
|
23822
|
+
};
|
23823
|
+
var matcher = module2.exports.match = function(connInfo, entry) {
|
23824
|
+
return fieldNames.slice(0, -1).reduce(function(prev, field, idx) {
|
23825
|
+
if (idx == 1) {
|
23826
|
+
if (Number(connInfo[field] || defaultPort) === Number(entry[field])) {
|
23827
|
+
return prev && true;
|
23828
|
+
}
|
23829
|
+
}
|
23830
|
+
return prev && (entry[field] === "*" || entry[field] === connInfo[field]);
|
23831
|
+
}, true);
|
23832
|
+
};
|
23833
|
+
module2.exports.getPassword = function(connInfo, stream, cb) {
|
23834
|
+
var pass;
|
23835
|
+
var lineStream = stream.pipe(split());
|
23836
|
+
function onLine(line) {
|
23837
|
+
var entry = parseLine(line);
|
23838
|
+
if (entry && isValidEntry(entry) && matcher(connInfo, entry)) {
|
23839
|
+
pass = entry[passKey];
|
23840
|
+
lineStream.end();
|
23841
|
+
}
|
23842
|
+
}
|
23843
|
+
var onEnd = function() {
|
23844
|
+
stream.destroy();
|
23845
|
+
cb(pass);
|
23846
|
+
};
|
23847
|
+
var onErr = function(err2) {
|
23848
|
+
stream.destroy();
|
23849
|
+
warn("WARNING: error on reading file: %s", err2);
|
23850
|
+
cb(void 0);
|
23851
|
+
};
|
23852
|
+
stream.on("error", onErr);
|
23853
|
+
lineStream.on("data", onLine).on("end", onEnd).on("error", onErr);
|
23854
|
+
};
|
23855
|
+
var parseLine = module2.exports.parseLine = function(line) {
|
23856
|
+
if (line.length < 11 || line.match(/^\s+#/)) {
|
23857
|
+
return null;
|
23858
|
+
}
|
23859
|
+
var curChar = "";
|
23860
|
+
var prevChar = "";
|
23861
|
+
var fieldIdx = 0;
|
23862
|
+
var startIdx = 0;
|
23863
|
+
var endIdx = 0;
|
23864
|
+
var obj = {};
|
23865
|
+
var isLastField = false;
|
23866
|
+
var addToObj = function(idx, i0, i1) {
|
23867
|
+
var field = line.substring(i0, i1);
|
23868
|
+
if (!Object.hasOwnProperty.call(process.env, "PGPASS_NO_DEESCAPE")) {
|
23869
|
+
field = field.replace(/\\([:\\])/g, "$1");
|
23870
|
+
}
|
23871
|
+
obj[fieldNames[idx]] = field;
|
23872
|
+
};
|
23873
|
+
for (var i = 0; i < line.length - 1; i += 1) {
|
23874
|
+
curChar = line.charAt(i + 1);
|
23875
|
+
prevChar = line.charAt(i);
|
23876
|
+
isLastField = fieldIdx == nrOfFields - 1;
|
23877
|
+
if (isLastField) {
|
23878
|
+
addToObj(fieldIdx, startIdx);
|
23879
|
+
break;
|
23880
|
+
}
|
23881
|
+
if (i >= 0 && curChar == ":" && prevChar !== "\\") {
|
23882
|
+
addToObj(fieldIdx, startIdx, i + 1);
|
23883
|
+
startIdx = i + 2;
|
23884
|
+
fieldIdx += 1;
|
23885
|
+
}
|
23886
|
+
}
|
23887
|
+
obj = Object.keys(obj).length === nrOfFields ? obj : null;
|
23888
|
+
return obj;
|
23889
|
+
};
|
23890
|
+
var isValidEntry = module2.exports.isValidEntry = function(entry) {
|
23891
|
+
var rules = {
|
23892
|
+
// host
|
23893
|
+
0: function(x) {
|
23894
|
+
return x.length > 0;
|
23895
|
+
},
|
23896
|
+
// port
|
23897
|
+
1: function(x) {
|
23898
|
+
if (x === "*") {
|
23899
|
+
return true;
|
23900
|
+
}
|
23901
|
+
x = Number(x);
|
23902
|
+
return isFinite(x) && x > 0 && x < 9007199254740992 && Math.floor(x) === x;
|
23903
|
+
},
|
23904
|
+
// database
|
23905
|
+
2: function(x) {
|
23906
|
+
return x.length > 0;
|
23907
|
+
},
|
23908
|
+
// username
|
23909
|
+
3: function(x) {
|
23910
|
+
return x.length > 0;
|
23911
|
+
},
|
23912
|
+
// password
|
23913
|
+
4: function(x) {
|
23914
|
+
return x.length > 0;
|
23915
|
+
}
|
23916
|
+
};
|
23917
|
+
for (var idx = 0; idx < fieldNames.length; idx += 1) {
|
23918
|
+
var rule = rules[idx];
|
23919
|
+
var value = entry[fieldNames[idx]] || "";
|
23920
|
+
var res = rule(value);
|
23921
|
+
if (!res) {
|
23922
|
+
return false;
|
23923
|
+
}
|
23924
|
+
}
|
23925
|
+
return true;
|
23926
|
+
};
|
23927
|
+
}
|
23928
|
+
});
|
23929
|
+
|
23930
|
+
// node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js
|
23931
|
+
var require_lib = __commonJS({
|
23932
|
+
"node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module2) {
|
23933
|
+
"use strict";
|
23934
|
+
var path4 = require("path");
|
23935
|
+
var fs8 = require("fs");
|
23936
|
+
var helper = require_helper();
|
23937
|
+
module2.exports = function(connInfo, cb) {
|
23938
|
+
var file = helper.getFileName();
|
23939
|
+
fs8.stat(file, function(err2, stat) {
|
23940
|
+
if (err2 || !helper.usePgPass(stat, file)) {
|
23941
|
+
return cb(void 0);
|
23942
|
+
}
|
23943
|
+
var st = fs8.createReadStream(file);
|
23944
|
+
helper.getPassword(connInfo, st, cb);
|
23945
|
+
});
|
23946
|
+
};
|
23947
|
+
module2.exports.warnTo = helper.warnTo;
|
23948
|
+
}
|
23949
|
+
});
|
23950
|
+
|
23951
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/client.js
|
23815
23952
|
var require_client = __commonJS({
|
23816
|
-
"node_modules/.pnpm/pg@8.
|
23953
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/client.js"(exports, module2) {
|
23817
23954
|
"use strict";
|
23818
23955
|
var EventEmitter = require("events").EventEmitter;
|
23819
|
-
var util2 = require("util");
|
23820
23956
|
var utils = require_utils2();
|
23821
23957
|
var sasl = require_sasl();
|
23822
|
-
var pgPass = require_lib();
|
23823
23958
|
var TypeOverrides = require_type_overrides();
|
23824
23959
|
var ConnectionParameters = require_connection_parameters();
|
23825
23960
|
var Query = require_query();
|
23826
23961
|
var defaults3 = require_defaults();
|
23827
23962
|
var Connection2 = require_connection();
|
23963
|
+
var crypto = require_utils3();
|
23828
23964
|
var Client2 = class extends EventEmitter {
|
23829
23965
|
constructor(config) {
|
23830
23966
|
super();
|
@@ -23844,6 +23980,7 @@ var require_client = __commonJS({
|
|
23844
23980
|
this._Promise = c.Promise || global.Promise;
|
23845
23981
|
this._types = new TypeOverrides(c.types);
|
23846
23982
|
this._ending = false;
|
23983
|
+
this._ended = false;
|
23847
23984
|
this._connecting = false;
|
23848
23985
|
this._connected = false;
|
23849
23986
|
this._connectionError = false;
|
@@ -23919,6 +24056,7 @@ var require_client = __commonJS({
|
|
23919
24056
|
const error2 = this._ending ? new Error("Connection terminated") : new Error("Connection terminated unexpectedly");
|
23920
24057
|
clearTimeout(this.connectionTimeoutHandle);
|
23921
24058
|
this._errorAllQueries(error2);
|
24059
|
+
this._ended = true;
|
23922
24060
|
if (!this._ending) {
|
23923
24061
|
if (this._connecting && !this._connectionError) {
|
23924
24062
|
if (this._connectionCallback) {
|
@@ -23993,12 +24131,17 @@ var require_client = __commonJS({
|
|
23993
24131
|
} else if (this.password !== null) {
|
23994
24132
|
cb();
|
23995
24133
|
} else {
|
23996
|
-
|
23997
|
-
|
23998
|
-
|
23999
|
-
|
24000
|
-
|
24001
|
-
|
24134
|
+
try {
|
24135
|
+
const pgPass = require_lib();
|
24136
|
+
pgPass(this.connectionParameters, (pass) => {
|
24137
|
+
if (void 0 !== pass) {
|
24138
|
+
this.connectionParameters.password = this.password = pass;
|
24139
|
+
}
|
24140
|
+
cb();
|
24141
|
+
});
|
24142
|
+
} catch (e) {
|
24143
|
+
this.emit("error", e);
|
24144
|
+
}
|
24002
24145
|
}
|
24003
24146
|
}
|
24004
24147
|
_handleAuthCleartextPassword(msg) {
|
@@ -24007,24 +24150,40 @@ var require_client = __commonJS({
|
|
24007
24150
|
});
|
24008
24151
|
}
|
24009
24152
|
_handleAuthMD5Password(msg) {
|
24010
|
-
this._checkPgPass(() => {
|
24011
|
-
|
24012
|
-
|
24153
|
+
this._checkPgPass(async () => {
|
24154
|
+
try {
|
24155
|
+
const hashedPassword = await crypto.postgresMd5PasswordHash(this.user, this.password, msg.salt);
|
24156
|
+
this.connection.password(hashedPassword);
|
24157
|
+
} catch (e) {
|
24158
|
+
this.emit("error", e);
|
24159
|
+
}
|
24013
24160
|
});
|
24014
24161
|
}
|
24015
24162
|
_handleAuthSASL(msg) {
|
24016
24163
|
this._checkPgPass(() => {
|
24017
|
-
|
24018
|
-
|
24164
|
+
try {
|
24165
|
+
this.saslSession = sasl.startSession(msg.mechanisms);
|
24166
|
+
this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism, this.saslSession.response);
|
24167
|
+
} catch (err2) {
|
24168
|
+
this.connection.emit("error", err2);
|
24169
|
+
}
|
24019
24170
|
});
|
24020
24171
|
}
|
24021
|
-
_handleAuthSASLContinue(msg) {
|
24022
|
-
|
24023
|
-
|
24172
|
+
async _handleAuthSASLContinue(msg) {
|
24173
|
+
try {
|
24174
|
+
await sasl.continueSession(this.saslSession, this.password, msg.data);
|
24175
|
+
this.connection.sendSCRAMClientFinalMessage(this.saslSession.response);
|
24176
|
+
} catch (err2) {
|
24177
|
+
this.connection.emit("error", err2);
|
24178
|
+
}
|
24024
24179
|
}
|
24025
24180
|
_handleAuthSASLFinal(msg) {
|
24026
|
-
|
24027
|
-
|
24181
|
+
try {
|
24182
|
+
sasl.finalizeSession(this.saslSession, msg.data);
|
24183
|
+
this.saslSession = null;
|
24184
|
+
} catch (err2) {
|
24185
|
+
this.connection.emit("error", err2);
|
24186
|
+
}
|
24028
24187
|
}
|
24029
24188
|
_handleBackendKeyData(msg) {
|
24030
24189
|
this.processID = msg.processID;
|
@@ -24166,30 +24325,14 @@ var require_client = __commonJS({
|
|
24166
24325
|
getTypeParser(oid, format) {
|
24167
24326
|
return this._types.getTypeParser(oid, format);
|
24168
24327
|
}
|
24169
|
-
//
|
24328
|
+
// escapeIdentifier and escapeLiteral moved to utility functions & exported
|
24329
|
+
// on PG
|
24330
|
+
// re-exported here for backwards compatibility
|
24170
24331
|
escapeIdentifier(str) {
|
24171
|
-
return
|
24332
|
+
return utils.escapeIdentifier(str);
|
24172
24333
|
}
|
24173
|
-
// Ported from PostgreSQL 9.2.4 source code in src/interfaces/libpq/fe-exec.c
|
24174
24334
|
escapeLiteral(str) {
|
24175
|
-
|
24176
|
-
var escaped = "'";
|
24177
|
-
for (var i = 0; i < str.length; i++) {
|
24178
|
-
var c = str[i];
|
24179
|
-
if (c === "'") {
|
24180
|
-
escaped += c + c;
|
24181
|
-
} else if (c === "\\") {
|
24182
|
-
escaped += c + c;
|
24183
|
-
hasBackslash = true;
|
24184
|
-
} else {
|
24185
|
-
escaped += c;
|
24186
|
-
}
|
24187
|
-
}
|
24188
|
-
escaped += "'";
|
24189
|
-
if (hasBackslash === true) {
|
24190
|
-
escaped = " E" + escaped;
|
24191
|
-
}
|
24192
|
-
return escaped;
|
24335
|
+
return utils.escapeLiteral(str);
|
24193
24336
|
}
|
24194
24337
|
_pulseQueryQueue() {
|
24195
24338
|
if (this.readyForQuery === true) {
|
@@ -24231,6 +24374,9 @@ var require_client = __commonJS({
|
|
24231
24374
|
if (!query.callback) {
|
24232
24375
|
result = new this._Promise((resolve2, reject) => {
|
24233
24376
|
query.callback = (err2, res) => err2 ? reject(err2) : resolve2(res);
|
24377
|
+
}).catch((err2) => {
|
24378
|
+
Error.captureStackTrace(err2);
|
24379
|
+
throw err2;
|
24234
24380
|
});
|
24235
24381
|
}
|
24236
24382
|
}
|
@@ -24285,7 +24431,7 @@ var require_client = __commonJS({
|
|
24285
24431
|
}
|
24286
24432
|
end(cb) {
|
24287
24433
|
this._ending = true;
|
24288
|
-
if (!this.connection._connecting) {
|
24434
|
+
if (!this.connection._connecting || this._ended) {
|
24289
24435
|
if (cb) {
|
24290
24436
|
cb();
|
24291
24437
|
} else {
|
@@ -24311,9 +24457,9 @@ var require_client = __commonJS({
|
|
24311
24457
|
}
|
24312
24458
|
});
|
24313
24459
|
|
24314
|
-
// node_modules/.pnpm/pg-pool@3.6.1_pg@8.
|
24460
|
+
// node_modules/.pnpm/pg-pool@3.6.1_pg@8.11.3/node_modules/pg-pool/index.js
|
24315
24461
|
var require_pg_pool = __commonJS({
|
24316
|
-
"node_modules/.pnpm/pg-pool@3.6.1_pg@8.
|
24462
|
+
"node_modules/.pnpm/pg-pool@3.6.1_pg@8.11.3/node_modules/pg-pool/index.js"(exports, module2) {
|
24317
24463
|
"use strict";
|
24318
24464
|
var EventEmitter = require("events").EventEmitter;
|
24319
24465
|
var NOOP = function() {
|
@@ -24694,72 +24840,9 @@ var require_pg_pool = __commonJS({
|
|
24694
24840
|
}
|
24695
24841
|
});
|
24696
24842
|
|
24697
|
-
// node_modules/.pnpm/pg@8.
|
24698
|
-
var require_package = __commonJS({
|
24699
|
-
"node_modules/.pnpm/pg@8.8.0/node_modules/pg/package.json"(exports, module2) {
|
24700
|
-
module2.exports = {
|
24701
|
-
name: "pg",
|
24702
|
-
version: "8.8.0",
|
24703
|
-
description: "PostgreSQL client - pure javascript & libpq with the same API",
|
24704
|
-
keywords: [
|
24705
|
-
"database",
|
24706
|
-
"libpq",
|
24707
|
-
"pg",
|
24708
|
-
"postgre",
|
24709
|
-
"postgres",
|
24710
|
-
"postgresql",
|
24711
|
-
"rdbms"
|
24712
|
-
],
|
24713
|
-
homepage: "https://github.com/brianc/node-postgres",
|
24714
|
-
repository: {
|
24715
|
-
type: "git",
|
24716
|
-
url: "git://github.com/brianc/node-postgres.git",
|
24717
|
-
directory: "packages/pg"
|
24718
|
-
},
|
24719
|
-
author: "Brian Carlson <brian.m.carlson@gmail.com>",
|
24720
|
-
main: "./lib",
|
24721
|
-
dependencies: {
|
24722
|
-
"buffer-writer": "2.0.0",
|
24723
|
-
"packet-reader": "1.0.0",
|
24724
|
-
"pg-connection-string": "^2.5.0",
|
24725
|
-
"pg-pool": "^3.5.2",
|
24726
|
-
"pg-protocol": "^1.5.0",
|
24727
|
-
"pg-types": "^2.1.0",
|
24728
|
-
pgpass: "1.x"
|
24729
|
-
},
|
24730
|
-
devDependencies: {
|
24731
|
-
async: "2.6.4",
|
24732
|
-
bluebird: "3.5.2",
|
24733
|
-
co: "4.6.0",
|
24734
|
-
"pg-copy-streams": "0.3.0"
|
24735
|
-
},
|
24736
|
-
peerDependencies: {
|
24737
|
-
"pg-native": ">=3.0.1"
|
24738
|
-
},
|
24739
|
-
peerDependenciesMeta: {
|
24740
|
-
"pg-native": {
|
24741
|
-
optional: true
|
24742
|
-
}
|
24743
|
-
},
|
24744
|
-
scripts: {
|
24745
|
-
test: "make test-all"
|
24746
|
-
},
|
24747
|
-
files: [
|
24748
|
-
"lib",
|
24749
|
-
"SPONSORS.md"
|
24750
|
-
],
|
24751
|
-
license: "MIT",
|
24752
|
-
engines: {
|
24753
|
-
node: ">= 8.0.0"
|
24754
|
-
},
|
24755
|
-
gitHead: "c99fb2c127ddf8d712500db2c7b9a5491a178655"
|
24756
|
-
};
|
24757
|
-
}
|
24758
|
-
});
|
24759
|
-
|
24760
|
-
// node_modules/.pnpm/pg@8.8.0/node_modules/pg/lib/native/query.js
|
24843
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/native/query.js
|
24761
24844
|
var require_query2 = __commonJS({
|
24762
|
-
"node_modules/.pnpm/pg@8.
|
24845
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/native/query.js"(exports, module2) {
|
24763
24846
|
"use strict";
|
24764
24847
|
var EventEmitter = require("events").EventEmitter;
|
24765
24848
|
var util2 = require("util");
|
@@ -24899,13 +24982,17 @@ var require_query2 = __commonJS({
|
|
24899
24982
|
}
|
24900
24983
|
});
|
24901
24984
|
|
24902
|
-
// node_modules/.pnpm/pg@8.
|
24985
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/native/client.js
|
24903
24986
|
var require_client2 = __commonJS({
|
24904
|
-
"node_modules/.pnpm/pg@8.
|
24987
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/native/client.js"(exports, module2) {
|
24905
24988
|
"use strict";
|
24906
|
-
var Native
|
24989
|
+
var Native;
|
24990
|
+
try {
|
24991
|
+
Native = require("pg-native");
|
24992
|
+
} catch (e) {
|
24993
|
+
throw e;
|
24994
|
+
}
|
24907
24995
|
var TypeOverrides = require_type_overrides();
|
24908
|
-
var pkg = require_package();
|
24909
24996
|
var EventEmitter = require("events").EventEmitter;
|
24910
24997
|
var util2 = require("util");
|
24911
24998
|
var ConnectionParameters = require_connection_parameters();
|
@@ -24924,6 +25011,8 @@ var require_client2 = __commonJS({
|
|
24924
25011
|
this._connected = false;
|
24925
25012
|
this._queryable = true;
|
24926
25013
|
var cp = this.connectionParameters = new ConnectionParameters(config);
|
25014
|
+
if (config.nativeConnectionString)
|
25015
|
+
cp.nativeConnectionString = config.nativeConnectionString;
|
24927
25016
|
this.user = cp.user;
|
24928
25017
|
Object.defineProperty(this, "password", {
|
24929
25018
|
configurable: true,
|
@@ -24960,6 +25049,8 @@ var require_client2 = __commonJS({
|
|
24960
25049
|
}
|
24961
25050
|
this._connecting = true;
|
24962
25051
|
this.connectionParameters.getLibpqConnectionString(function(err2, conString) {
|
25052
|
+
if (self2.connectionParameters.nativeConnectionString)
|
25053
|
+
conString = self2.connectionParameters.nativeConnectionString;
|
24963
25054
|
if (err2)
|
24964
25055
|
return cb(err2);
|
24965
25056
|
self2.native.connect(conString, function(err3) {
|
@@ -25022,6 +25113,9 @@ var require_client2 = __commonJS({
|
|
25022
25113
|
result = new this._Promise((resolve2, reject) => {
|
25023
25114
|
resolveOut = resolve2;
|
25024
25115
|
rejectOut = reject;
|
25116
|
+
}).catch((err2) => {
|
25117
|
+
Error.captureStackTrace(err2);
|
25118
|
+
throw err2;
|
25025
25119
|
});
|
25026
25120
|
query.callback = (err2, res) => err2 ? rejectOut(err2) : resolveOut(res);
|
25027
25121
|
}
|
@@ -25132,23 +25226,24 @@ var require_client2 = __commonJS({
|
|
25132
25226
|
}
|
25133
25227
|
});
|
25134
25228
|
|
25135
|
-
// node_modules/.pnpm/pg@8.
|
25229
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/native/index.js
|
25136
25230
|
var require_native = __commonJS({
|
25137
|
-
"node_modules/.pnpm/pg@8.
|
25231
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/native/index.js"(exports, module2) {
|
25138
25232
|
"use strict";
|
25139
25233
|
module2.exports = require_client2();
|
25140
25234
|
}
|
25141
25235
|
});
|
25142
25236
|
|
25143
|
-
// node_modules/.pnpm/pg@8.
|
25237
|
+
// node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/index.js
|
25144
25238
|
var require_lib2 = __commonJS({
|
25145
|
-
"node_modules/.pnpm/pg@8.
|
25239
|
+
"node_modules/.pnpm/pg@8.11.3/node_modules/pg/lib/index.js"(exports, module2) {
|
25146
25240
|
"use strict";
|
25147
25241
|
var Client2 = require_client();
|
25148
25242
|
var defaults3 = require_defaults();
|
25149
25243
|
var Connection2 = require_connection();
|
25150
25244
|
var Pool = require_pg_pool();
|
25151
25245
|
var { DatabaseError } = require_dist();
|
25246
|
+
var { escapeIdentifier, escapeLiteral } = require_utils2();
|
25152
25247
|
var poolFactory = (Client3) => {
|
25153
25248
|
return class BoundPool extends Pool {
|
25154
25249
|
constructor(options) {
|
@@ -25165,6 +25260,8 @@ var require_lib2 = __commonJS({
|
|
25165
25260
|
this.Connection = Connection2;
|
25166
25261
|
this.types = require_pg_types();
|
25167
25262
|
this.DatabaseError = DatabaseError;
|
25263
|
+
this.escapeIdentifier = escapeIdentifier;
|
25264
|
+
this.escapeLiteral = escapeLiteral;
|
25168
25265
|
};
|
25169
25266
|
if (typeof process.env.NODE_PG_FORCE_NATIVE !== "undefined") {
|
25170
25267
|
module2.exports = new PG(require_native());
|
@@ -25994,6 +26091,55 @@ var init_sqliteIntrospect = __esm({
|
|
25994
26091
|
}
|
25995
26092
|
});
|
25996
26093
|
|
26094
|
+
// src/cli/utils.ts
|
26095
|
+
var assertPackages, requiredApiVersion, assertOrmCoreVersion, ormCoreVersions;
|
26096
|
+
var init_utils3 = __esm({
|
26097
|
+
"src/cli/utils.ts"() {
|
26098
|
+
init_views();
|
26099
|
+
assertPackages = async (...pkgs) => {
|
26100
|
+
try {
|
26101
|
+
for (let i = 0; i < pkgs.length; i++) {
|
26102
|
+
const it = pkgs[i];
|
26103
|
+
await import(it);
|
26104
|
+
}
|
26105
|
+
} catch (e) {
|
26106
|
+
err(
|
26107
|
+
`please install required packages: ${pkgs.map((it) => `'${it}'`).join(" ")}`
|
26108
|
+
);
|
26109
|
+
process.exit(1);
|
26110
|
+
}
|
26111
|
+
};
|
26112
|
+
requiredApiVersion = 6;
|
26113
|
+
assertOrmCoreVersion = async () => {
|
26114
|
+
try {
|
26115
|
+
const { compatibilityVersion } = await import("drizzle-orm/version");
|
26116
|
+
if (compatibilityVersion && compatibilityVersion === requiredApiVersion)
|
26117
|
+
return;
|
26118
|
+
if (!compatibilityVersion || compatibilityVersion < requiredApiVersion) {
|
26119
|
+
console.log(
|
26120
|
+
"This version of drizzle-kit requires newer version of drizzle-orm\nPlease update drizzle-orm package to the latest version \u{1F44D}"
|
26121
|
+
);
|
26122
|
+
} else {
|
26123
|
+
console.log(
|
26124
|
+
"This version of drizzle-kit is outdated\nPlease update drizzle-kit package to the latest version \u{1F44D}"
|
26125
|
+
);
|
26126
|
+
}
|
26127
|
+
} catch (e) {
|
26128
|
+
console.log("Please install latest version of drizzle-orm");
|
26129
|
+
}
|
26130
|
+
process.exit(1);
|
26131
|
+
};
|
26132
|
+
ormCoreVersions = async () => {
|
26133
|
+
try {
|
26134
|
+
const { compatibilityVersion, npmVersion } = await import("drizzle-orm/version");
|
26135
|
+
return { compatibilityVersion, npmVersion };
|
26136
|
+
} catch (e) {
|
26137
|
+
return {};
|
26138
|
+
}
|
26139
|
+
};
|
26140
|
+
}
|
26141
|
+
});
|
26142
|
+
|
25997
26143
|
// node_modules/.pnpm/sqlstring@2.3.3/node_modules/sqlstring/lib/SqlString.js
|
25998
26144
|
var require_SqlString = __commonJS({
|
25999
26145
|
"node_modules/.pnpm/sqlstring@2.3.3/node_modules/sqlstring/lib/SqlString.js"(exports) {
|
@@ -42586,9 +42732,12 @@ var init_session = __esm({
|
|
42586
42732
|
};
|
42587
42733
|
_a = import_drizzle_orm9.entityKind;
|
42588
42734
|
SQLiteWranglerD1Session[_a] = "SQLiteD1Session";
|
42589
|
-
PreparedQuery = class extends import_sqlite_core3.
|
42735
|
+
PreparedQuery = class extends import_sqlite_core3.SQLitePreparedQuery {
|
42590
42736
|
constructor(stmt, configPath, dbName, queryString, params, logger, fields, executeMethod, customResultMapper) {
|
42591
|
-
super("async", executeMethod
|
42737
|
+
super("async", executeMethod, {
|
42738
|
+
sql: queryString,
|
42739
|
+
params
|
42740
|
+
});
|
42592
42741
|
this.stmt = stmt;
|
42593
42742
|
this.configPath = configPath;
|
42594
42743
|
this.dbName = dbName;
|
@@ -42647,7 +42796,11 @@ var init_session = __esm({
|
|
42647
42796
|
async values(placeholderValues) {
|
42648
42797
|
const params = (0, import_drizzle_orm11.fillPlaceholders)(this.params, placeholderValues ?? {});
|
42649
42798
|
this.logger.logQuery(this.queryString, params);
|
42650
|
-
const wranglerRes = await this.stmt(
|
42799
|
+
const wranglerRes = await this.stmt(
|
42800
|
+
this.queryString,
|
42801
|
+
this.configPath,
|
42802
|
+
this.dbName
|
42803
|
+
);
|
42651
42804
|
return this.d1ToRawMapping(wranglerRes.results);
|
42652
42805
|
}
|
42653
42806
|
};
|
@@ -44760,7 +44913,7 @@ var require_glob_parent = __commonJS({
|
|
44760
44913
|
});
|
44761
44914
|
|
44762
44915
|
// node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/utils.js
|
44763
|
-
var
|
44916
|
+
var require_utils4 = __commonJS({
|
44764
44917
|
"node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/utils.js"(exports) {
|
44765
44918
|
"use strict";
|
44766
44919
|
exports.isInteger = (num) => {
|
@@ -44847,7 +45000,7 @@ var require_utils3 = __commonJS({
|
|
44847
45000
|
var require_stringify = __commonJS({
|
44848
45001
|
"node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/stringify.js"(exports, module2) {
|
44849
45002
|
"use strict";
|
44850
|
-
var utils =
|
45003
|
+
var utils = require_utils4();
|
44851
45004
|
module2.exports = (ast, options = {}) => {
|
44852
45005
|
let stringify = (node, parent = {}) => {
|
44853
45006
|
let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
|
@@ -45313,7 +45466,7 @@ var require_compile = __commonJS({
|
|
45313
45466
|
"node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/compile.js"(exports, module2) {
|
45314
45467
|
"use strict";
|
45315
45468
|
var fill = require_fill_range();
|
45316
|
-
var utils =
|
45469
|
+
var utils = require_utils4();
|
45317
45470
|
var compile = (ast, options = {}) => {
|
45318
45471
|
let walk = (node, parent = {}) => {
|
45319
45472
|
let invalidBlock = utils.isInvalidBrace(parent);
|
@@ -45365,7 +45518,7 @@ var require_expand = __commonJS({
|
|
45365
45518
|
"use strict";
|
45366
45519
|
var fill = require_fill_range();
|
45367
45520
|
var stringify = require_stringify();
|
45368
|
-
var utils =
|
45521
|
+
var utils = require_utils4();
|
45369
45522
|
var append = (queue = "", stash = "", enclose = false) => {
|
45370
45523
|
let result = [];
|
45371
45524
|
queue = [].concat(queue);
|
@@ -46062,7 +46215,7 @@ var require_constants2 = __commonJS({
|
|
46062
46215
|
});
|
46063
46216
|
|
46064
46217
|
// node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js
|
46065
|
-
var
|
46218
|
+
var require_utils5 = __commonJS({
|
46066
46219
|
"node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/utils.js"(exports) {
|
46067
46220
|
"use strict";
|
46068
46221
|
var path4 = require("path");
|
@@ -46128,7 +46281,7 @@ var require_utils4 = __commonJS({
|
|
46128
46281
|
var require_scan = __commonJS({
|
46129
46282
|
"node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/scan.js"(exports, module2) {
|
46130
46283
|
"use strict";
|
46131
|
-
var utils =
|
46284
|
+
var utils = require_utils5();
|
46132
46285
|
var {
|
46133
46286
|
CHAR_ASTERISK,
|
46134
46287
|
/* * */
|
@@ -46462,7 +46615,7 @@ var require_parse2 = __commonJS({
|
|
46462
46615
|
"node_modules/.pnpm/picomatch@2.3.1/node_modules/picomatch/lib/parse.js"(exports, module2) {
|
46463
46616
|
"use strict";
|
46464
46617
|
var constants = require_constants2();
|
46465
|
-
var utils =
|
46618
|
+
var utils = require_utils5();
|
46466
46619
|
var {
|
46467
46620
|
MAX_LENGTH,
|
46468
46621
|
POSIX_REGEX_SOURCE,
|
@@ -47245,7 +47398,7 @@ var require_picomatch = __commonJS({
|
|
47245
47398
|
var path4 = require("path");
|
47246
47399
|
var scan = require_scan();
|
47247
47400
|
var parse = require_parse2();
|
47248
|
-
var utils =
|
47401
|
+
var utils = require_utils5();
|
47249
47402
|
var constants = require_constants2();
|
47250
47403
|
var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
47251
47404
|
var picomatch = (glob2, options, returnState = false) => {
|
@@ -47397,7 +47550,7 @@ var require_micromatch = __commonJS({
|
|
47397
47550
|
var util2 = require("util");
|
47398
47551
|
var braces = require_braces();
|
47399
47552
|
var picomatch = require_picomatch2();
|
47400
|
-
var utils =
|
47553
|
+
var utils = require_utils5();
|
47401
47554
|
var isEmptyString = (val) => val === "" || val === "./";
|
47402
47555
|
var micromatch = (list, patterns, options) => {
|
47403
47556
|
patterns = [].concat(patterns);
|
@@ -47701,7 +47854,7 @@ var require_pattern = __commonJS({
|
|
47701
47854
|
});
|
47702
47855
|
|
47703
47856
|
// node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/utils/stream.js
|
47704
|
-
var
|
47857
|
+
var require_stream2 = __commonJS({
|
47705
47858
|
"node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/utils/stream.js"(exports) {
|
47706
47859
|
"use strict";
|
47707
47860
|
Object.defineProperty(exports, "__esModule", { value: true });
|
@@ -47741,7 +47894,7 @@ var require_string2 = __commonJS({
|
|
47741
47894
|
});
|
47742
47895
|
|
47743
47896
|
// node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/utils/index.js
|
47744
|
-
var
|
47897
|
+
var require_utils6 = __commonJS({
|
47745
47898
|
"node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/utils/index.js"(exports) {
|
47746
47899
|
"use strict";
|
47747
47900
|
Object.defineProperty(exports, "__esModule", { value: true });
|
@@ -47756,7 +47909,7 @@ var require_utils5 = __commonJS({
|
|
47756
47909
|
exports.path = path4;
|
47757
47910
|
var pattern = require_pattern();
|
47758
47911
|
exports.pattern = pattern;
|
47759
|
-
var stream =
|
47912
|
+
var stream = require_stream2();
|
47760
47913
|
exports.stream = stream;
|
47761
47914
|
var string = require_string2();
|
47762
47915
|
exports.string = string;
|
@@ -47769,7 +47922,7 @@ var require_tasks = __commonJS({
|
|
47769
47922
|
"use strict";
|
47770
47923
|
Object.defineProperty(exports, "__esModule", { value: true });
|
47771
47924
|
exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
|
47772
|
-
var utils =
|
47925
|
+
var utils = require_utils6();
|
47773
47926
|
function generate(input, settings) {
|
47774
47927
|
const patterns = processPatterns(input, settings);
|
47775
47928
|
const ignore = processPatterns(settings.ignore, settings);
|
@@ -48115,7 +48268,7 @@ var require_fs3 = __commonJS({
|
|
48115
48268
|
});
|
48116
48269
|
|
48117
48270
|
// node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/index.js
|
48118
|
-
var
|
48271
|
+
var require_utils7 = __commonJS({
|
48119
48272
|
"node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports) {
|
48120
48273
|
"use strict";
|
48121
48274
|
Object.defineProperty(exports, "__esModule", { value: true });
|
@@ -48150,7 +48303,7 @@ var require_async2 = __commonJS({
|
|
48150
48303
|
var fsStat = require_out();
|
48151
48304
|
var rpl = require_run_parallel();
|
48152
48305
|
var constants_1 = require_constants3();
|
48153
|
-
var utils =
|
48306
|
+
var utils = require_utils7();
|
48154
48307
|
var common = require_common2();
|
48155
48308
|
function read(directory, settings, callback) {
|
48156
48309
|
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
@@ -48259,7 +48412,7 @@ var require_sync2 = __commonJS({
|
|
48259
48412
|
exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
|
48260
48413
|
var fsStat = require_out();
|
48261
48414
|
var constants_1 = require_constants3();
|
48262
|
-
var utils =
|
48415
|
+
var utils = require_utils7();
|
48263
48416
|
var common = require_common2();
|
48264
48417
|
function read(directory, settings) {
|
48265
48418
|
if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
@@ -48860,7 +49013,7 @@ var require_async4 = __commonJS({
|
|
48860
49013
|
});
|
48861
49014
|
|
48862
49015
|
// node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/stream.js
|
48863
|
-
var
|
49016
|
+
var require_stream3 = __commonJS({
|
48864
49017
|
"node_modules/.pnpm/@nodelib+fs.walk@1.2.8/node_modules/@nodelib/fs.walk/out/providers/stream.js"(exports) {
|
48865
49018
|
"use strict";
|
48866
49019
|
Object.defineProperty(exports, "__esModule", { value: true });
|
@@ -49023,7 +49176,7 @@ var require_out3 = __commonJS({
|
|
49023
49176
|
Object.defineProperty(exports, "__esModule", { value: true });
|
49024
49177
|
exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0;
|
49025
49178
|
var async_1 = require_async4();
|
49026
|
-
var stream_1 =
|
49179
|
+
var stream_1 = require_stream3();
|
49027
49180
|
var sync_1 = require_sync4();
|
49028
49181
|
var settings_1 = require_settings3();
|
49029
49182
|
exports.Settings = settings_1.default;
|
@@ -49063,7 +49216,7 @@ var require_reader2 = __commonJS({
|
|
49063
49216
|
Object.defineProperty(exports, "__esModule", { value: true });
|
49064
49217
|
var path4 = require("path");
|
49065
49218
|
var fsStat = require_out();
|
49066
|
-
var utils =
|
49219
|
+
var utils = require_utils6();
|
49067
49220
|
var Reader = class {
|
49068
49221
|
constructor(_settings) {
|
49069
49222
|
this._settings = _settings;
|
@@ -49096,7 +49249,7 @@ var require_reader2 = __commonJS({
|
|
49096
49249
|
});
|
49097
49250
|
|
49098
49251
|
// node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/readers/stream.js
|
49099
|
-
var
|
49252
|
+
var require_stream4 = __commonJS({
|
49100
49253
|
"node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/readers/stream.js"(exports) {
|
49101
49254
|
"use strict";
|
49102
49255
|
Object.defineProperty(exports, "__esModule", { value: true });
|
@@ -49159,7 +49312,7 @@ var require_async5 = __commonJS({
|
|
49159
49312
|
Object.defineProperty(exports, "__esModule", { value: true });
|
49160
49313
|
var fsWalk = require_out3();
|
49161
49314
|
var reader_1 = require_reader2();
|
49162
|
-
var stream_1 =
|
49315
|
+
var stream_1 = require_stream4();
|
49163
49316
|
var ReaderAsync = class extends reader_1.default {
|
49164
49317
|
constructor() {
|
49165
49318
|
super(...arguments);
|
@@ -49196,7 +49349,7 @@ var require_matcher = __commonJS({
|
|
49196
49349
|
"node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/providers/matchers/matcher.js"(exports) {
|
49197
49350
|
"use strict";
|
49198
49351
|
Object.defineProperty(exports, "__esModule", { value: true });
|
49199
|
-
var utils =
|
49352
|
+
var utils = require_utils6();
|
49200
49353
|
var Matcher = class {
|
49201
49354
|
constructor(_patterns, _settings, _micromatchOptions) {
|
49202
49355
|
this._patterns = _patterns;
|
@@ -49284,7 +49437,7 @@ var require_deep = __commonJS({
|
|
49284
49437
|
"node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/providers/filters/deep.js"(exports) {
|
49285
49438
|
"use strict";
|
49286
49439
|
Object.defineProperty(exports, "__esModule", { value: true });
|
49287
|
-
var utils =
|
49440
|
+
var utils = require_utils6();
|
49288
49441
|
var partial_1 = require_partial();
|
49289
49442
|
var DeepFilter = class {
|
49290
49443
|
constructor(_settings, _micromatchOptions) {
|
@@ -49349,7 +49502,7 @@ var require_entry = __commonJS({
|
|
49349
49502
|
"node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/providers/filters/entry.js"(exports) {
|
49350
49503
|
"use strict";
|
49351
49504
|
Object.defineProperty(exports, "__esModule", { value: true });
|
49352
|
-
var utils =
|
49505
|
+
var utils = require_utils6();
|
49353
49506
|
var EntryFilter = class {
|
49354
49507
|
constructor(_settings, _micromatchOptions) {
|
49355
49508
|
this._settings = _settings;
|
@@ -49415,7 +49568,7 @@ var require_error = __commonJS({
|
|
49415
49568
|
"node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/providers/filters/error.js"(exports) {
|
49416
49569
|
"use strict";
|
49417
49570
|
Object.defineProperty(exports, "__esModule", { value: true });
|
49418
|
-
var utils =
|
49571
|
+
var utils = require_utils6();
|
49419
49572
|
var ErrorFilter = class {
|
49420
49573
|
constructor(_settings) {
|
49421
49574
|
this._settings = _settings;
|
@@ -49436,7 +49589,7 @@ var require_entry2 = __commonJS({
|
|
49436
49589
|
"node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/providers/transformers/entry.js"(exports) {
|
49437
49590
|
"use strict";
|
49438
49591
|
Object.defineProperty(exports, "__esModule", { value: true });
|
49439
|
-
var utils =
|
49592
|
+
var utils = require_utils6();
|
49440
49593
|
var EntryTransformer = class {
|
49441
49594
|
constructor(_settings) {
|
49442
49595
|
this._settings = _settings;
|
@@ -49547,12 +49700,12 @@ var require_async6 = __commonJS({
|
|
49547
49700
|
});
|
49548
49701
|
|
49549
49702
|
// node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/providers/stream.js
|
49550
|
-
var
|
49703
|
+
var require_stream5 = __commonJS({
|
49551
49704
|
"node_modules/.pnpm/fast-glob@3.3.1/node_modules/fast-glob/out/providers/stream.js"(exports) {
|
49552
49705
|
"use strict";
|
49553
49706
|
Object.defineProperty(exports, "__esModule", { value: true });
|
49554
49707
|
var stream_1 = require("stream");
|
49555
|
-
var stream_2 =
|
49708
|
+
var stream_2 = require_stream4();
|
49556
49709
|
var provider_1 = require_provider();
|
49557
49710
|
var ProviderStream = class extends provider_1.default {
|
49558
49711
|
constructor() {
|
@@ -49723,10 +49876,10 @@ var require_out4 = __commonJS({
|
|
49723
49876
|
"use strict";
|
49724
49877
|
var taskManager = require_tasks();
|
49725
49878
|
var async_1 = require_async6();
|
49726
|
-
var stream_1 =
|
49879
|
+
var stream_1 = require_stream5();
|
49727
49880
|
var sync_1 = require_sync6();
|
49728
49881
|
var settings_1 = require_settings4();
|
49729
|
-
var utils =
|
49882
|
+
var utils = require_utils6();
|
49730
49883
|
async function FastGlob(source, options) {
|
49731
49884
|
assertPatternsInput2(source);
|
49732
49885
|
const works = getWorks(source, async_1.default, options);
|
@@ -57959,7 +58112,7 @@ var require_dist2 = __commonJS({
|
|
57959
58112
|
});
|
57960
58113
|
|
57961
58114
|
// node_modules/.pnpm/webpod@0.0.2/node_modules/webpod/dist/utils.js
|
57962
|
-
var
|
58115
|
+
var init_utils4 = __esm({
|
57963
58116
|
"node_modules/.pnpm/webpod@0.0.2/node_modules/webpod/dist/utils.js"() {
|
57964
58117
|
}
|
57965
58118
|
});
|
@@ -57967,7 +58120,7 @@ var init_utils3 = __esm({
|
|
57967
58120
|
// node_modules/.pnpm/webpod@0.0.2/node_modules/webpod/dist/ssh.js
|
57968
58121
|
var init_ssh = __esm({
|
57969
58122
|
"node_modules/.pnpm/webpod@0.0.2/node_modules/webpod/dist/ssh.js"() {
|
57970
|
-
|
58123
|
+
init_utils4();
|
57971
58124
|
}
|
57972
58125
|
});
|
57973
58126
|
|
@@ -58013,8 +58166,17 @@ __export(wrangler_client_exports, {
|
|
58013
58166
|
execute: () => execute
|
58014
58167
|
});
|
58015
58168
|
async function execute(query, configPath, dbName) {
|
58016
|
-
|
58017
|
-
|
58169
|
+
try {
|
58170
|
+
const response = await $`NO_D1_WARNING=true wrangler d1 execute ${dbName} --config=${configPath} --command=${query} --json`;
|
58171
|
+
return { results: JSON.parse(response.stdout)[0].results };
|
58172
|
+
} catch (e) {
|
58173
|
+
try {
|
58174
|
+
await $`NO_D1_WARNING=true wrangler d1 execute ${dbName} --config=${configPath} --command=${query}`;
|
58175
|
+
} catch (e1) {
|
58176
|
+
throw new Error(e1.stdout);
|
58177
|
+
}
|
58178
|
+
throw e;
|
58179
|
+
}
|
58018
58180
|
}
|
58019
58181
|
var init_wrangler_client = __esm({
|
58020
58182
|
"src/orm-extenstions/d1-driver/wrangler-client.ts"() {
|
@@ -58027,9 +58189,15 @@ var init_wrangler_client = __esm({
|
|
58027
58189
|
var studioUtils_exports = {};
|
58028
58190
|
__export(studioUtils_exports, {
|
58029
58191
|
drizzleDb: () => drizzleDb,
|
58030
|
-
|
58031
|
-
|
58032
|
-
|
58192
|
+
drizzleForMySQL: () => drizzleForMySQL,
|
58193
|
+
drizzleForPostgres: () => drizzleForPostgres,
|
58194
|
+
drizzleForSQLite: () => drizzleForSQLite,
|
58195
|
+
prepareModels: () => prepareModels,
|
58196
|
+
prepareMySqlSchema: () => prepareMySqlSchema,
|
58197
|
+
preparePgSchema: () => preparePgSchema,
|
58198
|
+
prepareSQLiteSchema: () => prepareSQLiteSchema
|
58199
|
+
});
|
58200
|
+
var import_drizzle_orm14, import_mysql_core4, import_pg_core4, import_sqlite_core5, preparePgSchema, prepareMySqlSchema, prepareSQLiteSchema, prepareModels, drizzleForPostgres, drizzleForMySQL, drizzleForSQLite, drizzleDb;
|
58033
58201
|
var init_studioUtils = __esm({
|
58034
58202
|
"src/serializer/studioUtils.ts"() {
|
58035
58203
|
import_drizzle_orm14 = require("drizzle-orm");
|
@@ -58037,7 +58205,76 @@ var init_studioUtils = __esm({
|
|
58037
58205
|
import_pg_core4 = require("drizzle-orm/pg-core");
|
58038
58206
|
import_sqlite_core5 = require("drizzle-orm/sqlite-core");
|
58039
58207
|
init_utils();
|
58208
|
+
init_utils3();
|
58209
|
+
init_global();
|
58040
58210
|
init_serializer();
|
58211
|
+
preparePgSchema = async (path4) => {
|
58212
|
+
const imports = prepareFilenames(path4);
|
58213
|
+
const pgSchema4 = {};
|
58214
|
+
const relations4 = {};
|
58215
|
+
const { unregister } = await safeRegister();
|
58216
|
+
for (let i = 0; i < imports.length; i++) {
|
58217
|
+
const it = imports[i];
|
58218
|
+
const i0 = require(`${it}`);
|
58219
|
+
const i0values = Object.entries(i0);
|
58220
|
+
i0values.forEach(([k, t]) => {
|
58221
|
+
if ((0, import_drizzle_orm14.is)(t, import_pg_core4.PgTable)) {
|
58222
|
+
const schema4 = (0, import_pg_core4.getTableConfig)(t).schema || "public";
|
58223
|
+
pgSchema4[schema4] = pgSchema4[schema4] || {};
|
58224
|
+
pgSchema4[schema4][k] = t;
|
58225
|
+
}
|
58226
|
+
if ((0, import_drizzle_orm14.is)(t, import_drizzle_orm14.Relations)) {
|
58227
|
+
relations4[k] = t;
|
58228
|
+
}
|
58229
|
+
});
|
58230
|
+
}
|
58231
|
+
unregister();
|
58232
|
+
return { schema: pgSchema4, relations: relations4 };
|
58233
|
+
};
|
58234
|
+
prepareMySqlSchema = async (path4) => {
|
58235
|
+
const imports = prepareFilenames(path4);
|
58236
|
+
const mysqlSchema4 = { public: {} };
|
58237
|
+
const relations4 = {};
|
58238
|
+
const { unregister } = await safeRegister();
|
58239
|
+
for (let i = 0; i < imports.length; i++) {
|
58240
|
+
const it = imports[i];
|
58241
|
+
const i0 = require(`${it}`);
|
58242
|
+
const i0values = Object.entries(i0);
|
58243
|
+
i0values.forEach(([k, t]) => {
|
58244
|
+
if ((0, import_drizzle_orm14.is)(t, import_mysql_core4.MySqlTable)) {
|
58245
|
+
const schema4 = (0, import_mysql_core4.getTableConfig)(t).schema || "public";
|
58246
|
+
mysqlSchema4[schema4][k] = t;
|
58247
|
+
}
|
58248
|
+
if ((0, import_drizzle_orm14.is)(t, import_drizzle_orm14.Relations)) {
|
58249
|
+
relations4[k] = t;
|
58250
|
+
}
|
58251
|
+
});
|
58252
|
+
}
|
58253
|
+
unregister();
|
58254
|
+
return { schema: mysqlSchema4, relations: relations4 };
|
58255
|
+
};
|
58256
|
+
prepareSQLiteSchema = async (path4) => {
|
58257
|
+
const imports = prepareFilenames(path4);
|
58258
|
+
const sqliteSchema2 = { public: {} };
|
58259
|
+
const relations4 = {};
|
58260
|
+
const { unregister } = await safeRegister();
|
58261
|
+
for (let i = 0; i < imports.length; i++) {
|
58262
|
+
const it = imports[i];
|
58263
|
+
const i0 = require(`${it}`);
|
58264
|
+
const i0values = Object.entries(i0);
|
58265
|
+
i0values.forEach(([k, t]) => {
|
58266
|
+
if ((0, import_drizzle_orm14.is)(t, import_sqlite_core5.SQLiteTable)) {
|
58267
|
+
const schema4 = "public";
|
58268
|
+
sqliteSchema2[schema4][k] = t;
|
58269
|
+
}
|
58270
|
+
if ((0, import_drizzle_orm14.is)(t, import_drizzle_orm14.Relations)) {
|
58271
|
+
relations4[k] = t;
|
58272
|
+
}
|
58273
|
+
});
|
58274
|
+
}
|
58275
|
+
unregister();
|
58276
|
+
return { schema: sqliteSchema2, relations: relations4 };
|
58277
|
+
};
|
58041
58278
|
prepareModels = async (path4) => {
|
58042
58279
|
const imports = prepareFilenames(path4);
|
58043
58280
|
const sqliteSchema2 = {};
|
@@ -58068,11 +58305,88 @@ var init_studioUtils = __esm({
|
|
58068
58305
|
unregister();
|
58069
58306
|
return { pgSchema: pgSchema4, mysqlSchema: mysqlSchema4, sqliteSchema: sqliteSchema2 };
|
58070
58307
|
};
|
58071
|
-
|
58308
|
+
drizzleForPostgres = async (connectionConfig, pgSchema4, relations4, verbose) => {
|
58309
|
+
assertPackages("pg");
|
58310
|
+
const { drizzle: drizzle2 } = await import("drizzle-orm/node-postgres");
|
58311
|
+
const pg = await Promise.resolve().then(() => __toESM(require_lib2()));
|
58312
|
+
const db = drizzle2(new pg.default.Pool(connectionConfig.dbCredentials), {
|
58313
|
+
logger: verbose
|
58314
|
+
});
|
58315
|
+
return {
|
58316
|
+
type: "pg",
|
58317
|
+
db,
|
58318
|
+
schema: pgSchema4,
|
58319
|
+
relations: relations4
|
58320
|
+
};
|
58321
|
+
};
|
58322
|
+
drizzleForMySQL = async (config, mysqlSchema4, relations4, verbose) => {
|
58323
|
+
assertPackages("mysql2");
|
58324
|
+
const { drizzle: drizzle2 } = await import("drizzle-orm/mysql2");
|
58325
|
+
const { createPool } = await Promise.resolve().then(() => __toESM(require_promise()));
|
58326
|
+
const client = createPool({ ...config.dbCredentials, connectionLimit: 1 });
|
58327
|
+
const db = drizzle2(client, { logger: verbose });
|
58328
|
+
return {
|
58329
|
+
type: "mysql",
|
58330
|
+
db,
|
58331
|
+
schema: mysqlSchema4,
|
58332
|
+
relations: relations4
|
58333
|
+
};
|
58334
|
+
};
|
58335
|
+
drizzleForSQLite = async (config, sqliteSchema2, relations4, verbose) => {
|
58336
|
+
const { driver, dbCredentials: creds } = config;
|
58337
|
+
if (driver === "d1") {
|
58338
|
+
const { drizzle: drizzle2 } = await Promise.resolve().then(() => (init_driver(), driver_exports));
|
58339
|
+
const { execute: execute2 } = await Promise.resolve().then(() => (init_wrangler_client(), wrangler_client_exports));
|
58340
|
+
const db = drizzle2(execute2, creds.wranglerConfigPath, creds.dbName, {
|
58341
|
+
logger: verbose
|
58342
|
+
});
|
58343
|
+
return {
|
58344
|
+
type: "sqlite",
|
58345
|
+
db,
|
58346
|
+
schema: sqliteSchema2,
|
58347
|
+
relations: relations4
|
58348
|
+
};
|
58349
|
+
}
|
58350
|
+
if (driver === "better-sqlite") {
|
58351
|
+
assertPackages("better-sqlite3");
|
58352
|
+
const { drizzle: drizzle2 } = await import("drizzle-orm/better-sqlite3");
|
58353
|
+
const Database = await import("better-sqlite3");
|
58354
|
+
const client = new Database.default(creds.url);
|
58355
|
+
const db = drizzle2(client, { logger: verbose });
|
58356
|
+
return {
|
58357
|
+
type: "sqlite",
|
58358
|
+
db,
|
58359
|
+
schema: sqliteSchema2,
|
58360
|
+
relations: relations4
|
58361
|
+
};
|
58362
|
+
}
|
58363
|
+
if (driver === "libsql" || driver === "turso") {
|
58364
|
+
assertPackages("@libsql/client");
|
58365
|
+
const { drizzle: drizzle2 } = await import("drizzle-orm/libsql");
|
58366
|
+
const { createClient } = await import("@libsql/client");
|
58367
|
+
const client = createClient(creds);
|
58368
|
+
const db = drizzle2(
|
58369
|
+
client,
|
58370
|
+
{ logger: verbose }
|
58371
|
+
);
|
58372
|
+
return {
|
58373
|
+
type: "sqlite",
|
58374
|
+
db,
|
58375
|
+
schema: sqliteSchema2,
|
58376
|
+
relations: relations4
|
58377
|
+
};
|
58378
|
+
}
|
58379
|
+
assertUnreachable(driver);
|
58380
|
+
};
|
58381
|
+
drizzleDb = async (drizzleConfig, models, logger) => {
|
58072
58382
|
if (drizzleConfig.driver === "pg") {
|
58073
58383
|
const { drizzle: drizzle2 } = await import("drizzle-orm/node-postgres");
|
58384
|
+
const pg = await Promise.resolve().then(() => __toESM(require_lib2()));
|
58385
|
+
const db = drizzle2(new pg.default.Pool(drizzleConfig.dbCredentials), {
|
58386
|
+
logger
|
58387
|
+
});
|
58074
58388
|
return {
|
58075
|
-
db
|
58389
|
+
db,
|
58076
58390
|
type: "pg",
|
58077
58391
|
schema: models.pgSchema
|
58078
58392
|
};
|
@@ -58080,12 +58394,7 @@ var init_studioUtils = __esm({
|
|
58080
58394
|
const { drizzle: drizzle2 } = await import("drizzle-orm/mysql2");
|
58081
58395
|
const { createPool } = await Promise.resolve().then(() => __toESM(require_promise()));
|
58082
58396
|
const client = createPool({
|
58083
|
-
|
58084
|
-
host: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.host : void 0,
|
58085
|
-
port: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.port : void 0,
|
58086
|
-
user: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.user : void 0,
|
58087
|
-
database: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.database : void 0,
|
58088
|
-
password: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.password : void 0,
|
58397
|
+
...drizzleConfig.dbCredentials,
|
58089
58398
|
connectionLimit: 1
|
58090
58399
|
});
|
58091
58400
|
return {
|
@@ -58133,7 +58442,7 @@ var init_studioUtils = __esm({
|
|
58133
58442
|
|
58134
58443
|
// src/utils.ts
|
58135
58444
|
var import_fs8, import_path5, assertV1OutFolder, dryJournal, snapshotsPriorV4, prepareOutFolder2, mapValues, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey;
|
58136
|
-
var
|
58445
|
+
var init_utils5 = __esm({
|
58137
58446
|
"src/utils.ts"() {
|
58138
58447
|
import_fs8 = require("fs");
|
58139
58448
|
init_views();
|
@@ -58725,7 +59034,7 @@ var init_pg = __esm({
|
|
58725
59034
|
});
|
58726
59035
|
|
58727
59036
|
// src/cli/validations/mysql.ts
|
58728
|
-
var mysqlConnectionCli, mysqlConnectionConfig, mysqlConfigIntrospectSchema, mysqlCliIntrospectParams, mysqlCliPushParams, mysqlConfigPushParams, printCliConnectionIssues3, printConfigConnectionIssues3, validateMySqlIntrospect, validateMySqlPush;
|
59037
|
+
var mysqlConnectionCli, mysql2credentials, mysqlConnectionConfig, mysqlConfigIntrospectSchema, mysqlCliIntrospectParams, mysqlCliPushParams, mysqlConfigPushParams, printCliConnectionIssues3, printConfigConnectionIssues3, validateMySqlIntrospect, validateMySqlPush;
|
58729
59038
|
var init_mysql = __esm({
|
58730
59039
|
"src/cli/validations/mysql.ts"() {
|
58731
59040
|
init_lib();
|
@@ -58739,35 +59048,31 @@ var init_mysql = __esm({
|
|
58739
59048
|
port: coerce.number().optional(),
|
58740
59049
|
user: stringType().default("mysql"),
|
58741
59050
|
password: stringType().optional(),
|
58742
|
-
database: stringType()
|
58743
|
-
type: literalType("params").default("params")
|
59051
|
+
database: stringType()
|
58744
59052
|
}),
|
58745
59053
|
objectType({
|
58746
59054
|
driver: literalType("mysql2"),
|
58747
|
-
|
58748
|
-
|
59055
|
+
uri: stringType()
|
59056
|
+
// TODO: change docs
|
58749
59057
|
})
|
58750
59058
|
]);
|
58751
|
-
|
59059
|
+
mysql2credentials = unionType([
|
58752
59060
|
objectType({
|
58753
|
-
|
58754
|
-
|
58755
|
-
|
58756
|
-
|
58757
|
-
|
58758
|
-
password: stringType().optional(),
|
58759
|
-
database: stringType(),
|
58760
|
-
type: literalType("params").default("params")
|
58761
|
-
})
|
59061
|
+
host: stringType(),
|
59062
|
+
port: coerce.number().optional(),
|
59063
|
+
user: stringType().default("mysql"),
|
59064
|
+
password: stringType().optional(),
|
59065
|
+
database: stringType()
|
58762
59066
|
}),
|
58763
59067
|
objectType({
|
58764
|
-
|
58765
|
-
|
58766
|
-
connectionString: stringType(),
|
58767
|
-
type: literalType("url").default("url")
|
58768
|
-
})
|
59068
|
+
uri: stringType()
|
59069
|
+
// TODO: change docs
|
58769
59070
|
})
|
58770
59071
|
]);
|
59072
|
+
mysqlConnectionConfig = objectType({
|
59073
|
+
driver: literalType("mysql2"),
|
59074
|
+
dbCredentials: mysql2credentials
|
59075
|
+
});
|
58771
59076
|
mysqlConfigIntrospectSchema = intersectionType(
|
58772
59077
|
configIntrospectSchema,
|
58773
59078
|
mysqlConnectionConfig
|
@@ -58785,22 +59090,22 @@ var init_mysql = __esm({
|
|
58785
59090
|
mysqlConnectionConfig
|
58786
59091
|
);
|
58787
59092
|
printCliConnectionIssues3 = (options) => {
|
58788
|
-
|
58789
|
-
|
58790
|
-
console.log(outputs.mysql.connection.required());
|
58791
|
-
}
|
58792
|
-
} else {
|
59093
|
+
const { driver, uri, host, database } = options || {};
|
59094
|
+
if (driver !== "mysql2") {
|
58793
59095
|
console.log(outputs.mysql.connection.driver());
|
58794
59096
|
}
|
59097
|
+
if (!uri && (!host || !database)) {
|
59098
|
+
console.log(outputs.mysql.connection.required());
|
59099
|
+
}
|
58795
59100
|
};
|
58796
59101
|
printConfigConnectionIssues3 = (options) => {
|
58797
|
-
if (options.driver
|
58798
|
-
if (typeof options.dbCredentials.connectionString === "undefined" && (typeof options.dbCredentials.host === "undefined" || typeof options.dbCredentials.database === "undefined")) {
|
58799
|
-
console.log(outputs.mysql.connection.required());
|
58800
|
-
}
|
58801
|
-
} else {
|
59102
|
+
if (options.driver !== "mysql2") {
|
58802
59103
|
console.log(outputs.mysql.connection.driver());
|
58803
59104
|
}
|
59105
|
+
const { uri, host, database } = options.dbCredentials || {};
|
59106
|
+
if (!uri && (!host || !database)) {
|
59107
|
+
console.log(outputs.mysql.connection.required());
|
59108
|
+
}
|
58804
59109
|
};
|
58805
59110
|
validateMySqlIntrospect = async (options) => {
|
58806
59111
|
const collisionRes = checkCollisions(options, "introspect:mysql");
|
@@ -58822,28 +59127,25 @@ var init_mysql = __esm({
|
|
58822
59127
|
printCliConnectionIssues3(options);
|
58823
59128
|
process.exit(1);
|
58824
59129
|
}
|
58825
|
-
if (cliRes.data.type === "url") {
|
58826
|
-
const { connectionString, introspectCasing: introspectCasing3, type: type2, ...rest2 } = cliRes.data;
|
58827
|
-
return {
|
58828
|
-
...rest2,
|
58829
|
-
dbCredentials: { connectionString, type: type2 },
|
58830
|
-
introspect: { casing: introspectCasing3 }
|
58831
|
-
};
|
58832
|
-
}
|
58833
59130
|
const {
|
58834
|
-
|
58835
|
-
|
58836
|
-
|
58837
|
-
|
58838
|
-
|
58839
|
-
|
59131
|
+
out,
|
59132
|
+
schema: schema4,
|
59133
|
+
driver,
|
59134
|
+
schemaFilter,
|
59135
|
+
tablesFilter,
|
59136
|
+
breakpoints,
|
58840
59137
|
introspectCasing: introspectCasing2,
|
58841
59138
|
...rest
|
58842
59139
|
} = cliRes.data;
|
58843
59140
|
return {
|
58844
|
-
|
58845
|
-
|
58846
|
-
|
59141
|
+
out,
|
59142
|
+
schema: schema4,
|
59143
|
+
driver,
|
59144
|
+
schemaFilter,
|
59145
|
+
tablesFilter,
|
59146
|
+
breakpoints,
|
59147
|
+
introspect: { casing: introspectCasing2 },
|
59148
|
+
dbCredentials: rest
|
58847
59149
|
};
|
58848
59150
|
};
|
58849
59151
|
validateMySqlPush = async (options) => {
|
@@ -58870,24 +59172,30 @@ var init_mysql = __esm({
|
|
58870
59172
|
printCliConnectionIssues3(options);
|
58871
59173
|
process.exit(1);
|
58872
59174
|
}
|
58873
|
-
|
58874
|
-
|
58875
|
-
|
58876
|
-
|
58877
|
-
|
58878
|
-
|
58879
|
-
|
58880
|
-
|
59175
|
+
const {
|
59176
|
+
strict,
|
59177
|
+
verbose,
|
59178
|
+
schema: schema4,
|
59179
|
+
driver,
|
59180
|
+
schemaFilter,
|
59181
|
+
tablesFilter,
|
59182
|
+
...rest
|
59183
|
+
} = cliRes.data;
|
58881
59184
|
return {
|
58882
|
-
|
58883
|
-
|
59185
|
+
driver,
|
59186
|
+
schema: schema4,
|
59187
|
+
strict,
|
59188
|
+
verbose,
|
59189
|
+
tablesFilter,
|
59190
|
+
schemaFilter,
|
59191
|
+
dbCredentials: rest
|
58884
59192
|
};
|
58885
59193
|
};
|
58886
59194
|
}
|
58887
59195
|
});
|
58888
59196
|
|
58889
59197
|
// node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/package.json
|
58890
|
-
var
|
59198
|
+
var require_package = __commonJS({
|
58891
59199
|
"node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/package.json"(exports, module2) {
|
58892
59200
|
module2.exports = {
|
58893
59201
|
name: "dotenv",
|
@@ -58958,7 +59266,7 @@ var require_main = __commonJS({
|
|
58958
59266
|
var fs8 = require("fs");
|
58959
59267
|
var path4 = require("path");
|
58960
59268
|
var os2 = require("os");
|
58961
|
-
var packageJson =
|
59269
|
+
var packageJson = require_package();
|
58962
59270
|
var version = packageJson.version;
|
58963
59271
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
58964
59272
|
function parse(src) {
|
@@ -59634,12 +59942,10 @@ var init_mysqlIntrospect = __esm({
|
|
59634
59942
|
init_global();
|
59635
59943
|
init_mjs();
|
59636
59944
|
connectToMySQL = async (config) => {
|
59637
|
-
|
59945
|
+
const client = await (0, import_promise.createConnection)(config.dbCredentials);
|
59638
59946
|
let databaseName;
|
59639
|
-
if (config.dbCredentials
|
59640
|
-
const
|
59641
|
-
client = await (0, import_promise.createConnection)(connection);
|
59642
|
-
const connectionUrl = new URL(connection);
|
59947
|
+
if ("uri" in config.dbCredentials) {
|
59948
|
+
const connectionUrl = new URL(config.dbCredentials.uri);
|
59643
59949
|
const pathname = connectionUrl.pathname;
|
59644
59950
|
databaseName = pathname.split("/")[pathname.split("/").length - 1];
|
59645
59951
|
if (!databaseName || databaseName === "") {
|
@@ -59647,10 +59953,8 @@ var init_mysqlIntrospect = __esm({
|
|
59647
59953
|
"You should specify a database name in connection string (mysql://USER:PASSWORD@HOST:PORT/DATABASE)"
|
59648
59954
|
);
|
59649
59955
|
}
|
59650
|
-
} else if (config.dbCredentials
|
59651
|
-
|
59652
|
-
client = await (0, import_promise.createConnection)(creds);
|
59653
|
-
databaseName = creds.database;
|
59956
|
+
} else if ("database" in config.dbCredentials) {
|
59957
|
+
databaseName = config.dbCredentials.database;
|
59654
59958
|
} else {
|
59655
59959
|
throw Error(
|
59656
59960
|
"Either `connectionString` or `host, port, etc.` params be provided in config file"
|
@@ -59715,9 +60019,10 @@ __export(studio_exports, {
|
|
59715
60019
|
studioConfidConnections: () => studioConfidConnections,
|
59716
60020
|
studioConfigSchema: () => studioConfigSchema,
|
59717
60021
|
studioSpecificConnections: () => studioSpecificConnections,
|
60022
|
+
stuioSqliteConnectionConfig: () => stuioSqliteConnectionConfig,
|
59718
60023
|
validateStudio: () => validateStudio
|
59719
60024
|
});
|
59720
|
-
var studioSpecificConnections, studioConfidConnections, studioConfigSchema, printDriverIssues, validateStudio;
|
60025
|
+
var studioSpecificConnections, stuioSqliteConnectionConfig, studioConfidConnections, studioConfigSchema, printDriverIssues, validateStudio;
|
59721
60026
|
var init_studio = __esm({
|
59722
60027
|
"src/cli/validations/studio.ts"() {
|
59723
60028
|
init_lib();
|
@@ -59736,6 +60041,7 @@ var init_studio = __esm({
|
|
59736
60041
|
dbName: stringType()
|
59737
60042
|
})
|
59738
60043
|
});
|
60044
|
+
stuioSqliteConnectionConfig = unionType([sqliteConnectionSchema, studioSpecificConnections]);
|
59739
60045
|
studioConfidConnections = unionType([mysqlConnectionConfig, pgConnectionConfig, sqliteConnectionSchema, studioSpecificConnections]);
|
59740
60046
|
studioConfigSchema = intersectionType(
|
59741
60047
|
objectType({
|
@@ -59782,8 +60088,7 @@ var init_studio = __esm({
|
|
59782
60088
|
// src/cli/index.ts
|
59783
60089
|
var cli_exports = {};
|
59784
60090
|
__export(cli_exports, {
|
59785
|
-
checkSchema: () => checkSchema
|
59786
|
-
defineConfig: () => defineConfig
|
60091
|
+
checkSchema: () => checkSchema
|
59787
60092
|
});
|
59788
60093
|
module.exports = __toCommonJS(cli_exports);
|
59789
60094
|
var import_commander = require("commander");
|
@@ -59791,7 +60096,7 @@ var import_fs11 = require("fs");
|
|
59791
60096
|
init_lib();
|
59792
60097
|
|
59793
60098
|
// src/cli/commands/check.ts
|
59794
|
-
|
60099
|
+
init_utils5();
|
59795
60100
|
var checkHandler = (out, dialect6) => {
|
59796
60101
|
const { snapshots } = prepareOutFolder2(out, dialect6);
|
59797
60102
|
const report = validateWithReport(snapshots, dialect6);
|
@@ -59830,54 +60135,7 @@ var checkHandler = (out, dialect6) => {
|
|
59830
60135
|
// src/cli/index.ts
|
59831
60136
|
var import_hanji11 = __toESM(require_hanji());
|
59832
60137
|
var import_path7 = __toESM(require("path"));
|
59833
|
-
|
59834
|
-
// src/cli/utils.ts
|
59835
|
-
init_views();
|
59836
|
-
var assertPackages = async (...pkgs) => {
|
59837
|
-
try {
|
59838
|
-
for (let i = 0; i < pkgs.length; i++) {
|
59839
|
-
const it = pkgs[i];
|
59840
|
-
await import(it);
|
59841
|
-
}
|
59842
|
-
} catch (e) {
|
59843
|
-
err(
|
59844
|
-
`please install required packages: ${pkgs.map((it) => `'${it}'`).join(" ")}`
|
59845
|
-
);
|
59846
|
-
process.exit(1);
|
59847
|
-
}
|
59848
|
-
};
|
59849
|
-
var requiredApiVersion = 5;
|
59850
|
-
var assertOrmCoreVersion = async () => {
|
59851
|
-
try {
|
59852
|
-
const { compatibilityVersion } = await import("drizzle-orm/version");
|
59853
|
-
if (compatibilityVersion && compatibilityVersion === requiredApiVersion)
|
59854
|
-
return;
|
59855
|
-
if (!compatibilityVersion || compatibilityVersion < requiredApiVersion) {
|
59856
|
-
console.log(
|
59857
|
-
"This version of drizzle-kit requires newer version of drizzle-orm\nPlease update drizzle-orm package to the latest version \u{1F44D}"
|
59858
|
-
);
|
59859
|
-
} else {
|
59860
|
-
console.log(
|
59861
|
-
"This version of drizzle-kit is outdated\nPlease update drizzle-kit package to the latest version \u{1F44D}"
|
59862
|
-
);
|
59863
|
-
}
|
59864
|
-
} catch (e) {
|
59865
|
-
console.log(
|
59866
|
-
"Please install latest version of drizzle-orm"
|
59867
|
-
);
|
59868
|
-
}
|
59869
|
-
process.exit(1);
|
59870
|
-
};
|
59871
|
-
var ormCoreVersions = async () => {
|
59872
|
-
try {
|
59873
|
-
const { compatibilityVersion, npmVersion } = await import("drizzle-orm/version");
|
59874
|
-
return { compatibilityVersion, npmVersion };
|
59875
|
-
} catch (e) {
|
59876
|
-
return {};
|
59877
|
-
}
|
59878
|
-
};
|
59879
|
-
|
59880
|
-
// src/cli/index.ts
|
60138
|
+
init_utils3();
|
59881
60139
|
init_source();
|
59882
60140
|
|
59883
60141
|
// package.json
|
@@ -59888,7 +60146,7 @@ var package_default = {
|
|
59888
60146
|
author: "Drizzle Team",
|
59889
60147
|
license: "MIT",
|
59890
60148
|
bin: {
|
59891
|
-
"drizzle-kit": "./
|
60149
|
+
"drizzle-kit": "./bin.cjs"
|
59892
60150
|
},
|
59893
60151
|
scripts: {
|
59894
60152
|
"test:pg:push": "drizzle-kit push:pg",
|
@@ -59918,12 +60176,13 @@ var package_default = {
|
|
59918
60176
|
sim: "node -r esbuild-register ./dev/simulate.ts",
|
59919
60177
|
"sim:sqlite": "node -r esbuild-register ./dev/sqlite/index.ts",
|
59920
60178
|
test: "ava test --timeout=60s",
|
59921
|
-
build: "rm -rf ./dist &&
|
60179
|
+
build: "rm -rf ./dist && tsc -p tsconfig.cli-types.json && cp dist/index.d.ts dist/index.d.mts && tsx build.ts",
|
59922
60180
|
"build:dev": "rm -rf ./dist && tsx build.dev.ts && tsc -p tsconfig.cli-types.json && chmod +x ./dist/index.cjs",
|
59923
60181
|
packit: "pnpm build && cp package.json dist/ && cd dist && pnpm pack",
|
59924
60182
|
tsc: "tsc -p tsconfig.build.json",
|
59925
60183
|
pub: "cp package.json readme.md dist/ && cd dist && npm publish",
|
59926
|
-
studio: "./dist/index.cjs studio --verbose"
|
60184
|
+
studio: "./dist/index.cjs studio --verbose",
|
60185
|
+
"studio:dev": "tsx ./src/cli/index.ts studio --verbose"
|
59927
60186
|
},
|
59928
60187
|
ava: {
|
59929
60188
|
files: [
|
@@ -59937,7 +60196,7 @@ var package_default = {
|
|
59937
60196
|
]
|
59938
60197
|
},
|
59939
60198
|
dependencies: {
|
59940
|
-
"@drizzle-team/studio": "^0.0.
|
60199
|
+
"@drizzle-team/studio": "^0.0.27",
|
59941
60200
|
"@esbuild-kit/esm-loader": "^2.5.5",
|
59942
60201
|
camelcase: "^7.0.1",
|
59943
60202
|
chalk: "^5.2.0",
|
@@ -59959,26 +60218,41 @@ var package_default = {
|
|
59959
60218
|
"@types/glob": "^8.1.0",
|
59960
60219
|
"@types/minimatch": "^5.1.2",
|
59961
60220
|
"@types/node": "^18.11.15",
|
59962
|
-
"@types/pg": "^8.
|
60221
|
+
"@types/pg": "^8.10.7",
|
59963
60222
|
"@typescript-eslint/eslint-plugin": "^5.46.1",
|
59964
60223
|
"@typescript-eslint/parser": "^5.46.1",
|
59965
60224
|
ava: "^5.1.0",
|
59966
60225
|
"better-sqlite3": "^8.4.0",
|
59967
60226
|
dockerode: "^3.3.4",
|
59968
60227
|
dotenv: "^16.0.3",
|
59969
|
-
"drizzle-orm": "0.
|
60228
|
+
"drizzle-orm": "0.29.0-d3b1c58",
|
60229
|
+
"esbuild-node-externals": "^1.9.0",
|
59970
60230
|
eslint: "^8.29.0",
|
59971
60231
|
"eslint-config-prettier": "^8.5.0",
|
59972
60232
|
"eslint-plugin-prettier": "^4.2.1",
|
59973
60233
|
"get-port": "^6.1.2",
|
59974
60234
|
mysql2: "2.3.3",
|
59975
|
-
pg: "^8.
|
60235
|
+
pg: "^8.11.3",
|
59976
60236
|
postgres: "^3.3.5",
|
59977
60237
|
prettier: "^2.8.1",
|
59978
60238
|
tsx: "^3.12.1",
|
59979
60239
|
typescript: "^4.9.4",
|
59980
60240
|
uvu: "^0.5.6",
|
59981
60241
|
zx: "^7.2.2"
|
60242
|
+
},
|
60243
|
+
exports: {
|
60244
|
+
".": {
|
60245
|
+
import: {
|
60246
|
+
types: "./index.d.mts",
|
60247
|
+
default: "./index.mjs"
|
60248
|
+
},
|
60249
|
+
require: {
|
60250
|
+
types: "./index.d.ts",
|
60251
|
+
default: "./index.js"
|
60252
|
+
},
|
60253
|
+
types: "./index.d.mts",
|
60254
|
+
default: "./index.mjs"
|
60255
|
+
}
|
59982
60256
|
}
|
59983
60257
|
};
|
59984
60258
|
|
@@ -59986,14 +60260,14 @@ var package_default = {
|
|
59986
60260
|
init_migrate();
|
59987
60261
|
init_utils2();
|
59988
60262
|
init_pgSchema();
|
59989
|
-
|
60263
|
+
init_utils5();
|
59990
60264
|
init_pgUp();
|
59991
60265
|
|
59992
60266
|
// src/cli/commands/sqliteUp.ts
|
59993
60267
|
init_source();
|
59994
60268
|
var import_fs9 = __toESM(require("fs"));
|
59995
60269
|
init_sqliteSchema();
|
59996
|
-
|
60270
|
+
init_utils5();
|
59997
60271
|
var upSqliteHandler = (out) => {
|
59998
60272
|
};
|
59999
60273
|
var upSqliteHandlerV4 = (out) => {
|
@@ -60584,7 +60858,7 @@ init_common();
|
|
60584
60858
|
init_mysql();
|
60585
60859
|
init_pgPushUtils();
|
60586
60860
|
init_outputs();
|
60587
|
-
var
|
60861
|
+
var import_server = require("@drizzle-team/studio/server");
|
60588
60862
|
init_sqlgenerator();
|
60589
60863
|
|
60590
60864
|
// node_modules/.pnpm/dotenv@16.0.3/node_modules/dotenv/config.js
|
@@ -60600,6 +60874,7 @@ init_sqlgenerator();
|
|
60600
60874
|
|
60601
60875
|
// src/cli/index.ts
|
60602
60876
|
init_selector_ui();
|
60877
|
+
init_global();
|
60603
60878
|
var printVersions = async () => {
|
60604
60879
|
const v = await versions();
|
60605
60880
|
console.log(`${source_default.gray(v)}
|
@@ -61288,16 +61563,48 @@ var dropCommand = new import_commander.Command("drop").option("--out <out>", `Ou
|
|
61288
61563
|
await dropMigration(out);
|
61289
61564
|
});
|
61290
61565
|
var studioCommand = new import_commander.Command("studio").option("--port <port>", "Custom port for drizzle studio [default=4983]").option("--host <host>", "Custom host for drizzle studio [default=0.0.0.0]").option("--verbose", "Print all stataments that are executed by Studio").option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
|
61566
|
+
await printVersions();
|
61567
|
+
await assertOrmCoreVersion();
|
61291
61568
|
const { validateStudio: validateStudio2 } = await Promise.resolve().then(() => (init_studio(), studio_exports));
|
61292
61569
|
const drizzleConfig = await validateStudio2(options);
|
61293
|
-
const {
|
61294
|
-
|
61295
|
-
|
61296
|
-
|
61297
|
-
|
61298
|
-
|
61299
|
-
|
61300
|
-
|
61570
|
+
const {
|
61571
|
+
drizzleForPostgres: drizzleForPostgres2,
|
61572
|
+
preparePgSchema: preparePgSchema2,
|
61573
|
+
prepareMySqlSchema: prepareMySqlSchema2,
|
61574
|
+
drizzleForMySQL: drizzleForMySQL2,
|
61575
|
+
prepareSQLiteSchema: prepareSQLiteSchema2,
|
61576
|
+
drizzleForSQLite: drizzleForSQLite2
|
61577
|
+
} = await Promise.resolve().then(() => (init_studioUtils(), studioUtils_exports));
|
61578
|
+
const { driver, schema: schemaPath } = drizzleConfig;
|
61579
|
+
let setup;
|
61580
|
+
if (driver === "pg") {
|
61581
|
+
const { schema: schema4, relations: relations4 } = await preparePgSchema2(schemaPath);
|
61582
|
+
setup = await drizzleForPostgres2(
|
61583
|
+
drizzleConfig,
|
61584
|
+
schema4,
|
61585
|
+
relations4,
|
61586
|
+
Boolean(options.verbose)
|
61587
|
+
);
|
61588
|
+
} else if (driver === "mysql2") {
|
61589
|
+
const { schema: schema4, relations: relations4 } = await prepareMySqlSchema2(schemaPath);
|
61590
|
+
setup = await drizzleForMySQL2(
|
61591
|
+
drizzleConfig,
|
61592
|
+
schema4,
|
61593
|
+
relations4,
|
61594
|
+
Boolean(options.verbose)
|
61595
|
+
);
|
61596
|
+
} else if (driver === "better-sqlite" || driver === "d1" || driver === "libsql" || driver === "turso") {
|
61597
|
+
const { schema: schema4, relations: relations4 } = await prepareSQLiteSchema2(schemaPath);
|
61598
|
+
setup = await drizzleForSQLite2(
|
61599
|
+
drizzleConfig,
|
61600
|
+
schema4,
|
61601
|
+
relations4,
|
61602
|
+
Boolean(options.verbose)
|
61603
|
+
);
|
61604
|
+
} else {
|
61605
|
+
assertUnreachable(driver);
|
61606
|
+
}
|
61607
|
+
const server = await (0, import_server.prepareServer)(setup);
|
61301
61608
|
const port = options.port ?? 4983;
|
61302
61609
|
const host = options.host ?? "127.0.0.1";
|
61303
61610
|
console.log();
|
@@ -61306,6 +61613,13 @@ var studioCommand = new import_commander.Command("studio").option("--port <port>
|
|
61306
61613
|
"Drizzle Studio is currently in Beta. If you find anything that is not working as expected or should be improved, feel free to create an issue on GitHub: https://github.com/drizzle-team/drizzle-kit-mirror/issues/new or write to us on Discord: https://discord.gg/WcRKz2FFxN"
|
61307
61614
|
)
|
61308
61615
|
);
|
61616
|
+
if (driver === "d1") {
|
61617
|
+
console.log(
|
61618
|
+
withStyle.fullWarning(
|
61619
|
+
"It seems like you are trying to access your D1 Database. Please make sure to run 'wrangler login' before using Drizzle Studio to ensure it has your token for making requests to the D1 Database. If you encounter an error related to CLOUDFLARE_TOKEN, please run 'wrangler login' and restart the studio"
|
61620
|
+
)
|
61621
|
+
);
|
61622
|
+
}
|
61309
61623
|
server.start({
|
61310
61624
|
host,
|
61311
61625
|
port,
|
@@ -61353,14 +61667,10 @@ var main = async () => {
|
|
61353
61667
|
import_commander.program.addCommand(studioCommand);
|
61354
61668
|
import_commander.program.parse();
|
61355
61669
|
};
|
61356
|
-
function defineConfig(config) {
|
61357
|
-
return config;
|
61358
|
-
}
|
61359
61670
|
main();
|
61360
61671
|
// Annotate the CommonJS export names for ESM import in node:
|
61361
61672
|
0 && (module.exports = {
|
61362
|
-
checkSchema
|
61363
|
-
defineConfig
|
61673
|
+
checkSchema
|
61364
61674
|
});
|
61365
61675
|
/*! Bundled license information:
|
61366
61676
|
|