drizzle-kit 0.19.2-f1211c0 → 0.19.3-23a3dbf
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +1045 -750
- package/index.d.ts +2 -9
- package/package.json +8 -5
- package/utils.js +109 -77
package/index.cjs
CHANGED
|
@@ -486,7 +486,7 @@ var init_lib = __esm({
|
|
|
486
486
|
message: issueData.message || errorMessage
|
|
487
487
|
};
|
|
488
488
|
};
|
|
489
|
-
ParseStatus = class {
|
|
489
|
+
ParseStatus = class _ParseStatus {
|
|
490
490
|
constructor() {
|
|
491
491
|
this.value = "valid";
|
|
492
492
|
}
|
|
@@ -517,7 +517,7 @@ var init_lib = __esm({
|
|
|
517
517
|
value: await pair.value
|
|
518
518
|
});
|
|
519
519
|
}
|
|
520
|
-
return
|
|
520
|
+
return _ParseStatus.mergeObjectSync(status, syncPairs);
|
|
521
521
|
}
|
|
522
522
|
static mergeObjectSync(status, pairs) {
|
|
523
523
|
const finalObject = {};
|
|
@@ -833,7 +833,7 @@ var init_lib = __esm({
|
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
835
|
};
|
|
836
|
-
ZodString = class extends ZodType {
|
|
836
|
+
ZodString = class _ZodString extends ZodType {
|
|
837
837
|
constructor() {
|
|
838
838
|
super(...arguments);
|
|
839
839
|
this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
|
|
@@ -842,7 +842,7 @@ var init_lib = __esm({
|
|
|
842
842
|
...errorUtil.errToObj(message)
|
|
843
843
|
});
|
|
844
844
|
this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
|
|
845
|
-
this.trim = () => new
|
|
845
|
+
this.trim = () => new _ZodString({
|
|
846
846
|
...this._def,
|
|
847
847
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
848
848
|
});
|
|
@@ -1014,7 +1014,7 @@ var init_lib = __esm({
|
|
|
1014
1014
|
return { status: status.value, value: input.data };
|
|
1015
1015
|
}
|
|
1016
1016
|
_addCheck(check) {
|
|
1017
|
-
return new
|
|
1017
|
+
return new _ZodString({
|
|
1018
1018
|
...this._def,
|
|
1019
1019
|
checks: [...this._def.checks, check]
|
|
1020
1020
|
});
|
|
@@ -1135,7 +1135,7 @@ var init_lib = __esm({
|
|
|
1135
1135
|
...processCreateParams(params)
|
|
1136
1136
|
});
|
|
1137
1137
|
};
|
|
1138
|
-
ZodNumber = class extends ZodType {
|
|
1138
|
+
ZodNumber = class _ZodNumber extends ZodType {
|
|
1139
1139
|
constructor() {
|
|
1140
1140
|
super(...arguments);
|
|
1141
1141
|
this.min = this.gte;
|
|
@@ -1236,7 +1236,7 @@ var init_lib = __esm({
|
|
|
1236
1236
|
return this.setLimit("max", value, false, errorUtil.toString(message));
|
|
1237
1237
|
}
|
|
1238
1238
|
setLimit(kind, value, inclusive, message) {
|
|
1239
|
-
return new
|
|
1239
|
+
return new _ZodNumber({
|
|
1240
1240
|
...this._def,
|
|
1241
1241
|
checks: [
|
|
1242
1242
|
...this._def.checks,
|
|
@@ -1250,7 +1250,7 @@ var init_lib = __esm({
|
|
|
1250
1250
|
});
|
|
1251
1251
|
}
|
|
1252
1252
|
_addCheck(check) {
|
|
1253
|
-
return new
|
|
1253
|
+
return new _ZodNumber({
|
|
1254
1254
|
...this._def,
|
|
1255
1255
|
checks: [...this._def.checks, check]
|
|
1256
1256
|
});
|
|
@@ -1389,7 +1389,7 @@ var init_lib = __esm({
|
|
|
1389
1389
|
...processCreateParams(params)
|
|
1390
1390
|
});
|
|
1391
1391
|
};
|
|
1392
|
-
ZodDate = class extends ZodType {
|
|
1392
|
+
ZodDate = class _ZodDate extends ZodType {
|
|
1393
1393
|
_parse(input) {
|
|
1394
1394
|
if (this._def.coerce) {
|
|
1395
1395
|
input.data = new Date(input.data);
|
|
@@ -1450,7 +1450,7 @@ var init_lib = __esm({
|
|
|
1450
1450
|
};
|
|
1451
1451
|
}
|
|
1452
1452
|
_addCheck(check) {
|
|
1453
|
-
return new
|
|
1453
|
+
return new _ZodDate({
|
|
1454
1454
|
...this._def,
|
|
1455
1455
|
checks: [...this._def.checks, check]
|
|
1456
1456
|
});
|
|
@@ -1629,7 +1629,7 @@ var init_lib = __esm({
|
|
|
1629
1629
|
...processCreateParams(params)
|
|
1630
1630
|
});
|
|
1631
1631
|
};
|
|
1632
|
-
ZodArray = class extends ZodType {
|
|
1632
|
+
ZodArray = class _ZodArray extends ZodType {
|
|
1633
1633
|
_parse(input) {
|
|
1634
1634
|
const { ctx, status } = this._processInputParams(input);
|
|
1635
1635
|
const def = this._def;
|
|
@@ -1699,19 +1699,19 @@ var init_lib = __esm({
|
|
|
1699
1699
|
return this._def.type;
|
|
1700
1700
|
}
|
|
1701
1701
|
min(minLength, message) {
|
|
1702
|
-
return new
|
|
1702
|
+
return new _ZodArray({
|
|
1703
1703
|
...this._def,
|
|
1704
1704
|
minLength: { value: minLength, message: errorUtil.toString(message) }
|
|
1705
1705
|
});
|
|
1706
1706
|
}
|
|
1707
1707
|
max(maxLength, message) {
|
|
1708
|
-
return new
|
|
1708
|
+
return new _ZodArray({
|
|
1709
1709
|
...this._def,
|
|
1710
1710
|
maxLength: { value: maxLength, message: errorUtil.toString(message) }
|
|
1711
1711
|
});
|
|
1712
1712
|
}
|
|
1713
1713
|
length(len, message) {
|
|
1714
|
-
return new
|
|
1714
|
+
return new _ZodArray({
|
|
1715
1715
|
...this._def,
|
|
1716
1716
|
exactLength: { value: len, message: errorUtil.toString(message) }
|
|
1717
1717
|
});
|
|
@@ -1748,7 +1748,7 @@ var init_lib = __esm({
|
|
|
1748
1748
|
})
|
|
1749
1749
|
});
|
|
1750
1750
|
};
|
|
1751
|
-
ZodObject = class extends ZodType {
|
|
1751
|
+
ZodObject = class _ZodObject extends ZodType {
|
|
1752
1752
|
constructor() {
|
|
1753
1753
|
super(...arguments);
|
|
1754
1754
|
this._cached = null;
|
|
@@ -1854,7 +1854,7 @@ var init_lib = __esm({
|
|
|
1854
1854
|
}
|
|
1855
1855
|
strict(message) {
|
|
1856
1856
|
errorUtil.errToObj;
|
|
1857
|
-
return new
|
|
1857
|
+
return new _ZodObject({
|
|
1858
1858
|
...this._def,
|
|
1859
1859
|
unknownKeys: "strict",
|
|
1860
1860
|
...message !== void 0 ? {
|
|
@@ -1873,13 +1873,13 @@ var init_lib = __esm({
|
|
|
1873
1873
|
});
|
|
1874
1874
|
}
|
|
1875
1875
|
strip() {
|
|
1876
|
-
return new
|
|
1876
|
+
return new _ZodObject({
|
|
1877
1877
|
...this._def,
|
|
1878
1878
|
unknownKeys: "strip"
|
|
1879
1879
|
});
|
|
1880
1880
|
}
|
|
1881
1881
|
passthrough() {
|
|
1882
|
-
return new
|
|
1882
|
+
return new _ZodObject({
|
|
1883
1883
|
...this._def,
|
|
1884
1884
|
unknownKeys: "passthrough"
|
|
1885
1885
|
});
|
|
@@ -1893,7 +1893,7 @@ var init_lib = __esm({
|
|
|
1893
1893
|
* upgrade if you are experiencing issues.
|
|
1894
1894
|
*/
|
|
1895
1895
|
merge(merging) {
|
|
1896
|
-
const merged = new
|
|
1896
|
+
const merged = new _ZodObject({
|
|
1897
1897
|
unknownKeys: merging._def.unknownKeys,
|
|
1898
1898
|
catchall: merging._def.catchall,
|
|
1899
1899
|
shape: () => objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
|
|
@@ -1902,7 +1902,7 @@ var init_lib = __esm({
|
|
|
1902
1902
|
return merged;
|
|
1903
1903
|
}
|
|
1904
1904
|
catchall(index4) {
|
|
1905
|
-
return new
|
|
1905
|
+
return new _ZodObject({
|
|
1906
1906
|
...this._def,
|
|
1907
1907
|
catchall: index4
|
|
1908
1908
|
});
|
|
@@ -1913,7 +1913,7 @@ var init_lib = __esm({
|
|
|
1913
1913
|
if (this.shape[key])
|
|
1914
1914
|
shape[key] = this.shape[key];
|
|
1915
1915
|
});
|
|
1916
|
-
return new
|
|
1916
|
+
return new _ZodObject({
|
|
1917
1917
|
...this._def,
|
|
1918
1918
|
shape: () => shape
|
|
1919
1919
|
});
|
|
@@ -1925,7 +1925,7 @@ var init_lib = __esm({
|
|
|
1925
1925
|
shape[key] = this.shape[key];
|
|
1926
1926
|
}
|
|
1927
1927
|
});
|
|
1928
|
-
return new
|
|
1928
|
+
return new _ZodObject({
|
|
1929
1929
|
...this._def,
|
|
1930
1930
|
shape: () => shape
|
|
1931
1931
|
});
|
|
@@ -1943,7 +1943,7 @@ var init_lib = __esm({
|
|
|
1943
1943
|
newShape[key] = this.shape[key].optional();
|
|
1944
1944
|
}
|
|
1945
1945
|
});
|
|
1946
|
-
return new
|
|
1946
|
+
return new _ZodObject({
|
|
1947
1947
|
...this._def,
|
|
1948
1948
|
shape: () => newShape
|
|
1949
1949
|
});
|
|
@@ -1953,7 +1953,7 @@ var init_lib = __esm({
|
|
|
1953
1953
|
newShape[key] = fieldSchema.optional();
|
|
1954
1954
|
}
|
|
1955
1955
|
}
|
|
1956
|
-
return new
|
|
1956
|
+
return new _ZodObject({
|
|
1957
1957
|
...this._def,
|
|
1958
1958
|
shape: () => newShape
|
|
1959
1959
|
});
|
|
@@ -1983,7 +1983,7 @@ var init_lib = __esm({
|
|
|
1983
1983
|
newShape[key] = newField;
|
|
1984
1984
|
}
|
|
1985
1985
|
}
|
|
1986
|
-
return new
|
|
1986
|
+
return new _ZodObject({
|
|
1987
1987
|
...this._def,
|
|
1988
1988
|
shape: () => newShape
|
|
1989
1989
|
});
|
|
@@ -2131,7 +2131,7 @@ var init_lib = __esm({
|
|
|
2131
2131
|
return null;
|
|
2132
2132
|
}
|
|
2133
2133
|
};
|
|
2134
|
-
ZodDiscriminatedUnion = class extends ZodType {
|
|
2134
|
+
ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
2135
2135
|
_parse(input) {
|
|
2136
2136
|
const { ctx } = this._processInputParams(input);
|
|
2137
2137
|
if (ctx.parsedType !== ZodParsedType.object) {
|
|
@@ -2198,7 +2198,7 @@ var init_lib = __esm({
|
|
|
2198
2198
|
optionsMap.set(value, type);
|
|
2199
2199
|
}
|
|
2200
2200
|
}
|
|
2201
|
-
return new
|
|
2201
|
+
return new _ZodDiscriminatedUnion({
|
|
2202
2202
|
typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
|
|
2203
2203
|
discriminator,
|
|
2204
2204
|
options,
|
|
@@ -2260,7 +2260,7 @@ var init_lib = __esm({
|
|
|
2260
2260
|
...processCreateParams(params)
|
|
2261
2261
|
});
|
|
2262
2262
|
};
|
|
2263
|
-
ZodTuple = class extends ZodType {
|
|
2263
|
+
ZodTuple = class _ZodTuple extends ZodType {
|
|
2264
2264
|
_parse(input) {
|
|
2265
2265
|
const { status, ctx } = this._processInputParams(input);
|
|
2266
2266
|
if (ctx.parsedType !== ZodParsedType.array) {
|
|
@@ -2310,7 +2310,7 @@ var init_lib = __esm({
|
|
|
2310
2310
|
return this._def.items;
|
|
2311
2311
|
}
|
|
2312
2312
|
rest(rest) {
|
|
2313
|
-
return new
|
|
2313
|
+
return new _ZodTuple({
|
|
2314
2314
|
...this._def,
|
|
2315
2315
|
rest
|
|
2316
2316
|
});
|
|
@@ -2327,7 +2327,7 @@ var init_lib = __esm({
|
|
|
2327
2327
|
...processCreateParams(params)
|
|
2328
2328
|
});
|
|
2329
2329
|
};
|
|
2330
|
-
ZodRecord = class extends ZodType {
|
|
2330
|
+
ZodRecord = class _ZodRecord extends ZodType {
|
|
2331
2331
|
get keySchema() {
|
|
2332
2332
|
return this._def.keyType;
|
|
2333
2333
|
}
|
|
@@ -2364,14 +2364,14 @@ var init_lib = __esm({
|
|
|
2364
2364
|
}
|
|
2365
2365
|
static create(first, second, third) {
|
|
2366
2366
|
if (second instanceof ZodType) {
|
|
2367
|
-
return new
|
|
2367
|
+
return new _ZodRecord({
|
|
2368
2368
|
keyType: first,
|
|
2369
2369
|
valueType: second,
|
|
2370
2370
|
typeName: ZodFirstPartyTypeKind.ZodRecord,
|
|
2371
2371
|
...processCreateParams(third)
|
|
2372
2372
|
});
|
|
2373
2373
|
}
|
|
2374
|
-
return new
|
|
2374
|
+
return new _ZodRecord({
|
|
2375
2375
|
keyType: ZodString.create(),
|
|
2376
2376
|
valueType: first,
|
|
2377
2377
|
typeName: ZodFirstPartyTypeKind.ZodRecord,
|
|
@@ -2439,7 +2439,7 @@ var init_lib = __esm({
|
|
|
2439
2439
|
...processCreateParams(params)
|
|
2440
2440
|
});
|
|
2441
2441
|
};
|
|
2442
|
-
ZodSet = class extends ZodType {
|
|
2442
|
+
ZodSet = class _ZodSet extends ZodType {
|
|
2443
2443
|
_parse(input) {
|
|
2444
2444
|
const { status, ctx } = this._processInputParams(input);
|
|
2445
2445
|
if (ctx.parsedType !== ZodParsedType.set) {
|
|
@@ -2497,13 +2497,13 @@ var init_lib = __esm({
|
|
|
2497
2497
|
}
|
|
2498
2498
|
}
|
|
2499
2499
|
min(minSize, message) {
|
|
2500
|
-
return new
|
|
2500
|
+
return new _ZodSet({
|
|
2501
2501
|
...this._def,
|
|
2502
2502
|
minSize: { value: minSize, message: errorUtil.toString(message) }
|
|
2503
2503
|
});
|
|
2504
2504
|
}
|
|
2505
2505
|
max(maxSize, message) {
|
|
2506
|
-
return new
|
|
2506
|
+
return new _ZodSet({
|
|
2507
2507
|
...this._def,
|
|
2508
2508
|
maxSize: { value: maxSize, message: errorUtil.toString(message) }
|
|
2509
2509
|
});
|
|
@@ -2524,7 +2524,7 @@ var init_lib = __esm({
|
|
|
2524
2524
|
...processCreateParams(params)
|
|
2525
2525
|
});
|
|
2526
2526
|
};
|
|
2527
|
-
ZodFunction = class extends ZodType {
|
|
2527
|
+
ZodFunction = class _ZodFunction extends ZodType {
|
|
2528
2528
|
constructor() {
|
|
2529
2529
|
super(...arguments);
|
|
2530
2530
|
this.validate = this.implement;
|
|
@@ -2609,13 +2609,13 @@ var init_lib = __esm({
|
|
|
2609
2609
|
return this._def.returns;
|
|
2610
2610
|
}
|
|
2611
2611
|
args(...items) {
|
|
2612
|
-
return new
|
|
2612
|
+
return new _ZodFunction({
|
|
2613
2613
|
...this._def,
|
|
2614
2614
|
args: ZodTuple.create(items).rest(ZodUnknown.create())
|
|
2615
2615
|
});
|
|
2616
2616
|
}
|
|
2617
2617
|
returns(returnType) {
|
|
2618
|
-
return new
|
|
2618
|
+
return new _ZodFunction({
|
|
2619
2619
|
...this._def,
|
|
2620
2620
|
returns: returnType
|
|
2621
2621
|
});
|
|
@@ -2629,7 +2629,7 @@ var init_lib = __esm({
|
|
|
2629
2629
|
return validatedFunc;
|
|
2630
2630
|
}
|
|
2631
2631
|
static create(args, returns, params) {
|
|
2632
|
-
return new
|
|
2632
|
+
return new _ZodFunction({
|
|
2633
2633
|
args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
|
|
2634
2634
|
returns: returns || ZodUnknown.create(),
|
|
2635
2635
|
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
@@ -3040,7 +3040,7 @@ var init_lib = __esm({
|
|
|
3040
3040
|
return this._def.type;
|
|
3041
3041
|
}
|
|
3042
3042
|
};
|
|
3043
|
-
ZodPipeline = class extends ZodType {
|
|
3043
|
+
ZodPipeline = class _ZodPipeline extends ZodType {
|
|
3044
3044
|
_parse(input) {
|
|
3045
3045
|
const { status, ctx } = this._processInputParams(input);
|
|
3046
3046
|
if (ctx.common.async) {
|
|
@@ -3088,7 +3088,7 @@ var init_lib = __esm({
|
|
|
3088
3088
|
}
|
|
3089
3089
|
}
|
|
3090
3090
|
static create(a, b) {
|
|
3091
|
-
return new
|
|
3091
|
+
return new _ZodPipeline({
|
|
3092
3092
|
in: a,
|
|
3093
3093
|
out: b,
|
|
3094
3094
|
typeName: ZodFirstPartyTypeKind.ZodPipeline
|
|
@@ -6264,9 +6264,9 @@ var require_src2 = __commonJS({
|
|
|
6264
6264
|
}
|
|
6265
6265
|
});
|
|
6266
6266
|
|
|
6267
|
-
// node_modules/.pnpm/esbuild-register@3.4.2_esbuild@0.
|
|
6267
|
+
// node_modules/.pnpm/esbuild-register@3.4.2_esbuild@0.18.6/node_modules/esbuild-register/dist/node.js
|
|
6268
6268
|
var require_node2 = __commonJS({
|
|
6269
|
-
"node_modules/.pnpm/esbuild-register@3.4.2_esbuild@0.
|
|
6269
|
+
"node_modules/.pnpm/esbuild-register@3.4.2_esbuild@0.18.6/node_modules/esbuild-register/dist/node.js"(exports) {
|
|
6270
6270
|
"use strict";
|
|
6271
6271
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6272
6272
|
function _interopRequireDefault2(obj) {
|
|
@@ -12386,7 +12386,7 @@ var init_sqliteSerializer = __esm({
|
|
|
12386
12386
|
primaryKeys.forEach((it) => {
|
|
12387
12387
|
if (it.columns.length > 1) {
|
|
12388
12388
|
primaryKeysObject[it.getName()] = {
|
|
12389
|
-
columns: it.columns.map((it2) => it2.name)
|
|
12389
|
+
columns: it.columns.map((it2) => it2.name).sort()
|
|
12390
12390
|
};
|
|
12391
12391
|
} else {
|
|
12392
12392
|
columnsObject[it.columns[0].name].primaryKey = true;
|
|
@@ -12416,10 +12416,22 @@ var init_sqliteSerializer = __esm({
|
|
|
12416
12416
|
const columns = await db.query(
|
|
12417
12417
|
`SELECT
|
|
12418
12418
|
m.name as "tableName", p.name as "columnName", p.type as "columnType", p."notnull" as "notNull", p.dflt_value as "defaultValue", p.pk as pk
|
|
12419
|
-
FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
|
|
12419
|
+
FROM sqlite_master AS m JOIN pragma_table_info(m.name) AS p
|
|
12420
12420
|
WHERE m.type = 'table' and m.tbl_name != 'sqlite_sequence' and m.tbl_name != 'sqlite_stat1' and m.tbl_name != '_litestream_seq' and m.tbl_name != '_litestream_lock';
|
|
12421
12421
|
`
|
|
12422
12422
|
);
|
|
12423
|
+
const isSeqExists = await db.query(
|
|
12424
|
+
`SELECT * FROM sqlite_master WHERE type='table' AND name='sqlite_sequence';`
|
|
12425
|
+
);
|
|
12426
|
+
const tablesWithSeq = [];
|
|
12427
|
+
if (isSeqExists.length > 0) {
|
|
12428
|
+
const seq = await db.query(
|
|
12429
|
+
`SELECT * FROM sqlite_sequence WHERE name != 'sqlite_sequence' and name != 'sqlite_stat1' and name != '_litestream_seq' and name != '_litestream_lock';`
|
|
12430
|
+
);
|
|
12431
|
+
for (const s of seq) {
|
|
12432
|
+
tablesWithSeq.push(s.name);
|
|
12433
|
+
}
|
|
12434
|
+
}
|
|
12423
12435
|
let columnsCount = 0;
|
|
12424
12436
|
let tablesCount = /* @__PURE__ */ new Set();
|
|
12425
12437
|
let indexesCount = 0;
|
|
@@ -12442,7 +12454,7 @@ var init_sqliteSerializer = __esm({
|
|
|
12442
12454
|
const columnType = column7.columnType;
|
|
12443
12455
|
const isPrimary = column7.pk !== 0;
|
|
12444
12456
|
const columnDefault = column7.defaultValue;
|
|
12445
|
-
const isAutoincrement =
|
|
12457
|
+
const isAutoincrement = isPrimary && tablesWithSeq.includes(tableName);
|
|
12446
12458
|
if (isPrimary) {
|
|
12447
12459
|
if (typeof tableToPk[tableName] === "undefined") {
|
|
12448
12460
|
tableToPk[tableName] = [columnName];
|
|
@@ -12454,7 +12466,7 @@ var init_sqliteSerializer = __esm({
|
|
|
12454
12466
|
const newColumn = {
|
|
12455
12467
|
default: columnDefault === null ? void 0 : /^-?[\d.]+(?:e-?\d+)?$/.test(columnDefault) ? Number(columnDefault) : ["CURRENT_TIME", "CURRENT_DATE", "CURRENT_TIMESTAMP"].includes(
|
|
12456
12468
|
columnDefault
|
|
12457
|
-
) ? `(${columnDefault})` : columnDefault,
|
|
12469
|
+
) ? `(${columnDefault})` : columnDefault === "false" ? false : columnDefault === "true" ? true : columnDefault.startsWith('"') && columnDefault.endsWith('"') ? columnDefault.substring(1, columnDefault.length - 1) : columnDefault,
|
|
12458
12470
|
autoincrement: isAutoincrement,
|
|
12459
12471
|
name: columnName,
|
|
12460
12472
|
type: mapSqlToSqliteType(columnType),
|
|
@@ -12477,9 +12489,10 @@ var init_sqliteSerializer = __esm({
|
|
|
12477
12489
|
}
|
|
12478
12490
|
for (const [key, value] of Object.entries(tableToPk)) {
|
|
12479
12491
|
if (value.length > 1) {
|
|
12492
|
+
value.sort();
|
|
12480
12493
|
result[key].compositePrimaryKeys = {
|
|
12481
|
-
[`${key}_${value.
|
|
12482
|
-
columns: value
|
|
12494
|
+
[`${key}_${value.join("_")}_pk`]: {
|
|
12495
|
+
columns: value
|
|
12483
12496
|
}
|
|
12484
12497
|
};
|
|
12485
12498
|
} else if (value.length === 1) {
|
|
@@ -14576,7 +14589,7 @@ var init_sqlgenerator = __esm({
|
|
|
14576
14589
|
if (pgNativeTypes.has(it))
|
|
14577
14590
|
return true;
|
|
14578
14591
|
const toCheck = it.replace(/ /g, "");
|
|
14579
|
-
return toCheck.startsWith("varchar(") || toCheck.startsWith("char(") || toCheck.startsWith("numeric(") || toCheck.startsWith("timestamp(");
|
|
14592
|
+
return toCheck.startsWith("varchar(") || toCheck.startsWith("char(") || toCheck.startsWith("numeric(") || toCheck.startsWith("timestamp(") || toCheck.startsWith("intervalyear(") || toCheck.startsWith("intervalmonth(") || toCheck.startsWith("intervalday(") || toCheck.startsWith("intervalhour(") || toCheck.startsWith("intervalminute(") || toCheck.startsWith("intervalsecond(") || toCheck.startsWith("intervalyeartomonth(") || toCheck.startsWith("intervaldaytohour(") || toCheck.startsWith("intervaldaytominute(") || toCheck.startsWith("intervaldaytosecond(") || toCheck.startsWith("intervalhourtominute(") || toCheck.startsWith("intervalhourtosecond(") || toCheck.startsWith("intervalminutetosecond(") || /^(\w+)(\[\d*])+$/.test(it);
|
|
14580
14593
|
};
|
|
14581
14594
|
Convertor = class {
|
|
14582
14595
|
};
|
|
@@ -14658,9 +14671,9 @@ var init_sqlgenerator = __esm({
|
|
|
14658
14671
|
const primaryKeyStatement = column7.primaryKey ? " PRIMARY KEY" : "";
|
|
14659
14672
|
const notNullStatement = column7.notNull ? " NOT NULL" : "";
|
|
14660
14673
|
const defaultStatement = column7.default !== void 0 ? ` DEFAULT ${column7.default}` : "";
|
|
14661
|
-
const autoincrementStatement = column7.autoincrement ? "
|
|
14674
|
+
const autoincrementStatement = column7.autoincrement ? " AUTOINCREMENT" : "";
|
|
14662
14675
|
statement += "\n ";
|
|
14663
|
-
statement += `\`${column7.name}\` ${column7.type}${
|
|
14676
|
+
statement += `\`${column7.name}\` ${column7.type}${primaryKeyStatement}${autoincrementStatement}${defaultStatement}${notNullStatement}`;
|
|
14664
14677
|
statement += ",";
|
|
14665
14678
|
}
|
|
14666
14679
|
compositePKs.forEach((it) => {
|
|
@@ -16300,6 +16313,8 @@ var init_snapshotsDiffer = __esm({
|
|
|
16300
16313
|
init_jsonDiffer();
|
|
16301
16314
|
init_jsonStatements();
|
|
16302
16315
|
init_utils2();
|
|
16316
|
+
init_sqliteSchema();
|
|
16317
|
+
init_mysqlSchema();
|
|
16303
16318
|
makeChanged = (schema4) => {
|
|
16304
16319
|
return objectType({
|
|
16305
16320
|
type: enumType(["changed"]),
|
|
@@ -16537,35 +16552,64 @@ var init_snapshotsDiffer = __esm({
|
|
|
16537
16552
|
const jsonSetNewTableSchemas = [];
|
|
16538
16553
|
allAlteredResolved.forEach((it) => {
|
|
16539
16554
|
const schemaUnwrapped = valueFromSelfOrPatchedNew(it.schema);
|
|
16540
|
-
let
|
|
16541
|
-
|
|
16542
|
-
|
|
16555
|
+
let addedColumns = [];
|
|
16556
|
+
for (const addedPkName of Object.keys(it.addedCompositePKs)) {
|
|
16557
|
+
const addedPkColumns = it.addedCompositePKs[addedPkName];
|
|
16558
|
+
if (dialect6 === "sqlite") {
|
|
16559
|
+
addedColumns = SQLiteSquasher.unsquashPK(addedPkColumns);
|
|
16560
|
+
} else if (dialect6 === "mysql") {
|
|
16561
|
+
addedColumns = MySqlSquasher.unsquashPK(addedPkColumns).columns;
|
|
16562
|
+
} else {
|
|
16563
|
+
addedColumns = SQLiteSquasher.unsquashPK(addedPkColumns);
|
|
16564
|
+
}
|
|
16565
|
+
}
|
|
16566
|
+
let deletedColumns = [];
|
|
16567
|
+
for (const deletedPkName of Object.keys(it.deletedCompositePKs)) {
|
|
16568
|
+
const deletedPkColumns = it.deletedCompositePKs[deletedPkName];
|
|
16569
|
+
if (dialect6 === "sqlite") {
|
|
16570
|
+
deletedColumns = SQLiteSquasher.unsquashPK(deletedPkColumns);
|
|
16571
|
+
} else if (dialect6 === "mysql") {
|
|
16572
|
+
deletedColumns = MySqlSquasher.unsquashPK(deletedPkColumns).columns;
|
|
16573
|
+
} else {
|
|
16574
|
+
deletedColumns = SQLiteSquasher.unsquashPK(deletedPkColumns);
|
|
16575
|
+
}
|
|
16576
|
+
}
|
|
16577
|
+
addedColumns.sort();
|
|
16578
|
+
deletedColumns.sort();
|
|
16579
|
+
const doPerformDeleteAndCreate = JSON.stringify(addedColumns) !== JSON.stringify(deletedColumns);
|
|
16580
|
+
let addedCompositePKs = [];
|
|
16581
|
+
let deletedCompositePKs = [];
|
|
16582
|
+
let alteredCompositePKs = [];
|
|
16543
16583
|
if (dialect6 === "sqlite") {
|
|
16544
|
-
|
|
16545
|
-
|
|
16546
|
-
|
|
16547
|
-
|
|
16548
|
-
|
|
16549
|
-
|
|
16550
|
-
|
|
16551
|
-
|
|
16584
|
+
if (doPerformDeleteAndCreate) {
|
|
16585
|
+
addedCompositePKs = prepareAddCompositePrimaryKeySqlite(
|
|
16586
|
+
it.name,
|
|
16587
|
+
it.addedCompositePKs
|
|
16588
|
+
);
|
|
16589
|
+
deletedCompositePKs = prepareDeleteCompositePrimaryKeySqlite(
|
|
16590
|
+
it.name,
|
|
16591
|
+
it.deletedCompositePKs
|
|
16592
|
+
);
|
|
16593
|
+
}
|
|
16552
16594
|
alteredCompositePKs = prepareAlterCompositePrimaryKeySqlite(
|
|
16553
16595
|
it.name,
|
|
16554
16596
|
it.alteredCompositePKs
|
|
16555
16597
|
);
|
|
16556
16598
|
} else if (dialect6 === "pg") {
|
|
16557
|
-
|
|
16558
|
-
|
|
16559
|
-
|
|
16560
|
-
|
|
16561
|
-
|
|
16562
|
-
|
|
16563
|
-
|
|
16564
|
-
|
|
16565
|
-
|
|
16566
|
-
|
|
16567
|
-
|
|
16568
|
-
|
|
16599
|
+
if (doPerformDeleteAndCreate) {
|
|
16600
|
+
addedCompositePKs = prepareAddCompositePrimaryKeyPg(
|
|
16601
|
+
it.name,
|
|
16602
|
+
schemaUnwrapped,
|
|
16603
|
+
it.addedCompositePKs,
|
|
16604
|
+
curFull
|
|
16605
|
+
);
|
|
16606
|
+
deletedCompositePKs = prepareDeleteCompositePrimaryKeyPg(
|
|
16607
|
+
it.name,
|
|
16608
|
+
schemaUnwrapped,
|
|
16609
|
+
it.deletedCompositePKs,
|
|
16610
|
+
prevFull
|
|
16611
|
+
);
|
|
16612
|
+
}
|
|
16569
16613
|
alteredCompositePKs = prepareAlterCompositePrimaryKeyPg(
|
|
16570
16614
|
it.name,
|
|
16571
16615
|
schemaUnwrapped,
|
|
@@ -16574,16 +16618,19 @@ var init_snapshotsDiffer = __esm({
|
|
|
16574
16618
|
curFull
|
|
16575
16619
|
);
|
|
16576
16620
|
} else {
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
|
|
16581
|
-
|
|
16582
|
-
|
|
16583
|
-
|
|
16584
|
-
|
|
16585
|
-
|
|
16586
|
-
|
|
16621
|
+
if (doPerformDeleteAndCreate) {
|
|
16622
|
+
addedCompositePKs = prepareAddCompositePrimaryKeyMySql(
|
|
16623
|
+
it.name,
|
|
16624
|
+
it.addedCompositePKs,
|
|
16625
|
+
curFull
|
|
16626
|
+
);
|
|
16627
|
+
deletedCompositePKs = prepareDeleteCompositePrimaryKeyMySql(
|
|
16628
|
+
it.name,
|
|
16629
|
+
it.deletedCompositePKs,
|
|
16630
|
+
prevFull
|
|
16631
|
+
);
|
|
16632
|
+
}
|
|
16633
|
+
;
|
|
16587
16634
|
alteredCompositePKs = prepareAlterCompositePrimaryKeyMySql(
|
|
16588
16635
|
it.name,
|
|
16589
16636
|
it.alteredCompositePKs,
|
|
@@ -17966,6 +18013,577 @@ var init_utils3 = __esm({
|
|
|
17966
18013
|
}
|
|
17967
18014
|
});
|
|
17968
18015
|
|
|
18016
|
+
// src/cli/commands/sqliteUtils.ts
|
|
18017
|
+
var sqliteConnectionSchema, sqliteCliConfigSchema;
|
|
18018
|
+
var init_sqliteUtils = __esm({
|
|
18019
|
+
"src/cli/commands/sqliteUtils.ts"() {
|
|
18020
|
+
init_lib();
|
|
18021
|
+
init_utils();
|
|
18022
|
+
sqliteConnectionSchema = unionType([
|
|
18023
|
+
objectType({
|
|
18024
|
+
driver: literalType("turso"),
|
|
18025
|
+
dbCredentials: objectType({
|
|
18026
|
+
url: stringType(),
|
|
18027
|
+
authToken: stringType().optional()
|
|
18028
|
+
})
|
|
18029
|
+
}),
|
|
18030
|
+
objectType({
|
|
18031
|
+
driver: literalType("libsql"),
|
|
18032
|
+
dbCredentials: objectType({
|
|
18033
|
+
url: stringType()
|
|
18034
|
+
})
|
|
18035
|
+
}),
|
|
18036
|
+
objectType({
|
|
18037
|
+
driver: literalType("better-sqlite"),
|
|
18038
|
+
dbCredentials: objectType({
|
|
18039
|
+
url: stringType()
|
|
18040
|
+
})
|
|
18041
|
+
})
|
|
18042
|
+
]);
|
|
18043
|
+
sqliteCliConfigSchema = intersectionType(
|
|
18044
|
+
configIntrospectSchema,
|
|
18045
|
+
sqliteConnectionSchema
|
|
18046
|
+
);
|
|
18047
|
+
}
|
|
18048
|
+
});
|
|
18049
|
+
|
|
18050
|
+
// src/cli/validations/outputs.ts
|
|
18051
|
+
var withStyle, outputs;
|
|
18052
|
+
var init_outputs = __esm({
|
|
18053
|
+
"src/cli/validations/outputs.ts"() {
|
|
18054
|
+
init_source();
|
|
18055
|
+
withStyle = {
|
|
18056
|
+
error: (str) => `${source_default.red(`${source_default.white.bgRed(" Invalid input ")} ${str}`)}`,
|
|
18057
|
+
warning: (str) => `${source_default.white.bgGray(" Warning ")} ${str}`,
|
|
18058
|
+
fullWarning: (str) => `${source_default.black.bgYellow("[Warning]")} ${source_default.bold(str)}`
|
|
18059
|
+
};
|
|
18060
|
+
outputs = {
|
|
18061
|
+
studio: {
|
|
18062
|
+
drivers: (param) => withStyle.error(
|
|
18063
|
+
`"${param}" is not a valid driver. Available drivers: "pg", "mysql2", "better-sqlite", "libsql", "turso". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
|
|
18064
|
+
),
|
|
18065
|
+
noCredentials: () => withStyle.error(
|
|
18066
|
+
`You need to specify a "dbCredentials" param in you config. It will help drizzle to know how to query you database. You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
|
|
18067
|
+
),
|
|
18068
|
+
noDriver: () => withStyle.error(
|
|
18069
|
+
`You need to specify a "driver" param in you config. It will help drizzle to know how to query you database. You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
|
|
18070
|
+
)
|
|
18071
|
+
},
|
|
18072
|
+
common: {
|
|
18073
|
+
ambiguousParams: (command) => withStyle.error(
|
|
18074
|
+
`You can't use both --config and other cli options for ${command} command`
|
|
18075
|
+
),
|
|
18076
|
+
schema: (command) => withStyle.error(`"--schema" is a required field for ${command} command`),
|
|
18077
|
+
schemaConfig: (command) => withStyle.error(
|
|
18078
|
+
`"schema" is a required field in drizzle.config for ${command} command`
|
|
18079
|
+
)
|
|
18080
|
+
},
|
|
18081
|
+
postgres: {
|
|
18082
|
+
connection: {
|
|
18083
|
+
driver: () => withStyle.error(`Only "pg" is available options for "--driver"`),
|
|
18084
|
+
required: () => withStyle.error(
|
|
18085
|
+
`Either "connectionString" or "host", "database" are required for database connection`
|
|
18086
|
+
)
|
|
18087
|
+
}
|
|
18088
|
+
},
|
|
18089
|
+
mysql: {
|
|
18090
|
+
connection: {
|
|
18091
|
+
driver: () => withStyle.error(`Only "mysql2" is available options for "--driver"`),
|
|
18092
|
+
required: () => withStyle.error(
|
|
18093
|
+
`Either "connectionString" or "host", "database" are required for database connection`
|
|
18094
|
+
)
|
|
18095
|
+
}
|
|
18096
|
+
},
|
|
18097
|
+
sqlite: {
|
|
18098
|
+
connection: {
|
|
18099
|
+
driver: () => withStyle.error(
|
|
18100
|
+
`Either "turso", "libsql", "better-sqlite" are available options for "--driver"`
|
|
18101
|
+
),
|
|
18102
|
+
url: (driver) => withStyle.error(`"url" is a required option for driver "${driver}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`),
|
|
18103
|
+
authToken: (driver) => withStyle.error(
|
|
18104
|
+
`"authToken" is a required option for driver "${driver}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
|
|
18105
|
+
)
|
|
18106
|
+
},
|
|
18107
|
+
introspect: {},
|
|
18108
|
+
push: {}
|
|
18109
|
+
}
|
|
18110
|
+
};
|
|
18111
|
+
}
|
|
18112
|
+
});
|
|
18113
|
+
|
|
18114
|
+
// src/cli/validations/common.ts
|
|
18115
|
+
var checkCollisions;
|
|
18116
|
+
var init_common = __esm({
|
|
18117
|
+
"src/cli/validations/common.ts"() {
|
|
18118
|
+
init_outputs();
|
|
18119
|
+
checkCollisions = (options, command, inputWhitelist = []) => {
|
|
18120
|
+
const { config, ...rest } = options;
|
|
18121
|
+
let atLeastOneParam = false;
|
|
18122
|
+
for (const key of Object.keys(rest)) {
|
|
18123
|
+
if (inputWhitelist.includes(key))
|
|
18124
|
+
continue;
|
|
18125
|
+
atLeastOneParam = true;
|
|
18126
|
+
}
|
|
18127
|
+
if (!atLeastOneParam && typeof config !== "undefined") {
|
|
18128
|
+
return {
|
|
18129
|
+
success: true,
|
|
18130
|
+
action: "config"
|
|
18131
|
+
};
|
|
18132
|
+
}
|
|
18133
|
+
if (typeof config === "undefined" && atLeastOneParam) {
|
|
18134
|
+
return {
|
|
18135
|
+
success: true,
|
|
18136
|
+
action: "cli"
|
|
18137
|
+
};
|
|
18138
|
+
}
|
|
18139
|
+
if (typeof config === "undefined" && !atLeastOneParam) {
|
|
18140
|
+
return {
|
|
18141
|
+
success: true,
|
|
18142
|
+
action: "config"
|
|
18143
|
+
};
|
|
18144
|
+
}
|
|
18145
|
+
return {
|
|
18146
|
+
success: false,
|
|
18147
|
+
message: outputs.common.ambiguousParams(command),
|
|
18148
|
+
action: "error"
|
|
18149
|
+
};
|
|
18150
|
+
};
|
|
18151
|
+
}
|
|
18152
|
+
});
|
|
18153
|
+
|
|
18154
|
+
// src/cli/validations/sqlite.ts
|
|
18155
|
+
var sqliteConnectionCli, sqliteCliIntrospectParams, sqliteCliPushParams, sqliteConfigPushParams, printCliConnectionIssues, printConfigConnectionIssues, validateIntrospect, validatePush;
|
|
18156
|
+
var init_sqlite = __esm({
|
|
18157
|
+
"src/cli/validations/sqlite.ts"() {
|
|
18158
|
+
init_lib();
|
|
18159
|
+
init_sqliteUtils();
|
|
18160
|
+
init_utils();
|
|
18161
|
+
init_common();
|
|
18162
|
+
init_outputs();
|
|
18163
|
+
sqliteConnectionCli = unionType([
|
|
18164
|
+
objectType({
|
|
18165
|
+
driver: literalType("turso"),
|
|
18166
|
+
url: stringType(),
|
|
18167
|
+
authToken: stringType()
|
|
18168
|
+
}),
|
|
18169
|
+
objectType({
|
|
18170
|
+
driver: literalType("better-sqlite"),
|
|
18171
|
+
url: stringType()
|
|
18172
|
+
}),
|
|
18173
|
+
objectType({
|
|
18174
|
+
driver: literalType("libsql"),
|
|
18175
|
+
url: stringType()
|
|
18176
|
+
})
|
|
18177
|
+
]);
|
|
18178
|
+
sqliteCliIntrospectParams = intersectionType(
|
|
18179
|
+
configIntrospectCliSchema,
|
|
18180
|
+
sqliteConnectionCli
|
|
18181
|
+
);
|
|
18182
|
+
sqliteCliPushParams = intersectionType(
|
|
18183
|
+
configPushSchema,
|
|
18184
|
+
sqliteConnectionCli
|
|
18185
|
+
);
|
|
18186
|
+
sqliteConfigPushParams = intersectionType(
|
|
18187
|
+
configPushSchema,
|
|
18188
|
+
sqliteConnectionSchema
|
|
18189
|
+
);
|
|
18190
|
+
printCliConnectionIssues = (options) => {
|
|
18191
|
+
if (options.driver === "turso") {
|
|
18192
|
+
if (typeof options.url === "undefined") {
|
|
18193
|
+
console.log(outputs.sqlite.connection.url("turso"));
|
|
18194
|
+
}
|
|
18195
|
+
if (typeof options.authToken === "undefined") {
|
|
18196
|
+
console.log(outputs.sqlite.connection.authToken("turso"));
|
|
18197
|
+
}
|
|
18198
|
+
} else if (options.driver === "libsql") {
|
|
18199
|
+
if (typeof options.url === "undefined") {
|
|
18200
|
+
console.log(outputs.sqlite.connection.url("libsql"));
|
|
18201
|
+
}
|
|
18202
|
+
} else if (options.driver === "better-sqlite") {
|
|
18203
|
+
if (typeof options.url === "undefined") {
|
|
18204
|
+
console.log(outputs.sqlite.connection.url("better-sqlite"));
|
|
18205
|
+
}
|
|
18206
|
+
} else {
|
|
18207
|
+
console.log(outputs.sqlite.connection.driver());
|
|
18208
|
+
}
|
|
18209
|
+
};
|
|
18210
|
+
printConfigConnectionIssues = (options) => {
|
|
18211
|
+
var _a, _b, _c;
|
|
18212
|
+
if (options.driver === "turso") {
|
|
18213
|
+
if (typeof options.url === "undefined") {
|
|
18214
|
+
console.log(outputs.sqlite.connection.url("turso"));
|
|
18215
|
+
}
|
|
18216
|
+
if (typeof ((_a = options.dbCredentials) == null ? void 0 : _a.authToken) === "undefined") {
|
|
18217
|
+
console.log(outputs.sqlite.connection.authToken("turso"));
|
|
18218
|
+
}
|
|
18219
|
+
} else if (options.driver === "libsql") {
|
|
18220
|
+
if (typeof ((_b = options.dbCredentials) == null ? void 0 : _b.url) === "undefined") {
|
|
18221
|
+
console.log(outputs.sqlite.connection.url("libsql"));
|
|
18222
|
+
}
|
|
18223
|
+
} else if (options.driver === "better-sqlite") {
|
|
18224
|
+
if (typeof ((_c = options.dbCredentials) == null ? void 0 : _c.url) === "undefined") {
|
|
18225
|
+
console.log(outputs.sqlite.connection.url("better-sqlite"));
|
|
18226
|
+
}
|
|
18227
|
+
} else {
|
|
18228
|
+
console.log(outputs.sqlite.connection.driver());
|
|
18229
|
+
}
|
|
18230
|
+
};
|
|
18231
|
+
validateIntrospect = async (options) => {
|
|
18232
|
+
const collisionRes = checkCollisions(options, "introspect:sqlite");
|
|
18233
|
+
if (!collisionRes.success) {
|
|
18234
|
+
console.log(collisionRes.message);
|
|
18235
|
+
process.exit(1);
|
|
18236
|
+
}
|
|
18237
|
+
if (collisionRes.action === "config") {
|
|
18238
|
+
const drizzleConfig = await readDrizzleConfig(options.config);
|
|
18239
|
+
const configRes = sqliteCliConfigSchema.safeParse(drizzleConfig);
|
|
18240
|
+
if (!configRes.success) {
|
|
18241
|
+
printConfigConnectionIssues(drizzleConfig);
|
|
18242
|
+
process.exit(1);
|
|
18243
|
+
}
|
|
18244
|
+
return configRes.data;
|
|
18245
|
+
}
|
|
18246
|
+
const cliRes = sqliteCliIntrospectParams.safeParse(options);
|
|
18247
|
+
if (!cliRes.success) {
|
|
18248
|
+
printCliConnectionIssues(options);
|
|
18249
|
+
process.exit(1);
|
|
18250
|
+
}
|
|
18251
|
+
if (cliRes.data.driver === "turso") {
|
|
18252
|
+
const { authToken, url: url2, introspectCasing: introspectCasing3, ...rest2 } = cliRes.data;
|
|
18253
|
+
return {
|
|
18254
|
+
...rest2,
|
|
18255
|
+
dbCredentials: { url: url2, authToken },
|
|
18256
|
+
introspect: { casing: introspectCasing3 }
|
|
18257
|
+
};
|
|
18258
|
+
}
|
|
18259
|
+
if (cliRes.data.driver === "libsql") {
|
|
18260
|
+
const { url: url2, introspectCasing: introspectCasing3, ...rest2 } = cliRes.data;
|
|
18261
|
+
return {
|
|
18262
|
+
...rest2,
|
|
18263
|
+
dbCredentials: { url: url2 },
|
|
18264
|
+
introspect: { casing: introspectCasing3 }
|
|
18265
|
+
};
|
|
18266
|
+
}
|
|
18267
|
+
const { url, introspectCasing: introspectCasing2, ...rest } = cliRes.data;
|
|
18268
|
+
return {
|
|
18269
|
+
...rest,
|
|
18270
|
+
dbCredentials: { url },
|
|
18271
|
+
introspect: { casing: introspectCasing2 }
|
|
18272
|
+
};
|
|
18273
|
+
};
|
|
18274
|
+
validatePush = async (options) => {
|
|
18275
|
+
const collisionRes = checkCollisions(options, "push:sqlite");
|
|
18276
|
+
if (!collisionRes.success) {
|
|
18277
|
+
console.log(collisionRes.message);
|
|
18278
|
+
console.log();
|
|
18279
|
+
process.exit(1);
|
|
18280
|
+
}
|
|
18281
|
+
if (collisionRes.action === "config") {
|
|
18282
|
+
const drizzleConfig = await readDrizzleConfig(options.config);
|
|
18283
|
+
const configRes = sqliteConfigPushParams.safeParse(drizzleConfig);
|
|
18284
|
+
if (!configRes.success) {
|
|
18285
|
+
printConfigConnectionIssues(drizzleConfig);
|
|
18286
|
+
process.exit(1);
|
|
18287
|
+
}
|
|
18288
|
+
return configRes.data;
|
|
18289
|
+
}
|
|
18290
|
+
const cliRes = sqliteCliPushParams.safeParse(options);
|
|
18291
|
+
if (!cliRes.success) {
|
|
18292
|
+
if (typeof options.schema === "undefined") {
|
|
18293
|
+
console.log(outputs.common.schema("push:sqlite"));
|
|
18294
|
+
}
|
|
18295
|
+
printCliConnectionIssues(options);
|
|
18296
|
+
process.exit(1);
|
|
18297
|
+
}
|
|
18298
|
+
if (cliRes.data.driver === "turso") {
|
|
18299
|
+
const { authToken, url: url2, ...rest2 } = cliRes.data;
|
|
18300
|
+
return { ...rest2, dbCredentials: { url: url2, authToken } };
|
|
18301
|
+
}
|
|
18302
|
+
const { url, ...rest } = cliRes.data;
|
|
18303
|
+
return { ...rest, dbCredentials: { url } };
|
|
18304
|
+
};
|
|
18305
|
+
}
|
|
18306
|
+
});
|
|
18307
|
+
|
|
18308
|
+
// src/cli/validations/pg.ts
|
|
18309
|
+
var pgConnectionCli, pgConnectionConfig, pgConfigIntrospectSchema, pgCliIntrospectParams, printCliConnectionIssues2, printConfigConnectionIssues2, validatePgIntrospect;
|
|
18310
|
+
var init_pg = __esm({
|
|
18311
|
+
"src/cli/validations/pg.ts"() {
|
|
18312
|
+
init_lib();
|
|
18313
|
+
init_utils();
|
|
18314
|
+
init_common();
|
|
18315
|
+
init_outputs();
|
|
18316
|
+
pgConnectionCli = unionType([
|
|
18317
|
+
objectType({
|
|
18318
|
+
driver: literalType("pg"),
|
|
18319
|
+
host: stringType(),
|
|
18320
|
+
port: coerce.number().optional(),
|
|
18321
|
+
user: stringType().default("postgres"),
|
|
18322
|
+
password: stringType().optional(),
|
|
18323
|
+
database: stringType(),
|
|
18324
|
+
ssl: coerce.boolean().optional(),
|
|
18325
|
+
type: literalType("params").default("params")
|
|
18326
|
+
}),
|
|
18327
|
+
objectType({
|
|
18328
|
+
driver: literalType("pg"),
|
|
18329
|
+
connectionString: stringType(),
|
|
18330
|
+
type: literalType("url").default("url")
|
|
18331
|
+
})
|
|
18332
|
+
]);
|
|
18333
|
+
pgConnectionConfig = unionType([
|
|
18334
|
+
objectType({
|
|
18335
|
+
driver: literalType("pg"),
|
|
18336
|
+
dbCredentials: objectType({
|
|
18337
|
+
host: stringType(),
|
|
18338
|
+
port: coerce.number().optional(),
|
|
18339
|
+
user: stringType().default("postgres"),
|
|
18340
|
+
password: stringType().optional(),
|
|
18341
|
+
database: stringType(),
|
|
18342
|
+
ssl: coerce.boolean().optional()
|
|
18343
|
+
})
|
|
18344
|
+
}),
|
|
18345
|
+
objectType({
|
|
18346
|
+
driver: literalType("pg"),
|
|
18347
|
+
dbCredentials: objectType({
|
|
18348
|
+
connectionString: stringType()
|
|
18349
|
+
})
|
|
18350
|
+
})
|
|
18351
|
+
]);
|
|
18352
|
+
pgConfigIntrospectSchema = intersectionType(
|
|
18353
|
+
configIntrospectSchema,
|
|
18354
|
+
pgConnectionConfig
|
|
18355
|
+
);
|
|
18356
|
+
pgCliIntrospectParams = intersectionType(
|
|
18357
|
+
configIntrospectCliSchema,
|
|
18358
|
+
pgConnectionCli
|
|
18359
|
+
);
|
|
18360
|
+
printCliConnectionIssues2 = (options) => {
|
|
18361
|
+
if (options.driver === "pg") {
|
|
18362
|
+
if (typeof options.connectionString === "undefined" && (typeof options.host === "undefined" || typeof options.database === "undefined")) {
|
|
18363
|
+
console.log(outputs.postgres.connection.required());
|
|
18364
|
+
}
|
|
18365
|
+
} else {
|
|
18366
|
+
console.log(outputs.postgres.connection.driver());
|
|
18367
|
+
}
|
|
18368
|
+
};
|
|
18369
|
+
printConfigConnectionIssues2 = (options) => {
|
|
18370
|
+
if (options.driver === "pg") {
|
|
18371
|
+
if (typeof options.dbCredentials.connectionString === "undefined" && (typeof options.dbCredentials.host === "undefined" || typeof options.dbCredentials.database === "undefined")) {
|
|
18372
|
+
console.log(outputs.postgres.connection.required());
|
|
18373
|
+
}
|
|
18374
|
+
} else {
|
|
18375
|
+
console.log(outputs.postgres.connection.driver());
|
|
18376
|
+
}
|
|
18377
|
+
};
|
|
18378
|
+
validatePgIntrospect = async (options) => {
|
|
18379
|
+
const collisionRes = checkCollisions(options, "introspect:pg");
|
|
18380
|
+
if (!collisionRes.success) {
|
|
18381
|
+
console.log(collisionRes.message);
|
|
18382
|
+
process.exit(1);
|
|
18383
|
+
}
|
|
18384
|
+
if (collisionRes.action === "config") {
|
|
18385
|
+
const drizzleConfig = await readDrizzleConfig(options.config);
|
|
18386
|
+
const configRes = pgConfigIntrospectSchema.safeParse(drizzleConfig);
|
|
18387
|
+
if (!configRes.success) {
|
|
18388
|
+
printConfigConnectionIssues2(drizzleConfig);
|
|
18389
|
+
process.exit(1);
|
|
18390
|
+
}
|
|
18391
|
+
return configRes.data;
|
|
18392
|
+
}
|
|
18393
|
+
const cliRes = pgCliIntrospectParams.safeParse(options);
|
|
18394
|
+
if (!cliRes.success) {
|
|
18395
|
+
printCliConnectionIssues2(options);
|
|
18396
|
+
process.exit(1);
|
|
18397
|
+
}
|
|
18398
|
+
if (cliRes.data.type === "url") {
|
|
18399
|
+
const { connectionString, introspectCasing: introspectCasing3, ...rest2 } = cliRes.data;
|
|
18400
|
+
return {
|
|
18401
|
+
...rest2,
|
|
18402
|
+
dbCredentials: { connectionString },
|
|
18403
|
+
introspect: { casing: introspectCasing3 }
|
|
18404
|
+
};
|
|
18405
|
+
}
|
|
18406
|
+
const {
|
|
18407
|
+
host,
|
|
18408
|
+
password,
|
|
18409
|
+
port,
|
|
18410
|
+
database,
|
|
18411
|
+
ssl,
|
|
18412
|
+
user,
|
|
18413
|
+
introspectCasing: introspectCasing2,
|
|
18414
|
+
...rest
|
|
18415
|
+
} = cliRes.data;
|
|
18416
|
+
return {
|
|
18417
|
+
...rest,
|
|
18418
|
+
dbCredentials: { host, password, port, database, ssl, user },
|
|
18419
|
+
introspect: { casing: introspectCasing2 }
|
|
18420
|
+
};
|
|
18421
|
+
};
|
|
18422
|
+
}
|
|
18423
|
+
});
|
|
18424
|
+
|
|
18425
|
+
// src/cli/validations/mysql.ts
|
|
18426
|
+
var mysqlConnectionCli, mysqlConnectionConfig, mysqlConfigIntrospectSchema, mysqlCliIntrospectParams, mysqlCliPushParams, mysqlConfigPushParams, printCliConnectionIssues3, printConfigConnectionIssues3, validateMySqlIntrospect, validateMySqlPush;
|
|
18427
|
+
var init_mysql = __esm({
|
|
18428
|
+
"src/cli/validations/mysql.ts"() {
|
|
18429
|
+
init_lib();
|
|
18430
|
+
init_utils();
|
|
18431
|
+
init_common();
|
|
18432
|
+
init_outputs();
|
|
18433
|
+
mysqlConnectionCli = unionType([
|
|
18434
|
+
objectType({
|
|
18435
|
+
driver: literalType("mysql2"),
|
|
18436
|
+
host: stringType(),
|
|
18437
|
+
port: coerce.number().optional(),
|
|
18438
|
+
user: stringType().default("mysql"),
|
|
18439
|
+
password: stringType().optional(),
|
|
18440
|
+
database: stringType(),
|
|
18441
|
+
type: literalType("params").default("params")
|
|
18442
|
+
}),
|
|
18443
|
+
objectType({
|
|
18444
|
+
driver: literalType("mysql2"),
|
|
18445
|
+
connectionString: stringType(),
|
|
18446
|
+
type: literalType("url").default("url")
|
|
18447
|
+
})
|
|
18448
|
+
]);
|
|
18449
|
+
mysqlConnectionConfig = unionType([
|
|
18450
|
+
objectType({
|
|
18451
|
+
driver: literalType("mysql2"),
|
|
18452
|
+
dbCredentials: objectType({
|
|
18453
|
+
host: stringType(),
|
|
18454
|
+
port: coerce.number().optional(),
|
|
18455
|
+
user: stringType().default("mysql"),
|
|
18456
|
+
password: stringType().optional(),
|
|
18457
|
+
database: stringType(),
|
|
18458
|
+
type: literalType("params").default("params")
|
|
18459
|
+
})
|
|
18460
|
+
}),
|
|
18461
|
+
objectType({
|
|
18462
|
+
driver: literalType("mysql2"),
|
|
18463
|
+
dbCredentials: objectType({
|
|
18464
|
+
connectionString: stringType(),
|
|
18465
|
+
type: literalType("url").default("url")
|
|
18466
|
+
})
|
|
18467
|
+
})
|
|
18468
|
+
]);
|
|
18469
|
+
mysqlConfigIntrospectSchema = intersectionType(
|
|
18470
|
+
configIntrospectSchema,
|
|
18471
|
+
mysqlConnectionConfig
|
|
18472
|
+
);
|
|
18473
|
+
mysqlCliIntrospectParams = intersectionType(
|
|
18474
|
+
configIntrospectCliSchema,
|
|
18475
|
+
mysqlConnectionCli
|
|
18476
|
+
);
|
|
18477
|
+
mysqlCliPushParams = intersectionType(
|
|
18478
|
+
configPushSchema,
|
|
18479
|
+
mysqlConnectionCli
|
|
18480
|
+
);
|
|
18481
|
+
mysqlConfigPushParams = intersectionType(
|
|
18482
|
+
configPushSchema,
|
|
18483
|
+
mysqlConnectionConfig
|
|
18484
|
+
);
|
|
18485
|
+
printCliConnectionIssues3 = (options) => {
|
|
18486
|
+
if (options.driver === "mysql2") {
|
|
18487
|
+
if (typeof options.connectionString === "undefined" && (typeof options.host === "undefined" || typeof options.database === "undefined")) {
|
|
18488
|
+
console.log(outputs.mysql.connection.required());
|
|
18489
|
+
}
|
|
18490
|
+
} else {
|
|
18491
|
+
console.log(outputs.mysql.connection.driver());
|
|
18492
|
+
}
|
|
18493
|
+
};
|
|
18494
|
+
printConfigConnectionIssues3 = (options) => {
|
|
18495
|
+
if (options.driver === "mysql2") {
|
|
18496
|
+
if (typeof options.dbCredentials.connectionString === "undefined" && (typeof options.dbCredentials.host === "undefined" || typeof options.dbCredentials.database === "undefined")) {
|
|
18497
|
+
console.log(outputs.mysql.connection.required());
|
|
18498
|
+
}
|
|
18499
|
+
} else {
|
|
18500
|
+
console.log(outputs.mysql.connection.driver());
|
|
18501
|
+
}
|
|
18502
|
+
};
|
|
18503
|
+
validateMySqlIntrospect = async (options) => {
|
|
18504
|
+
const collisionRes = checkCollisions(options, "introspect:mysql");
|
|
18505
|
+
if (!collisionRes.success) {
|
|
18506
|
+
console.log(collisionRes.message);
|
|
18507
|
+
process.exit(1);
|
|
18508
|
+
}
|
|
18509
|
+
if (collisionRes.action === "config") {
|
|
18510
|
+
const drizzleConfig = await readDrizzleConfig(options.config);
|
|
18511
|
+
const configRes = mysqlConfigIntrospectSchema.safeParse(drizzleConfig);
|
|
18512
|
+
if (!configRes.success) {
|
|
18513
|
+
printConfigConnectionIssues3(drizzleConfig);
|
|
18514
|
+
process.exit(1);
|
|
18515
|
+
}
|
|
18516
|
+
return configRes.data;
|
|
18517
|
+
}
|
|
18518
|
+
const cliRes = mysqlCliIntrospectParams.safeParse(options);
|
|
18519
|
+
if (!cliRes.success) {
|
|
18520
|
+
printCliConnectionIssues3(options);
|
|
18521
|
+
process.exit(1);
|
|
18522
|
+
}
|
|
18523
|
+
if (cliRes.data.type === "url") {
|
|
18524
|
+
const { connectionString, introspectCasing: introspectCasing3, type: type2, ...rest2 } = cliRes.data;
|
|
18525
|
+
return {
|
|
18526
|
+
...rest2,
|
|
18527
|
+
dbCredentials: { connectionString, type: type2 },
|
|
18528
|
+
introspect: { casing: introspectCasing3 }
|
|
18529
|
+
};
|
|
18530
|
+
}
|
|
18531
|
+
const {
|
|
18532
|
+
host,
|
|
18533
|
+
password,
|
|
18534
|
+
port,
|
|
18535
|
+
database,
|
|
18536
|
+
user,
|
|
18537
|
+
type,
|
|
18538
|
+
introspectCasing: introspectCasing2,
|
|
18539
|
+
...rest
|
|
18540
|
+
} = cliRes.data;
|
|
18541
|
+
return {
|
|
18542
|
+
...rest,
|
|
18543
|
+
dbCredentials: { host, password, port, database, user, type },
|
|
18544
|
+
introspect: { casing: introspectCasing2 }
|
|
18545
|
+
};
|
|
18546
|
+
};
|
|
18547
|
+
validateMySqlPush = async (options) => {
|
|
18548
|
+
const collisionRes = checkCollisions(options, "push:mysql");
|
|
18549
|
+
if (!collisionRes.success) {
|
|
18550
|
+
console.log(collisionRes.message);
|
|
18551
|
+
console.log();
|
|
18552
|
+
process.exit(1);
|
|
18553
|
+
}
|
|
18554
|
+
if (collisionRes.action === "config") {
|
|
18555
|
+
const drizzleConfig = await readDrizzleConfig(options.config);
|
|
18556
|
+
const configRes = mysqlConfigPushParams.safeParse(drizzleConfig);
|
|
18557
|
+
if (!configRes.success) {
|
|
18558
|
+
printConfigConnectionIssues3(drizzleConfig);
|
|
18559
|
+
process.exit(1);
|
|
18560
|
+
}
|
|
18561
|
+
return configRes.data;
|
|
18562
|
+
}
|
|
18563
|
+
const cliRes = mysqlCliPushParams.safeParse(options);
|
|
18564
|
+
if (!cliRes.success) {
|
|
18565
|
+
if (typeof options.schema === "undefined") {
|
|
18566
|
+
console.log(outputs.common.schema("push:mysql"));
|
|
18567
|
+
}
|
|
18568
|
+
printCliConnectionIssues3(options);
|
|
18569
|
+
process.exit(1);
|
|
18570
|
+
}
|
|
18571
|
+
if (cliRes.data.type === "url") {
|
|
18572
|
+
const { connectionString, type: type2, ...rest2 } = cliRes.data;
|
|
18573
|
+
return {
|
|
18574
|
+
...rest2,
|
|
18575
|
+
dbCredentials: { connectionString, type: type2 }
|
|
18576
|
+
};
|
|
18577
|
+
}
|
|
18578
|
+
const { host, password, port, database, user, type, ...rest } = cliRes.data;
|
|
18579
|
+
return {
|
|
18580
|
+
...rest,
|
|
18581
|
+
dbCredentials: { host, password, port, database, user, type }
|
|
18582
|
+
};
|
|
18583
|
+
};
|
|
18584
|
+
}
|
|
18585
|
+
});
|
|
18586
|
+
|
|
17969
18587
|
// node_modules/.pnpm/sqlstring@2.3.3/node_modules/sqlstring/lib/SqlString.js
|
|
17970
18588
|
var require_SqlString = __commonJS({
|
|
17971
18589
|
"node_modules/.pnpm/sqlstring@2.3.3/node_modules/sqlstring/lib/SqlString.js"(exports) {
|
|
@@ -25824,7 +26442,7 @@ var require_packet = __commonJS({
|
|
|
25824
26442
|
var dot = ".".charCodeAt(0);
|
|
25825
26443
|
var exponent = "e".charCodeAt(0);
|
|
25826
26444
|
var exponentCapital = "E".charCodeAt(0);
|
|
25827
|
-
var Packet = class {
|
|
26445
|
+
var Packet = class _Packet {
|
|
25828
26446
|
constructor(id, buffer, start, end) {
|
|
25829
26447
|
this.sequenceId = id;
|
|
25830
26448
|
this.numPackets = 1;
|
|
@@ -26529,7 +27147,7 @@ var require_packet = __commonJS({
|
|
|
26529
27147
|
this.offset = offset;
|
|
26530
27148
|
}
|
|
26531
27149
|
clone() {
|
|
26532
|
-
return new
|
|
27150
|
+
return new _Packet(this.sequenceId, this.buffer, this.start, this.end);
|
|
26533
27151
|
}
|
|
26534
27152
|
type() {
|
|
26535
27153
|
if (this.isEOF()) {
|
|
@@ -26558,7 +27176,7 @@ var require_packet = __commonJS({
|
|
|
26558
27176
|
static lengthCodedStringLength(str, encoding) {
|
|
26559
27177
|
const buf = StringParser.encode(str, encoding);
|
|
26560
27178
|
const slen = buf.length;
|
|
26561
|
-
return
|
|
27179
|
+
return _Packet.lengthCodedNumberLength(slen) + slen;
|
|
26562
27180
|
}
|
|
26563
27181
|
static MockBuffer() {
|
|
26564
27182
|
const noop = function() {
|
|
@@ -26591,7 +27209,7 @@ var require_packet_parser = __commonJS({
|
|
|
26591
27209
|
}
|
|
26592
27210
|
return b0 + (b1 << 8) + (b2 << 16);
|
|
26593
27211
|
}
|
|
26594
|
-
var PacketParser = class {
|
|
27212
|
+
var PacketParser = class _PacketParser {
|
|
26595
27213
|
constructor(onPacket, packetHeaderLength) {
|
|
26596
27214
|
if (typeof packetHeaderLength === "undefined") {
|
|
26597
27215
|
packetHeaderLength = 4;
|
|
@@ -26604,7 +27222,7 @@ var require_packet_parser = __commonJS({
|
|
|
26604
27222
|
this.largePacketParts = [];
|
|
26605
27223
|
this.firstPacketSequenceId = 0;
|
|
26606
27224
|
this.onPacket = onPacket;
|
|
26607
|
-
this.execute =
|
|
27225
|
+
this.execute = _PacketParser.prototype.executeStart;
|
|
26608
27226
|
this._flushLargePacket = packetHeaderLength === 7 ? this._flushLargePacket7 : this._flushLargePacket4;
|
|
26609
27227
|
}
|
|
26610
27228
|
_flushLargePacket4() {
|
|
@@ -26659,7 +27277,7 @@ var require_packet_parser = __commonJS({
|
|
|
26659
27277
|
} else {
|
|
26660
27278
|
this.buffer = [chunk.slice(start + 3, end)];
|
|
26661
27279
|
this.bufferLength = end - start - 3;
|
|
26662
|
-
this.execute =
|
|
27280
|
+
this.execute = _PacketParser.prototype.executePayload;
|
|
26663
27281
|
return;
|
|
26664
27282
|
}
|
|
26665
27283
|
}
|
|
@@ -26668,9 +27286,9 @@ var require_packet_parser = __commonJS({
|
|
|
26668
27286
|
this.length = chunk[start];
|
|
26669
27287
|
if (this.headerLen === 2) {
|
|
26670
27288
|
this.length = chunk[start] + (chunk[start + 1] << 8);
|
|
26671
|
-
this.execute =
|
|
27289
|
+
this.execute = _PacketParser.prototype.executeHeader3;
|
|
26672
27290
|
} else {
|
|
26673
|
-
this.execute =
|
|
27291
|
+
this.execute = _PacketParser.prototype.executeHeader2;
|
|
26674
27292
|
}
|
|
26675
27293
|
}
|
|
26676
27294
|
}
|
|
@@ -26712,7 +27330,7 @@ var require_packet_parser = __commonJS({
|
|
|
26712
27330
|
}
|
|
26713
27331
|
this.buffer = [];
|
|
26714
27332
|
this.bufferLength = 0;
|
|
26715
|
-
this.execute =
|
|
27333
|
+
this.execute = _PacketParser.prototype.executeStart;
|
|
26716
27334
|
start += remainingPayload;
|
|
26717
27335
|
if (end - start > 0) {
|
|
26718
27336
|
return this.execute(chunk.slice(start, end));
|
|
@@ -26727,15 +27345,15 @@ var require_packet_parser = __commonJS({
|
|
|
26727
27345
|
this.length += chunk[0] << 8;
|
|
26728
27346
|
if (chunk.length > 1) {
|
|
26729
27347
|
this.length += chunk[1] << 16;
|
|
26730
|
-
this.execute =
|
|
27348
|
+
this.execute = _PacketParser.prototype.executePayload;
|
|
26731
27349
|
return this.executePayload(chunk.slice(2));
|
|
26732
27350
|
}
|
|
26733
|
-
this.execute =
|
|
27351
|
+
this.execute = _PacketParser.prototype.executeHeader3;
|
|
26734
27352
|
return null;
|
|
26735
27353
|
}
|
|
26736
27354
|
executeHeader3(chunk) {
|
|
26737
27355
|
this.length += chunk[0] << 16;
|
|
26738
|
-
this.execute =
|
|
27356
|
+
this.execute = _PacketParser.prototype.executePayload;
|
|
26739
27357
|
return this.executePayload(chunk.slice(1));
|
|
26740
27358
|
}
|
|
26741
27359
|
};
|
|
@@ -26748,7 +27366,7 @@ var require_auth_switch_request = __commonJS({
|
|
|
26748
27366
|
"node_modules/.pnpm/mysql2@2.3.3/node_modules/mysql2/lib/packets/auth_switch_request.js"(exports, module2) {
|
|
26749
27367
|
"use strict";
|
|
26750
27368
|
var Packet = require_packet();
|
|
26751
|
-
var AuthSwitchRequest = class {
|
|
27369
|
+
var AuthSwitchRequest = class _AuthSwitchRequest {
|
|
26752
27370
|
constructor(opts) {
|
|
26753
27371
|
this.pluginName = opts.pluginName;
|
|
26754
27372
|
this.pluginData = opts.pluginData;
|
|
@@ -26767,7 +27385,7 @@ var require_auth_switch_request = __commonJS({
|
|
|
26767
27385
|
packet.readInt8();
|
|
26768
27386
|
const name = packet.readNullTerminatedString("cesu8");
|
|
26769
27387
|
const data = packet.readBuffer();
|
|
26770
|
-
return new
|
|
27388
|
+
return new _AuthSwitchRequest({
|
|
26771
27389
|
pluginName: name,
|
|
26772
27390
|
pluginData: data
|
|
26773
27391
|
});
|
|
@@ -26782,7 +27400,7 @@ var require_auth_switch_request_more_data = __commonJS({
|
|
|
26782
27400
|
"node_modules/.pnpm/mysql2@2.3.3/node_modules/mysql2/lib/packets/auth_switch_request_more_data.js"(exports, module2) {
|
|
26783
27401
|
"use strict";
|
|
26784
27402
|
var Packet = require_packet();
|
|
26785
|
-
var AuthSwitchRequestMoreData = class {
|
|
27403
|
+
var AuthSwitchRequestMoreData = class _AuthSwitchRequestMoreData {
|
|
26786
27404
|
constructor(data) {
|
|
26787
27405
|
this.data = data;
|
|
26788
27406
|
}
|
|
@@ -26798,7 +27416,7 @@ var require_auth_switch_request_more_data = __commonJS({
|
|
|
26798
27416
|
static fromPacket(packet) {
|
|
26799
27417
|
packet.readInt8();
|
|
26800
27418
|
const data = packet.readBuffer();
|
|
26801
|
-
return new
|
|
27419
|
+
return new _AuthSwitchRequestMoreData(data);
|
|
26802
27420
|
}
|
|
26803
27421
|
static verifyMarker(packet) {
|
|
26804
27422
|
return packet.peekByte() === 1;
|
|
@@ -26813,7 +27431,7 @@ var require_auth_switch_response = __commonJS({
|
|
|
26813
27431
|
"node_modules/.pnpm/mysql2@2.3.3/node_modules/mysql2/lib/packets/auth_switch_response.js"(exports, module2) {
|
|
26814
27432
|
"use strict";
|
|
26815
27433
|
var Packet = require_packet();
|
|
26816
|
-
var AuthSwitchResponse = class {
|
|
27434
|
+
var AuthSwitchResponse = class _AuthSwitchResponse {
|
|
26817
27435
|
constructor(data) {
|
|
26818
27436
|
if (!Buffer.isBuffer(data)) {
|
|
26819
27437
|
data = Buffer.from(data);
|
|
@@ -26830,7 +27448,7 @@ var require_auth_switch_response = __commonJS({
|
|
|
26830
27448
|
}
|
|
26831
27449
|
static fromPacket(packet) {
|
|
26832
27450
|
const data = packet.readBuffer();
|
|
26833
|
-
return new
|
|
27451
|
+
return new _AuthSwitchResponse(data);
|
|
26834
27452
|
}
|
|
26835
27453
|
};
|
|
26836
27454
|
module2.exports = AuthSwitchResponse;
|
|
@@ -26879,7 +27497,7 @@ var require_binary_row = __commonJS({
|
|
|
26879
27497
|
var Types = require_types();
|
|
26880
27498
|
var Packet = require_packet();
|
|
26881
27499
|
var binaryReader = new Array(256);
|
|
26882
|
-
var BinaryRow = class {
|
|
27500
|
+
var BinaryRow = class _BinaryRow {
|
|
26883
27501
|
constructor(columns) {
|
|
26884
27502
|
this.columns = columns || [];
|
|
26885
27503
|
}
|
|
@@ -26895,7 +27513,7 @@ var require_binary_row = __commonJS({
|
|
|
26895
27513
|
for (let i = 0; i < columns.length; ++i) {
|
|
26896
27514
|
columns[i] = binaryReader[fields[i].columnType].apply(packet);
|
|
26897
27515
|
}
|
|
26898
|
-
return new
|
|
27516
|
+
return new _BinaryRow(columns);
|
|
26899
27517
|
}
|
|
26900
27518
|
};
|
|
26901
27519
|
binaryReader[Types.DECIMAL] = Packet.prototype.readLengthCodedString;
|
|
@@ -27797,7 +28415,7 @@ var require_handshake = __commonJS({
|
|
|
27797
28415
|
"use strict";
|
|
27798
28416
|
var Packet = require_packet();
|
|
27799
28417
|
var ClientConstants = require_client();
|
|
27800
|
-
var Handshake = class {
|
|
28418
|
+
var Handshake = class _Handshake {
|
|
27801
28419
|
constructor(args) {
|
|
27802
28420
|
this.protocolVersion = args.protocolVersion;
|
|
27803
28421
|
this.serverVersion = args.serverVersion;
|
|
@@ -27886,7 +28504,7 @@ var require_handshake = __commonJS({
|
|
|
27886
28504
|
if (args.capabilityFlags & ClientConstants.PLUGIN_AUTH) {
|
|
27887
28505
|
args.autPluginName = packet.readNullTerminatedString("ascii");
|
|
27888
28506
|
}
|
|
27889
|
-
return new
|
|
28507
|
+
return new _Handshake(args);
|
|
27890
28508
|
}
|
|
27891
28509
|
};
|
|
27892
28510
|
module2.exports = Handshake;
|
|
@@ -28371,7 +28989,7 @@ var require_text_row = __commonJS({
|
|
|
28371
28989
|
"node_modules/.pnpm/mysql2@2.3.3/node_modules/mysql2/lib/packets/text_row.js"(exports, module2) {
|
|
28372
28990
|
"use strict";
|
|
28373
28991
|
var Packet = require_packet();
|
|
28374
|
-
var TextRow = class {
|
|
28992
|
+
var TextRow = class _TextRow {
|
|
28375
28993
|
constructor(columns) {
|
|
28376
28994
|
this.columns = columns || [];
|
|
28377
28995
|
}
|
|
@@ -28380,7 +28998,7 @@ var require_text_row = __commonJS({
|
|
|
28380
28998
|
while (packet.haveMoreData()) {
|
|
28381
28999
|
columns.push(packet.readLengthCodedString());
|
|
28382
29000
|
}
|
|
28383
|
-
return new
|
|
29001
|
+
return new _TextRow(columns);
|
|
28384
29002
|
}
|
|
28385
29003
|
static toPacket(columns, encoding) {
|
|
28386
29004
|
const sequenceId = 0;
|
|
@@ -28513,7 +29131,7 @@ var require_packets = __commonJS({
|
|
|
28513
29131
|
}
|
|
28514
29132
|
};
|
|
28515
29133
|
exports.EOF = EOF;
|
|
28516
|
-
var Error2 = class {
|
|
29134
|
+
var Error2 = class _Error {
|
|
28517
29135
|
static toPacket(args, encoding) {
|
|
28518
29136
|
const length = 13 + Buffer.byteLength(args.message, "utf8");
|
|
28519
29137
|
const packet = new Packet(0, Buffer.allocUnsafe(length), 0, length);
|
|
@@ -28531,7 +29149,7 @@ var require_packets = __commonJS({
|
|
|
28531
29149
|
packet.readString(1, "ascii");
|
|
28532
29150
|
packet.readString(5, "ascii");
|
|
28533
29151
|
const message = packet.readNullTerminatedString("utf8");
|
|
28534
|
-
const error2 = new
|
|
29152
|
+
const error2 = new _Error();
|
|
28535
29153
|
error2.message = message;
|
|
28536
29154
|
error2.code = code;
|
|
28537
29155
|
return error2;
|
|
@@ -29098,14 +29716,14 @@ var require_client_handshake = __commonJS({
|
|
|
29098
29716
|
}
|
|
29099
29717
|
return res;
|
|
29100
29718
|
}
|
|
29101
|
-
var ClientHandshake = class extends Command2 {
|
|
29719
|
+
var ClientHandshake = class _ClientHandshake extends Command2 {
|
|
29102
29720
|
constructor(clientFlags) {
|
|
29103
29721
|
super();
|
|
29104
29722
|
this.handshake = null;
|
|
29105
29723
|
this.clientFlags = clientFlags;
|
|
29106
29724
|
}
|
|
29107
29725
|
start() {
|
|
29108
|
-
return
|
|
29726
|
+
return _ClientHandshake.prototype.handshakeInit;
|
|
29109
29727
|
}
|
|
29110
29728
|
sendSSLRequest(connection) {
|
|
29111
29729
|
const sslRequest = new Packets.SSLRequest(
|
|
@@ -29201,7 +29819,7 @@ var require_client_handshake = __commonJS({
|
|
|
29201
29819
|
} else {
|
|
29202
29820
|
this.sendCredentials(connection);
|
|
29203
29821
|
}
|
|
29204
|
-
return
|
|
29822
|
+
return _ClientHandshake.prototype.handshakeResult;
|
|
29205
29823
|
}
|
|
29206
29824
|
handshakeResult(packet, connection) {
|
|
29207
29825
|
const marker = packet.peekByte();
|
|
@@ -29213,7 +29831,7 @@ var require_client_handshake = __commonJS({
|
|
|
29213
29831
|
} else {
|
|
29214
29832
|
authSwitch.authSwitchRequest(packet, connection, this);
|
|
29215
29833
|
}
|
|
29216
|
-
return
|
|
29834
|
+
return _ClientHandshake.prototype.handshakeResult;
|
|
29217
29835
|
} catch (err2) {
|
|
29218
29836
|
err2.code = "AUTH_SWITCH_PLUGIN_ERROR";
|
|
29219
29837
|
err2.fatal = true;
|
|
@@ -29261,7 +29879,7 @@ var require_server_handshake = __commonJS({
|
|
|
29261
29879
|
var Errors = require_errors();
|
|
29262
29880
|
var Command2 = require_command();
|
|
29263
29881
|
var Packets = require_packets();
|
|
29264
|
-
var ServerHandshake = class extends Command2 {
|
|
29882
|
+
var ServerHandshake = class _ServerHandshake extends Command2 {
|
|
29265
29883
|
constructor(args) {
|
|
29266
29884
|
super();
|
|
29267
29885
|
this.args = args;
|
|
@@ -29276,7 +29894,7 @@ var require_server_handshake = __commonJS({
|
|
|
29276
29894
|
}
|
|
29277
29895
|
connection.writePacket(serverHelloPacket.toPacket(0));
|
|
29278
29896
|
});
|
|
29279
|
-
return
|
|
29897
|
+
return _ServerHandshake.prototype.readClientReply;
|
|
29280
29898
|
}
|
|
29281
29899
|
readClientReply(packet, connection) {
|
|
29282
29900
|
const clientHelloReply = Packets.HandshakeResponse.fromPacket(packet);
|
|
@@ -29306,7 +29924,7 @@ var require_server_handshake = __commonJS({
|
|
|
29306
29924
|
} else {
|
|
29307
29925
|
connection.writeOk();
|
|
29308
29926
|
}
|
|
29309
|
-
return
|
|
29927
|
+
return _ServerHandshake.prototype.dispatchCommands;
|
|
29310
29928
|
}
|
|
29311
29929
|
dispatchCommands(packet, connection) {
|
|
29312
29930
|
let knownCommand = true;
|
|
@@ -29366,7 +29984,7 @@ var require_server_handshake = __commonJS({
|
|
|
29366
29984
|
} else if (!knownCommand) {
|
|
29367
29985
|
console.log("Unknown command:", commandCode);
|
|
29368
29986
|
}
|
|
29369
|
-
return
|
|
29987
|
+
return _ServerHandshake.prototype.dispatchCommands;
|
|
29370
29988
|
}
|
|
29371
29989
|
};
|
|
29372
29990
|
module2.exports = ServerHandshake;
|
|
@@ -30109,7 +30727,7 @@ var require_query2 = __commonJS({
|
|
|
30109
30727
|
var getTextParser = require_text_parser();
|
|
30110
30728
|
var ServerStatus = require_server_status();
|
|
30111
30729
|
var EmptyPacket = new Packets.Packet(0, Buffer.allocUnsafe(4), 0, 4);
|
|
30112
|
-
var Query = class extends Command2 {
|
|
30730
|
+
var Query = class _Query extends Command2 {
|
|
30113
30731
|
constructor(options, callback) {
|
|
30114
30732
|
super();
|
|
30115
30733
|
this.sql = options.sql;
|
|
@@ -30149,7 +30767,7 @@ var require_query2 = __commonJS({
|
|
|
30149
30767
|
connection.config.charsetNumber
|
|
30150
30768
|
);
|
|
30151
30769
|
connection.writePacket(cmdPacket.toPacket(1));
|
|
30152
|
-
return
|
|
30770
|
+
return _Query.prototype.resultsetHeader;
|
|
30153
30771
|
}
|
|
30154
30772
|
done() {
|
|
30155
30773
|
this._unpipeStream();
|
|
@@ -30288,9 +30906,9 @@ var require_query2 = __commonJS({
|
|
|
30288
30906
|
const fields = this._fields[this._resultIndex];
|
|
30289
30907
|
this.emit("fields", fields);
|
|
30290
30908
|
this._rowParser = new (getTextParser(fields, this.options, connection.config))(fields);
|
|
30291
|
-
return
|
|
30909
|
+
return _Query.prototype.fieldsEOF;
|
|
30292
30910
|
}
|
|
30293
|
-
return
|
|
30911
|
+
return _Query.prototype.readField;
|
|
30294
30912
|
}
|
|
30295
30913
|
fieldsEOF(packet, connection) {
|
|
30296
30914
|
if (!packet.isEOF()) {
|
|
@@ -30305,7 +30923,7 @@ var require_query2 = __commonJS({
|
|
|
30305
30923
|
const moreResults = status & ServerStatus.SERVER_MORE_RESULTS_EXISTS;
|
|
30306
30924
|
if (moreResults) {
|
|
30307
30925
|
this._resultIndex++;
|
|
30308
|
-
return
|
|
30926
|
+
return _Query.prototype.resultsetHeader;
|
|
30309
30927
|
}
|
|
30310
30928
|
return this.done();
|
|
30311
30929
|
}
|
|
@@ -30325,7 +30943,7 @@ var require_query2 = __commonJS({
|
|
|
30325
30943
|
} else {
|
|
30326
30944
|
this.emit("result", row);
|
|
30327
30945
|
}
|
|
30328
|
-
return
|
|
30946
|
+
return _Query.prototype.row;
|
|
30329
30947
|
}
|
|
30330
30948
|
infileOk(packet, connection) {
|
|
30331
30949
|
const rs = new Packets.ResultSetHeader(packet, connection);
|
|
@@ -30585,7 +31203,7 @@ var require_execute2 = __commonJS({
|
|
|
30585
31203
|
var Query = require_query2();
|
|
30586
31204
|
var Packets = require_packets();
|
|
30587
31205
|
var getBinaryParser = require_binary_parser();
|
|
30588
|
-
var Execute = class extends Command2 {
|
|
31206
|
+
var Execute = class _Execute extends Command2 {
|
|
30589
31207
|
constructor(options, callback) {
|
|
30590
31208
|
super();
|
|
30591
31209
|
this.statement = options.statement;
|
|
@@ -30627,7 +31245,7 @@ var require_execute2 = __commonJS({
|
|
|
30627
31245
|
} catch (error2) {
|
|
30628
31246
|
this.onResult(error2);
|
|
30629
31247
|
}
|
|
30630
|
-
return
|
|
31248
|
+
return _Execute.prototype.resultsetHeader;
|
|
30631
31249
|
}
|
|
30632
31250
|
readField(packet, connection) {
|
|
30633
31251
|
let fields;
|
|
@@ -30640,9 +31258,9 @@ var require_execute2 = __commonJS({
|
|
|
30640
31258
|
if (this._receivedFieldsCount === this._fieldCount) {
|
|
30641
31259
|
fields = this._fields[this._resultIndex];
|
|
30642
31260
|
this.emit("fields", fields, this._resultIndex);
|
|
30643
|
-
return
|
|
31261
|
+
return _Execute.prototype.fieldsEOF;
|
|
30644
31262
|
}
|
|
30645
|
-
return
|
|
31263
|
+
return _Execute.prototype.readField;
|
|
30646
31264
|
}
|
|
30647
31265
|
fieldsEOF(packet, connection) {
|
|
30648
31266
|
if (!packet.isEOF()) {
|
|
@@ -30652,7 +31270,7 @@ var require_execute2 = __commonJS({
|
|
|
30652
31270
|
this._fields[this._resultIndex],
|
|
30653
31271
|
connection
|
|
30654
31272
|
))();
|
|
30655
|
-
return
|
|
31273
|
+
return _Execute.prototype.row;
|
|
30656
31274
|
}
|
|
30657
31275
|
};
|
|
30658
31276
|
Execute.prototype.done = Query.prototype.done;
|
|
@@ -30698,7 +31316,7 @@ var require_prepare = __commonJS({
|
|
|
30698
31316
|
);
|
|
30699
31317
|
}
|
|
30700
31318
|
};
|
|
30701
|
-
var Prepare = class extends Command2 {
|
|
31319
|
+
var Prepare = class _Prepare extends Command2 {
|
|
30702
31320
|
constructor(options, callback) {
|
|
30703
31321
|
super();
|
|
30704
31322
|
this.query = options.sql;
|
|
@@ -30725,7 +31343,7 @@ var require_prepare = __commonJS({
|
|
|
30725
31343
|
connection.config.charsetNumber
|
|
30726
31344
|
);
|
|
30727
31345
|
connection.writePacket(cmdPacket.toPacket(1));
|
|
30728
|
-
return
|
|
31346
|
+
return _Prepare.prototype.prepareHeader;
|
|
30729
31347
|
}
|
|
30730
31348
|
prepareHeader(packet, connection) {
|
|
30731
31349
|
const header = new Packets.PreparedStatementHeader(packet);
|
|
@@ -30733,10 +31351,10 @@ var require_prepare = __commonJS({
|
|
|
30733
31351
|
this.fieldCount = header.fieldCount;
|
|
30734
31352
|
this.parameterCount = header.parameterCount;
|
|
30735
31353
|
if (this.parameterCount > 0) {
|
|
30736
|
-
return
|
|
31354
|
+
return _Prepare.prototype.readParameter;
|
|
30737
31355
|
}
|
|
30738
31356
|
if (this.fieldCount > 0) {
|
|
30739
|
-
return
|
|
31357
|
+
return _Prepare.prototype.readField;
|
|
30740
31358
|
}
|
|
30741
31359
|
return this.prepareDone(connection);
|
|
30742
31360
|
}
|
|
@@ -30744,7 +31362,7 @@ var require_prepare = __commonJS({
|
|
|
30744
31362
|
const def = new Packets.ColumnDefinition(packet, connection.clientEncoding);
|
|
30745
31363
|
this.parameterDefinitions.push(def);
|
|
30746
31364
|
if (this.parameterDefinitions.length === this.parameterCount) {
|
|
30747
|
-
return
|
|
31365
|
+
return _Prepare.prototype.parametersEOF;
|
|
30748
31366
|
}
|
|
30749
31367
|
return this.readParameter;
|
|
30750
31368
|
}
|
|
@@ -30752,16 +31370,16 @@ var require_prepare = __commonJS({
|
|
|
30752
31370
|
const def = new Packets.ColumnDefinition(packet, connection.clientEncoding);
|
|
30753
31371
|
this.fields.push(def);
|
|
30754
31372
|
if (this.fields.length === this.fieldCount) {
|
|
30755
|
-
return
|
|
31373
|
+
return _Prepare.prototype.fieldsEOF;
|
|
30756
31374
|
}
|
|
30757
|
-
return
|
|
31375
|
+
return _Prepare.prototype.readField;
|
|
30758
31376
|
}
|
|
30759
31377
|
parametersEOF(packet, connection) {
|
|
30760
31378
|
if (!packet.isEOF()) {
|
|
30761
31379
|
return connection.protocolError("Expected EOF packet after parameters");
|
|
30762
31380
|
}
|
|
30763
31381
|
if (this.fieldCount > 0) {
|
|
30764
|
-
return
|
|
31382
|
+
return _Prepare.prototype.readField;
|
|
30765
31383
|
}
|
|
30766
31384
|
return this.prepareDone(connection);
|
|
30767
31385
|
}
|
|
@@ -30797,7 +31415,7 @@ var require_ping = __commonJS({
|
|
|
30797
31415
|
var Command2 = require_command();
|
|
30798
31416
|
var CommandCode = require_commands();
|
|
30799
31417
|
var Packet = require_packet();
|
|
30800
|
-
var Ping = class extends Command2 {
|
|
31418
|
+
var Ping = class _Ping extends Command2 {
|
|
30801
31419
|
constructor(callback) {
|
|
30802
31420
|
super();
|
|
30803
31421
|
this.onResult = callback;
|
|
@@ -30810,7 +31428,7 @@ var require_ping = __commonJS({
|
|
|
30810
31428
|
5
|
|
30811
31429
|
);
|
|
30812
31430
|
connection.writePacket(ping);
|
|
30813
|
-
return
|
|
31431
|
+
return _Ping.prototype.pingResponse;
|
|
30814
31432
|
}
|
|
30815
31433
|
pingResponse() {
|
|
30816
31434
|
if (this.onResult) {
|
|
@@ -30829,7 +31447,7 @@ var require_register_slave2 = __commonJS({
|
|
|
30829
31447
|
"use strict";
|
|
30830
31448
|
var Command2 = require_command();
|
|
30831
31449
|
var Packets = require_packets();
|
|
30832
|
-
var RegisterSlave = class extends Command2 {
|
|
31450
|
+
var RegisterSlave = class _RegisterSlave extends Command2 {
|
|
30833
31451
|
constructor(opts, callback) {
|
|
30834
31452
|
super();
|
|
30835
31453
|
this.onResult = callback;
|
|
@@ -30838,7 +31456,7 @@ var require_register_slave2 = __commonJS({
|
|
|
30838
31456
|
start(packet, connection) {
|
|
30839
31457
|
const newPacket = new Packets.RegisterSlave(this.opts);
|
|
30840
31458
|
connection.writePacket(newPacket.toPacket(1));
|
|
30841
|
-
return
|
|
31459
|
+
return _RegisterSlave.prototype.registerResponse;
|
|
30842
31460
|
}
|
|
30843
31461
|
registerResponse() {
|
|
30844
31462
|
if (this.onResult) {
|
|
@@ -30980,7 +31598,7 @@ var require_binlog_dump2 = __commonJS({
|
|
|
30980
31598
|
this.flags = packet.readInt16();
|
|
30981
31599
|
}
|
|
30982
31600
|
};
|
|
30983
|
-
var BinlogDump = class extends Command2 {
|
|
31601
|
+
var BinlogDump = class _BinlogDump extends Command2 {
|
|
30984
31602
|
constructor(opts) {
|
|
30985
31603
|
super();
|
|
30986
31604
|
this.opts = opts;
|
|
@@ -30988,7 +31606,7 @@ var require_binlog_dump2 = __commonJS({
|
|
|
30988
31606
|
start(packet, connection) {
|
|
30989
31607
|
const newPacket = new Packets.BinlogDump(this.opts);
|
|
30990
31608
|
connection.writePacket(newPacket.toPacket(1));
|
|
30991
|
-
return
|
|
31609
|
+
return _BinlogDump.prototype.binlogData;
|
|
30992
31610
|
}
|
|
30993
31611
|
binlogData(packet) {
|
|
30994
31612
|
if (packet.isEOF()) {
|
|
@@ -31008,7 +31626,7 @@ var require_binlog_dump2 = __commonJS({
|
|
|
31008
31626
|
}
|
|
31009
31627
|
event.header = header;
|
|
31010
31628
|
this.emit("event", event);
|
|
31011
|
-
return
|
|
31629
|
+
return _BinlogDump.prototype.binlogData;
|
|
31012
31630
|
}
|
|
31013
31631
|
};
|
|
31014
31632
|
var RotateEvent = class {
|
|
@@ -31068,7 +31686,7 @@ var require_change_user2 = __commonJS({
|
|
|
31068
31686
|
var Packets = require_packets();
|
|
31069
31687
|
var ClientHandshake = require_client_handshake();
|
|
31070
31688
|
var CharsetToEncoding = require_charset_encodings();
|
|
31071
|
-
var ChangeUser = class extends Command2 {
|
|
31689
|
+
var ChangeUser = class _ChangeUser extends Command2 {
|
|
31072
31690
|
constructor(options, callback) {
|
|
31073
31691
|
super();
|
|
31074
31692
|
this.onResult = callback;
|
|
@@ -31097,7 +31715,7 @@ var require_change_user2 = __commonJS({
|
|
|
31097
31715
|
connection.clientEncoding = CharsetToEncoding[this.charsetNumber];
|
|
31098
31716
|
connection._statements.reset();
|
|
31099
31717
|
connection.writePacket(newPacket.toPacket());
|
|
31100
|
-
return
|
|
31718
|
+
return _ChangeUser.prototype.handshakeResult;
|
|
31101
31719
|
}
|
|
31102
31720
|
};
|
|
31103
31721
|
ChangeUser.prototype.handshakeResult = ClientHandshake.prototype.handshakeResult;
|
|
@@ -31279,12 +31897,12 @@ var require_connection_config = __commonJS({
|
|
|
31279
31897
|
queueLimit: 1,
|
|
31280
31898
|
waitForConnections: 1
|
|
31281
31899
|
};
|
|
31282
|
-
var ConnectionConfig = class {
|
|
31900
|
+
var ConnectionConfig = class _ConnectionConfig {
|
|
31283
31901
|
constructor(options) {
|
|
31284
31902
|
if (typeof options === "string") {
|
|
31285
|
-
options =
|
|
31903
|
+
options = _ConnectionConfig.parseUrl(options);
|
|
31286
31904
|
} else if (options && options.uri) {
|
|
31287
|
-
const uriOptions =
|
|
31905
|
+
const uriOptions = _ConnectionConfig.parseUrl(options.uri);
|
|
31288
31906
|
for (const key in uriOptions) {
|
|
31289
31907
|
if (!Object.prototype.hasOwnProperty.call(uriOptions, key))
|
|
31290
31908
|
continue;
|
|
@@ -31333,7 +31951,7 @@ var require_connection_config = __commonJS({
|
|
|
31333
31951
|
}
|
|
31334
31952
|
this.queryFormat = options.queryFormat;
|
|
31335
31953
|
this.pool = options.pool || void 0;
|
|
31336
|
-
this.ssl = typeof options.ssl === "string" ?
|
|
31954
|
+
this.ssl = typeof options.ssl === "string" ? _ConnectionConfig.getSSLProfile(options.ssl) : options.ssl || false;
|
|
31337
31955
|
this.multipleStatements = options.multipleStatements || false;
|
|
31338
31956
|
this.rowsAsArray = options.rowsAsArray || false;
|
|
31339
31957
|
this.namedPlaceholders = options.namedPlaceholders || false;
|
|
@@ -31351,12 +31969,12 @@ var require_connection_config = __commonJS({
|
|
|
31351
31969
|
this.ssl.rejectUnauthorized = this.ssl.rejectUnauthorized !== false;
|
|
31352
31970
|
}
|
|
31353
31971
|
this.maxPacketSize = 0;
|
|
31354
|
-
this.charsetNumber = options.charset ?
|
|
31972
|
+
this.charsetNumber = options.charset ? _ConnectionConfig.getCharsetNumber(options.charset) : options.charsetNumber || Charsets.UTF8MB4_UNICODE_CI;
|
|
31355
31973
|
this.compress = options.compress || false;
|
|
31356
31974
|
this.authPlugins = options.authPlugins;
|
|
31357
31975
|
this.authSwitchHandler = options.authSwitchHandler;
|
|
31358
|
-
this.clientFlags =
|
|
31359
|
-
|
|
31976
|
+
this.clientFlags = _ConnectionConfig.mergeFlags(
|
|
31977
|
+
_ConnectionConfig.getDefaultFlags(options),
|
|
31360
31978
|
options.flags || ""
|
|
31361
31979
|
);
|
|
31362
31980
|
this.connectAttributes = options.connectAttributes;
|
|
@@ -31554,7 +32172,7 @@ var require_lru_cache2 = __commonJS({
|
|
|
31554
32172
|
return this.heap[--this.length];
|
|
31555
32173
|
}
|
|
31556
32174
|
};
|
|
31557
|
-
var LRUCache = class {
|
|
32175
|
+
var LRUCache = class _LRUCache {
|
|
31558
32176
|
constructor(options = {}) {
|
|
31559
32177
|
const {
|
|
31560
32178
|
max = 0,
|
|
@@ -31579,7 +32197,7 @@ var require_lru_cache2 = __commonJS({
|
|
|
31579
32197
|
allowStaleOnFetchAbort,
|
|
31580
32198
|
ignoreFetchAbort
|
|
31581
32199
|
} = options;
|
|
31582
|
-
const { length, maxAge, stale } = options instanceof
|
|
32200
|
+
const { length, maxAge, stale } = options instanceof _LRUCache ? {} : options;
|
|
31583
32201
|
if (max !== 0 && !isPosInt(max)) {
|
|
31584
32202
|
throw new TypeError("max option must be a nonnegative integer");
|
|
31585
32203
|
}
|
|
@@ -31679,7 +32297,7 @@ var require_lru_cache2 = __commonJS({
|
|
|
31679
32297
|
if (shouldWarn(code)) {
|
|
31680
32298
|
warned.add(code);
|
|
31681
32299
|
const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.";
|
|
31682
|
-
emitWarning(msg, "UnboundedCacheWarning", code,
|
|
32300
|
+
emitWarning(msg, "UnboundedCacheWarning", code, _LRUCache);
|
|
31683
32301
|
}
|
|
31684
32302
|
}
|
|
31685
32303
|
if (stale) {
|
|
@@ -32651,7 +33269,7 @@ var require_connection = __commonJS({
|
|
|
32651
33269
|
var CharsetToEncoding = require_charset_encodings();
|
|
32652
33270
|
var _connectionId = 0;
|
|
32653
33271
|
var convertNamedPlaceholders = null;
|
|
32654
|
-
var Connection2 = class extends EventEmitter {
|
|
33272
|
+
var Connection2 = class _Connection extends EventEmitter {
|
|
32655
33273
|
constructor(opts) {
|
|
32656
33274
|
super();
|
|
32657
33275
|
this.config = opts.config;
|
|
@@ -33072,7 +33690,7 @@ var require_connection = __commonJS({
|
|
|
33072
33690
|
if (sql.constructor === Commands.Query) {
|
|
33073
33691
|
cmdQuery = sql;
|
|
33074
33692
|
} else {
|
|
33075
|
-
cmdQuery =
|
|
33693
|
+
cmdQuery = _Connection.createQuery(sql, values, cb, this.config);
|
|
33076
33694
|
}
|
|
33077
33695
|
this._resolveNamedPlaceholders(cmdQuery);
|
|
33078
33696
|
const rawSql = this.format(cmdQuery.sql, cmdQuery.values !== void 0 ? cmdQuery.values : []);
|
|
@@ -33108,7 +33726,7 @@ var require_connection = __commonJS({
|
|
|
33108
33726
|
} else {
|
|
33109
33727
|
options.sql = sql;
|
|
33110
33728
|
}
|
|
33111
|
-
const key =
|
|
33729
|
+
const key = _Connection.statementKey(options);
|
|
33112
33730
|
const stmt = this._statements.get(key);
|
|
33113
33731
|
if (stmt) {
|
|
33114
33732
|
this._statements.del(key);
|
|
@@ -34413,7 +35031,7 @@ var require_promise = __commonJS({
|
|
|
34413
35031
|
"escapeId",
|
|
34414
35032
|
"format"
|
|
34415
35033
|
]);
|
|
34416
|
-
var PromisePoolCluster = class extends EventEmitter {
|
|
35034
|
+
var PromisePoolCluster = class _PromisePoolCluster extends EventEmitter {
|
|
34417
35035
|
constructor(poolCluster, thePromise) {
|
|
34418
35036
|
super();
|
|
34419
35037
|
this.poolCluster = poolCluster;
|
|
@@ -34459,7 +35077,7 @@ var require_promise = __commonJS({
|
|
|
34459
35077
|
});
|
|
34460
35078
|
}
|
|
34461
35079
|
of(pattern, selector) {
|
|
34462
|
-
return new
|
|
35080
|
+
return new _PromisePoolCluster(
|
|
34463
35081
|
this.poolCluster.of(pattern, selector),
|
|
34464
35082
|
this.Promise
|
|
34465
35083
|
);
|
|
@@ -38423,7 +39041,7 @@ var require_sender = __commonJS({
|
|
|
38423
39041
|
var { mask: applyMask, toBuffer } = require_buffer_util();
|
|
38424
39042
|
var kByteLength = Symbol("kByteLength");
|
|
38425
39043
|
var maskBuffer = Buffer.alloc(4);
|
|
38426
|
-
var Sender2 = class {
|
|
39044
|
+
var Sender2 = class _Sender {
|
|
38427
39045
|
/**
|
|
38428
39046
|
* Creates a Sender instance.
|
|
38429
39047
|
*
|
|
@@ -38572,7 +39190,7 @@ var require_sender = __commonJS({
|
|
|
38572
39190
|
if (this._deflating) {
|
|
38573
39191
|
this.enqueue([this.dispatch, buf, false, options, cb]);
|
|
38574
39192
|
} else {
|
|
38575
|
-
this.sendFrame(
|
|
39193
|
+
this.sendFrame(_Sender.frame(buf, options), cb);
|
|
38576
39194
|
}
|
|
38577
39195
|
}
|
|
38578
39196
|
/**
|
|
@@ -38610,7 +39228,7 @@ var require_sender = __commonJS({
|
|
|
38610
39228
|
if (this._deflating) {
|
|
38611
39229
|
this.enqueue([this.dispatch, data, false, options, cb]);
|
|
38612
39230
|
} else {
|
|
38613
|
-
this.sendFrame(
|
|
39231
|
+
this.sendFrame(_Sender.frame(data, options), cb);
|
|
38614
39232
|
}
|
|
38615
39233
|
}
|
|
38616
39234
|
/**
|
|
@@ -38648,7 +39266,7 @@ var require_sender = __commonJS({
|
|
|
38648
39266
|
if (this._deflating) {
|
|
38649
39267
|
this.enqueue([this.dispatch, data, false, options, cb]);
|
|
38650
39268
|
} else {
|
|
38651
|
-
this.sendFrame(
|
|
39269
|
+
this.sendFrame(_Sender.frame(data, options), cb);
|
|
38652
39270
|
}
|
|
38653
39271
|
}
|
|
38654
39272
|
/**
|
|
@@ -38711,7 +39329,7 @@ var require_sender = __commonJS({
|
|
|
38711
39329
|
}
|
|
38712
39330
|
} else {
|
|
38713
39331
|
this.sendFrame(
|
|
38714
|
-
|
|
39332
|
+
_Sender.frame(data, {
|
|
38715
39333
|
[kByteLength]: byteLength,
|
|
38716
39334
|
fin: options.fin,
|
|
38717
39335
|
generateMask: this._generateMask,
|
|
@@ -38750,7 +39368,7 @@ var require_sender = __commonJS({
|
|
|
38750
39368
|
*/
|
|
38751
39369
|
dispatch(data, compress, options, cb) {
|
|
38752
39370
|
if (!compress) {
|
|
38753
|
-
this.sendFrame(
|
|
39371
|
+
this.sendFrame(_Sender.frame(data, options), cb);
|
|
38754
39372
|
return;
|
|
38755
39373
|
}
|
|
38756
39374
|
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
@@ -38774,7 +39392,7 @@ var require_sender = __commonJS({
|
|
|
38774
39392
|
this._bufferedBytes -= options[kByteLength];
|
|
38775
39393
|
this._deflating = false;
|
|
38776
39394
|
options.readOnly = false;
|
|
38777
|
-
this.sendFrame(
|
|
39395
|
+
this.sendFrame(_Sender.frame(buf, options), cb);
|
|
38778
39396
|
this.dequeue();
|
|
38779
39397
|
});
|
|
38780
39398
|
}
|
|
@@ -39256,7 +39874,7 @@ var require_websocket = __commonJS({
|
|
|
39256
39874
|
var protocolVersions2 = [8, 13];
|
|
39257
39875
|
var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
|
|
39258
39876
|
var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
39259
|
-
var WebSocket2 = class extends EventEmitter {
|
|
39877
|
+
var WebSocket2 = class _WebSocket extends EventEmitter {
|
|
39260
39878
|
/**
|
|
39261
39879
|
* Create a new `WebSocket`.
|
|
39262
39880
|
*
|
|
@@ -39275,7 +39893,7 @@ var require_websocket = __commonJS({
|
|
|
39275
39893
|
this._extensions = {};
|
|
39276
39894
|
this._paused = false;
|
|
39277
39895
|
this._protocol = "";
|
|
39278
|
-
this._readyState =
|
|
39896
|
+
this._readyState = _WebSocket.CONNECTING;
|
|
39279
39897
|
this._receiver = null;
|
|
39280
39898
|
this._sender = null;
|
|
39281
39899
|
this._socket = null;
|
|
@@ -39422,7 +40040,7 @@ var require_websocket = __commonJS({
|
|
|
39422
40040
|
socket.on("data", socketOnData);
|
|
39423
40041
|
socket.on("end", socketOnEnd);
|
|
39424
40042
|
socket.on("error", socketOnError);
|
|
39425
|
-
this._readyState =
|
|
40043
|
+
this._readyState = _WebSocket.OPEN;
|
|
39426
40044
|
this.emit("open");
|
|
39427
40045
|
}
|
|
39428
40046
|
/**
|
|
@@ -39432,7 +40050,7 @@ var require_websocket = __commonJS({
|
|
|
39432
40050
|
*/
|
|
39433
40051
|
emitClose() {
|
|
39434
40052
|
if (!this._socket) {
|
|
39435
|
-
this._readyState =
|
|
40053
|
+
this._readyState = _WebSocket.CLOSED;
|
|
39436
40054
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
39437
40055
|
return;
|
|
39438
40056
|
}
|
|
@@ -39440,7 +40058,7 @@ var require_websocket = __commonJS({
|
|
|
39440
40058
|
this._extensions[PerMessageDeflate.extensionName].cleanup();
|
|
39441
40059
|
}
|
|
39442
40060
|
this._receiver.removeAllListeners();
|
|
39443
|
-
this._readyState =
|
|
40061
|
+
this._readyState = _WebSocket.CLOSED;
|
|
39444
40062
|
this.emit("close", this._closeCode, this._closeMessage);
|
|
39445
40063
|
}
|
|
39446
40064
|
/**
|
|
@@ -39464,20 +40082,20 @@ var require_websocket = __commonJS({
|
|
|
39464
40082
|
* @public
|
|
39465
40083
|
*/
|
|
39466
40084
|
close(code, data) {
|
|
39467
|
-
if (this.readyState ===
|
|
40085
|
+
if (this.readyState === _WebSocket.CLOSED)
|
|
39468
40086
|
return;
|
|
39469
|
-
if (this.readyState ===
|
|
40087
|
+
if (this.readyState === _WebSocket.CONNECTING) {
|
|
39470
40088
|
const msg = "WebSocket was closed before the connection was established";
|
|
39471
40089
|
abortHandshake(this, this._req, msg);
|
|
39472
40090
|
return;
|
|
39473
40091
|
}
|
|
39474
|
-
if (this.readyState ===
|
|
40092
|
+
if (this.readyState === _WebSocket.CLOSING) {
|
|
39475
40093
|
if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) {
|
|
39476
40094
|
this._socket.end();
|
|
39477
40095
|
}
|
|
39478
40096
|
return;
|
|
39479
40097
|
}
|
|
39480
|
-
this._readyState =
|
|
40098
|
+
this._readyState = _WebSocket.CLOSING;
|
|
39481
40099
|
this._sender.close(code, data, !this._isServer, (err2) => {
|
|
39482
40100
|
if (err2)
|
|
39483
40101
|
return;
|
|
@@ -39497,7 +40115,7 @@ var require_websocket = __commonJS({
|
|
|
39497
40115
|
* @public
|
|
39498
40116
|
*/
|
|
39499
40117
|
pause() {
|
|
39500
|
-
if (this.readyState ===
|
|
40118
|
+
if (this.readyState === _WebSocket.CONNECTING || this.readyState === _WebSocket.CLOSED) {
|
|
39501
40119
|
return;
|
|
39502
40120
|
}
|
|
39503
40121
|
this._paused = true;
|
|
@@ -39512,7 +40130,7 @@ var require_websocket = __commonJS({
|
|
|
39512
40130
|
* @public
|
|
39513
40131
|
*/
|
|
39514
40132
|
ping(data, mask, cb) {
|
|
39515
|
-
if (this.readyState ===
|
|
40133
|
+
if (this.readyState === _WebSocket.CONNECTING) {
|
|
39516
40134
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
39517
40135
|
}
|
|
39518
40136
|
if (typeof data === "function") {
|
|
@@ -39524,7 +40142,7 @@ var require_websocket = __commonJS({
|
|
|
39524
40142
|
}
|
|
39525
40143
|
if (typeof data === "number")
|
|
39526
40144
|
data = data.toString();
|
|
39527
|
-
if (this.readyState !==
|
|
40145
|
+
if (this.readyState !== _WebSocket.OPEN) {
|
|
39528
40146
|
sendAfterClose(this, data, cb);
|
|
39529
40147
|
return;
|
|
39530
40148
|
}
|
|
@@ -39541,7 +40159,7 @@ var require_websocket = __commonJS({
|
|
|
39541
40159
|
* @public
|
|
39542
40160
|
*/
|
|
39543
40161
|
pong(data, mask, cb) {
|
|
39544
|
-
if (this.readyState ===
|
|
40162
|
+
if (this.readyState === _WebSocket.CONNECTING) {
|
|
39545
40163
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
39546
40164
|
}
|
|
39547
40165
|
if (typeof data === "function") {
|
|
@@ -39553,7 +40171,7 @@ var require_websocket = __commonJS({
|
|
|
39553
40171
|
}
|
|
39554
40172
|
if (typeof data === "number")
|
|
39555
40173
|
data = data.toString();
|
|
39556
|
-
if (this.readyState !==
|
|
40174
|
+
if (this.readyState !== _WebSocket.OPEN) {
|
|
39557
40175
|
sendAfterClose(this, data, cb);
|
|
39558
40176
|
return;
|
|
39559
40177
|
}
|
|
@@ -39567,7 +40185,7 @@ var require_websocket = __commonJS({
|
|
|
39567
40185
|
* @public
|
|
39568
40186
|
*/
|
|
39569
40187
|
resume() {
|
|
39570
|
-
if (this.readyState ===
|
|
40188
|
+
if (this.readyState === _WebSocket.CONNECTING || this.readyState === _WebSocket.CLOSED) {
|
|
39571
40189
|
return;
|
|
39572
40190
|
}
|
|
39573
40191
|
this._paused = false;
|
|
@@ -39590,7 +40208,7 @@ var require_websocket = __commonJS({
|
|
|
39590
40208
|
* @public
|
|
39591
40209
|
*/
|
|
39592
40210
|
send(data, options, cb) {
|
|
39593
|
-
if (this.readyState ===
|
|
40211
|
+
if (this.readyState === _WebSocket.CONNECTING) {
|
|
39594
40212
|
throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
39595
40213
|
}
|
|
39596
40214
|
if (typeof options === "function") {
|
|
@@ -39599,7 +40217,7 @@ var require_websocket = __commonJS({
|
|
|
39599
40217
|
}
|
|
39600
40218
|
if (typeof data === "number")
|
|
39601
40219
|
data = data.toString();
|
|
39602
|
-
if (this.readyState !==
|
|
40220
|
+
if (this.readyState !== _WebSocket.OPEN) {
|
|
39603
40221
|
sendAfterClose(this, data, cb);
|
|
39604
40222
|
return;
|
|
39605
40223
|
}
|
|
@@ -39621,15 +40239,15 @@ var require_websocket = __commonJS({
|
|
|
39621
40239
|
* @public
|
|
39622
40240
|
*/
|
|
39623
40241
|
terminate() {
|
|
39624
|
-
if (this.readyState ===
|
|
40242
|
+
if (this.readyState === _WebSocket.CLOSED)
|
|
39625
40243
|
return;
|
|
39626
|
-
if (this.readyState ===
|
|
40244
|
+
if (this.readyState === _WebSocket.CONNECTING) {
|
|
39627
40245
|
const msg = "WebSocket was closed before the connection was established";
|
|
39628
40246
|
abortHandshake(this, this._req, msg);
|
|
39629
40247
|
return;
|
|
39630
40248
|
}
|
|
39631
40249
|
if (this._socket) {
|
|
39632
|
-
this._readyState =
|
|
40250
|
+
this._readyState = _WebSocket.CLOSING;
|
|
39633
40251
|
this._socket.destroy();
|
|
39634
40252
|
}
|
|
39635
40253
|
}
|
|
@@ -41175,7 +41793,7 @@ var init_batch = __esm({
|
|
|
41175
41793
|
});
|
|
41176
41794
|
}
|
|
41177
41795
|
};
|
|
41178
|
-
BatchCond = class {
|
|
41796
|
+
BatchCond = class _BatchCond {
|
|
41179
41797
|
/** @private */
|
|
41180
41798
|
_proto;
|
|
41181
41799
|
/** @private */
|
|
@@ -41183,19 +41801,19 @@ var init_batch = __esm({
|
|
|
41183
41801
|
this._proto = proto2;
|
|
41184
41802
|
}
|
|
41185
41803
|
static ok(step) {
|
|
41186
|
-
return new
|
|
41804
|
+
return new _BatchCond({ "type": "ok", "step": stepIndex(step) });
|
|
41187
41805
|
}
|
|
41188
41806
|
static error(step) {
|
|
41189
|
-
return new
|
|
41807
|
+
return new _BatchCond({ "type": "error", "step": stepIndex(step) });
|
|
41190
41808
|
}
|
|
41191
41809
|
static not(cond) {
|
|
41192
|
-
return new
|
|
41810
|
+
return new _BatchCond({ "type": "not", "cond": cond._proto });
|
|
41193
41811
|
}
|
|
41194
41812
|
static and(conds) {
|
|
41195
|
-
return new
|
|
41813
|
+
return new _BatchCond({ "type": "and", "conds": conds.map((e) => e._proto) });
|
|
41196
41814
|
}
|
|
41197
41815
|
static or(conds) {
|
|
41198
|
-
return new
|
|
41816
|
+
return new _BatchCond({ "type": "or", "conds": conds.map((e) => e._proto) });
|
|
41199
41817
|
}
|
|
41200
41818
|
};
|
|
41201
41819
|
}
|
|
@@ -43800,7 +44418,7 @@ var require_lib3 = __commonJS({
|
|
|
43800
44418
|
var Readable = Stream2.Readable;
|
|
43801
44419
|
var BUFFER = Symbol("buffer");
|
|
43802
44420
|
var TYPE = Symbol("type");
|
|
43803
|
-
var Blob = class {
|
|
44421
|
+
var Blob = class _Blob {
|
|
43804
44422
|
constructor() {
|
|
43805
44423
|
this[TYPE] = "";
|
|
43806
44424
|
const blobParts = arguments[0];
|
|
@@ -43819,7 +44437,7 @@ var require_lib3 = __commonJS({
|
|
|
43819
44437
|
buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength);
|
|
43820
44438
|
} else if (element instanceof ArrayBuffer) {
|
|
43821
44439
|
buffer = Buffer.from(element);
|
|
43822
|
-
} else if (element instanceof
|
|
44440
|
+
} else if (element instanceof _Blob) {
|
|
43823
44441
|
buffer = element[BUFFER];
|
|
43824
44442
|
} else {
|
|
43825
44443
|
buffer = Buffer.from(typeof element === "string" ? element : String(element));
|
|
@@ -43881,7 +44499,7 @@ var require_lib3 = __commonJS({
|
|
|
43881
44499
|
const span = Math.max(relativeEnd - relativeStart, 0);
|
|
43882
44500
|
const buffer = this[BUFFER];
|
|
43883
44501
|
const slicedBuffer = buffer.slice(relativeStart, relativeStart + span);
|
|
43884
|
-
const blob = new
|
|
44502
|
+
const blob = new _Blob([], { type: arguments[2] });
|
|
43885
44503
|
blob[BUFFER] = slicedBuffer;
|
|
43886
44504
|
return blob;
|
|
43887
44505
|
}
|
|
@@ -44258,7 +44876,7 @@ var require_lib3 = __commonJS({
|
|
|
44258
44876
|
return void 0;
|
|
44259
44877
|
}
|
|
44260
44878
|
var MAP = Symbol("map");
|
|
44261
|
-
var Headers2 = class {
|
|
44879
|
+
var Headers2 = class _Headers {
|
|
44262
44880
|
/**
|
|
44263
44881
|
* Headers class
|
|
44264
44882
|
*
|
|
@@ -44268,7 +44886,7 @@ var require_lib3 = __commonJS({
|
|
|
44268
44886
|
constructor() {
|
|
44269
44887
|
let init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : void 0;
|
|
44270
44888
|
this[MAP] = /* @__PURE__ */ Object.create(null);
|
|
44271
|
-
if (init instanceof
|
|
44889
|
+
if (init instanceof _Headers) {
|
|
44272
44890
|
const rawHeaders = init.raw();
|
|
44273
44891
|
const headerNames = Object.keys(rawHeaders);
|
|
44274
44892
|
for (const headerName of headerNames) {
|
|
@@ -44537,7 +45155,7 @@ var require_lib3 = __commonJS({
|
|
|
44537
45155
|
}
|
|
44538
45156
|
var INTERNALS$1 = Symbol("Response internals");
|
|
44539
45157
|
var STATUS_CODES = http.STATUS_CODES;
|
|
44540
|
-
var Response2 = class {
|
|
45158
|
+
var Response2 = class _Response {
|
|
44541
45159
|
constructor() {
|
|
44542
45160
|
let body = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
44543
45161
|
let opts = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
@@ -44585,7 +45203,7 @@ var require_lib3 = __commonJS({
|
|
|
44585
45203
|
* @return Response
|
|
44586
45204
|
*/
|
|
44587
45205
|
clone() {
|
|
44588
|
-
return new
|
|
45206
|
+
return new _Response(clone(this), {
|
|
44589
45207
|
url: this.url,
|
|
44590
45208
|
status: this.status,
|
|
44591
45209
|
statusText: this.statusText,
|
|
@@ -44629,7 +45247,7 @@ var require_lib3 = __commonJS({
|
|
|
44629
45247
|
const proto2 = signal && typeof signal === "object" && Object.getPrototypeOf(signal);
|
|
44630
45248
|
return !!(proto2 && proto2.constructor.name === "AbortSignal");
|
|
44631
45249
|
}
|
|
44632
|
-
var Request2 = class {
|
|
45250
|
+
var Request2 = class _Request {
|
|
44633
45251
|
constructor(input) {
|
|
44634
45252
|
let init = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
44635
45253
|
let parsedURL;
|
|
@@ -44699,7 +45317,7 @@ var require_lib3 = __commonJS({
|
|
|
44699
45317
|
* @return Request
|
|
44700
45318
|
*/
|
|
44701
45319
|
clone() {
|
|
44702
|
-
return new
|
|
45320
|
+
return new _Request(this);
|
|
44703
45321
|
}
|
|
44704
45322
|
};
|
|
44705
45323
|
Body.mixIn(Request2.prototype);
|
|
@@ -44785,12 +45403,12 @@ var require_lib3 = __commonJS({
|
|
|
44785
45403
|
const dest = new URL$1(destination).protocol;
|
|
44786
45404
|
return orig === dest;
|
|
44787
45405
|
};
|
|
44788
|
-
function
|
|
44789
|
-
if (!
|
|
45406
|
+
function fetch(url, opts) {
|
|
45407
|
+
if (!fetch.Promise) {
|
|
44790
45408
|
throw new Error("native promise missing, set fetch.Promise to your favorite alternative");
|
|
44791
45409
|
}
|
|
44792
|
-
Body.Promise =
|
|
44793
|
-
return new
|
|
45410
|
+
Body.Promise = fetch.Promise;
|
|
45411
|
+
return new fetch.Promise(function(resolve2, reject) {
|
|
44794
45412
|
const request = new Request2(url, opts);
|
|
44795
45413
|
const options = getNodeRequestOptions(request);
|
|
44796
45414
|
const send = (options.protocol === "https:" ? https : http).request;
|
|
@@ -44863,7 +45481,7 @@ var require_lib3 = __commonJS({
|
|
|
44863
45481
|
req.on("response", function(res) {
|
|
44864
45482
|
clearTimeout(reqTimeout);
|
|
44865
45483
|
const headers = createHeadersLenient(res.headers);
|
|
44866
|
-
if (
|
|
45484
|
+
if (fetch.isRedirect(res.statusCode)) {
|
|
44867
45485
|
const location = headers.get("Location");
|
|
44868
45486
|
let locationURL = null;
|
|
44869
45487
|
try {
|
|
@@ -44925,7 +45543,7 @@ var require_lib3 = __commonJS({
|
|
|
44925
45543
|
requestOpts.body = void 0;
|
|
44926
45544
|
requestOpts.headers.delete("content-length");
|
|
44927
45545
|
}
|
|
44928
|
-
resolve2(
|
|
45546
|
+
resolve2(fetch(new Request2(locationURL, requestOpts)));
|
|
44929
45547
|
finalize();
|
|
44930
45548
|
return;
|
|
44931
45549
|
}
|
|
@@ -45018,11 +45636,11 @@ var require_lib3 = __commonJS({
|
|
|
45018
45636
|
stream.end();
|
|
45019
45637
|
}
|
|
45020
45638
|
}
|
|
45021
|
-
|
|
45639
|
+
fetch.isRedirect = function(code) {
|
|
45022
45640
|
return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
|
|
45023
45641
|
};
|
|
45024
|
-
|
|
45025
|
-
module2.exports = exports =
|
|
45642
|
+
fetch.Promise = global.Promise;
|
|
45643
|
+
module2.exports = exports = fetch;
|
|
45026
45644
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45027
45645
|
exports.default = exports;
|
|
45028
45646
|
exports.Headers = Headers2;
|
|
@@ -45032,12 +45650,11 @@ var require_lib3 = __commonJS({
|
|
|
45032
45650
|
}
|
|
45033
45651
|
});
|
|
45034
45652
|
|
|
45035
|
-
// node_modules/.pnpm/@libsql+isomorphic-fetch@0.1.
|
|
45036
|
-
var import_node_fetch
|
|
45653
|
+
// node_modules/.pnpm/@libsql+isomorphic-fetch@0.1.4/node_modules/@libsql/isomorphic-fetch/node.mjs
|
|
45654
|
+
var import_node_fetch;
|
|
45037
45655
|
var init_node2 = __esm({
|
|
45038
|
-
"node_modules/.pnpm/@libsql+isomorphic-fetch@0.1.
|
|
45656
|
+
"node_modules/.pnpm/@libsql+isomorphic-fetch@0.1.4/node_modules/@libsql/isomorphic-fetch/node.mjs"() {
|
|
45039
45657
|
import_node_fetch = __toESM(require_lib3(), 1);
|
|
45040
|
-
({ Request, Response, Headers } = import_node_fetch.default);
|
|
45041
45658
|
}
|
|
45042
45659
|
});
|
|
45043
45660
|
|
|
@@ -45181,6 +45798,11 @@ var init_http = __esm({
|
|
|
45181
45798
|
});
|
|
45182
45799
|
|
|
45183
45800
|
// node_modules/.pnpm/@libsql+client@0.1.6/node_modules/@libsql/client/lib-esm/index.js
|
|
45801
|
+
var lib_esm_exports2 = {};
|
|
45802
|
+
__export(lib_esm_exports2, {
|
|
45803
|
+
LibsqlError: () => LibsqlError,
|
|
45804
|
+
createClient: () => createClient
|
|
45805
|
+
});
|
|
45184
45806
|
function createClient(config) {
|
|
45185
45807
|
return _createClient4(expandConfig(config));
|
|
45186
45808
|
}
|
|
@@ -45334,7 +45956,7 @@ var require_postgres_array = __commonJS({
|
|
|
45334
45956
|
exports.parse = function(source, transform) {
|
|
45335
45957
|
return new ArrayParser(source, transform).parse();
|
|
45336
45958
|
};
|
|
45337
|
-
var ArrayParser = class {
|
|
45959
|
+
var ArrayParser = class _ArrayParser {
|
|
45338
45960
|
constructor(source, transform) {
|
|
45339
45961
|
this.source = source;
|
|
45340
45962
|
this.transform = transform || identity;
|
|
@@ -45392,7 +46014,7 @@ var require_postgres_array = __commonJS({
|
|
|
45392
46014
|
if (character.value === "{" && !quote) {
|
|
45393
46015
|
this.dimension++;
|
|
45394
46016
|
if (this.dimension > 1) {
|
|
45395
|
-
parser = new
|
|
46017
|
+
parser = new _ArrayParser(this.source.substr(this.position - 1), this.transform);
|
|
45396
46018
|
this.entries.push(parser.parse(true));
|
|
45397
46019
|
this.position += parser.position - 2;
|
|
45398
46020
|
}
|
|
@@ -50439,6 +51061,164 @@ var init_pgIntrospect = __esm({
|
|
|
50439
51061
|
}
|
|
50440
51062
|
});
|
|
50441
51063
|
|
|
51064
|
+
// src/cli/validations/studio.ts
|
|
51065
|
+
var studio_exports = {};
|
|
51066
|
+
__export(studio_exports, {
|
|
51067
|
+
studioConfigSchema: () => studioConfigSchema,
|
|
51068
|
+
validateStudio: () => validateStudio
|
|
51069
|
+
});
|
|
51070
|
+
var studioConfigSchema, printDriverIssues, validateStudio;
|
|
51071
|
+
var init_studio = __esm({
|
|
51072
|
+
"src/cli/validations/studio.ts"() {
|
|
51073
|
+
init_lib();
|
|
51074
|
+
init_pg();
|
|
51075
|
+
init_mysql();
|
|
51076
|
+
init_sqliteUtils();
|
|
51077
|
+
init_utils();
|
|
51078
|
+
init_outputs();
|
|
51079
|
+
init_pg();
|
|
51080
|
+
init_mysql();
|
|
51081
|
+
init_sqlite();
|
|
51082
|
+
studioConfigSchema = intersectionType(
|
|
51083
|
+
objectType({
|
|
51084
|
+
schema: unionType([stringType(), stringType().array()])
|
|
51085
|
+
}),
|
|
51086
|
+
unionType([mysqlConnectionConfig, pgConnectionConfig, sqliteConnectionSchema])
|
|
51087
|
+
);
|
|
51088
|
+
printDriverIssues = (options) => {
|
|
51089
|
+
if (options.driver === "pg") {
|
|
51090
|
+
printConfigConnectionIssues2(options);
|
|
51091
|
+
} else if (options.driver === "mysql") {
|
|
51092
|
+
printConfigConnectionIssues3(options);
|
|
51093
|
+
} else if (["libsql", "turso", "better-sqlite"].includes(options.driver)) {
|
|
51094
|
+
printConfigConnectionIssues(options);
|
|
51095
|
+
} else {
|
|
51096
|
+
if (typeof options.driver === "undefined") {
|
|
51097
|
+
console.log(outputs.studio.noDriver());
|
|
51098
|
+
} else {
|
|
51099
|
+
console.log(outputs.studio.drivers(options.driver));
|
|
51100
|
+
}
|
|
51101
|
+
if (typeof options.dbCredentials === "undefined") {
|
|
51102
|
+
console.log(outputs.studio.noCredentials());
|
|
51103
|
+
}
|
|
51104
|
+
}
|
|
51105
|
+
};
|
|
51106
|
+
validateStudio = async (options) => {
|
|
51107
|
+
const drizzleConfig = await readDrizzleConfig(
|
|
51108
|
+
options.config
|
|
51109
|
+
);
|
|
51110
|
+
const configRes = studioConfigSchema.safeParse(drizzleConfig);
|
|
51111
|
+
if (!configRes.success) {
|
|
51112
|
+
if (typeof drizzleConfig.schema === "undefined") {
|
|
51113
|
+
console.log(outputs.common.schemaConfig("studio"));
|
|
51114
|
+
process.exit(1);
|
|
51115
|
+
}
|
|
51116
|
+
printDriverIssues(drizzleConfig);
|
|
51117
|
+
process.exit(1);
|
|
51118
|
+
}
|
|
51119
|
+
return configRes.data;
|
|
51120
|
+
};
|
|
51121
|
+
}
|
|
51122
|
+
});
|
|
51123
|
+
|
|
51124
|
+
// src/serializer/studioUtils.ts
|
|
51125
|
+
var studioUtils_exports = {};
|
|
51126
|
+
__export(studioUtils_exports, {
|
|
51127
|
+
drizzleDb: () => drizzleDb,
|
|
51128
|
+
prepareModels: () => prepareModels
|
|
51129
|
+
});
|
|
51130
|
+
var import_drizzle_orm10, import_mysql_core4, import_pg_core4, import_sqlite_core3, prepareModels, drizzleDb;
|
|
51131
|
+
var init_studioUtils = __esm({
|
|
51132
|
+
"src/serializer/studioUtils.ts"() {
|
|
51133
|
+
import_drizzle_orm10 = require("drizzle-orm");
|
|
51134
|
+
import_mysql_core4 = require("drizzle-orm/mysql-core");
|
|
51135
|
+
import_pg_core4 = require("drizzle-orm/pg-core");
|
|
51136
|
+
import_sqlite_core3 = require("drizzle-orm/sqlite-core");
|
|
51137
|
+
init_utils();
|
|
51138
|
+
init_serializer();
|
|
51139
|
+
prepareModels = async (path3) => {
|
|
51140
|
+
const imports = prepareFilenames(path3);
|
|
51141
|
+
const sqliteSchema2 = {};
|
|
51142
|
+
const pgSchema3 = {};
|
|
51143
|
+
const mysqlSchema3 = {};
|
|
51144
|
+
const { unregister } = safeRegister();
|
|
51145
|
+
for (let i = 0; i < imports.length; i++) {
|
|
51146
|
+
const it = imports[i];
|
|
51147
|
+
const i0 = require(`${it}`);
|
|
51148
|
+
const i0values = Object.entries(i0);
|
|
51149
|
+
i0values.forEach(([k, t]) => {
|
|
51150
|
+
if ((0, import_drizzle_orm10.is)(t, import_pg_core4.PgTable)) {
|
|
51151
|
+
pgSchema3[k] = t;
|
|
51152
|
+
}
|
|
51153
|
+
if ((0, import_drizzle_orm10.is)(t, import_mysql_core4.MySqlTable)) {
|
|
51154
|
+
mysqlSchema3[k] = t;
|
|
51155
|
+
}
|
|
51156
|
+
if ((0, import_drizzle_orm10.is)(t, import_sqlite_core3.SQLiteTable)) {
|
|
51157
|
+
sqliteSchema2[k] = t;
|
|
51158
|
+
}
|
|
51159
|
+
if ((0, import_drizzle_orm10.is)(t, import_drizzle_orm10.Relations)) {
|
|
51160
|
+
sqliteSchema2[k] = t;
|
|
51161
|
+
pgSchema3[k] = t;
|
|
51162
|
+
mysqlSchema3[k] = t;
|
|
51163
|
+
}
|
|
51164
|
+
});
|
|
51165
|
+
}
|
|
51166
|
+
unregister();
|
|
51167
|
+
return { pgSchema: pgSchema3, mysqlSchema: mysqlSchema3, sqliteSchema: sqliteSchema2 };
|
|
51168
|
+
};
|
|
51169
|
+
drizzleDb = async (drizzleConfig, models, logger) => {
|
|
51170
|
+
if (drizzleConfig.driver === "pg") {
|
|
51171
|
+
const { drizzle } = await import("drizzle-orm/node-postgres");
|
|
51172
|
+
const { Pool: Pool2, types } = await Promise.resolve().then(() => __toESM(require_lib5()));
|
|
51173
|
+
const client = new Pool2({ ...drizzleConfig.dbCredentials, max: 1 });
|
|
51174
|
+
types.setTypeParser(types.builtins.INTERVAL, (val) => val);
|
|
51175
|
+
return {
|
|
51176
|
+
db: drizzle(client, { logger }),
|
|
51177
|
+
type: "pg",
|
|
51178
|
+
schema: models.pgSchema
|
|
51179
|
+
};
|
|
51180
|
+
} else if (drizzleConfig.driver === "mysql2") {
|
|
51181
|
+
const { drizzle } = await import("drizzle-orm/mysql2");
|
|
51182
|
+
const { createPool } = await Promise.resolve().then(() => __toESM(require_promise()));
|
|
51183
|
+
const client = createPool({
|
|
51184
|
+
uri: drizzleConfig.dbCredentials.type === "url" ? drizzleConfig.dbCredentials.connectionString : void 0,
|
|
51185
|
+
host: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.host : void 0,
|
|
51186
|
+
port: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.port : void 0,
|
|
51187
|
+
user: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.user : void 0,
|
|
51188
|
+
database: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.database : void 0,
|
|
51189
|
+
password: drizzleConfig.dbCredentials.type === "params" ? drizzleConfig.dbCredentials.password : void 0,
|
|
51190
|
+
connectionLimit: 1
|
|
51191
|
+
});
|
|
51192
|
+
return {
|
|
51193
|
+
db: drizzle(client, { logger }),
|
|
51194
|
+
type: "mysql",
|
|
51195
|
+
schema: models.mysqlSchema
|
|
51196
|
+
};
|
|
51197
|
+
} else {
|
|
51198
|
+
if (drizzleConfig.driver === "better-sqlite") {
|
|
51199
|
+
const { drizzle } = await import("drizzle-orm/better-sqlite3");
|
|
51200
|
+
const Database2 = await import("better-sqlite3");
|
|
51201
|
+
const client = new Database2.default(drizzleConfig.dbCredentials.url);
|
|
51202
|
+
return {
|
|
51203
|
+
db: drizzle(client, { logger }),
|
|
51204
|
+
type: "sqlite",
|
|
51205
|
+
schema: models.sqliteSchema
|
|
51206
|
+
};
|
|
51207
|
+
} else {
|
|
51208
|
+
const { drizzle } = await import("drizzle-orm/libsql");
|
|
51209
|
+
const { createClient: createClient2 } = await Promise.resolve().then(() => (init_lib_esm2(), lib_esm_exports2));
|
|
51210
|
+
const client = createClient2({ ...drizzleConfig.dbCredentials });
|
|
51211
|
+
return {
|
|
51212
|
+
db: drizzle(client, { logger }),
|
|
51213
|
+
type: "sqlite",
|
|
51214
|
+
schema: models.sqliteSchema
|
|
51215
|
+
};
|
|
51216
|
+
}
|
|
51217
|
+
}
|
|
51218
|
+
};
|
|
51219
|
+
}
|
|
51220
|
+
});
|
|
51221
|
+
|
|
50442
51222
|
// src/cli/index.ts
|
|
50443
51223
|
var cli_exports = {};
|
|
50444
51224
|
__export(cli_exports, {
|
|
@@ -50543,7 +51323,7 @@ init_source();
|
|
|
50543
51323
|
// package.json
|
|
50544
51324
|
var package_default = {
|
|
50545
51325
|
name: "drizzle-kit",
|
|
50546
|
-
version: "0.19.
|
|
51326
|
+
version: "0.19.3",
|
|
50547
51327
|
repository: "https://github.com/drizzle-team/drizzle-kit-mirror",
|
|
50548
51328
|
author: "Drizzle Team",
|
|
50549
51329
|
license: "MIT",
|
|
@@ -50580,7 +51360,8 @@ var package_default = {
|
|
|
50580
51360
|
"build:dev": "rm -rf ./dist && tsx build.dev.ts && tsc -p tsconfig.cli-types.json && chmod +x ./dist/index.cjs",
|
|
50581
51361
|
pack: "build && package",
|
|
50582
51362
|
tsc: "tsc -p tsconfig.build.json",
|
|
50583
|
-
pub: "cp package.json readme.md dist/ && cd dist && npm publish"
|
|
51363
|
+
pub: "cp package.json readme.md dist/ && cd dist && npm publish",
|
|
51364
|
+
studio: "./dist/index.cjs studio --verbose"
|
|
50584
51365
|
},
|
|
50585
51366
|
ava: {
|
|
50586
51367
|
files: [
|
|
@@ -50594,10 +51375,13 @@ var package_default = {
|
|
|
50594
51375
|
]
|
|
50595
51376
|
},
|
|
50596
51377
|
dependencies: {
|
|
51378
|
+
"@drizzle-team/studio": "file:drizzle-team-studio-0.0.1.tgz",
|
|
50597
51379
|
"@esbuild-kit/esm-loader": "^2.5.5",
|
|
50598
51380
|
camelcase: "^7.0.1",
|
|
50599
51381
|
chalk: "^5.2.0",
|
|
50600
51382
|
commander: "^9.4.1",
|
|
51383
|
+
esbuild: "^0.18.6",
|
|
51384
|
+
"esbuild-register": "^3.4.2",
|
|
50601
51385
|
glob: "^8.1.0",
|
|
50602
51386
|
hanji: "^0.0.5",
|
|
50603
51387
|
"json-diff": "0.9.0",
|
|
@@ -50618,15 +51402,14 @@ var package_default = {
|
|
|
50618
51402
|
"better-sqlite3": "^8.4.0",
|
|
50619
51403
|
dockerode: "^3.3.4",
|
|
50620
51404
|
dotenv: "^16.0.3",
|
|
50621
|
-
"drizzle-orm": "0.27.0
|
|
50622
|
-
esbuild: "^0.17.19",
|
|
50623
|
-
"esbuild-register": "^3.4.2",
|
|
51405
|
+
"drizzle-orm": "0.27.0",
|
|
50624
51406
|
eslint: "^8.29.0",
|
|
50625
51407
|
"eslint-config-prettier": "^8.5.0",
|
|
50626
51408
|
"eslint-plugin-prettier": "^4.2.1",
|
|
50627
51409
|
"get-port": "^6.1.2",
|
|
50628
51410
|
mysql2: "2.3.3",
|
|
50629
51411
|
pg: "^8.8.0",
|
|
51412
|
+
postgres: "^3.3.5",
|
|
50630
51413
|
prettier: "^2.8.1",
|
|
50631
51414
|
tsx: "^3.12.1",
|
|
50632
51415
|
typescript: "^4.9.4",
|
|
@@ -51148,532 +51931,12 @@ var logSuggestionsAndReturn2 = async ({
|
|
|
51148
51931
|
// src/cli/index.ts
|
|
51149
51932
|
init_serializer();
|
|
51150
51933
|
init_sqliteSchema();
|
|
51151
|
-
|
|
51152
|
-
|
|
51153
|
-
|
|
51154
|
-
|
|
51155
|
-
|
|
51156
|
-
|
|
51157
|
-
init_utils();
|
|
51158
|
-
var sqliteConnectionSchema = unionType([
|
|
51159
|
-
objectType({
|
|
51160
|
-
driver: literalType("turso"),
|
|
51161
|
-
dbCredentials: objectType({
|
|
51162
|
-
url: stringType(),
|
|
51163
|
-
authToken: stringType().optional()
|
|
51164
|
-
})
|
|
51165
|
-
}),
|
|
51166
|
-
objectType({
|
|
51167
|
-
driver: literalType("libsql"),
|
|
51168
|
-
dbCredentials: objectType({
|
|
51169
|
-
url: stringType()
|
|
51170
|
-
})
|
|
51171
|
-
}),
|
|
51172
|
-
objectType({
|
|
51173
|
-
driver: literalType("better-sqlite"),
|
|
51174
|
-
dbCredentials: objectType({
|
|
51175
|
-
url: stringType()
|
|
51176
|
-
})
|
|
51177
|
-
})
|
|
51178
|
-
]);
|
|
51179
|
-
var sqliteCliConfigSchema = intersectionType(
|
|
51180
|
-
configIntrospectSchema,
|
|
51181
|
-
sqliteConnectionSchema
|
|
51182
|
-
);
|
|
51183
|
-
|
|
51184
|
-
// src/cli/validations/sqlite.ts
|
|
51185
|
-
init_utils();
|
|
51186
|
-
|
|
51187
|
-
// src/cli/validations/outputs.ts
|
|
51188
|
-
init_source();
|
|
51189
|
-
var withStyle = {
|
|
51190
|
-
error: (str) => `${source_default.red(`${source_default.white.bgRed(" Invalid input ")} ${str}`)}`,
|
|
51191
|
-
warning: (str) => `${source_default.white.bgGray(" Warning ")} ${str}`
|
|
51192
|
-
};
|
|
51193
|
-
var outputs = {
|
|
51194
|
-
common: {
|
|
51195
|
-
ambiguousParams: (command) => withStyle.error(
|
|
51196
|
-
`You can't use both --config and other cli options for ${command} command`
|
|
51197
|
-
),
|
|
51198
|
-
schema: (command) => withStyle.error(`"--schema" is a required field for ${command} command`)
|
|
51199
|
-
},
|
|
51200
|
-
postgres: {
|
|
51201
|
-
connection: {
|
|
51202
|
-
driver: () => withStyle.error(
|
|
51203
|
-
`Only "pg" is available options for "--driver"`
|
|
51204
|
-
),
|
|
51205
|
-
required: () => withStyle.error(
|
|
51206
|
-
`Either "connectionString" or "host", "database" are required for database connection`
|
|
51207
|
-
)
|
|
51208
|
-
}
|
|
51209
|
-
},
|
|
51210
|
-
mysql: {
|
|
51211
|
-
connection: {
|
|
51212
|
-
driver: () => withStyle.error(
|
|
51213
|
-
`Only "mysql2" is available options for "--driver"`
|
|
51214
|
-
),
|
|
51215
|
-
required: () => withStyle.error(
|
|
51216
|
-
`Either "connectionString" or "host", "database" are required for database connection`
|
|
51217
|
-
)
|
|
51218
|
-
}
|
|
51219
|
-
},
|
|
51220
|
-
sqlite: {
|
|
51221
|
-
connection: {
|
|
51222
|
-
driver: () => withStyle.error(`Either "turso", "libsql", "better-sqlite" are available options for "--driver"`),
|
|
51223
|
-
url: (driver) => withStyle.error(`"--url" is a required option for driver "${driver}"`),
|
|
51224
|
-
authToken: (driver) => withStyle.error(
|
|
51225
|
-
`"--auth-token" is a required option for driver "${driver}"`
|
|
51226
|
-
)
|
|
51227
|
-
},
|
|
51228
|
-
introspect: {},
|
|
51229
|
-
push: {}
|
|
51230
|
-
}
|
|
51231
|
-
};
|
|
51232
|
-
|
|
51233
|
-
// src/cli/validations/common.ts
|
|
51234
|
-
var checkCollisions = (options, command, inputWhitelist = []) => {
|
|
51235
|
-
const { config, ...rest } = options;
|
|
51236
|
-
let atLeastOneParam = false;
|
|
51237
|
-
for (const key of Object.keys(rest)) {
|
|
51238
|
-
if (inputWhitelist.includes(key))
|
|
51239
|
-
continue;
|
|
51240
|
-
atLeastOneParam = true;
|
|
51241
|
-
}
|
|
51242
|
-
if (!atLeastOneParam && typeof config !== "undefined") {
|
|
51243
|
-
return {
|
|
51244
|
-
success: true,
|
|
51245
|
-
action: "config"
|
|
51246
|
-
};
|
|
51247
|
-
}
|
|
51248
|
-
if (typeof config === "undefined" && atLeastOneParam) {
|
|
51249
|
-
return {
|
|
51250
|
-
success: true,
|
|
51251
|
-
action: "cli"
|
|
51252
|
-
};
|
|
51253
|
-
}
|
|
51254
|
-
if (typeof config === "undefined" && !atLeastOneParam) {
|
|
51255
|
-
return {
|
|
51256
|
-
success: true,
|
|
51257
|
-
action: "config"
|
|
51258
|
-
};
|
|
51259
|
-
}
|
|
51260
|
-
return {
|
|
51261
|
-
success: false,
|
|
51262
|
-
message: outputs.common.ambiguousParams(command),
|
|
51263
|
-
action: "error"
|
|
51264
|
-
};
|
|
51265
|
-
};
|
|
51266
|
-
|
|
51267
|
-
// src/cli/validations/sqlite.ts
|
|
51268
|
-
var sqliteConnectionCli = unionType([
|
|
51269
|
-
objectType({
|
|
51270
|
-
driver: literalType("turso"),
|
|
51271
|
-
url: stringType(),
|
|
51272
|
-
authToken: stringType()
|
|
51273
|
-
}),
|
|
51274
|
-
objectType({
|
|
51275
|
-
driver: literalType("better-sqlite"),
|
|
51276
|
-
url: stringType()
|
|
51277
|
-
}),
|
|
51278
|
-
objectType({
|
|
51279
|
-
driver: literalType("libsql"),
|
|
51280
|
-
url: stringType()
|
|
51281
|
-
})
|
|
51282
|
-
]);
|
|
51283
|
-
var sqliteCliIntrospectParams = intersectionType(
|
|
51284
|
-
configIntrospectCliSchema,
|
|
51285
|
-
sqliteConnectionCli
|
|
51286
|
-
);
|
|
51287
|
-
var sqliteCliPushParams = intersectionType(
|
|
51288
|
-
configPushSchema,
|
|
51289
|
-
sqliteConnectionCli
|
|
51290
|
-
);
|
|
51291
|
-
var sqliteConfigPushParams = intersectionType(
|
|
51292
|
-
configPushSchema,
|
|
51293
|
-
sqliteConnectionSchema
|
|
51294
|
-
);
|
|
51295
|
-
var printCliConnectionIssues = (options) => {
|
|
51296
|
-
if (options.driver === "turso") {
|
|
51297
|
-
if (typeof options.url === "undefined") {
|
|
51298
|
-
console.log(outputs.sqlite.connection.url("turso"));
|
|
51299
|
-
}
|
|
51300
|
-
if (typeof options.authToken === "undefined") {
|
|
51301
|
-
console.log(outputs.sqlite.connection.authToken("turso"));
|
|
51302
|
-
}
|
|
51303
|
-
} else if (options.driver === "libsql") {
|
|
51304
|
-
if (typeof options.url === "undefined") {
|
|
51305
|
-
console.log(outputs.sqlite.connection.url("libsql"));
|
|
51306
|
-
}
|
|
51307
|
-
} else if (options.driver === "better-sqlite") {
|
|
51308
|
-
if (typeof options.url === "undefined") {
|
|
51309
|
-
console.log(outputs.sqlite.connection.url("better-sqlite"));
|
|
51310
|
-
}
|
|
51311
|
-
} else {
|
|
51312
|
-
console.log(outputs.sqlite.connection.driver());
|
|
51313
|
-
}
|
|
51314
|
-
};
|
|
51315
|
-
var printConfigConnectionIssues = (options) => {
|
|
51316
|
-
var _a, _b, _c;
|
|
51317
|
-
if (options.driver === "turso") {
|
|
51318
|
-
if (typeof options.url === "undefined") {
|
|
51319
|
-
console.log(outputs.sqlite.connection.url("turso"));
|
|
51320
|
-
}
|
|
51321
|
-
if (typeof ((_a = options.dbCredentials) == null ? void 0 : _a.authToken) === "undefined") {
|
|
51322
|
-
console.log(outputs.sqlite.connection.authToken("turso"));
|
|
51323
|
-
}
|
|
51324
|
-
} else if (options.driver === "libsql") {
|
|
51325
|
-
if (typeof ((_b = options.dbCredentials) == null ? void 0 : _b.url) === "undefined") {
|
|
51326
|
-
console.log(outputs.sqlite.connection.url("libsql"));
|
|
51327
|
-
}
|
|
51328
|
-
} else if (options.driver === "better-sqlite") {
|
|
51329
|
-
if (typeof ((_c = options.dbCredentials) == null ? void 0 : _c.url) === "undefined") {
|
|
51330
|
-
console.log(outputs.sqlite.connection.url("better-sqlite"));
|
|
51331
|
-
}
|
|
51332
|
-
} else {
|
|
51333
|
-
console.log(outputs.sqlite.connection.driver());
|
|
51334
|
-
}
|
|
51335
|
-
};
|
|
51336
|
-
var validateIntrospect = async (options) => {
|
|
51337
|
-
const collisionRes = checkCollisions(options, "introspect:sqlite");
|
|
51338
|
-
if (!collisionRes.success) {
|
|
51339
|
-
console.log(collisionRes.message);
|
|
51340
|
-
process.exit(1);
|
|
51341
|
-
}
|
|
51342
|
-
if (collisionRes.action === "config") {
|
|
51343
|
-
const drizzleConfig = await readDrizzleConfig(options.config);
|
|
51344
|
-
const configRes = sqliteCliConfigSchema.safeParse(drizzleConfig);
|
|
51345
|
-
if (!configRes.success) {
|
|
51346
|
-
printConfigConnectionIssues(drizzleConfig);
|
|
51347
|
-
process.exit(1);
|
|
51348
|
-
}
|
|
51349
|
-
return configRes.data;
|
|
51350
|
-
}
|
|
51351
|
-
const cliRes = sqliteCliIntrospectParams.safeParse(options);
|
|
51352
|
-
if (!cliRes.success) {
|
|
51353
|
-
printCliConnectionIssues(options);
|
|
51354
|
-
process.exit(1);
|
|
51355
|
-
}
|
|
51356
|
-
if (cliRes.data.driver === "turso") {
|
|
51357
|
-
const { authToken, url: url2, introspectCasing: introspectCasing3, ...rest2 } = cliRes.data;
|
|
51358
|
-
return {
|
|
51359
|
-
...rest2,
|
|
51360
|
-
dbCredentials: { url: url2, authToken },
|
|
51361
|
-
introspect: { casing: introspectCasing3 }
|
|
51362
|
-
};
|
|
51363
|
-
}
|
|
51364
|
-
if (cliRes.data.driver === "libsql") {
|
|
51365
|
-
const { url: url2, introspectCasing: introspectCasing3, ...rest2 } = cliRes.data;
|
|
51366
|
-
return {
|
|
51367
|
-
...rest2,
|
|
51368
|
-
dbCredentials: { url: url2 },
|
|
51369
|
-
introspect: { casing: introspectCasing3 }
|
|
51370
|
-
};
|
|
51371
|
-
}
|
|
51372
|
-
const { url, introspectCasing: introspectCasing2, ...rest } = cliRes.data;
|
|
51373
|
-
return {
|
|
51374
|
-
...rest,
|
|
51375
|
-
dbCredentials: { url },
|
|
51376
|
-
introspect: { casing: introspectCasing2 }
|
|
51377
|
-
};
|
|
51378
|
-
};
|
|
51379
|
-
var validatePush = async (options) => {
|
|
51380
|
-
const collisionRes = checkCollisions(options, "push:sqlite");
|
|
51381
|
-
if (!collisionRes.success) {
|
|
51382
|
-
console.log(collisionRes.message);
|
|
51383
|
-
console.log();
|
|
51384
|
-
process.exit(1);
|
|
51385
|
-
}
|
|
51386
|
-
if (collisionRes.action === "config") {
|
|
51387
|
-
const drizzleConfig = await readDrizzleConfig(options.config);
|
|
51388
|
-
const configRes = sqliteConfigPushParams.safeParse(drizzleConfig);
|
|
51389
|
-
if (!configRes.success) {
|
|
51390
|
-
printConfigConnectionIssues(drizzleConfig);
|
|
51391
|
-
process.exit(1);
|
|
51392
|
-
}
|
|
51393
|
-
return configRes.data;
|
|
51394
|
-
}
|
|
51395
|
-
const cliRes = sqliteCliPushParams.safeParse(options);
|
|
51396
|
-
if (!cliRes.success) {
|
|
51397
|
-
if (typeof options.schema === "undefined") {
|
|
51398
|
-
console.log(outputs.common.schema("push:sqlite"));
|
|
51399
|
-
}
|
|
51400
|
-
printCliConnectionIssues(options);
|
|
51401
|
-
process.exit(1);
|
|
51402
|
-
}
|
|
51403
|
-
if (cliRes.data.driver === "turso") {
|
|
51404
|
-
const { authToken, url: url2, ...rest2 } = cliRes.data;
|
|
51405
|
-
return { ...rest2, dbCredentials: { url: url2, authToken } };
|
|
51406
|
-
}
|
|
51407
|
-
const { url, ...rest } = cliRes.data;
|
|
51408
|
-
return { ...rest, dbCredentials: { url } };
|
|
51409
|
-
};
|
|
51410
|
-
|
|
51411
|
-
// src/cli/validations/pg.ts
|
|
51412
|
-
init_lib();
|
|
51413
|
-
init_utils();
|
|
51414
|
-
var pgConnectionCli = unionType([
|
|
51415
|
-
objectType({
|
|
51416
|
-
driver: literalType("pg"),
|
|
51417
|
-
host: stringType(),
|
|
51418
|
-
port: coerce.number().optional(),
|
|
51419
|
-
user: stringType().default("postgres"),
|
|
51420
|
-
password: stringType().optional(),
|
|
51421
|
-
database: stringType(),
|
|
51422
|
-
ssl: coerce.boolean().optional(),
|
|
51423
|
-
type: literalType("params").default("params")
|
|
51424
|
-
}),
|
|
51425
|
-
objectType({
|
|
51426
|
-
driver: literalType("pg"),
|
|
51427
|
-
connectionString: stringType(),
|
|
51428
|
-
type: literalType("url").default("url")
|
|
51429
|
-
})
|
|
51430
|
-
]);
|
|
51431
|
-
var pgConnectionConfig = unionType([
|
|
51432
|
-
objectType({
|
|
51433
|
-
driver: literalType("pg"),
|
|
51434
|
-
dbCredentials: objectType({
|
|
51435
|
-
host: stringType(),
|
|
51436
|
-
port: coerce.number().optional(),
|
|
51437
|
-
user: stringType().default("postgres"),
|
|
51438
|
-
password: stringType().optional(),
|
|
51439
|
-
database: stringType(),
|
|
51440
|
-
ssl: coerce.boolean().optional()
|
|
51441
|
-
})
|
|
51442
|
-
}),
|
|
51443
|
-
objectType({
|
|
51444
|
-
driver: literalType("pg"),
|
|
51445
|
-
dbCredentials: objectType({
|
|
51446
|
-
connectionString: stringType()
|
|
51447
|
-
})
|
|
51448
|
-
})
|
|
51449
|
-
]);
|
|
51450
|
-
var pgConfigIntrospectSchema = intersectionType(
|
|
51451
|
-
configIntrospectSchema,
|
|
51452
|
-
pgConnectionConfig
|
|
51453
|
-
);
|
|
51454
|
-
var pgCliIntrospectParams = intersectionType(
|
|
51455
|
-
configIntrospectCliSchema,
|
|
51456
|
-
pgConnectionCli
|
|
51457
|
-
);
|
|
51458
|
-
var printCliConnectionIssues2 = (options) => {
|
|
51459
|
-
if (options.driver === "pg") {
|
|
51460
|
-
if (typeof options.connectionString === "undefined" && (typeof options.host === "undefined" || typeof options.database === "undefined")) {
|
|
51461
|
-
console.log(outputs.postgres.connection.required());
|
|
51462
|
-
}
|
|
51463
|
-
} else {
|
|
51464
|
-
console.log(outputs.postgres.connection.driver());
|
|
51465
|
-
}
|
|
51466
|
-
};
|
|
51467
|
-
var printConfigConnectionIssues2 = (options) => {
|
|
51468
|
-
if (options.driver === "pg") {
|
|
51469
|
-
if (typeof options.dbCredentials.connectionString === "undefined" && (typeof options.dbCredentials.host === "undefined" || typeof options.dbCredentials.database === "undefined")) {
|
|
51470
|
-
console.log(outputs.postgres.connection.required());
|
|
51471
|
-
}
|
|
51472
|
-
} else {
|
|
51473
|
-
console.log(outputs.postgres.connection.driver());
|
|
51474
|
-
}
|
|
51475
|
-
};
|
|
51476
|
-
var validatePgIntrospect = async (options) => {
|
|
51477
|
-
const collisionRes = checkCollisions(options, "introspect:pg");
|
|
51478
|
-
if (!collisionRes.success) {
|
|
51479
|
-
console.log(collisionRes.message);
|
|
51480
|
-
process.exit(1);
|
|
51481
|
-
}
|
|
51482
|
-
if (collisionRes.action === "config") {
|
|
51483
|
-
const drizzleConfig = await readDrizzleConfig(options.config);
|
|
51484
|
-
const configRes = pgConfigIntrospectSchema.safeParse(drizzleConfig);
|
|
51485
|
-
if (!configRes.success) {
|
|
51486
|
-
printConfigConnectionIssues2(drizzleConfig);
|
|
51487
|
-
process.exit(1);
|
|
51488
|
-
}
|
|
51489
|
-
return configRes.data;
|
|
51490
|
-
}
|
|
51491
|
-
const cliRes = pgCliIntrospectParams.safeParse(options);
|
|
51492
|
-
if (!cliRes.success) {
|
|
51493
|
-
printCliConnectionIssues2(options);
|
|
51494
|
-
process.exit(1);
|
|
51495
|
-
}
|
|
51496
|
-
if (cliRes.data.type === "url") {
|
|
51497
|
-
const { connectionString, introspectCasing: introspectCasing3, ...rest2 } = cliRes.data;
|
|
51498
|
-
return {
|
|
51499
|
-
...rest2,
|
|
51500
|
-
dbCredentials: { connectionString },
|
|
51501
|
-
introspect: { casing: introspectCasing3 }
|
|
51502
|
-
};
|
|
51503
|
-
}
|
|
51504
|
-
const {
|
|
51505
|
-
host,
|
|
51506
|
-
password,
|
|
51507
|
-
port,
|
|
51508
|
-
database,
|
|
51509
|
-
ssl,
|
|
51510
|
-
user,
|
|
51511
|
-
introspectCasing: introspectCasing2,
|
|
51512
|
-
...rest
|
|
51513
|
-
} = cliRes.data;
|
|
51514
|
-
return {
|
|
51515
|
-
...rest,
|
|
51516
|
-
dbCredentials: { host, password, port, database, ssl, user },
|
|
51517
|
-
introspect: { casing: introspectCasing2 }
|
|
51518
|
-
};
|
|
51519
|
-
};
|
|
51520
|
-
|
|
51521
|
-
// src/cli/validations/mysql.ts
|
|
51522
|
-
init_lib();
|
|
51523
|
-
init_utils();
|
|
51524
|
-
var mysqlConnectionCli = unionType([
|
|
51525
|
-
objectType({
|
|
51526
|
-
driver: literalType("mysql2"),
|
|
51527
|
-
host: stringType(),
|
|
51528
|
-
port: coerce.number().optional(),
|
|
51529
|
-
user: stringType().default("mysql"),
|
|
51530
|
-
password: stringType().optional(),
|
|
51531
|
-
database: stringType(),
|
|
51532
|
-
type: literalType("params").default("params")
|
|
51533
|
-
}),
|
|
51534
|
-
objectType({
|
|
51535
|
-
driver: literalType("mysql2"),
|
|
51536
|
-
connectionString: stringType(),
|
|
51537
|
-
type: literalType("url").default("url")
|
|
51538
|
-
})
|
|
51539
|
-
]);
|
|
51540
|
-
var mysqlConnectionConfig = unionType([
|
|
51541
|
-
objectType({
|
|
51542
|
-
driver: literalType("mysql2"),
|
|
51543
|
-
dbCredentials: objectType({
|
|
51544
|
-
host: stringType(),
|
|
51545
|
-
port: coerce.number().optional(),
|
|
51546
|
-
user: stringType().default("mysql"),
|
|
51547
|
-
password: stringType().optional(),
|
|
51548
|
-
database: stringType(),
|
|
51549
|
-
type: literalType("params").default("params")
|
|
51550
|
-
})
|
|
51551
|
-
}),
|
|
51552
|
-
objectType({
|
|
51553
|
-
driver: literalType("mysql2"),
|
|
51554
|
-
dbCredentials: objectType({
|
|
51555
|
-
connectionString: stringType(),
|
|
51556
|
-
type: literalType("url").default("url")
|
|
51557
|
-
})
|
|
51558
|
-
})
|
|
51559
|
-
]);
|
|
51560
|
-
var mysqlConfigIntrospectSchema = intersectionType(
|
|
51561
|
-
configIntrospectSchema,
|
|
51562
|
-
mysqlConnectionConfig
|
|
51563
|
-
);
|
|
51564
|
-
var mysqlCliIntrospectParams = intersectionType(
|
|
51565
|
-
configIntrospectCliSchema,
|
|
51566
|
-
mysqlConnectionCli
|
|
51567
|
-
);
|
|
51568
|
-
var mysqlCliPushParams = intersectionType(
|
|
51569
|
-
configPushSchema,
|
|
51570
|
-
mysqlConnectionCli
|
|
51571
|
-
);
|
|
51572
|
-
var mysqlConfigPushParams = intersectionType(
|
|
51573
|
-
configPushSchema,
|
|
51574
|
-
mysqlConnectionConfig
|
|
51575
|
-
);
|
|
51576
|
-
var printCliConnectionIssues3 = (options) => {
|
|
51577
|
-
if (options.driver === "mysql2") {
|
|
51578
|
-
if (typeof options.connectionString === "undefined" && (typeof options.host === "undefined" || typeof options.database === "undefined")) {
|
|
51579
|
-
console.log(outputs.mysql.connection.required());
|
|
51580
|
-
}
|
|
51581
|
-
} else {
|
|
51582
|
-
console.log(outputs.mysql.connection.driver());
|
|
51583
|
-
}
|
|
51584
|
-
};
|
|
51585
|
-
var printConfigConnectionIssues3 = (options) => {
|
|
51586
|
-
if (options.driver === "mysql2") {
|
|
51587
|
-
if (typeof options.dbCredentials.connectionString === "undefined" && (typeof options.dbCredentials.host === "undefined" || typeof options.dbCredentials.database === "undefined")) {
|
|
51588
|
-
console.log(outputs.mysql.connection.required());
|
|
51589
|
-
}
|
|
51590
|
-
} else {
|
|
51591
|
-
console.log(outputs.mysql.connection.driver());
|
|
51592
|
-
}
|
|
51593
|
-
};
|
|
51594
|
-
var validateMySqlIntrospect = async (options) => {
|
|
51595
|
-
const collisionRes = checkCollisions(options, "introspect:mysql");
|
|
51596
|
-
if (!collisionRes.success) {
|
|
51597
|
-
console.log(collisionRes.message);
|
|
51598
|
-
process.exit(1);
|
|
51599
|
-
}
|
|
51600
|
-
if (collisionRes.action === "config") {
|
|
51601
|
-
const drizzleConfig = await readDrizzleConfig(options.config);
|
|
51602
|
-
const configRes = mysqlConfigIntrospectSchema.safeParse(drizzleConfig);
|
|
51603
|
-
if (!configRes.success) {
|
|
51604
|
-
printConfigConnectionIssues3(drizzleConfig);
|
|
51605
|
-
process.exit(1);
|
|
51606
|
-
}
|
|
51607
|
-
return configRes.data;
|
|
51608
|
-
}
|
|
51609
|
-
const cliRes = mysqlCliIntrospectParams.safeParse(options);
|
|
51610
|
-
if (!cliRes.success) {
|
|
51611
|
-
printCliConnectionIssues3(options);
|
|
51612
|
-
process.exit(1);
|
|
51613
|
-
}
|
|
51614
|
-
if (cliRes.data.type === "url") {
|
|
51615
|
-
const { connectionString, introspectCasing: introspectCasing3, type: type2, ...rest2 } = cliRes.data;
|
|
51616
|
-
return {
|
|
51617
|
-
...rest2,
|
|
51618
|
-
dbCredentials: { connectionString, type: type2 },
|
|
51619
|
-
introspect: { casing: introspectCasing3 }
|
|
51620
|
-
};
|
|
51621
|
-
}
|
|
51622
|
-
const {
|
|
51623
|
-
host,
|
|
51624
|
-
password,
|
|
51625
|
-
port,
|
|
51626
|
-
database,
|
|
51627
|
-
user,
|
|
51628
|
-
type,
|
|
51629
|
-
introspectCasing: introspectCasing2,
|
|
51630
|
-
...rest
|
|
51631
|
-
} = cliRes.data;
|
|
51632
|
-
return {
|
|
51633
|
-
...rest,
|
|
51634
|
-
dbCredentials: { host, password, port, database, user, type },
|
|
51635
|
-
introspect: { casing: introspectCasing2 }
|
|
51636
|
-
};
|
|
51637
|
-
};
|
|
51638
|
-
var validateMySqlPush = async (options) => {
|
|
51639
|
-
const collisionRes = checkCollisions(options, "push:mysql");
|
|
51640
|
-
if (!collisionRes.success) {
|
|
51641
|
-
console.log(collisionRes.message);
|
|
51642
|
-
console.log();
|
|
51643
|
-
process.exit(1);
|
|
51644
|
-
}
|
|
51645
|
-
if (collisionRes.action === "config") {
|
|
51646
|
-
const drizzleConfig = await readDrizzleConfig(options.config);
|
|
51647
|
-
const configRes = mysqlConfigPushParams.safeParse(drizzleConfig);
|
|
51648
|
-
if (!configRes.success) {
|
|
51649
|
-
printConfigConnectionIssues3(drizzleConfig);
|
|
51650
|
-
process.exit(1);
|
|
51651
|
-
}
|
|
51652
|
-
return configRes.data;
|
|
51653
|
-
}
|
|
51654
|
-
const cliRes = mysqlCliPushParams.safeParse(options);
|
|
51655
|
-
if (!cliRes.success) {
|
|
51656
|
-
if (typeof options.schema === "undefined") {
|
|
51657
|
-
console.log(outputs.common.schema("push:mysql"));
|
|
51658
|
-
}
|
|
51659
|
-
printCliConnectionIssues3(options);
|
|
51660
|
-
process.exit(1);
|
|
51661
|
-
}
|
|
51662
|
-
if (cliRes.data.type === "url") {
|
|
51663
|
-
const { connectionString, type: type2, ...rest2 } = cliRes.data;
|
|
51664
|
-
return {
|
|
51665
|
-
...rest2,
|
|
51666
|
-
dbCredentials: { connectionString, type: type2 }
|
|
51667
|
-
};
|
|
51668
|
-
}
|
|
51669
|
-
const { host, password, port, database, user, type, ...rest } = cliRes.data;
|
|
51670
|
-
return {
|
|
51671
|
-
...rest,
|
|
51672
|
-
dbCredentials: { host, password, port, database, user, type }
|
|
51673
|
-
};
|
|
51674
|
-
};
|
|
51675
|
-
|
|
51676
|
-
// src/cli/index.ts
|
|
51934
|
+
init_sqlite();
|
|
51935
|
+
init_pg();
|
|
51936
|
+
init_common();
|
|
51937
|
+
init_mysql();
|
|
51938
|
+
init_outputs();
|
|
51939
|
+
var import_studio = require("@drizzle-team/studio");
|
|
51677
51940
|
var printVersions = async () => {
|
|
51678
51941
|
const v = await versions();
|
|
51679
51942
|
console.log(`${source_default.gray(v)}
|
|
@@ -52263,6 +52526,37 @@ var dropCommand = new import_commander.Command("drop").option("--out <out>", `Ou
|
|
|
52263
52526
|
assertV1OutFolder(out, "{dialect}");
|
|
52264
52527
|
await dropMigration(out);
|
|
52265
52528
|
});
|
|
52529
|
+
var studioCommand = new import_commander.Command("studio").option("--port <port>", "Custom port for drizzle studio [default=4983]").option("--verbose", "Print all stataments that are executed by Studio").option("--config <config>", `Config path [default=drizzle.config.ts]`).action(async (options) => {
|
|
52530
|
+
const { validateStudio: validateStudio2 } = await Promise.resolve().then(() => (init_studio(), studio_exports));
|
|
52531
|
+
const drizzleConfig = await validateStudio2(options);
|
|
52532
|
+
const { prepareModels: prepareModels2, drizzleDb: drizzleDb2 } = await Promise.resolve().then(() => (init_studioUtils(), studioUtils_exports));
|
|
52533
|
+
const models = await prepareModels2(drizzleConfig.schema);
|
|
52534
|
+
const setup = await drizzleDb2(drizzleConfig, models, options.verbose);
|
|
52535
|
+
const server = await (0, import_studio.prepareServer)(setup);
|
|
52536
|
+
const port = options.port ?? 4983;
|
|
52537
|
+
console.log();
|
|
52538
|
+
console.log(
|
|
52539
|
+
withStyle.fullWarning(
|
|
52540
|
+
"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"
|
|
52541
|
+
)
|
|
52542
|
+
);
|
|
52543
|
+
server.start({
|
|
52544
|
+
host: "127.0.0.1",
|
|
52545
|
+
port,
|
|
52546
|
+
cb: (err2, address) => {
|
|
52547
|
+
if (err2) {
|
|
52548
|
+
console.error(err2);
|
|
52549
|
+
} else {
|
|
52550
|
+
console.log(
|
|
52551
|
+
`
|
|
52552
|
+
Drizzle Studio is up and running on ${source_default.blue(
|
|
52553
|
+
address
|
|
52554
|
+
)}`
|
|
52555
|
+
);
|
|
52556
|
+
}
|
|
52557
|
+
}
|
|
52558
|
+
});
|
|
52559
|
+
});
|
|
52266
52560
|
var main = async () => {
|
|
52267
52561
|
const version2 = await versions();
|
|
52268
52562
|
import_commander.program.version(version2, "--version, -v");
|
|
@@ -52281,6 +52575,7 @@ var main = async () => {
|
|
|
52281
52575
|
import_commander.program.addCommand(introspectSQLiteCommand);
|
|
52282
52576
|
import_commander.program.addCommand(dbPushSqliteCommand);
|
|
52283
52577
|
import_commander.program.addCommand(checkMySqlCommand);
|
|
52578
|
+
import_commander.program.addCommand(studioCommand);
|
|
52284
52579
|
import_commander.program.parse();
|
|
52285
52580
|
};
|
|
52286
52581
|
main();
|