drizzle-kit 0.21.4 → 0.22.0-18d9643
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +1256 -526
- package/index.d.mts +6 -11
- package/index.d.ts +6 -11
- package/package.json +4 -4
- package/payload.d.mts +188 -20
- package/payload.d.ts +188 -20
- package/payload.js +2477 -1404
- package/payload.mjs +2507 -1425
- package/utils-studio.js +297 -31
- package/utils-studio.mjs +297 -31
- package/utils.js +141 -10
- package/utils.mjs +140 -10
package/bin.cjs
CHANGED
@@ -1092,7 +1092,7 @@ var init_views = __esm({
|
|
1092
1092
|
return source_default.grey(msg);
|
1093
1093
|
};
|
1094
1094
|
error = (error2, greyMsg = "") => {
|
1095
|
-
return `${source_default.
|
1095
|
+
return `${source_default.bgRed.bold(" Error ")} ${error2} ${greyMsg ? source_default.grey(greyMsg) : ""}`.trim();
|
1096
1096
|
};
|
1097
1097
|
schema = (schema5) => {
|
1098
1098
|
const tables = Object.values(schema5.tables);
|
@@ -1451,12 +1451,15 @@ Is ${source_default.bold.blue(
|
|
1451
1451
|
function assertUnreachable(x3) {
|
1452
1452
|
throw new Error("Didn't expect to get here");
|
1453
1453
|
}
|
1454
|
+
function softAssertUnreachable(x3) {
|
1455
|
+
return null;
|
1456
|
+
}
|
1454
1457
|
var originUUID, snapshotVersion, mapValues, mapKeys, mapEntries;
|
1455
1458
|
var init_global = __esm({
|
1456
1459
|
"src/global.ts"() {
|
1457
1460
|
"use strict";
|
1458
1461
|
originUUID = "00000000-0000-0000-0000-000000000000";
|
1459
|
-
snapshotVersion = "
|
1462
|
+
snapshotVersion = "7";
|
1460
1463
|
mapValues = (obj, map) => {
|
1461
1464
|
const result = Object.keys(obj).reduce(function(result2, key) {
|
1462
1465
|
result2[key] = map(obj[key]);
|
@@ -5474,7 +5477,16 @@ var init_mysqlSchema = __esm({
|
|
5474
5477
|
objectType({ isDefaultAnExpression: booleanType().optional() }).optional()
|
5475
5478
|
)
|
5476
5479
|
}).optional()
|
5477
|
-
)
|
5480
|
+
).optional(),
|
5481
|
+
indexes: recordType(
|
5482
|
+
stringType(),
|
5483
|
+
objectType({
|
5484
|
+
columns: recordType(
|
5485
|
+
stringType(),
|
5486
|
+
objectType({ isExpression: booleanType().optional() }).optional()
|
5487
|
+
)
|
5488
|
+
}).optional()
|
5489
|
+
).optional()
|
5478
5490
|
}).optional();
|
5479
5491
|
dialect = literalType("mysql");
|
5480
5492
|
schemaHash = objectType({
|
@@ -5658,7 +5670,7 @@ var init_mysqlSchema = __esm({
|
|
5658
5670
|
});
|
5659
5671
|
|
5660
5672
|
// src/serializer/pgSchema.ts
|
5661
|
-
var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, index2, fk2, column2, tableV32, compositePK2, uniqueConstraint2, tableV42, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaExternal, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
|
5673
|
+
var indexV2, columnV2, tableV2, enumSchemaV1, enumSchema, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn, index2, indexV4, indexV5, indexV6, fk2, column2, tableV32, compositePK2, uniqueConstraint2, tableV42, tableV6, tableV5, table2, schemaHash2, kitInternals2, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternal, tableSquashed2, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg;
|
5662
5674
|
var init_pgSchema = __esm({
|
5663
5675
|
"src/serializer/pgSchema.ts"() {
|
5664
5676
|
"use strict";
|
@@ -5726,10 +5738,48 @@ var init_pgSchema = __esm({
|
|
5726
5738
|
tables: recordType(stringType(), tableV1),
|
5727
5739
|
enums: recordType(stringType(), enumSchemaV1)
|
5728
5740
|
}).strict();
|
5741
|
+
indexColumn = objectType({
|
5742
|
+
expression: stringType(),
|
5743
|
+
isExpression: booleanType(),
|
5744
|
+
asc: booleanType(),
|
5745
|
+
nulls: stringType().optional(),
|
5746
|
+
opclass: stringType().optional()
|
5747
|
+
});
|
5729
5748
|
index2 = objectType({
|
5749
|
+
name: stringType(),
|
5750
|
+
columns: indexColumn.array(),
|
5751
|
+
isUnique: booleanType(),
|
5752
|
+
with: recordType(stringType(), anyType()).optional(),
|
5753
|
+
method: stringType().default("btree"),
|
5754
|
+
where: stringType().optional(),
|
5755
|
+
concurrently: booleanType().default(false)
|
5756
|
+
}).strict();
|
5757
|
+
indexV4 = objectType({
|
5730
5758
|
name: stringType(),
|
5731
5759
|
columns: stringType().array(),
|
5732
|
-
isUnique: booleanType()
|
5760
|
+
isUnique: booleanType(),
|
5761
|
+
with: recordType(stringType(), stringType()).optional(),
|
5762
|
+
method: stringType().default("btree"),
|
5763
|
+
where: stringType().optional(),
|
5764
|
+
concurrently: booleanType().default(false)
|
5765
|
+
}).strict();
|
5766
|
+
indexV5 = objectType({
|
5767
|
+
name: stringType(),
|
5768
|
+
columns: stringType().array(),
|
5769
|
+
isUnique: booleanType(),
|
5770
|
+
with: recordType(stringType(), stringType()).optional(),
|
5771
|
+
method: stringType().default("btree"),
|
5772
|
+
where: stringType().optional(),
|
5773
|
+
concurrently: booleanType().default(false)
|
5774
|
+
}).strict();
|
5775
|
+
indexV6 = objectType({
|
5776
|
+
name: stringType(),
|
5777
|
+
columns: stringType().array(),
|
5778
|
+
isUnique: booleanType(),
|
5779
|
+
with: recordType(stringType(), stringType()).optional(),
|
5780
|
+
method: stringType().default("btree"),
|
5781
|
+
where: stringType().optional(),
|
5782
|
+
concurrently: booleanType().default(false)
|
5733
5783
|
}).strict();
|
5734
5784
|
fk2 = objectType({
|
5735
5785
|
name: stringType(),
|
@@ -5771,9 +5821,27 @@ var init_pgSchema = __esm({
|
|
5771
5821
|
name: stringType(),
|
5772
5822
|
schema: stringType(),
|
5773
5823
|
columns: recordType(stringType(), column2),
|
5774
|
-
indexes: recordType(stringType(),
|
5824
|
+
indexes: recordType(stringType(), indexV4),
|
5775
5825
|
foreignKeys: recordType(stringType(), fk2)
|
5776
5826
|
}).strict();
|
5827
|
+
tableV6 = objectType({
|
5828
|
+
name: stringType(),
|
5829
|
+
schema: stringType(),
|
5830
|
+
columns: recordType(stringType(), column2),
|
5831
|
+
indexes: recordType(stringType(), indexV6),
|
5832
|
+
foreignKeys: recordType(stringType(), fk2),
|
5833
|
+
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
5834
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
5835
|
+
}).strict();
|
5836
|
+
tableV5 = objectType({
|
5837
|
+
name: stringType(),
|
5838
|
+
schema: stringType(),
|
5839
|
+
columns: recordType(stringType(), column2),
|
5840
|
+
indexes: recordType(stringType(), indexV5),
|
5841
|
+
foreignKeys: recordType(stringType(), fk2),
|
5842
|
+
compositePrimaryKeys: recordType(stringType(), compositePK2),
|
5843
|
+
uniqueConstraints: recordType(stringType(), uniqueConstraint2).default({})
|
5844
|
+
}).strict();
|
5777
5845
|
table2 = objectType({
|
5778
5846
|
name: stringType(),
|
5779
5847
|
schema: stringType(),
|
@@ -5818,7 +5886,7 @@ var init_pgSchema = __esm({
|
|
5818
5886
|
pgSchemaInternalV5 = objectType({
|
5819
5887
|
version: literalType("5"),
|
5820
5888
|
dialect: literalType("pg"),
|
5821
|
-
tables: recordType(stringType(),
|
5889
|
+
tables: recordType(stringType(), tableV5),
|
5822
5890
|
enums: recordType(stringType(), enumSchemaV1),
|
5823
5891
|
schemas: recordType(stringType(), stringType()),
|
5824
5892
|
_meta: objectType({
|
@@ -5828,6 +5896,19 @@ var init_pgSchema = __esm({
|
|
5828
5896
|
}),
|
5829
5897
|
internal: kitInternals2
|
5830
5898
|
}).strict();
|
5899
|
+
pgSchemaInternalV6 = objectType({
|
5900
|
+
version: literalType("6"),
|
5901
|
+
dialect: literalType("postgresql"),
|
5902
|
+
tables: recordType(stringType(), tableV6),
|
5903
|
+
enums: recordType(stringType(), enumSchema),
|
5904
|
+
schemas: recordType(stringType(), stringType()),
|
5905
|
+
_meta: objectType({
|
5906
|
+
schemas: recordType(stringType(), stringType()),
|
5907
|
+
tables: recordType(stringType(), stringType()),
|
5908
|
+
columns: recordType(stringType(), stringType())
|
5909
|
+
}),
|
5910
|
+
internal: kitInternals2
|
5911
|
+
}).strict();
|
5831
5912
|
pgSchemaExternal = objectType({
|
5832
5913
|
version: literalType("5"),
|
5833
5914
|
dialect: literalType("pg"),
|
@@ -5841,7 +5922,7 @@ var init_pgSchema = __esm({
|
|
5841
5922
|
})
|
5842
5923
|
}).strict();
|
5843
5924
|
pgSchemaInternal = objectType({
|
5844
|
-
version: literalType("
|
5925
|
+
version: literalType("7"),
|
5845
5926
|
dialect: literalType("postgresql"),
|
5846
5927
|
tables: recordType(stringType(), table2),
|
5847
5928
|
enums: recordType(stringType(), enumSchema),
|
@@ -5876,29 +5957,94 @@ var init_pgSchema = __esm({
|
|
5876
5957
|
enums: recordType(stringType(), enumSchemaV1),
|
5877
5958
|
schemas: recordType(stringType(), stringType())
|
5878
5959
|
}).strict();
|
5879
|
-
|
5960
|
+
pgSchemaSquashedV6 = objectType({
|
5880
5961
|
version: literalType("6"),
|
5881
5962
|
dialect: literalType("postgresql"),
|
5882
5963
|
tables: recordType(stringType(), tableSquashed2),
|
5883
5964
|
enums: recordType(stringType(), enumSchema),
|
5884
5965
|
schemas: recordType(stringType(), stringType())
|
5885
5966
|
}).strict();
|
5967
|
+
pgSchemaSquashed = objectType({
|
5968
|
+
version: literalType("7"),
|
5969
|
+
dialect: literalType("postgresql"),
|
5970
|
+
tables: recordType(stringType(), tableSquashed2),
|
5971
|
+
enums: recordType(stringType(), enumSchema),
|
5972
|
+
schemas: recordType(stringType(), stringType())
|
5973
|
+
}).strict();
|
5886
5974
|
pgSchemaV3 = pgSchemaInternalV3.merge(schemaHash2);
|
5887
5975
|
pgSchemaV4 = pgSchemaInternalV4.merge(schemaHash2);
|
5888
5976
|
pgSchemaV5 = pgSchemaInternalV5.merge(schemaHash2);
|
5977
|
+
pgSchemaV6 = pgSchemaInternalV6.merge(schemaHash2);
|
5889
5978
|
pgSchema = pgSchemaInternal.merge(schemaHash2);
|
5890
|
-
backwardCompatiblePgSchema = unionType([
|
5979
|
+
backwardCompatiblePgSchema = unionType([
|
5980
|
+
pgSchemaV5,
|
5981
|
+
pgSchemaV6,
|
5982
|
+
pgSchema
|
5983
|
+
]);
|
5891
5984
|
PgSquasher = {
|
5892
5985
|
squashIdx: (idx) => {
|
5893
5986
|
index2.parse(idx);
|
5894
|
-
return `${idx.name};${idx.columns.
|
5987
|
+
return `${idx.name};${idx.columns.map(
|
5988
|
+
(c) => `${c.expression},${c.isExpression},${c.asc},${c.nulls},${c.opclass}`
|
5989
|
+
).join(",,")};${idx.isUnique};${idx.concurrently};${idx.method};${idx.where};${JSON.stringify(idx.with)}`;
|
5895
5990
|
},
|
5896
5991
|
unsquashIdx: (input) => {
|
5897
|
-
const [
|
5992
|
+
const [
|
5993
|
+
name,
|
5994
|
+
columnsString,
|
5995
|
+
isUnique,
|
5996
|
+
concurrently,
|
5997
|
+
method,
|
5998
|
+
where,
|
5999
|
+
idxWith
|
6000
|
+
] = input.split(";");
|
6001
|
+
const columnString = columnsString.split(",,");
|
6002
|
+
const columns = [];
|
6003
|
+
for (const column7 of columnString) {
|
6004
|
+
const [expression, isExpression, asc, nulls, opclass] = column7.split(",");
|
6005
|
+
columns.push({
|
6006
|
+
nulls,
|
6007
|
+
isExpression: isExpression === "true",
|
6008
|
+
asc: asc === "true",
|
6009
|
+
expression,
|
6010
|
+
opclass: opclass === "undefined" ? void 0 : opclass
|
6011
|
+
});
|
6012
|
+
}
|
5898
6013
|
const result = index2.parse({
|
5899
6014
|
name,
|
5900
|
-
columns
|
5901
|
-
isUnique: isUnique === "true"
|
6015
|
+
columns,
|
6016
|
+
isUnique: isUnique === "true",
|
6017
|
+
concurrently: concurrently === "true",
|
6018
|
+
method,
|
6019
|
+
where: where === "undefined" ? void 0 : where,
|
6020
|
+
with: !idxWith || idxWith === "undefined" ? void 0 : JSON.parse(idxWith)
|
6021
|
+
});
|
6022
|
+
return result;
|
6023
|
+
},
|
6024
|
+
squashIdxPush: (idx) => {
|
6025
|
+
index2.parse(idx);
|
6026
|
+
return `${idx.name};${idx.columns.map((c) => `${c.isExpression ? "" : c.expression},${c.asc},${c.nulls}`).join(",,")};${idx.isUnique};${idx.method};${JSON.stringify(idx.with)}`;
|
6027
|
+
},
|
6028
|
+
unsquashIdxPush: (input) => {
|
6029
|
+
const [name, columnsString, isUnique, method, idxWith] = input.split(";");
|
6030
|
+
const columnString = columnsString.split(",,");
|
6031
|
+
const columns = [];
|
6032
|
+
for (const column7 of columnString) {
|
6033
|
+
const [expression, asc, nulls, opclass] = column7.split(",");
|
6034
|
+
columns.push({
|
6035
|
+
nulls,
|
6036
|
+
isExpression: expression === "",
|
6037
|
+
asc: asc === "true",
|
6038
|
+
expression
|
6039
|
+
});
|
6040
|
+
}
|
6041
|
+
const result = index2.parse({
|
6042
|
+
name,
|
6043
|
+
columns,
|
6044
|
+
isUnique: isUnique === "true",
|
6045
|
+
concurrently: false,
|
6046
|
+
method,
|
6047
|
+
with: idxWith === "undefined" ? void 0 : JSON.parse(idxWith)
|
5902
6048
|
});
|
5903
6049
|
return result;
|
5904
6050
|
},
|
@@ -5947,11 +6093,11 @@ var init_pgSchema = __esm({
|
|
5947
6093
|
return result;
|
5948
6094
|
}
|
5949
6095
|
};
|
5950
|
-
squashPgScheme = (json) => {
|
6096
|
+
squashPgScheme = (json, action) => {
|
5951
6097
|
const mappedTables = Object.fromEntries(
|
5952
6098
|
Object.entries(json.tables).map((it) => {
|
5953
6099
|
const squashedIndexes = mapValues(it[1].indexes, (index4) => {
|
5954
|
-
return PgSquasher.squashIdx(index4);
|
6100
|
+
return action === "push" ? PgSquasher.squashIdxPush(index4) : PgSquasher.squashIdx(index4);
|
5955
6101
|
});
|
5956
6102
|
const squashedFKs = mapValues(it[1].foreignKeys, (fk4) => {
|
5957
6103
|
return PgSquasher.squashFK(fk4);
|
@@ -5980,7 +6126,7 @@ var init_pgSchema = __esm({
|
|
5980
6126
|
})
|
5981
6127
|
);
|
5982
6128
|
return {
|
5983
|
-
version: "
|
6129
|
+
version: "7",
|
5984
6130
|
dialect: json.dialect,
|
5985
6131
|
tables: mappedTables,
|
5986
6132
|
enums: json.enums,
|
@@ -6005,7 +6151,7 @@ var init_pgSchema = __esm({
|
|
6005
6151
|
});
|
6006
6152
|
|
6007
6153
|
// src/serializer/sqliteSchema.ts
|
6008
|
-
var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, schemaInternalV52, latestVersion, schemaInternal2, schemaV32, schemaV42, schemaV52, schema3, tableSquashed3, schemaSquashed2, SQLiteSquasher, squashSqliteScheme, drySQLite, sqliteSchemaV5, sqliteSchema, SQLiteSchemaSquashed, backwardCompatibleSqliteSchema;
|
6154
|
+
var index3, fk3, compositePK3, column3, tableV33, uniqueConstraint3, table3, dialect2, schemaHash3, schemaInternalV32, schemaInternalV42, schemaInternalV52, kitInternals3, latestVersion, schemaInternal2, schemaV32, schemaV42, schemaV52, schema3, tableSquashed3, schemaSquashed2, SQLiteSquasher, squashSqliteScheme, drySQLite, sqliteSchemaV5, sqliteSchema, SQLiteSchemaSquashed, backwardCompatibleSqliteSchema;
|
6009
6155
|
var init_sqliteSchema = __esm({
|
6010
6156
|
"src/serializer/sqliteSchema.ts"() {
|
6011
6157
|
"use strict";
|
@@ -6083,6 +6229,17 @@ var init_sqliteSchema = __esm({
|
|
6083
6229
|
columns: recordType(stringType(), stringType())
|
6084
6230
|
})
|
6085
6231
|
}).strict();
|
6232
|
+
kitInternals3 = objectType({
|
6233
|
+
indexes: recordType(
|
6234
|
+
stringType(),
|
6235
|
+
objectType({
|
6236
|
+
columns: recordType(
|
6237
|
+
stringType(),
|
6238
|
+
objectType({ isExpression: booleanType().optional() }).optional()
|
6239
|
+
)
|
6240
|
+
}).optional()
|
6241
|
+
).optional()
|
6242
|
+
}).optional();
|
6086
6243
|
latestVersion = literalType("6");
|
6087
6244
|
schemaInternal2 = objectType({
|
6088
6245
|
version: latestVersion,
|
@@ -6092,7 +6249,8 @@ var init_sqliteSchema = __esm({
|
|
6092
6249
|
_meta: objectType({
|
6093
6250
|
tables: recordType(stringType(), stringType()),
|
6094
6251
|
columns: recordType(stringType(), stringType())
|
6095
|
-
})
|
6252
|
+
}),
|
6253
|
+
internal: kitInternals3
|
6096
6254
|
}).strict();
|
6097
6255
|
schemaV32 = schemaInternalV32.merge(schemaHash3).strict();
|
6098
6256
|
schemaV42 = schemaInternalV42.merge(schemaHash3).strict();
|
@@ -6223,7 +6381,7 @@ var init_sqliteSchema = __esm({
|
|
6223
6381
|
});
|
6224
6382
|
|
6225
6383
|
// src/utils.ts
|
6226
|
-
var import_fs, import_path, copy, objectValues, assertV1OutFolder, dryJournal, prepareOutFolder, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey;
|
6384
|
+
var import_fs, import_path, import_url, copy, objectValues, assertV1OutFolder, dryJournal, prepareOutFolder, validatorForDialect, validateWithReport, prepareMigrationFolder, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey, normaliseSQLiteUrl;
|
6227
6385
|
var init_utils = __esm({
|
6228
6386
|
"src/utils.ts"() {
|
6229
6387
|
"use strict";
|
@@ -6234,6 +6392,7 @@ var init_utils = __esm({
|
|
6234
6392
|
init_sqliteSchema();
|
6235
6393
|
init_source();
|
6236
6394
|
import_path = require("path");
|
6395
|
+
import_url = require("url");
|
6237
6396
|
init_global();
|
6238
6397
|
copy = (it) => {
|
6239
6398
|
return JSON.parse(JSON.stringify(it));
|
@@ -6278,7 +6437,7 @@ var init_utils = __esm({
|
|
6278
6437
|
validatorForDialect = (dialect7) => {
|
6279
6438
|
switch (dialect7) {
|
6280
6439
|
case "postgresql":
|
6281
|
-
return { validator: backwardCompatiblePgSchema, version:
|
6440
|
+
return { validator: backwardCompatiblePgSchema, version: 7 };
|
6282
6441
|
case "sqlite":
|
6283
6442
|
return { validator: backwardCompatibleSqliteSchema, version: 6 };
|
6284
6443
|
case "mysql":
|
@@ -6396,6 +6555,29 @@ var init_utils = __esm({
|
|
6396
6555
|
const out = schema5 ? `"${schema5}"."${table4}"."${column7}"` : `"${table4}"."${column7}"`;
|
6397
6556
|
return out;
|
6398
6557
|
};
|
6558
|
+
normaliseSQLiteUrl = (it, type) => {
|
6559
|
+
if (type === "libsql") {
|
6560
|
+
if (it.startsWith("file:")) {
|
6561
|
+
return it;
|
6562
|
+
}
|
6563
|
+
try {
|
6564
|
+
const url = (0, import_url.parse)(it);
|
6565
|
+
if (url.protocol === null) {
|
6566
|
+
return `file:${it}`;
|
6567
|
+
}
|
6568
|
+
return it;
|
6569
|
+
} catch (e2) {
|
6570
|
+
return `file:${it}`;
|
6571
|
+
}
|
6572
|
+
}
|
6573
|
+
if (type === "better-sqlite") {
|
6574
|
+
if (it.startsWith("file:")) {
|
6575
|
+
return it.substring(5);
|
6576
|
+
}
|
6577
|
+
return it;
|
6578
|
+
}
|
6579
|
+
assertUnreachable(type);
|
6580
|
+
};
|
6399
6581
|
}
|
6400
6582
|
});
|
6401
6583
|
|
@@ -6809,7 +6991,7 @@ var require_semver = __commonJS({
|
|
6809
6991
|
var require_parse = __commonJS({
|
6810
6992
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/parse.js"(exports2, module2) {
|
6811
6993
|
var SemVer = require_semver();
|
6812
|
-
var
|
6994
|
+
var parse7 = (version2, options, throwErrors = false) => {
|
6813
6995
|
if (version2 instanceof SemVer) {
|
6814
6996
|
return version2;
|
6815
6997
|
}
|
@@ -6822,16 +7004,16 @@ var require_parse = __commonJS({
|
|
6822
7004
|
throw er3;
|
6823
7005
|
}
|
6824
7006
|
};
|
6825
|
-
module2.exports =
|
7007
|
+
module2.exports = parse7;
|
6826
7008
|
}
|
6827
7009
|
});
|
6828
7010
|
|
6829
7011
|
// node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/valid.js
|
6830
7012
|
var require_valid = __commonJS({
|
6831
7013
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/valid.js"(exports2, module2) {
|
6832
|
-
var
|
7014
|
+
var parse7 = require_parse();
|
6833
7015
|
var valid = (version2, options) => {
|
6834
|
-
const v6 =
|
7016
|
+
const v6 = parse7(version2, options);
|
6835
7017
|
return v6 ? v6.version : null;
|
6836
7018
|
};
|
6837
7019
|
module2.exports = valid;
|
@@ -6841,9 +7023,9 @@ var require_valid = __commonJS({
|
|
6841
7023
|
// node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/clean.js
|
6842
7024
|
var require_clean = __commonJS({
|
6843
7025
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/clean.js"(exports2, module2) {
|
6844
|
-
var
|
7026
|
+
var parse7 = require_parse();
|
6845
7027
|
var clean = (version2, options) => {
|
6846
|
-
const s2 =
|
7028
|
+
const s2 = parse7(version2.trim().replace(/^[=v]+/, ""), options);
|
6847
7029
|
return s2 ? s2.version : null;
|
6848
7030
|
};
|
6849
7031
|
module2.exports = clean;
|
@@ -6876,10 +7058,10 @@ var require_inc = __commonJS({
|
|
6876
7058
|
// node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/diff.js
|
6877
7059
|
var require_diff = __commonJS({
|
6878
7060
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/diff.js"(exports2, module2) {
|
6879
|
-
var
|
7061
|
+
var parse7 = require_parse();
|
6880
7062
|
var diff2 = (version1, version2) => {
|
6881
|
-
const v12 =
|
6882
|
-
const v22 =
|
7063
|
+
const v12 = parse7(version1, null, true);
|
7064
|
+
const v22 = parse7(version2, null, true);
|
6883
7065
|
const comparison = v12.compare(v22);
|
6884
7066
|
if (comparison === 0) {
|
6885
7067
|
return null;
|
@@ -6947,9 +7129,9 @@ var require_patch = __commonJS({
|
|
6947
7129
|
// node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/prerelease.js
|
6948
7130
|
var require_prerelease = __commonJS({
|
6949
7131
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/prerelease.js"(exports2, module2) {
|
6950
|
-
var
|
7132
|
+
var parse7 = require_parse();
|
6951
7133
|
var prerelease = (version2, options) => {
|
6952
|
-
const parsed =
|
7134
|
+
const parsed = parse7(version2, options);
|
6953
7135
|
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
6954
7136
|
};
|
6955
7137
|
module2.exports = prerelease;
|
@@ -7121,9 +7303,9 @@ var require_cmp = __commonJS({
|
|
7121
7303
|
var require_coerce = __commonJS({
|
7122
7304
|
"node_modules/.pnpm/semver@7.6.2/node_modules/semver/functions/coerce.js"(exports2, module2) {
|
7123
7305
|
var SemVer = require_semver();
|
7124
|
-
var
|
7306
|
+
var parse7 = require_parse();
|
7125
7307
|
var { safeRe: re2, t: t2 } = require_re();
|
7126
|
-
var
|
7308
|
+
var coerce2 = (version2, options) => {
|
7127
7309
|
if (version2 instanceof SemVer) {
|
7128
7310
|
return version2;
|
7129
7311
|
}
|
@@ -7156,9 +7338,9 @@ var require_coerce = __commonJS({
|
|
7156
7338
|
const patch = match2[4] || "0";
|
7157
7339
|
const prerelease = options.includePrerelease && match2[5] ? `-${match2[5]}` : "";
|
7158
7340
|
const build = options.includePrerelease && match2[6] ? `+${match2[6]}` : "";
|
7159
|
-
return
|
7341
|
+
return parse7(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
7160
7342
|
};
|
7161
|
-
module2.exports =
|
7343
|
+
module2.exports = coerce2;
|
7162
7344
|
}
|
7163
7345
|
});
|
7164
7346
|
|
@@ -8137,7 +8319,7 @@ var require_semver2 = __commonJS({
|
|
8137
8319
|
var constants = require_constants();
|
8138
8320
|
var SemVer = require_semver();
|
8139
8321
|
var identifiers = require_identifiers();
|
8140
|
-
var
|
8322
|
+
var parse7 = require_parse();
|
8141
8323
|
var valid = require_valid();
|
8142
8324
|
var clean = require_clean();
|
8143
8325
|
var inc = require_inc();
|
@@ -8159,7 +8341,7 @@ var require_semver2 = __commonJS({
|
|
8159
8341
|
var gte = require_gte();
|
8160
8342
|
var lte = require_lte();
|
8161
8343
|
var cmp = require_cmp();
|
8162
|
-
var
|
8344
|
+
var coerce2 = require_coerce();
|
8163
8345
|
var Comparator = require_comparator();
|
8164
8346
|
var Range = require_range();
|
8165
8347
|
var satisfies = require_satisfies();
|
@@ -8175,7 +8357,7 @@ var require_semver2 = __commonJS({
|
|
8175
8357
|
var simplifyRange = require_simplify();
|
8176
8358
|
var subset = require_subset();
|
8177
8359
|
module2.exports = {
|
8178
|
-
parse:
|
8360
|
+
parse: parse7,
|
8179
8361
|
valid,
|
8180
8362
|
clean,
|
8181
8363
|
inc,
|
@@ -8197,7 +8379,7 @@ var require_semver2 = __commonJS({
|
|
8197
8379
|
gte,
|
8198
8380
|
lte,
|
8199
8381
|
cmp,
|
8200
|
-
coerce:
|
8382
|
+
coerce: coerce2,
|
8201
8383
|
Comparator,
|
8202
8384
|
Range,
|
8203
8385
|
satisfies,
|
@@ -8265,7 +8447,7 @@ var init_utils2 = __esm({
|
|
8265
8447
|
process.exit(1);
|
8266
8448
|
}
|
8267
8449
|
};
|
8268
|
-
requiredApiVersion =
|
8450
|
+
requiredApiVersion = 7;
|
8269
8451
|
assertOrmCoreVersion = async () => {
|
8270
8452
|
try {
|
8271
8453
|
const { compatibilityVersion } = await import("drizzle-orm/version");
|
@@ -8417,206 +8599,6 @@ var init_utils3 = __esm({
|
|
8417
8599
|
}
|
8418
8600
|
});
|
8419
8601
|
|
8420
|
-
// src/cli/validations/outputs.ts
|
8421
|
-
var withStyle, outputs;
|
8422
|
-
var init_outputs = __esm({
|
8423
|
-
"src/cli/validations/outputs.ts"() {
|
8424
|
-
"use strict";
|
8425
|
-
init_source();
|
8426
|
-
withStyle = {
|
8427
|
-
error: (str) => `${source_default.red(`${source_default.white.bgRed(" Invalid input ")} ${str}`)}`,
|
8428
|
-
warning: (str) => `${source_default.white.bgGray(" Warning ")} ${str}`,
|
8429
|
-
errorWarning: (str) => `${source_default.red(`${source_default.white.bgRed(" Warning ")} ${str}`)}`,
|
8430
|
-
fullWarning: (str) => `${source_default.black.bgYellow("[Warning]")} ${source_default.bold(str)}`,
|
8431
|
-
suggestion: (str) => `${source_default.white.bgGray(" Suggestion ")} ${str}`,
|
8432
|
-
info: (str) => `${source_default.grey(str)}`
|
8433
|
-
};
|
8434
|
-
outputs = {
|
8435
|
-
studio: {
|
8436
|
-
drivers: (param) => withStyle.error(
|
8437
|
-
`"${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`
|
8438
|
-
),
|
8439
|
-
noCredentials: () => withStyle.error(
|
8440
|
-
`Please specify a 'dbCredentials' param in 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`
|
8441
|
-
),
|
8442
|
-
noDriver: () => withStyle.error(
|
8443
|
-
`Please specify a 'driver' param in 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`
|
8444
|
-
),
|
8445
|
-
noDialect: () => withStyle.error(
|
8446
|
-
`Please specify 'dialect' param in config, either of 'pg', 'mysql' or 'sqlite'`
|
8447
|
-
)
|
8448
|
-
},
|
8449
|
-
common: {
|
8450
|
-
ambiguousParams: (command) => withStyle.error(
|
8451
|
-
`You can't use both --config and other cli options for ${command} command`
|
8452
|
-
),
|
8453
|
-
schema: (command) => withStyle.error(`"--schema" is a required field for ${command} command`)
|
8454
|
-
},
|
8455
|
-
postgres: {
|
8456
|
-
connection: {
|
8457
|
-
required: () => withStyle.error(
|
8458
|
-
`Either "url" or "host", "database" are required for database connection`
|
8459
|
-
),
|
8460
|
-
awsDataApi: () => withStyle.error(
|
8461
|
-
"You need to provide 'database', 'secretArn' and 'resourceArn' for Drizzle Kit to connect to AWS Data API"
|
8462
|
-
)
|
8463
|
-
}
|
8464
|
-
},
|
8465
|
-
mysql: {
|
8466
|
-
connection: {
|
8467
|
-
driver: () => withStyle.error(`Only "mysql2" is available options for "--driver"`),
|
8468
|
-
required: () => withStyle.error(
|
8469
|
-
`Either "url" or "host", "database" are required for database connection`
|
8470
|
-
)
|
8471
|
-
}
|
8472
|
-
},
|
8473
|
-
sqlite: {
|
8474
|
-
connection: {
|
8475
|
-
driver: () => withStyle.error(
|
8476
|
-
`Either "turso", "libsql", "better-sqlite" are available options for "--driver"`
|
8477
|
-
),
|
8478
|
-
url: (driver2) => withStyle.error(
|
8479
|
-
`"url" is a required option for driver "${driver2}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
|
8480
|
-
),
|
8481
|
-
authToken: (driver2) => withStyle.error(
|
8482
|
-
`"authToken" is a required option for driver "${driver2}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
|
8483
|
-
)
|
8484
|
-
},
|
8485
|
-
introspect: {},
|
8486
|
-
push: {}
|
8487
|
-
}
|
8488
|
-
};
|
8489
|
-
}
|
8490
|
-
});
|
8491
|
-
|
8492
|
-
// src/cli/validations/mysql.ts
|
8493
|
-
var mysqlCredentials, printConfigConnectionIssues;
|
8494
|
-
var init_mysql = __esm({
|
8495
|
-
"src/cli/validations/mysql.ts"() {
|
8496
|
-
"use strict";
|
8497
|
-
init_lib();
|
8498
|
-
init_outputs();
|
8499
|
-
mysqlCredentials = unionType([
|
8500
|
-
objectType({
|
8501
|
-
host: stringType(),
|
8502
|
-
port: coerce.number().optional(),
|
8503
|
-
user: stringType().default("mysql"),
|
8504
|
-
password: stringType().optional(),
|
8505
|
-
database: stringType(),
|
8506
|
-
ssl: unionType([
|
8507
|
-
stringType(),
|
8508
|
-
objectType({
|
8509
|
-
pfx: stringType().optional(),
|
8510
|
-
key: stringType().optional(),
|
8511
|
-
passphrase: stringType().optional(),
|
8512
|
-
cert: stringType().optional(),
|
8513
|
-
ca: unionType([stringType(), stringType().array()]).optional(),
|
8514
|
-
crl: unionType([stringType(), stringType().array()]).optional(),
|
8515
|
-
ciphers: stringType().optional(),
|
8516
|
-
rejectUnauthorized: booleanType().optional()
|
8517
|
-
})
|
8518
|
-
]).optional()
|
8519
|
-
}),
|
8520
|
-
objectType({
|
8521
|
-
url: stringType()
|
8522
|
-
})
|
8523
|
-
]);
|
8524
|
-
printConfigConnectionIssues = (options) => {
|
8525
|
-
if (options.driver !== "mysql2") {
|
8526
|
-
console.log(outputs.mysql.connection.driver());
|
8527
|
-
}
|
8528
|
-
const { uri, connectionString, url, host, database } = options;
|
8529
|
-
if (!uri && !connectionString && !url && (!host || !database)) {
|
8530
|
-
console.log(outputs.mysql.connection.required());
|
8531
|
-
}
|
8532
|
-
};
|
8533
|
-
}
|
8534
|
-
});
|
8535
|
-
|
8536
|
-
// src/cli/validations/pg.ts
|
8537
|
-
var postgresCredentials, printConfigConnectionIssues2;
|
8538
|
-
var init_pg = __esm({
|
8539
|
-
"src/cli/validations/pg.ts"() {
|
8540
|
-
"use strict";
|
8541
|
-
init_lib();
|
8542
|
-
init_outputs();
|
8543
|
-
postgresCredentials = unionType([
|
8544
|
-
objectType({
|
8545
|
-
host: stringType(),
|
8546
|
-
port: coerce.number().optional(),
|
8547
|
-
user: stringType().default("postgres"),
|
8548
|
-
password: stringType().optional(),
|
8549
|
-
database: stringType(),
|
8550
|
-
ssl: coerce.boolean().optional()
|
8551
|
-
}),
|
8552
|
-
objectType({
|
8553
|
-
url: stringType()
|
8554
|
-
}),
|
8555
|
-
objectType({
|
8556
|
-
driver: literalType("aws-data-api"),
|
8557
|
-
database: stringType(),
|
8558
|
-
secretArn: stringType(),
|
8559
|
-
resourceArn: stringType()
|
8560
|
-
})
|
8561
|
-
]);
|
8562
|
-
printConfigConnectionIssues2 = (options) => {
|
8563
|
-
if (options.driver === "aws-data-api") {
|
8564
|
-
console.log(outputs.postgres.connection.awsDataApi());
|
8565
|
-
return;
|
8566
|
-
}
|
8567
|
-
if (!("url" in options) && !("host" in options || "database" in options)) {
|
8568
|
-
console.log(outputs.postgres.connection.required());
|
8569
|
-
}
|
8570
|
-
};
|
8571
|
-
}
|
8572
|
-
});
|
8573
|
-
|
8574
|
-
// src/cli/validations/sqlite.ts
|
8575
|
-
var sqliteCredentials, printConfigConnectionIssues3;
|
8576
|
-
var init_sqlite = __esm({
|
8577
|
-
"src/cli/validations/sqlite.ts"() {
|
8578
|
-
"use strict";
|
8579
|
-
init_lib();
|
8580
|
-
init_outputs();
|
8581
|
-
sqliteCredentials = unionType([
|
8582
|
-
objectType({
|
8583
|
-
driver: literalType("turso"),
|
8584
|
-
url: stringType(),
|
8585
|
-
authToken: stringType()
|
8586
|
-
}),
|
8587
|
-
objectType({
|
8588
|
-
driver: literalType("d1-http"),
|
8589
|
-
accountId: stringType(),
|
8590
|
-
databaseId: stringType(),
|
8591
|
-
token: stringType()
|
8592
|
-
}),
|
8593
|
-
objectType({
|
8594
|
-
url: stringType()
|
8595
|
-
})
|
8596
|
-
]);
|
8597
|
-
printConfigConnectionIssues3 = (options) => {
|
8598
|
-
if (options.driver === "turso") {
|
8599
|
-
if (!options.url) {
|
8600
|
-
console.log(outputs.sqlite.connection.url("turso"));
|
8601
|
-
}
|
8602
|
-
if (!options.authToken) {
|
8603
|
-
console.log(outputs.sqlite.connection.authToken("turso"));
|
8604
|
-
}
|
8605
|
-
} else if (options.driver === "libsql") {
|
8606
|
-
if (!options.url) {
|
8607
|
-
console.log(outputs.sqlite.connection.url("libsql"));
|
8608
|
-
}
|
8609
|
-
} else if (options.driver === "better-sqlite") {
|
8610
|
-
if (!options.url) {
|
8611
|
-
console.log(outputs.sqlite.connection.url("better-sqlite"));
|
8612
|
-
}
|
8613
|
-
} else {
|
8614
|
-
console.log(outputs.sqlite.connection.driver());
|
8615
|
-
}
|
8616
|
-
};
|
8617
|
-
}
|
8618
|
-
});
|
8619
|
-
|
8620
8602
|
// src/schemaValidator.ts
|
8621
8603
|
var dialect3, commonSquashedSchema, commonSchema;
|
8622
8604
|
var init_schemaValidator = __esm({
|
@@ -8641,13 +8623,14 @@ var init_schemaValidator = __esm({
|
|
8641
8623
|
});
|
8642
8624
|
|
8643
8625
|
// src/cli/validations/common.ts
|
8644
|
-
var assertCollisions, sqliteDriver, postgresDriver, mysqlDriver, driver, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema;
|
8626
|
+
var assertCollisions, sqliteDriversLiterals, sqliteDriver, postgresDriver, mysqlDriver, driver, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema, wrapParam;
|
8645
8627
|
var init_common = __esm({
|
8646
8628
|
"src/cli/validations/common.ts"() {
|
8647
8629
|
"use strict";
|
8648
8630
|
init_outputs();
|
8649
8631
|
init_lib();
|
8650
8632
|
init_schemaValidator();
|
8633
|
+
init_source();
|
8651
8634
|
assertCollisions = (options, command, inputWhitelist = []) => {
|
8652
8635
|
const { config, ...rest } = options;
|
8653
8636
|
let atLeastOneParam = false;
|
@@ -8668,14 +8651,12 @@ var init_common = __esm({
|
|
8668
8651
|
console.log(outputs.common.ambiguousParams(command));
|
8669
8652
|
process.exit(1);
|
8670
8653
|
};
|
8671
|
-
|
8672
|
-
literalType("better-sqlite"),
|
8654
|
+
sqliteDriversLiterals = [
|
8673
8655
|
literalType("turso"),
|
8674
|
-
literalType("libsql"),
|
8675
|
-
literalType("d1"),
|
8676
8656
|
literalType("d1-http"),
|
8677
8657
|
literalType("expo")
|
8678
|
-
]
|
8658
|
+
];
|
8659
|
+
sqliteDriver = unionType(sqliteDriversLiterals);
|
8679
8660
|
postgresDriver = literalType("aws-data-api");
|
8680
8661
|
mysqlDriver = literalType("mysql2");
|
8681
8662
|
driver = unionType([sqliteDriver, postgresDriver, mysqlDriver]);
|
@@ -8725,6 +8706,313 @@ var init_common = __esm({
|
|
8725
8706
|
strict: booleanType().default(false),
|
8726
8707
|
out: stringType().optional()
|
8727
8708
|
});
|
8709
|
+
wrapParam = (name, param, optional = false) => {
|
8710
|
+
const check = `[${source_default.green("\u2713")}]`;
|
8711
|
+
const cross = `[${source_default.red("x")}]`;
|
8712
|
+
if (typeof param === "string") {
|
8713
|
+
if (param.length === 0) {
|
8714
|
+
return ` ${cross} ${name}: ''`;
|
8715
|
+
}
|
8716
|
+
return ` ${check} ${name}: '${param}'`;
|
8717
|
+
}
|
8718
|
+
if (optional) {
|
8719
|
+
return source_default.gray(` ${name}?: `);
|
8720
|
+
}
|
8721
|
+
return ` ${cross} ${name}: ${source_default.gray("undefined")}`;
|
8722
|
+
};
|
8723
|
+
}
|
8724
|
+
});
|
8725
|
+
|
8726
|
+
// src/cli/validations/outputs.ts
|
8727
|
+
var withStyle, outputs;
|
8728
|
+
var init_outputs = __esm({
|
8729
|
+
"src/cli/validations/outputs.ts"() {
|
8730
|
+
"use strict";
|
8731
|
+
init_source();
|
8732
|
+
init_common();
|
8733
|
+
withStyle = {
|
8734
|
+
error: (str) => `${source_default.red(`${source_default.white.bgRed(" Invalid input ")} ${str}`)}`,
|
8735
|
+
warning: (str) => `${source_default.white.bgGray(" Warning ")} ${str}`,
|
8736
|
+
errorWarning: (str) => `${source_default.red(`${source_default.white.bgRed(" Warning ")} ${str}`)}`,
|
8737
|
+
fullWarning: (str) => `${source_default.black.bgYellow(" Warning ")} ${source_default.bold(str)}`,
|
8738
|
+
suggestion: (str) => `${source_default.white.bgGray(" Suggestion ")} ${str}`,
|
8739
|
+
info: (str) => `${source_default.grey(str)}`
|
8740
|
+
};
|
8741
|
+
outputs = {
|
8742
|
+
studio: {
|
8743
|
+
drivers: (param) => withStyle.error(
|
8744
|
+
`"${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`
|
8745
|
+
),
|
8746
|
+
noCredentials: () => withStyle.error(
|
8747
|
+
`Please specify a 'dbCredentials' param in 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`
|
8748
|
+
),
|
8749
|
+
noDriver: () => withStyle.error(
|
8750
|
+
`Please specify a 'driver' param in 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`
|
8751
|
+
),
|
8752
|
+
noDialect: () => withStyle.error(
|
8753
|
+
`Please specify 'dialect' param in config, either of 'pg', 'mysql' or 'sqlite'`
|
8754
|
+
)
|
8755
|
+
},
|
8756
|
+
common: {
|
8757
|
+
ambiguousParams: (command) => withStyle.error(
|
8758
|
+
`You can't use both --config and other cli options for ${command} command`
|
8759
|
+
),
|
8760
|
+
schema: (command) => withStyle.error(`"--schema" is a required field for ${command} command`)
|
8761
|
+
},
|
8762
|
+
postgres: {
|
8763
|
+
connection: {
|
8764
|
+
required: () => withStyle.error(
|
8765
|
+
`Either "url" or "host", "database" are required for database connection`
|
8766
|
+
),
|
8767
|
+
awsDataApi: () => withStyle.error(
|
8768
|
+
"You need to provide 'database', 'secretArn' and 'resourceArn' for Drizzle Kit to connect to AWS Data API"
|
8769
|
+
)
|
8770
|
+
}
|
8771
|
+
},
|
8772
|
+
mysql: {
|
8773
|
+
connection: {
|
8774
|
+
driver: () => withStyle.error(`Only "mysql2" is available options for "--driver"`),
|
8775
|
+
required: () => withStyle.error(
|
8776
|
+
`Either "url" or "host", "database" are required for database connection`
|
8777
|
+
)
|
8778
|
+
}
|
8779
|
+
},
|
8780
|
+
sqlite: {
|
8781
|
+
connection: {
|
8782
|
+
driver: () => {
|
8783
|
+
const listOfDrivers = sqliteDriversLiterals.map((it) => `'${it.value}'`).join(", ");
|
8784
|
+
return withStyle.error(
|
8785
|
+
`Either ${listOfDrivers} are available options for 'driver' param`
|
8786
|
+
);
|
8787
|
+
},
|
8788
|
+
url: (driver3) => withStyle.error(
|
8789
|
+
`"url" is a required option for driver "${driver3}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
|
8790
|
+
),
|
8791
|
+
authToken: (driver3) => withStyle.error(
|
8792
|
+
`"authToken" is a required option for driver "${driver3}". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference`
|
8793
|
+
)
|
8794
|
+
},
|
8795
|
+
introspect: {},
|
8796
|
+
push: {}
|
8797
|
+
}
|
8798
|
+
};
|
8799
|
+
}
|
8800
|
+
});
|
8801
|
+
|
8802
|
+
// src/cli/validations/mysql.ts
|
8803
|
+
var mysqlCredentials, printConfigConnectionIssues;
|
8804
|
+
var init_mysql = __esm({
|
8805
|
+
"src/cli/validations/mysql.ts"() {
|
8806
|
+
"use strict";
|
8807
|
+
init_lib();
|
8808
|
+
init_outputs();
|
8809
|
+
init_common();
|
8810
|
+
init_views();
|
8811
|
+
mysqlCredentials = unionType([
|
8812
|
+
objectType({
|
8813
|
+
host: stringType().min(1),
|
8814
|
+
port: coerce.number().min(1).optional(),
|
8815
|
+
user: stringType().min(1).optional(),
|
8816
|
+
password: stringType().min(1).optional(),
|
8817
|
+
database: stringType().min(1),
|
8818
|
+
ssl: unionType([
|
8819
|
+
stringType(),
|
8820
|
+
objectType({
|
8821
|
+
pfx: stringType().optional(),
|
8822
|
+
key: stringType().optional(),
|
8823
|
+
passphrase: stringType().optional(),
|
8824
|
+
cert: stringType().optional(),
|
8825
|
+
ca: unionType([stringType(), stringType().array()]).optional(),
|
8826
|
+
crl: unionType([stringType(), stringType().array()]).optional(),
|
8827
|
+
ciphers: stringType().optional(),
|
8828
|
+
rejectUnauthorized: booleanType().optional()
|
8829
|
+
})
|
8830
|
+
]).optional()
|
8831
|
+
}),
|
8832
|
+
objectType({
|
8833
|
+
url: stringType().min(1)
|
8834
|
+
})
|
8835
|
+
]);
|
8836
|
+
printConfigConnectionIssues = (options) => {
|
8837
|
+
if ("url" in options) {
|
8838
|
+
let text2 = `Please provide required params for MySQL driver:
|
8839
|
+
`;
|
8840
|
+
console.log(error(text2));
|
8841
|
+
console.log(wrapParam("url", options.url));
|
8842
|
+
process.exit(1);
|
8843
|
+
}
|
8844
|
+
let text = `Please provide required params for MySQL driver:
|
8845
|
+
`;
|
8846
|
+
console.log(error(text));
|
8847
|
+
console.log(wrapParam("host", options.host));
|
8848
|
+
console.log(wrapParam("port", options.port, true));
|
8849
|
+
console.log(wrapParam("user", options.user, true));
|
8850
|
+
console.log(wrapParam("password", options.password, true));
|
8851
|
+
console.log(wrapParam("database", options.database));
|
8852
|
+
console.log(wrapParam("ssl", options.ssl, true));
|
8853
|
+
process.exit(1);
|
8854
|
+
};
|
8855
|
+
}
|
8856
|
+
});
|
8857
|
+
|
8858
|
+
// src/cli/validations/postgres.ts
|
8859
|
+
var postgresCredentials, printConfigConnectionIssues2;
|
8860
|
+
var init_postgres = __esm({
|
8861
|
+
"src/cli/validations/postgres.ts"() {
|
8862
|
+
"use strict";
|
8863
|
+
init_lib();
|
8864
|
+
init_common();
|
8865
|
+
init_views();
|
8866
|
+
postgresCredentials = unionType([
|
8867
|
+
objectType({
|
8868
|
+
driver: undefinedType(),
|
8869
|
+
host: stringType().min(1),
|
8870
|
+
port: coerce.number().min(1).optional(),
|
8871
|
+
user: stringType().min(1).optional(),
|
8872
|
+
password: stringType().min(1).optional(),
|
8873
|
+
database: stringType().min(1),
|
8874
|
+
ssl: unionType([
|
8875
|
+
literalType("require"),
|
8876
|
+
literalType("allow"),
|
8877
|
+
literalType("prefer"),
|
8878
|
+
literalType("verify-full"),
|
8879
|
+
booleanType(),
|
8880
|
+
objectType({}).passthrough()
|
8881
|
+
]).optional()
|
8882
|
+
}).transform((o) => {
|
8883
|
+
delete o.driver;
|
8884
|
+
return o;
|
8885
|
+
}),
|
8886
|
+
objectType({
|
8887
|
+
driver: undefinedType(),
|
8888
|
+
url: stringType().min(1)
|
8889
|
+
}).transform((o) => {
|
8890
|
+
delete o.driver;
|
8891
|
+
return o;
|
8892
|
+
}),
|
8893
|
+
objectType({
|
8894
|
+
driver: literalType("aws-data-api"),
|
8895
|
+
database: stringType().min(1),
|
8896
|
+
secretArn: stringType().min(1),
|
8897
|
+
resourceArn: stringType().min(1)
|
8898
|
+
})
|
8899
|
+
]);
|
8900
|
+
printConfigConnectionIssues2 = (options) => {
|
8901
|
+
if (options.driver === "aws-data-api") {
|
8902
|
+
let text = `Please provide required params for AWS Data API driver:
|
8903
|
+
`;
|
8904
|
+
console.log(error(text));
|
8905
|
+
console.log(wrapParam("database", options.database));
|
8906
|
+
console.log(wrapParam("secretArn", options.secretArn));
|
8907
|
+
console.log(wrapParam("resourceArn", options.resourceArn));
|
8908
|
+
process.exit(1);
|
8909
|
+
}
|
8910
|
+
if ("url" in options) {
|
8911
|
+
let text = `Please provide required params for Postgres driver:
|
8912
|
+
`;
|
8913
|
+
console.log(error(text));
|
8914
|
+
console.log(wrapParam("url", options.url));
|
8915
|
+
process.exit(1);
|
8916
|
+
}
|
8917
|
+
if ("host" in options || "database" in options) {
|
8918
|
+
let text = `Please provide required params for Postgres driver:
|
8919
|
+
`;
|
8920
|
+
console.log(error(text));
|
8921
|
+
console.log(wrapParam("host", options.host));
|
8922
|
+
console.log(wrapParam("port", options.port, true));
|
8923
|
+
console.log(wrapParam("user", options.user, true));
|
8924
|
+
console.log(wrapParam("password", options.password, true));
|
8925
|
+
console.log(wrapParam("database", options.database));
|
8926
|
+
console.log(wrapParam("ssl", options.ssl, true));
|
8927
|
+
process.exit(1);
|
8928
|
+
}
|
8929
|
+
console.log(
|
8930
|
+
error(
|
8931
|
+
`Either connection "url" or "host", "database" are required for database connection`
|
8932
|
+
)
|
8933
|
+
);
|
8934
|
+
process.exit(1);
|
8935
|
+
};
|
8936
|
+
}
|
8937
|
+
});
|
8938
|
+
|
8939
|
+
// src/cli/validations/sqlite.ts
|
8940
|
+
var sqliteCredentials, printConfigConnectionIssues3;
|
8941
|
+
var init_sqlite = __esm({
|
8942
|
+
"src/cli/validations/sqlite.ts"() {
|
8943
|
+
"use strict";
|
8944
|
+
init_lib();
|
8945
|
+
init_common();
|
8946
|
+
init_views();
|
8947
|
+
init_global();
|
8948
|
+
sqliteCredentials = unionType([
|
8949
|
+
objectType({
|
8950
|
+
driver: literalType("turso"),
|
8951
|
+
url: stringType().min(1),
|
8952
|
+
authToken: stringType().min(1).optional()
|
8953
|
+
}),
|
8954
|
+
objectType({
|
8955
|
+
driver: literalType("d1-http"),
|
8956
|
+
accountId: stringType().min(1),
|
8957
|
+
databaseId: stringType().min(1),
|
8958
|
+
token: stringType().min(1)
|
8959
|
+
}),
|
8960
|
+
objectType({
|
8961
|
+
driver: undefinedType(),
|
8962
|
+
url: stringType().min(1)
|
8963
|
+
}).transform((o) => {
|
8964
|
+
delete o.driver;
|
8965
|
+
return o;
|
8966
|
+
})
|
8967
|
+
]);
|
8968
|
+
printConfigConnectionIssues3 = (options, command) => {
|
8969
|
+
const parsedDriver = sqliteDriver.safeParse(options.driver);
|
8970
|
+
const driver3 = parsedDriver.success ? parsedDriver.data : "";
|
8971
|
+
if (driver3 === "expo") {
|
8972
|
+
if (command === "migrate") {
|
8973
|
+
console.log(
|
8974
|
+
error(
|
8975
|
+
`You can't use 'migrate' command with Expo SQLite, please follow migration instructions in our docs - https://orm.drizzle.team/docs/get-started-sqlite#expo-sqlite`
|
8976
|
+
)
|
8977
|
+
);
|
8978
|
+
} else if (command === "studio") {
|
8979
|
+
console.log(
|
8980
|
+
error(
|
8981
|
+
`You can't use 'studio' command with Expo SQLite, please use Expo Plugin https://www.npmjs.com/package/expo-drizzle-studio-plugin`
|
8982
|
+
)
|
8983
|
+
);
|
8984
|
+
} else if (command === "pull") {
|
8985
|
+
console.log(error("You can't use 'pull' command with Expo SQLite"));
|
8986
|
+
} else if (command === "push") {
|
8987
|
+
console.log(error("You can't use 'push' command with Expo SQLite"));
|
8988
|
+
} else {
|
8989
|
+
console.log(error("Unexpected error with expo driver \u{1F914}"));
|
8990
|
+
}
|
8991
|
+
process.exit(1);
|
8992
|
+
} else if (driver3 === "d1-http") {
|
8993
|
+
let text2 = `Please provide required params for D1 HTTP driver:
|
8994
|
+
`;
|
8995
|
+
console.log(error(text2));
|
8996
|
+
console.log(wrapParam("accountId", options.accountId));
|
8997
|
+
console.log(wrapParam("databaseId", options.databaseId));
|
8998
|
+
console.log(wrapParam("token", options.token));
|
8999
|
+
process.exit(1);
|
9000
|
+
} else if (driver3 === "turso") {
|
9001
|
+
let text2 = `Please provide required params for Turso driver:
|
9002
|
+
`;
|
9003
|
+
console.log(error(text2));
|
9004
|
+
console.log(wrapParam("url", options.url));
|
9005
|
+
console.log(wrapParam("authToken", options.authToken));
|
9006
|
+
return;
|
9007
|
+
} else {
|
9008
|
+
softAssertUnreachable(driver3);
|
9009
|
+
}
|
9010
|
+
let text = `Please provide required params:
|
9011
|
+
`;
|
9012
|
+
console.log(error(text));
|
9013
|
+
console.log(wrapParam("url", options.url));
|
9014
|
+
process.exit(1);
|
9015
|
+
};
|
8728
9016
|
}
|
8729
9017
|
});
|
8730
9018
|
|
@@ -8750,6 +9038,7 @@ var init_cli = __esm({
|
|
8750
9038
|
schema: unionType([stringType(), stringType().array()]).optional(),
|
8751
9039
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
8752
9040
|
schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
9041
|
+
extensionsFilters: literalType("postgis").array().optional(),
|
8753
9042
|
verbose: booleanType().optional(),
|
8754
9043
|
strict: booleanType().optional()
|
8755
9044
|
}).passthrough();
|
@@ -8759,6 +9048,7 @@ var init_cli = __esm({
|
|
8759
9048
|
out: stringType().optional().default("drizzle"),
|
8760
9049
|
tablesFilter: unionType([stringType(), stringType().array()]).optional(),
|
8761
9050
|
schemaFilter: unionType([stringType(), stringType().array()]).optional().default(["public"]),
|
9051
|
+
extensionsFilters: literalType("postgis").array().optional(),
|
8762
9052
|
introspectCasing: casing,
|
8763
9053
|
breakpoints: booleanType().optional().default(true)
|
8764
9054
|
}).passthrough();
|
@@ -8784,7 +9074,7 @@ var init_studio = __esm({
|
|
8784
9074
|
init_mysql();
|
8785
9075
|
init_sqlite();
|
8786
9076
|
init_schemaValidator();
|
8787
|
-
|
9077
|
+
init_postgres();
|
8788
9078
|
credentials = intersectionType(
|
8789
9079
|
postgresCredentials,
|
8790
9080
|
mysqlCredentials,
|
@@ -8829,7 +9119,7 @@ var require_ms = __commonJS({
|
|
8829
9119
|
options = options || {};
|
8830
9120
|
var type = typeof val2;
|
8831
9121
|
if (type === "string" && val2.length > 0) {
|
8832
|
-
return
|
9122
|
+
return parse7(val2);
|
8833
9123
|
} else if (type === "number" && isFinite(val2)) {
|
8834
9124
|
return options.long ? fmtLong(val2) : fmtShort(val2);
|
8835
9125
|
}
|
@@ -8837,7 +9127,7 @@ var require_ms = __commonJS({
|
|
8837
9127
|
"val is not a non-empty string or a valid number. val=" + JSON.stringify(val2)
|
8838
9128
|
);
|
8839
9129
|
};
|
8840
|
-
function
|
9130
|
+
function parse7(str) {
|
8841
9131
|
str = String(str);
|
8842
9132
|
if (str.length > 100) {
|
8843
9133
|
return;
|
@@ -8938,7 +9228,7 @@ var require_common = __commonJS({
|
|
8938
9228
|
function setup(env3) {
|
8939
9229
|
createDebug.debug = createDebug;
|
8940
9230
|
createDebug.default = createDebug;
|
8941
|
-
createDebug.coerce =
|
9231
|
+
createDebug.coerce = coerce2;
|
8942
9232
|
createDebug.disable = disable;
|
8943
9233
|
createDebug.enable = enable;
|
8944
9234
|
createDebug.enabled = enabled;
|
@@ -9079,7 +9369,7 @@ var require_common = __commonJS({
|
|
9079
9369
|
function toNamespace(regexp) {
|
9080
9370
|
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
|
9081
9371
|
}
|
9082
|
-
function
|
9372
|
+
function coerce2(val2) {
|
9083
9373
|
if (val2 instanceof Error) {
|
9084
9374
|
return val2.stack || val2.message;
|
9085
9375
|
}
|
@@ -12556,7 +12846,7 @@ var require_node2 = __commonJS({
|
|
12556
12846
|
var token;
|
12557
12847
|
var key;
|
12558
12848
|
var root;
|
12559
|
-
module22.exports = function
|
12849
|
+
module22.exports = function parse7(text, reviver) {
|
12560
12850
|
source = String(text);
|
12561
12851
|
parseState = "start";
|
12562
12852
|
stack = [];
|
@@ -13604,10 +13894,10 @@ var require_node2 = __commonJS({
|
|
13604
13894
|
};
|
13605
13895
|
});
|
13606
13896
|
var require_lib32 = __commonJS2((exports3, module22) => {
|
13607
|
-
var
|
13897
|
+
var parse7 = require_parse4();
|
13608
13898
|
var stringify4 = require_stringify3();
|
13609
13899
|
var JSON5 = {
|
13610
|
-
parse:
|
13900
|
+
parse: parse7,
|
13611
13901
|
stringify: stringify4
|
13612
13902
|
};
|
13613
13903
|
module22.exports = JSON5;
|
@@ -14434,7 +14724,7 @@ var init_utils4 = __esm({
|
|
14434
14724
|
import_hanji2 = __toESM(require_hanji());
|
14435
14725
|
init_global();
|
14436
14726
|
init_mysql();
|
14437
|
-
|
14727
|
+
init_postgres();
|
14438
14728
|
init_sqlite();
|
14439
14729
|
init_common();
|
14440
14730
|
init_schemaValidator();
|
@@ -14568,6 +14858,13 @@ var init_utils4 = __esm({
|
|
14568
14858
|
const tablesFilter = tablesFilterConfig ? typeof tablesFilterConfig === "string" ? [tablesFilterConfig] : tablesFilterConfig : [];
|
14569
14859
|
const schemasFilterConfig = config.schemaFilter;
|
14570
14860
|
const schemasFilter = schemasFilterConfig ? typeof schemasFilterConfig === "string" ? [schemasFilterConfig] : schemasFilterConfig : [];
|
14861
|
+
if (config.extensionsFilters) {
|
14862
|
+
if (config.extensionsFilters.includes("postgis") && dialect7 === "postgresql") {
|
14863
|
+
tablesFilter.push(
|
14864
|
+
...["!geography_columns", "!geometry_columns", "!spatial_ref_sys"]
|
14865
|
+
);
|
14866
|
+
}
|
14867
|
+
}
|
14571
14868
|
if (dialect7 === "postgresql") {
|
14572
14869
|
const parsed = postgresCredentials.safeParse(config);
|
14573
14870
|
if (!parsed.success) {
|
@@ -14603,7 +14900,7 @@ var init_utils4 = __esm({
|
|
14603
14900
|
if (dialect7 === "sqlite") {
|
14604
14901
|
const parsed = sqliteCredentials.safeParse(config);
|
14605
14902
|
if (!parsed.success) {
|
14606
|
-
printConfigConnectionIssues3(config);
|
14903
|
+
printConfigConnectionIssues3(config, "pull");
|
14607
14904
|
process.exit(1);
|
14608
14905
|
}
|
14609
14906
|
return {
|
@@ -14634,6 +14931,13 @@ var init_utils4 = __esm({
|
|
14634
14931
|
}
|
14635
14932
|
const tablesFilterConfig = config.tablesFilter;
|
14636
14933
|
const tablesFilter = tablesFilterConfig ? typeof tablesFilterConfig === "string" ? [tablesFilterConfig] : tablesFilterConfig : [];
|
14934
|
+
if (config.extensionsFilters) {
|
14935
|
+
if (config.extensionsFilters.includes("postgis") && dialect7 === "postgresql") {
|
14936
|
+
tablesFilter.push(
|
14937
|
+
...["!geography_columns", "!geometry_columns", "!spatial_ref_sys"]
|
14938
|
+
);
|
14939
|
+
}
|
14940
|
+
}
|
14637
14941
|
const schemasFilterConfig = config.schemaFilter;
|
14638
14942
|
const schemasFilter = schemasFilterConfig ? typeof schemasFilterConfig === "string" ? [schemasFilterConfig] : schemasFilterConfig : [];
|
14639
14943
|
if (dialect7 === "postgresql") {
|
@@ -14671,7 +14975,7 @@ var init_utils4 = __esm({
|
|
14671
14975
|
if (dialect7 === "sqlite") {
|
14672
14976
|
const parsed = sqliteCredentials.safeParse(config);
|
14673
14977
|
if (!parsed.success) {
|
14674
|
-
printConfigConnectionIssues3(config);
|
14978
|
+
printConfigConnectionIssues3(config, "pull");
|
14675
14979
|
process.exit(1);
|
14676
14980
|
}
|
14677
14981
|
return {
|
@@ -14736,7 +15040,7 @@ var init_utils4 = __esm({
|
|
14736
15040
|
if (dialect7 === "sqlite") {
|
14737
15041
|
const parsed = sqliteCredentials.safeParse(flattened);
|
14738
15042
|
if (!parsed.success) {
|
14739
|
-
printConfigConnectionIssues3(flattened);
|
15043
|
+
printConfigConnectionIssues3(flattened, "studio");
|
14740
15044
|
process.exit(1);
|
14741
15045
|
}
|
14742
15046
|
const credentials2 = parsed.data;
|
@@ -14811,7 +15115,7 @@ var init_utils4 = __esm({
|
|
14811
15115
|
if (dialect7 === "sqlite") {
|
14812
15116
|
const parsed = sqliteCredentials.safeParse(flattened);
|
14813
15117
|
if (!parsed.success) {
|
14814
|
-
printConfigConnectionIssues3(flattened);
|
15118
|
+
printConfigConnectionIssues3(flattened, "migrate");
|
14815
15119
|
process.exit(1);
|
14816
15120
|
}
|
14817
15121
|
const credentials2 = parsed.data;
|
@@ -14872,8 +15176,9 @@ var init_utils4 = __esm({
|
|
14872
15176
|
unregister();
|
14873
15177
|
const res = configCommonSchema.safeParse(content);
|
14874
15178
|
if (!res.success) {
|
14875
|
-
|
14876
|
-
|
15179
|
+
if (!("dialect" in content)) {
|
15180
|
+
console.log(error("Please specify 'dialect' param"));
|
15181
|
+
}
|
14877
15182
|
process.exit(1);
|
14878
15183
|
}
|
14879
15184
|
return res.data;
|
@@ -14984,6 +15289,7 @@ var init_mysqlSerializer = __esm({
|
|
14984
15289
|
};
|
14985
15290
|
generateMySqlSnapshot = (tables) => {
|
14986
15291
|
const result = {};
|
15292
|
+
const internal = { tables: {}, indexes: {} };
|
14987
15293
|
for (const table4 of tables) {
|
14988
15294
|
const {
|
14989
15295
|
name: tableName,
|
@@ -15134,10 +15440,29 @@ The unique constraint ${source_default.underline.blue(
|
|
15134
15440
|
const columns2 = value.config.columns;
|
15135
15441
|
const name = value.config.name;
|
15136
15442
|
let indexColumns = columns2.map((it) => {
|
15443
|
+
var _a;
|
15137
15444
|
if ((0, import_drizzle_orm2.is)(it, import_drizzle_orm3.SQL)) {
|
15138
|
-
|
15445
|
+
const sql2 = dialect4.sqlToQuery(it, "indexes").sql;
|
15446
|
+
if (typeof internal.indexes[name] === "undefined") {
|
15447
|
+
internal.indexes[name] = {
|
15448
|
+
columns: {
|
15449
|
+
[sql2]: {
|
15450
|
+
isExpression: true
|
15451
|
+
}
|
15452
|
+
}
|
15453
|
+
};
|
15454
|
+
} else {
|
15455
|
+
if (typeof ((_a = internal.indexes[name]) == null ? void 0 : _a.columns[sql2]) === "undefined") {
|
15456
|
+
internal.indexes[name].columns[sql2] = {
|
15457
|
+
isExpression: true
|
15458
|
+
};
|
15459
|
+
} else {
|
15460
|
+
internal.indexes[name].columns[sql2].isExpression = true;
|
15461
|
+
}
|
15462
|
+
}
|
15463
|
+
return sql2;
|
15139
15464
|
} else {
|
15140
|
-
return it.name
|
15465
|
+
return `${it.name}`;
|
15141
15466
|
}
|
15142
15467
|
});
|
15143
15468
|
if (value.config.unique) {
|
@@ -15204,12 +15529,13 @@ We have encountered a collision between the index name on columns ${source_defau
|
|
15204
15529
|
_meta: {
|
15205
15530
|
tables: {},
|
15206
15531
|
columns: {}
|
15207
|
-
}
|
15532
|
+
},
|
15533
|
+
internal
|
15208
15534
|
};
|
15209
15535
|
};
|
15210
15536
|
fromDatabase = async (db2, inputSchema, tablesFilter = (table4) => true, progressCallback) => {
|
15211
15537
|
const result = {};
|
15212
|
-
const internals = { tables: {} };
|
15538
|
+
const internals = { tables: {}, indexes: {} };
|
15213
15539
|
const columns = await db2.query(`select * from information_schema.columns
|
15214
15540
|
where table_schema = '${inputSchema}' and table_name != '__drizzle_migrations'
|
15215
15541
|
order by table_name, ordinal_position;`);
|
@@ -15525,6 +15851,24 @@ var init_pgImports = __esm({
|
|
15525
15851
|
}
|
15526
15852
|
});
|
15527
15853
|
|
15854
|
+
// src/extensions/vector.ts
|
15855
|
+
var vectorOps;
|
15856
|
+
var init_vector = __esm({
|
15857
|
+
"src/extensions/vector.ts"() {
|
15858
|
+
"use strict";
|
15859
|
+
vectorOps = [
|
15860
|
+
"vector_l2_ops",
|
15861
|
+
"vector_ip_ops",
|
15862
|
+
"vector_cosine_ops",
|
15863
|
+
"vector_l1_ops",
|
15864
|
+
"bit_hamming_ops",
|
15865
|
+
"bit_jaccard_ops",
|
15866
|
+
"halfvec_l2_ops",
|
15867
|
+
"sparsevec_l2_ops"
|
15868
|
+
];
|
15869
|
+
}
|
15870
|
+
});
|
15871
|
+
|
15528
15872
|
// src/serializer/pgSerializer.ts
|
15529
15873
|
var pgSerializer_exports = {};
|
15530
15874
|
__export(pgSerializer_exports, {
|
@@ -15542,6 +15886,7 @@ var init_pgSerializer = __esm({
|
|
15542
15886
|
init_serializer();
|
15543
15887
|
init_source();
|
15544
15888
|
init_outputs();
|
15889
|
+
init_vector();
|
15545
15890
|
dialect5 = new import_pg_core2.PgDialect();
|
15546
15891
|
indexName2 = (tableName, columns) => {
|
15547
15892
|
return `${tableName}_${columns.join("_")}_index`;
|
@@ -15549,6 +15894,16 @@ var init_pgSerializer = __esm({
|
|
15549
15894
|
generatePgSnapshot = (tables, enums, schemas, schemaFilter) => {
|
15550
15895
|
const result = {};
|
15551
15896
|
const indexesInSchema = {};
|
15897
|
+
const enumsToReturn = enums.reduce((map, obj) => {
|
15898
|
+
const enumSchema3 = obj.schema || "public";
|
15899
|
+
const key = `${enumSchema3}.${obj.enumName}`;
|
15900
|
+
map[key] = {
|
15901
|
+
name: obj.enumName,
|
15902
|
+
schema: enumSchema3,
|
15903
|
+
values: obj.enumValues
|
15904
|
+
};
|
15905
|
+
return map;
|
15906
|
+
}, {});
|
15552
15907
|
for (const table4 of tables) {
|
15553
15908
|
const {
|
15554
15909
|
name: tableName,
|
@@ -15579,6 +15934,7 @@ var init_pgSerializer = __esm({
|
|
15579
15934
|
typeSchema,
|
15580
15935
|
primaryKey,
|
15581
15936
|
notNull
|
15937
|
+
// isenum: typeof enumsToReturn[column.getSQLType()] !== "undefined",
|
15582
15938
|
};
|
15583
15939
|
if (column7.isUnique) {
|
15584
15940
|
const existingUnique = uniqueConstraintObject[column7.uniqueName];
|
@@ -15692,18 +16048,71 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
15692
16048
|
});
|
15693
16049
|
indexes.forEach((value) => {
|
15694
16050
|
const columns2 = value.config.columns;
|
15695
|
-
let
|
15696
|
-
|
15697
|
-
tableName,
|
15698
|
-
columns2.map((it) => it.name)
|
15699
|
-
);
|
15700
|
-
let indexColumns = columns2.map((it) => {
|
16051
|
+
let indexColumnNames = [];
|
16052
|
+
columns2.forEach((it) => {
|
15701
16053
|
if ((0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL)) {
|
15702
|
-
|
15703
|
-
|
15704
|
-
|
16054
|
+
if (typeof value.config.name === "undefined") {
|
16055
|
+
console.log(
|
16056
|
+
`
|
16057
|
+
${withStyle.errorWarning(
|
16058
|
+
`Please specify an index name in ${(0, import_drizzle_orm5.getTableName)(
|
16059
|
+
value.config.table
|
16060
|
+
)} table that has "${dialect5.sqlToQuery(it).sql}" expression. We can generate index names for indexes on columns only; for expressions in indexes, you need to specify the name yourself.`
|
16061
|
+
)}`
|
16062
|
+
);
|
16063
|
+
process.exit(1);
|
16064
|
+
}
|
16065
|
+
}
|
16066
|
+
it = it;
|
16067
|
+
if (!(0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL) && it.type === "PgVector" && typeof it.indexConfig.opClass === "undefined") {
|
16068
|
+
console.log(
|
16069
|
+
`
|
16070
|
+
${withStyle.errorWarning(
|
16071
|
+
`You are specifying an index on the ${source_default.blueBright(
|
16072
|
+
it.name
|
16073
|
+
)} column inside the ${source_default.blueBright(
|
16074
|
+
tableName
|
16075
|
+
)} table with the ${source_default.blueBright(
|
16076
|
+
"vector"
|
16077
|
+
)} type without specifying an operator class. Vector extension doesn't have a default operator class, so you need to specify one of the available options. Here is a list of available op classes for the vector extension: [${vectorOps.map((it2) => `${source_default.underline(`${it2}`)}`).join(
|
16078
|
+
", "
|
16079
|
+
)}].
|
16080
|
+
|
16081
|
+
You can specify it using current syntax: ${source_default.underline(
|
16082
|
+
`index("${value.config.name}").using("${value.config.method}", table.${it.name}.op("${vectorOps[0]}"))`
|
16083
|
+
)}
|
16084
|
+
|
16085
|
+
You can check the "pg_vector" docs for more info: https://github.com/pgvector/pgvector?tab=readme-ov-file#indexing
|
16086
|
+
`
|
16087
|
+
)}`
|
16088
|
+
);
|
16089
|
+
process.exit(1);
|
15705
16090
|
}
|
16091
|
+
indexColumnNames.push(it.name);
|
15706
16092
|
});
|
16093
|
+
const name = value.config.name ? value.config.name : indexName2(tableName, indexColumnNames);
|
16094
|
+
let indexColumns = columns2.map(
|
16095
|
+
(it) => {
|
16096
|
+
var _a, _b, _c, _d, _e2;
|
16097
|
+
if ((0, import_drizzle_orm5.is)(it, import_drizzle_orm5.SQL)) {
|
16098
|
+
return {
|
16099
|
+
expression: dialect5.sqlToQuery(it, "indexes").sql,
|
16100
|
+
asc: true,
|
16101
|
+
isExpression: true,
|
16102
|
+
nulls: "last"
|
16103
|
+
};
|
16104
|
+
} else {
|
16105
|
+
it = it;
|
16106
|
+
return {
|
16107
|
+
expression: it.name,
|
16108
|
+
isExpression: false,
|
16109
|
+
asc: ((_a = it.indexConfig) == null ? void 0 : _a.order) === "asc",
|
16110
|
+
nulls: ((_b = it.indexConfig) == null ? void 0 : _b.nulls) ? (_c = it.indexConfig) == null ? void 0 : _c.nulls : ((_d = it.indexConfig) == null ? void 0 : _d.order) === "desc" ? "first" : "last",
|
16111
|
+
opclass: (_e2 = it.indexConfig) == null ? void 0 : _e2.opClass
|
16112
|
+
};
|
16113
|
+
}
|
16114
|
+
}
|
16115
|
+
);
|
15707
16116
|
if (typeof indexesInSchema[schema5 ?? "public"] !== "undefined") {
|
15708
16117
|
if (indexesInSchema[schema5 ?? "public"].includes(name)) {
|
15709
16118
|
console.log(
|
@@ -15725,7 +16134,11 @@ ${withStyle.errorWarning(
|
|
15725
16134
|
indexesObject[name] = {
|
15726
16135
|
name,
|
15727
16136
|
columns: indexColumns,
|
15728
|
-
isUnique: value.config.unique ?? false
|
16137
|
+
isUnique: value.config.unique ?? false,
|
16138
|
+
where: value.config.where ? dialect5.sqlToQuery(value.config.where).sql : void 0,
|
16139
|
+
concurrently: value.config.concurrently ?? false,
|
16140
|
+
method: value.config.method ?? "btree",
|
16141
|
+
with: value.config.with ?? {}
|
15729
16142
|
};
|
15730
16143
|
});
|
15731
16144
|
const tableKey2 = `${schema5 ?? "public"}.${tableName}`;
|
@@ -15739,16 +16152,6 @@ ${withStyle.errorWarning(
|
|
15739
16152
|
uniqueConstraints: uniqueConstraintObject
|
15740
16153
|
};
|
15741
16154
|
}
|
15742
|
-
const enumsToReturn = enums.reduce((map, obj) => {
|
15743
|
-
const enumSchema3 = obj.schema || "public";
|
15744
|
-
const key = `${enumSchema3}.${obj.enumName}`;
|
15745
|
-
map[key] = {
|
15746
|
-
name: obj.enumName,
|
15747
|
-
schema: enumSchema3,
|
15748
|
-
values: obj.enumValues
|
15749
|
-
};
|
15750
|
-
return map;
|
15751
|
-
}, {});
|
15752
16155
|
const schemasObject = Object.fromEntries(
|
15753
16156
|
schemas.filter((it) => {
|
15754
16157
|
if (schemaFilter) {
|
@@ -15759,7 +16162,7 @@ ${withStyle.errorWarning(
|
|
15759
16162
|
}).map((it) => [it.schemaName, it.schemaName])
|
15760
16163
|
);
|
15761
16164
|
return {
|
15762
|
-
version: "
|
16165
|
+
version: "7",
|
15763
16166
|
dialect: "postgresql",
|
15764
16167
|
tables: result,
|
15765
16168
|
enums: enumsToReturn,
|
@@ -16031,7 +16434,10 @@ ${withStyle.errorWarning(
|
|
16031
16434
|
columnTypeMapped = trimChar(columnTypeMapped, '"');
|
16032
16435
|
columnToReturn[columnName] = {
|
16033
16436
|
name: columnName,
|
16034
|
-
type:
|
16437
|
+
type: (
|
16438
|
+
// filter vectors, but in future we should filter any extension that was installed by user
|
16439
|
+
columnAdditionalDT === "USER-DEFINED" && !["vector", "geometry"].includes(enumType3) ? enumType3 : columnTypeMapped
|
16440
|
+
),
|
16035
16441
|
typeSchema: enumsToReturn[`${tableSchema}.${enumType3}`] !== void 0 ? enumsToReturn[`${tableSchema}.${enumType3}`].schema : void 0,
|
16036
16442
|
primaryKey: primaryKey.length === 1 && cprimaryKey.length < 2,
|
16037
16443
|
// default: isSerial ? undefined : defaultValue,
|
@@ -16042,15 +16448,42 @@ ${withStyle.errorWarning(
|
|
16042
16448
|
}
|
16043
16449
|
}
|
16044
16450
|
const dbIndexes = await db2.query(
|
16045
|
-
`SELECT t.relname
|
16046
|
-
|
16047
|
-
|
16048
|
-
|
16049
|
-
|
16050
|
-
|
16051
|
-
|
16052
|
-
|
16053
|
-
|
16451
|
+
`SELECT DISTINCT ON (t.relname, ic.relname, k.i) t.relname as table_name, ic.relname AS indexname,
|
16452
|
+
k.i AS index_order,
|
16453
|
+
i.indisunique as is_unique,
|
16454
|
+
am.amname as method,
|
16455
|
+
ic.reloptions as with,
|
16456
|
+
coalesce(a.attname,
|
16457
|
+
(('{' || pg_get_expr(
|
16458
|
+
i.indexprs,
|
16459
|
+
i.indrelid
|
16460
|
+
)
|
16461
|
+
|| '}')::text[]
|
16462
|
+
)[k.i]
|
16463
|
+
) AS column_name,
|
16464
|
+
CASE
|
16465
|
+
WHEN pg_get_expr(i.indexprs, i.indrelid) IS NOT NULL THEN 1
|
16466
|
+
ELSE 0
|
16467
|
+
END AS is_expression,
|
16468
|
+
i.indoption[k.i-1] & 1 = 1 AS descending,
|
16469
|
+
i.indoption[k.i-1] & 2 = 2 AS nulls_first,
|
16470
|
+
pg_get_expr(
|
16471
|
+
i.indpred,
|
16472
|
+
i.indrelid
|
16473
|
+
) as where,
|
16474
|
+
opc.opcname
|
16475
|
+
FROM pg_class t
|
16476
|
+
LEFT JOIN pg_index i ON t.oid = i.indrelid
|
16477
|
+
LEFT JOIN pg_class ic ON ic.oid = i.indexrelid
|
16478
|
+
CROSS JOIN LATERAL (SELECT unnest(i.indkey), generate_subscripts(i.indkey, 1) + 1) AS k(attnum, i)
|
16479
|
+
LEFT JOIN pg_attribute AS a
|
16480
|
+
ON i.indrelid = a.attrelid AND k.attnum = a.attnum
|
16481
|
+
JOIN pg_namespace c on c.oid = t.relnamespace
|
16482
|
+
LEFT JOIN pg_am AS am ON ic.relam = am.oid
|
16483
|
+
JOIN pg_opclass opc ON opc.oid = ANY(i.indclass)
|
16484
|
+
WHERE
|
16485
|
+
c.nspname = '${tableSchema}' AND
|
16486
|
+
t.relname = '${tableName}';`
|
16054
16487
|
);
|
16055
16488
|
const dbIndexFromConstraint = await db2.query(
|
16056
16489
|
`SELECT
|
@@ -16067,18 +16500,51 @@ ${withStyle.errorWarning(
|
|
16067
16500
|
);
|
16068
16501
|
const idxsInConsteraint = dbIndexFromConstraint.filter((it) => it.generated_by_constraint === 1).map((it) => it.index_name);
|
16069
16502
|
for (const dbIndex of dbIndexes) {
|
16070
|
-
const indexName4 = dbIndex.
|
16503
|
+
const indexName4 = dbIndex.indexname;
|
16071
16504
|
const indexColumnName = dbIndex.column_name;
|
16072
16505
|
const indexIsUnique = dbIndex.is_unique;
|
16506
|
+
const indexMethod = dbIndex.method;
|
16507
|
+
const indexWith = dbIndex.with;
|
16508
|
+
const indexWhere = dbIndex.where;
|
16509
|
+
const opclass = dbIndex.opcname;
|
16510
|
+
const isExpression = dbIndex.is_expression === 1;
|
16511
|
+
const desc = dbIndex.descending;
|
16512
|
+
const nullsFirst = dbIndex.nulls_first;
|
16513
|
+
const mappedWith = {};
|
16514
|
+
if (indexWith !== null) {
|
16515
|
+
indexWith.forEach((it) => {
|
16516
|
+
const splitted = it.split("=");
|
16517
|
+
mappedWith[splitted[0]] = splitted[1];
|
16518
|
+
});
|
16519
|
+
}
|
16073
16520
|
if (idxsInConsteraint.includes(indexName4))
|
16074
16521
|
continue;
|
16075
16522
|
if (typeof indexToReturn[indexName4] !== "undefined") {
|
16076
|
-
indexToReturn[indexName4].columns.push(
|
16523
|
+
indexToReturn[indexName4].columns.push({
|
16524
|
+
expression: indexColumnName,
|
16525
|
+
asc: !desc,
|
16526
|
+
nulls: nullsFirst ? "first" : "last",
|
16527
|
+
opclass,
|
16528
|
+
isExpression
|
16529
|
+
});
|
16077
16530
|
} else {
|
16078
16531
|
indexToReturn[indexName4] = {
|
16079
16532
|
name: indexName4,
|
16080
|
-
columns: [
|
16081
|
-
|
16533
|
+
columns: [
|
16534
|
+
{
|
16535
|
+
expression: indexColumnName,
|
16536
|
+
asc: !desc,
|
16537
|
+
nulls: nullsFirst ? "first" : "last",
|
16538
|
+
opclass,
|
16539
|
+
isExpression
|
16540
|
+
}
|
16541
|
+
],
|
16542
|
+
isUnique: indexIsUnique,
|
16543
|
+
// should not be a part of diff detecs
|
16544
|
+
concurrently: false,
|
16545
|
+
method: indexMethod,
|
16546
|
+
where: indexWhere === null ? void 0 : indexWhere,
|
16547
|
+
with: mappedWith
|
16082
16548
|
};
|
16083
16549
|
}
|
16084
16550
|
}
|
@@ -16114,7 +16580,7 @@ ${withStyle.errorWarning(
|
|
16114
16580
|
}
|
16115
16581
|
const schemasObject = Object.fromEntries([...schemas].map((it) => [it, it]));
|
16116
16582
|
return {
|
16117
|
-
version: "
|
16583
|
+
version: "7",
|
16118
16584
|
dialect: "postgresql",
|
16119
16585
|
tables: result,
|
16120
16586
|
enums: enumsToReturn,
|
@@ -16284,6 +16750,7 @@ var init_sqliteSerializer = __esm({
|
|
16284
16750
|
dialect6 = new import_sqlite_core2.SQLiteSyncDialect();
|
16285
16751
|
generateSqliteSnapshot = (tables) => {
|
16286
16752
|
const result = {};
|
16753
|
+
const internal = { indexes: {} };
|
16287
16754
|
for (const table4 of tables) {
|
16288
16755
|
const columnsObject = {};
|
16289
16756
|
const indexesObject = {};
|
@@ -16369,8 +16836,27 @@ ${withStyle.errorWarning(`We've found duplicated unique constraint names in ${so
|
|
16369
16836
|
const columns2 = value.config.columns;
|
16370
16837
|
const name = value.config.name;
|
16371
16838
|
let indexColumns = columns2.map((it) => {
|
16839
|
+
var _a;
|
16372
16840
|
if ((0, import_drizzle_orm7.is)(it, import_drizzle_orm7.SQL)) {
|
16373
|
-
|
16841
|
+
const sql2 = dialect6.sqlToQuery(it, "indexes").sql;
|
16842
|
+
if (typeof internal.indexes[name] === "undefined") {
|
16843
|
+
internal.indexes[name] = {
|
16844
|
+
columns: {
|
16845
|
+
[sql2]: {
|
16846
|
+
isExpression: true
|
16847
|
+
}
|
16848
|
+
}
|
16849
|
+
};
|
16850
|
+
} else {
|
16851
|
+
if (typeof ((_a = internal.indexes[name]) == null ? void 0 : _a.columns[sql2]) === "undefined") {
|
16852
|
+
internal.indexes[name].columns[sql2] = {
|
16853
|
+
isExpression: true
|
16854
|
+
};
|
16855
|
+
} else {
|
16856
|
+
internal.indexes[name].columns[sql2].isExpression = true;
|
16857
|
+
}
|
16858
|
+
}
|
16859
|
+
return sql2;
|
16374
16860
|
} else {
|
16375
16861
|
return it.name;
|
16376
16862
|
}
|
@@ -16444,7 +16930,8 @@ The unique constraint ${source_default.underline.blue(
|
|
16444
16930
|
_meta: {
|
16445
16931
|
tables: {},
|
16446
16932
|
columns: {}
|
16447
|
-
}
|
16933
|
+
},
|
16934
|
+
internal
|
16448
16935
|
};
|
16449
16936
|
};
|
16450
16937
|
fromDatabase3 = async (db2, tablesFilter = (table4) => true, progressCallback) => {
|
@@ -16898,7 +17385,7 @@ var init_sqlgenerator = __esm({
|
|
16898
17385
|
if (pgNativeTypes.has(it))
|
16899
17386
|
return true;
|
16900
17387
|
const toCheck = it.replace(/ /g, "");
|
16901
|
-
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);
|
17388
|
+
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(") || toCheck.startsWith("vector(") || /^(\w+)(\[\d*])+$/.test(it);
|
16902
17389
|
};
|
16903
17390
|
Convertor = class {
|
16904
17391
|
};
|
@@ -16947,7 +17434,14 @@ var init_sqlgenerator = __esm({
|
|
16947
17434
|
return statement.type === "create_table" && dialect7 === "mysql";
|
16948
17435
|
}
|
16949
17436
|
convert(st) {
|
16950
|
-
const {
|
17437
|
+
const {
|
17438
|
+
tableName,
|
17439
|
+
columns,
|
17440
|
+
schema: schema5,
|
17441
|
+
compositePKs,
|
17442
|
+
uniqueConstraints,
|
17443
|
+
internals
|
17444
|
+
} = st;
|
16951
17445
|
let statement = "";
|
16952
17446
|
statement += `CREATE TABLE \`${tableName}\` (
|
16953
17447
|
`;
|
@@ -16970,7 +17464,11 @@ var init_sqlgenerator = __esm({
|
|
16970
17464
|
for (const uniqueConstraint4 of uniqueConstraints) {
|
16971
17465
|
statement += ",\n";
|
16972
17466
|
const unsquashedUnique = MySqlSquasher.unsquashUnique(uniqueConstraint4);
|
16973
|
-
|
17467
|
+
const uniqueString = unsquashedUnique.columns.map((it) => {
|
17468
|
+
var _a, _b;
|
17469
|
+
return (internals == null ? void 0 : internals.indexes) ? ((_b = (_a = internals == null ? void 0 : internals.indexes[unsquashedUnique.name]) == null ? void 0 : _a.columns[it]) == null ? void 0 : _b.isExpression) ? it : `\`${it}\`` : `\`${it}\``;
|
17470
|
+
}).join(",");
|
17471
|
+
statement += ` CONSTRAINT \`${unsquashedUnique.name}\` UNIQUE(${uniqueString})`;
|
16974
17472
|
}
|
16975
17473
|
}
|
16976
17474
|
statement += `
|
@@ -17860,14 +18358,34 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
17860
18358
|
};
|
17861
18359
|
CreatePgIndexConvertor = class extends Convertor {
|
17862
18360
|
can(statement, dialect7) {
|
17863
|
-
return statement.type === "
|
18361
|
+
return statement.type === "create_index_pg" && dialect7 === "postgresql";
|
17864
18362
|
}
|
17865
18363
|
convert(statement) {
|
17866
|
-
const {
|
18364
|
+
const {
|
18365
|
+
name,
|
18366
|
+
columns,
|
18367
|
+
isUnique,
|
18368
|
+
concurrently,
|
18369
|
+
with: withMap,
|
18370
|
+
method,
|
18371
|
+
where
|
18372
|
+
} = statement.data;
|
17867
18373
|
const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
|
17868
|
-
const value = columns.map(
|
18374
|
+
const value = columns.map(
|
18375
|
+
(it) => `${it.expression}${it.opclass ? ` ${it.opclass}` : it.asc ? "" : " DESC"}${it.asc && it.nulls && it.nulls === "last" || it.opclass ? "" : ` NULLS ${it.nulls.toUpperCase()}`}`
|
18376
|
+
).join(",");
|
17869
18377
|
const tableNameWithSchema = statement.schema ? `"${statement.schema}"."${statement.tableName}"` : `"${statement.tableName}"`;
|
17870
|
-
|
18378
|
+
function reverseLogic(mappedWith) {
|
18379
|
+
let reversedString = "";
|
18380
|
+
for (const key in mappedWith) {
|
18381
|
+
if (mappedWith.hasOwnProperty(key)) {
|
18382
|
+
reversedString += `${key}=${mappedWith[key]},`;
|
18383
|
+
}
|
18384
|
+
}
|
18385
|
+
reversedString = reversedString.slice(0, -1);
|
18386
|
+
return reversedString;
|
18387
|
+
}
|
18388
|
+
return `CREATE ${indexPart}${concurrently ? " CONCURRENTLY" : ""} IF NOT EXISTS "${name}" ON ${tableNameWithSchema} USING ${method} (${value})${Object.keys(withMap).length !== 0 ? ` WITH (${reverseLogic(withMap)})` : ""}${where ? ` WHERE ${where}` : ""};`;
|
17871
18389
|
}
|
17872
18390
|
};
|
17873
18391
|
CreateMySqlIndexConvertor = class extends Convertor {
|
@@ -17879,8 +18397,11 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
17879
18397
|
statement.data
|
17880
18398
|
);
|
17881
18399
|
const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
|
17882
|
-
const
|
17883
|
-
|
18400
|
+
const uniqueString = columns.map((it) => {
|
18401
|
+
var _a, _b, _c, _d;
|
18402
|
+
return ((_a = statement.internal) == null ? void 0 : _a.indexes) ? ((_d = (_c = (_b = statement.internal) == null ? void 0 : _b.indexes[name]) == null ? void 0 : _c.columns[it]) == null ? void 0 : _d.isExpression) ? it : `\`${it}\`` : `\`${it}\``;
|
18403
|
+
}).join(",");
|
18404
|
+
return `CREATE ${indexPart} \`${name}\` ON \`${statement.tableName}\` (${uniqueString});`;
|
17884
18405
|
}
|
17885
18406
|
};
|
17886
18407
|
CreateSqliteIndexConvertor = class extends Convertor {
|
@@ -17893,8 +18414,11 @@ ${BREAKPOINT}ALTER TABLE ${tableNameWithSchema} ADD CONSTRAINT ${statement.newCo
|
|
17893
18414
|
);
|
17894
18415
|
const indexPart = isUnique ? "UNIQUE INDEX" : "INDEX";
|
17895
18416
|
const whereStatement = where ? ` WHERE ${where}` : "";
|
17896
|
-
const
|
17897
|
-
|
18417
|
+
const uniqueString = columns.map((it) => {
|
18418
|
+
var _a, _b, _c, _d;
|
18419
|
+
return ((_a = statement.internal) == null ? void 0 : _a.indexes) ? ((_d = (_c = (_b = statement.internal) == null ? void 0 : _b.indexes[name]) == null ? void 0 : _c.columns[it]) == null ? void 0 : _d.isExpression) ? it : `\`${it}\`` : `\`${it}\``;
|
18420
|
+
}).join(",");
|
18421
|
+
return `CREATE ${indexPart} \`${name}\` ON \`${statement.tableName}\` (${uniqueString})${whereStatement};`;
|
17898
18422
|
}
|
17899
18423
|
};
|
17900
18424
|
PgDropIndexConvertor = class extends Convertor {
|
@@ -18521,7 +19045,7 @@ var init_jsonDiffer = __esm({
|
|
18521
19045
|
});
|
18522
19046
|
|
18523
19047
|
// src/jsonStatements.ts
|
18524
|
-
var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
|
19048
|
+
var preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql;
|
18525
19049
|
var init_jsonStatements = __esm({
|
18526
19050
|
"src/jsonStatements.ts"() {
|
18527
19051
|
"use strict";
|
@@ -18542,7 +19066,7 @@ var init_jsonStatements = __esm({
|
|
18542
19066
|
uniqueConstraints: Object.values(uniqueConstraints)
|
18543
19067
|
};
|
18544
19068
|
};
|
18545
|
-
prepareMySqlCreateTableJson = (table4, json2) => {
|
19069
|
+
prepareMySqlCreateTableJson = (table4, json2, internals) => {
|
18546
19070
|
const { name, schema: schema5, columns, compositePrimaryKeys, uniqueConstraints } = table4;
|
18547
19071
|
return {
|
18548
19072
|
type: "create_table",
|
@@ -18551,7 +19075,8 @@ var init_jsonStatements = __esm({
|
|
18551
19075
|
columns: Object.values(columns),
|
18552
19076
|
compositePKs: Object.values(compositePrimaryKeys),
|
18553
19077
|
compositePkName: Object.values(compositePrimaryKeys).length > 0 ? json2.tables[name].compositePrimaryKeys[MySqlSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name].name : "",
|
18554
|
-
uniqueConstraints: Object.values(uniqueConstraints)
|
19078
|
+
uniqueConstraints: Object.values(uniqueConstraints),
|
19079
|
+
internals
|
18555
19080
|
};
|
18556
19081
|
};
|
18557
19082
|
prepareSQLiteCreateTable = (table4) => {
|
@@ -19286,13 +19811,36 @@ var init_jsonStatements = __esm({
|
|
19286
19811
|
}
|
19287
19812
|
return [...dropPkStatements, ...setPkStatements, ...statements];
|
19288
19813
|
};
|
19289
|
-
|
19814
|
+
preparePgCreateIndexesJson = (tableName, schema5, indexes, fullSchema, action) => {
|
19815
|
+
if (action === "push") {
|
19816
|
+
return Object.values(indexes).map((indexData) => {
|
19817
|
+
const unsquashedIndex = PgSquasher.unsquashIdxPush(indexData);
|
19818
|
+
const data = fullSchema.tables[`${schema5 === "" ? "public" : schema5}.${tableName}`].indexes[unsquashedIndex.name];
|
19819
|
+
return {
|
19820
|
+
type: "create_index_pg",
|
19821
|
+
tableName,
|
19822
|
+
data,
|
19823
|
+
schema: schema5
|
19824
|
+
};
|
19825
|
+
});
|
19826
|
+
}
|
19827
|
+
return Object.values(indexes).map((indexData) => {
|
19828
|
+
return {
|
19829
|
+
type: "create_index_pg",
|
19830
|
+
tableName,
|
19831
|
+
data: PgSquasher.unsquashIdx(indexData),
|
19832
|
+
schema: schema5
|
19833
|
+
};
|
19834
|
+
});
|
19835
|
+
};
|
19836
|
+
prepareCreateIndexesJson = (tableName, schema5, indexes, internal) => {
|
19290
19837
|
return Object.values(indexes).map((indexData) => {
|
19291
19838
|
return {
|
19292
19839
|
type: "create_index",
|
19293
19840
|
tableName,
|
19294
19841
|
data: indexData,
|
19295
|
-
schema: schema5
|
19842
|
+
schema: schema5,
|
19843
|
+
internal
|
19296
19844
|
};
|
19297
19845
|
});
|
19298
19846
|
};
|
@@ -19317,20 +19865,21 @@ var init_jsonStatements = __esm({
|
|
19317
19865
|
});
|
19318
19866
|
};
|
19319
19867
|
prepareAlterReferencesJson = (tableName, schema5, foreignKeys) => {
|
19320
|
-
const keys = Object.keys(foreignKeys);
|
19321
19868
|
const stmts = [];
|
19322
|
-
|
19323
|
-
stmts.push(
|
19324
|
-
|
19325
|
-
|
19326
|
-
|
19327
|
-
|
19328
|
-
|
19329
|
-
|
19330
|
-
|
19331
|
-
|
19332
|
-
|
19333
|
-
|
19869
|
+
Object.values(foreignKeys).map((val2) => {
|
19870
|
+
stmts.push({
|
19871
|
+
type: "delete_reference",
|
19872
|
+
tableName,
|
19873
|
+
schema: schema5,
|
19874
|
+
data: val2.__old
|
19875
|
+
});
|
19876
|
+
stmts.push({
|
19877
|
+
type: "create_reference",
|
19878
|
+
tableName,
|
19879
|
+
schema: schema5,
|
19880
|
+
data: val2.__new
|
19881
|
+
});
|
19882
|
+
});
|
19334
19883
|
return stmts;
|
19335
19884
|
};
|
19336
19885
|
prepareDropIndexesJson = (tableName, schema5, indexes) => {
|
@@ -19661,7 +20210,7 @@ var init_snapshotsDiffer = __esm({
|
|
19661
20210
|
}
|
19662
20211
|
return column7;
|
19663
20212
|
};
|
19664
|
-
applyPgSnapshotsDiff = async (json1, json2, schemasResolver2, enumsResolver2, tablesResolver2, columnsResolver2, prevFull, curFull) => {
|
20213
|
+
applyPgSnapshotsDiff = async (json1, json2, schemasResolver2, enumsResolver2, tablesResolver2, columnsResolver2, prevFull, curFull, action) => {
|
19665
20214
|
const schemasDiff = diffSchemasOrTables(json1.schemas, json2.schemas);
|
19666
20215
|
const {
|
19667
20216
|
created: createdSchemas,
|
@@ -19823,7 +20372,13 @@ var init_snapshotsDiffer = __esm({
|
|
19823
20372
|
const typedResult = diffResultScheme.parse(diffResult);
|
19824
20373
|
const jsonStatements = [];
|
19825
20374
|
const jsonCreateIndexesForCreatedTables = createdTables.map((it) => {
|
19826
|
-
return
|
20375
|
+
return preparePgCreateIndexesJson(
|
20376
|
+
it.name,
|
20377
|
+
it.schema,
|
20378
|
+
it.indexes,
|
20379
|
+
curFull,
|
20380
|
+
action
|
20381
|
+
);
|
19827
20382
|
}).flat();
|
19828
20383
|
const jsonDropTables = deletedTables.map((it) => {
|
19829
20384
|
return prepareDropTableJson(it);
|
@@ -19947,10 +20502,12 @@ var init_snapshotsDiffer = __esm({
|
|
19947
20502
|
return preparePgAlterColumns(it.name, it.schema, it.altered, json2);
|
19948
20503
|
}).flat();
|
19949
20504
|
const jsonCreateIndexesFoAlteredTables = alteredTables.map((it) => {
|
19950
|
-
return
|
20505
|
+
return preparePgCreateIndexesJson(
|
19951
20506
|
it.name,
|
19952
20507
|
it.schema,
|
19953
|
-
it.addedIndexes || {}
|
20508
|
+
it.addedIndexes || {},
|
20509
|
+
curFull,
|
20510
|
+
action
|
19954
20511
|
);
|
19955
20512
|
}).flat();
|
19956
20513
|
const jsonDropIndexesForAllAlteredTables = alteredTables.map((it) => {
|
@@ -19976,7 +20533,13 @@ var init_snapshotsDiffer = __esm({
|
|
19976
20533
|
{}
|
19977
20534
|
);
|
19978
20535
|
jsonCreateIndexesFoAlteredTables.push(
|
19979
|
-
...
|
20536
|
+
...preparePgCreateIndexesJson(
|
20537
|
+
it.name,
|
20538
|
+
it.schema,
|
20539
|
+
createdIndexes || {},
|
20540
|
+
curFull,
|
20541
|
+
action
|
20542
|
+
)
|
19980
20543
|
);
|
19981
20544
|
jsonDropIndexesForAllAlteredTables.push(
|
19982
20545
|
...prepareDropIndexesJson(it.name, it.schema, droppedIndexes || {})
|
@@ -20182,7 +20745,12 @@ var init_snapshotsDiffer = __esm({
|
|
20182
20745
|
const typedResult = diffResultSchemeMysql.parse(diffResult);
|
20183
20746
|
const jsonStatements = [];
|
20184
20747
|
const jsonCreateIndexesForCreatedTables = createdTables.map((it) => {
|
20185
|
-
return prepareCreateIndexesJson(
|
20748
|
+
return prepareCreateIndexesJson(
|
20749
|
+
it.name,
|
20750
|
+
it.schema,
|
20751
|
+
it.indexes,
|
20752
|
+
curFull.internal
|
20753
|
+
);
|
20186
20754
|
}).flat();
|
20187
20755
|
const jsonDropTables = deletedTables.map((it) => {
|
20188
20756
|
return prepareDropTableJson(it);
|
@@ -20281,7 +20849,8 @@ var init_snapshotsDiffer = __esm({
|
|
20281
20849
|
return prepareCreateIndexesJson(
|
20282
20850
|
it.name,
|
20283
20851
|
it.schema,
|
20284
|
-
it.addedIndexes || {}
|
20852
|
+
it.addedIndexes || {},
|
20853
|
+
curFull.internal
|
20285
20854
|
);
|
20286
20855
|
}).flat();
|
20287
20856
|
const jsonDropIndexesForAllAlteredTables = alteredTables.map((it) => {
|
@@ -20341,7 +20910,11 @@ var init_snapshotsDiffer = __esm({
|
|
20341
20910
|
(t2) => t2.type === "delete_reference"
|
20342
20911
|
);
|
20343
20912
|
const jsonMySqlCreateTables = createdTables.map((it) => {
|
20344
|
-
return prepareMySqlCreateTableJson(
|
20913
|
+
return prepareMySqlCreateTableJson(
|
20914
|
+
it,
|
20915
|
+
curFull,
|
20916
|
+
curFull.internal
|
20917
|
+
);
|
20345
20918
|
});
|
20346
20919
|
jsonStatements.push(...jsonMySqlCreateTables);
|
20347
20920
|
jsonStatements.push(...jsonDropTables);
|
@@ -20381,7 +20954,7 @@ var init_snapshotsDiffer = __esm({
|
|
20381
20954
|
_meta
|
20382
20955
|
};
|
20383
20956
|
};
|
20384
|
-
applySqliteSnapshotsDiff = async (json1, json2, tablesResolver2, columnsResolver2) => {
|
20957
|
+
applySqliteSnapshotsDiff = async (json1, json2, tablesResolver2, columnsResolver2, prevFull, curFull) => {
|
20385
20958
|
const tablesDiff = diffSchemasOrTables(json1.tables, json2.tables);
|
20386
20959
|
const {
|
20387
20960
|
created: createdTables,
|
@@ -20461,7 +21034,12 @@ var init_snapshotsDiffer = __esm({
|
|
20461
21034
|
return prepareSQLiteCreateTable(it);
|
20462
21035
|
});
|
20463
21036
|
const jsonCreateIndexesForCreatedTables = createdTables.map((it) => {
|
20464
|
-
return prepareCreateIndexesJson(
|
21037
|
+
return prepareCreateIndexesJson(
|
21038
|
+
it.name,
|
21039
|
+
it.schema,
|
21040
|
+
it.indexes,
|
21041
|
+
curFull.internal
|
21042
|
+
);
|
20465
21043
|
}).flat();
|
20466
21044
|
const jsonDropTables = deletedTables.map((it) => {
|
20467
21045
|
return prepareDropTableJson(it);
|
@@ -20563,7 +21141,8 @@ var init_snapshotsDiffer = __esm({
|
|
20563
21141
|
return prepareCreateIndexesJson(
|
20564
21142
|
it.name,
|
20565
21143
|
it.schema,
|
20566
|
-
it.addedIndexes || {}
|
21144
|
+
it.addedIndexes || {},
|
21145
|
+
curFull.internal
|
20567
21146
|
);
|
20568
21147
|
}).flat();
|
20569
21148
|
const jsonDropIndexesForAllAlteredTables = allAltered.map((it) => {
|
@@ -22083,7 +22662,10 @@ var init_migrate = __esm({
|
|
22083
22662
|
const schemaPath = config.schema;
|
22084
22663
|
try {
|
22085
22664
|
assertV1OutFolder(outFolder);
|
22086
|
-
const { snapshots, journal } = prepareMigrationFolder(
|
22665
|
+
const { snapshots, journal } = prepareMigrationFolder(
|
22666
|
+
outFolder,
|
22667
|
+
"postgresql"
|
22668
|
+
);
|
22087
22669
|
const { prev, cur, custom: custom2 } = await preparePgMigrationSnapshot(
|
22088
22670
|
snapshots,
|
22089
22671
|
schemaPath
|
@@ -22134,8 +22716,8 @@ var init_migrate = __esm({
|
|
22134
22716
|
);
|
22135
22717
|
const validatedPrev = pgSchema.parse(prev);
|
22136
22718
|
const validatedCur = pgSchema.parse(cur);
|
22137
|
-
const squashedPrev = squashPgScheme(validatedPrev);
|
22138
|
-
const squashedCur = squashPgScheme(validatedCur);
|
22719
|
+
const squashedPrev = squashPgScheme(validatedPrev, "push");
|
22720
|
+
const squashedCur = squashPgScheme(validatedCur, "push");
|
22139
22721
|
const { sqlStatements, statements, _meta } = await applyPgSnapshotsDiff(
|
22140
22722
|
squashedPrev,
|
22141
22723
|
squashedCur,
|
@@ -22144,7 +22726,8 @@ var init_migrate = __esm({
|
|
22144
22726
|
tablesResolver,
|
22145
22727
|
columnsResolver,
|
22146
22728
|
validatedPrev,
|
22147
|
-
validatedCur
|
22729
|
+
validatedCur,
|
22730
|
+
"push"
|
22148
22731
|
);
|
22149
22732
|
return { sqlStatements, statements, squashedPrev, squashedCur };
|
22150
22733
|
};
|
@@ -22250,7 +22833,9 @@ var init_migrate = __esm({
|
|
22250
22833
|
squashedPrev,
|
22251
22834
|
squashedCur,
|
22252
22835
|
tablesResolver,
|
22253
|
-
columnsResolver
|
22836
|
+
columnsResolver,
|
22837
|
+
validatedPrev,
|
22838
|
+
validatedCur
|
22254
22839
|
);
|
22255
22840
|
writeResult({
|
22256
22841
|
cur,
|
@@ -22276,7 +22861,9 @@ var init_migrate = __esm({
|
|
22276
22861
|
squashedPrev,
|
22277
22862
|
squashedCur,
|
22278
22863
|
tablesResolver,
|
22279
|
-
columnsResolver
|
22864
|
+
columnsResolver,
|
22865
|
+
validatedPrev,
|
22866
|
+
validatedCur
|
22280
22867
|
);
|
22281
22868
|
return {
|
22282
22869
|
sqlStatements,
|
@@ -22615,7 +23202,7 @@ var require_main = __commonJS({
|
|
22615
23202
|
var packageJson = require_package();
|
22616
23203
|
var version2 = packageJson.version;
|
22617
23204
|
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
22618
|
-
function
|
23205
|
+
function parse7(src) {
|
22619
23206
|
const obj = {};
|
22620
23207
|
let lines = src.toString();
|
22621
23208
|
lines = lines.replace(/\r\n?/mg, "\n");
|
@@ -22858,7 +23445,7 @@ var require_main = __commonJS({
|
|
22858
23445
|
_parseVault,
|
22859
23446
|
config,
|
22860
23447
|
decrypt,
|
22861
|
-
parse:
|
23448
|
+
parse: parse7,
|
22862
23449
|
populate
|
22863
23450
|
};
|
22864
23451
|
module2.exports.configDotenv = DotenvModule.configDotenv;
|
@@ -24271,9 +24858,9 @@ var require_glob_parent = __commonJS({
|
|
24271
24858
|
}
|
24272
24859
|
});
|
24273
24860
|
|
24274
|
-
// node_modules/.pnpm/braces@3.0.
|
24861
|
+
// node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/utils.js
|
24275
24862
|
var require_utils2 = __commonJS({
|
24276
|
-
"node_modules/.pnpm/braces@3.0.
|
24863
|
+
"node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/utils.js"(exports2) {
|
24277
24864
|
"use strict";
|
24278
24865
|
exports2.isInteger = (num) => {
|
24279
24866
|
if (typeof num === "number") {
|
@@ -24293,7 +24880,7 @@ var require_utils2 = __commonJS({
|
|
24293
24880
|
return (Number(max) - Number(min)) / Number(step) >= limit;
|
24294
24881
|
};
|
24295
24882
|
exports2.escapeNode = (block, n = 0, type) => {
|
24296
|
-
|
24883
|
+
let node = block.nodes[n];
|
24297
24884
|
if (!node)
|
24298
24885
|
return;
|
24299
24886
|
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
@@ -24344,14 +24931,8 @@ var require_utils2 = __commonJS({
|
|
24344
24931
|
const result = [];
|
24345
24932
|
const flat = (arr) => {
|
24346
24933
|
for (let i2 = 0; i2 < arr.length; i2++) {
|
24347
|
-
|
24348
|
-
|
24349
|
-
flat(ele);
|
24350
|
-
continue;
|
24351
|
-
}
|
24352
|
-
if (ele !== void 0) {
|
24353
|
-
result.push(ele);
|
24354
|
-
}
|
24934
|
+
let ele = arr[i2];
|
24935
|
+
Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele);
|
24355
24936
|
}
|
24356
24937
|
return result;
|
24357
24938
|
};
|
@@ -24361,15 +24942,15 @@ var require_utils2 = __commonJS({
|
|
24361
24942
|
}
|
24362
24943
|
});
|
24363
24944
|
|
24364
|
-
// node_modules/.pnpm/braces@3.0.
|
24945
|
+
// node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/stringify.js
|
24365
24946
|
var require_stringify = __commonJS({
|
24366
|
-
"node_modules/.pnpm/braces@3.0.
|
24947
|
+
"node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/stringify.js"(exports2, module2) {
|
24367
24948
|
"use strict";
|
24368
24949
|
var utils = require_utils2();
|
24369
24950
|
module2.exports = (ast, options = {}) => {
|
24370
|
-
|
24371
|
-
|
24372
|
-
|
24951
|
+
let stringify4 = (node, parent = {}) => {
|
24952
|
+
let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
|
24953
|
+
let invalidNode = node.invalid === true && options.escapeInvalid === true;
|
24373
24954
|
let output = "";
|
24374
24955
|
if (node.value) {
|
24375
24956
|
if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
|
@@ -24381,7 +24962,7 @@ var require_stringify = __commonJS({
|
|
24381
24962
|
return node.value;
|
24382
24963
|
}
|
24383
24964
|
if (node.nodes) {
|
24384
|
-
for (
|
24965
|
+
for (let child of node.nodes) {
|
24385
24966
|
output += stringify4(child);
|
24386
24967
|
}
|
24387
24968
|
}
|
@@ -24552,14 +25133,14 @@ var require_to_regex_range = __commonJS({
|
|
24552
25133
|
}
|
24553
25134
|
return tokens;
|
24554
25135
|
}
|
24555
|
-
function filterPatterns(arr, comparison, prefix,
|
25136
|
+
function filterPatterns(arr, comparison, prefix, intersection, options) {
|
24556
25137
|
let result = [];
|
24557
25138
|
for (let ele of arr) {
|
24558
25139
|
let { string } = ele;
|
24559
|
-
if (!
|
25140
|
+
if (!intersection && !contains(comparison, "string", string)) {
|
24560
25141
|
result.push(prefix + string);
|
24561
25142
|
}
|
24562
|
-
if (
|
25143
|
+
if (intersection && contains(comparison, "string", string)) {
|
24563
25144
|
result.push(prefix + string);
|
24564
25145
|
}
|
24565
25146
|
}
|
@@ -24826,24 +25407,23 @@ var require_fill_range = __commonJS({
|
|
24826
25407
|
}
|
24827
25408
|
});
|
24828
25409
|
|
24829
|
-
// node_modules/.pnpm/braces@3.0.
|
25410
|
+
// node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/compile.js
|
24830
25411
|
var require_compile = __commonJS({
|
24831
|
-
"node_modules/.pnpm/braces@3.0.
|
25412
|
+
"node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/compile.js"(exports2, module2) {
|
24832
25413
|
"use strict";
|
24833
25414
|
var fill = require_fill_range();
|
24834
25415
|
var utils = require_utils2();
|
24835
25416
|
var compile = (ast, options = {}) => {
|
24836
|
-
|
24837
|
-
|
24838
|
-
|
24839
|
-
|
24840
|
-
|
25417
|
+
let walk = (node, parent = {}) => {
|
25418
|
+
let invalidBlock = utils.isInvalidBrace(parent);
|
25419
|
+
let invalidNode = node.invalid === true && options.escapeInvalid === true;
|
25420
|
+
let invalid = invalidBlock === true || invalidNode === true;
|
25421
|
+
let prefix = options.escapeInvalid === true ? "\\" : "";
|
24841
25422
|
let output = "";
|
24842
25423
|
if (node.isOpen === true) {
|
24843
25424
|
return prefix + node.value;
|
24844
25425
|
}
|
24845
25426
|
if (node.isClose === true) {
|
24846
|
-
console.log("node.isClose", prefix, node.value);
|
24847
25427
|
return prefix + node.value;
|
24848
25428
|
}
|
24849
25429
|
if (node.type === "open") {
|
@@ -24859,14 +25439,14 @@ var require_compile = __commonJS({
|
|
24859
25439
|
return node.value;
|
24860
25440
|
}
|
24861
25441
|
if (node.nodes && node.ranges > 0) {
|
24862
|
-
|
24863
|
-
|
25442
|
+
let args = utils.reduce(node.nodes);
|
25443
|
+
let range = fill(...args, { ...options, wrap: false, toRegex: true });
|
24864
25444
|
if (range.length !== 0) {
|
24865
25445
|
return args.length > 1 && range.length > 1 ? `(${range})` : range;
|
24866
25446
|
}
|
24867
25447
|
}
|
24868
25448
|
if (node.nodes) {
|
24869
|
-
for (
|
25449
|
+
for (let child of node.nodes) {
|
24870
25450
|
output += walk(child, node);
|
24871
25451
|
}
|
24872
25452
|
}
|
@@ -24878,15 +25458,15 @@ var require_compile = __commonJS({
|
|
24878
25458
|
}
|
24879
25459
|
});
|
24880
25460
|
|
24881
|
-
// node_modules/.pnpm/braces@3.0.
|
25461
|
+
// node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/expand.js
|
24882
25462
|
var require_expand = __commonJS({
|
24883
|
-
"node_modules/.pnpm/braces@3.0.
|
25463
|
+
"node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/expand.js"(exports2, module2) {
|
24884
25464
|
"use strict";
|
24885
25465
|
var fill = require_fill_range();
|
24886
25466
|
var stringify4 = require_stringify();
|
24887
25467
|
var utils = require_utils2();
|
24888
25468
|
var append = (queue = "", stash = "", enclose = false) => {
|
24889
|
-
|
25469
|
+
let result = [];
|
24890
25470
|
queue = [].concat(queue);
|
24891
25471
|
stash = [].concat(stash);
|
24892
25472
|
if (!stash.length)
|
@@ -24894,9 +25474,9 @@ var require_expand = __commonJS({
|
|
24894
25474
|
if (!queue.length) {
|
24895
25475
|
return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
|
24896
25476
|
}
|
24897
|
-
for (
|
25477
|
+
for (let item of queue) {
|
24898
25478
|
if (Array.isArray(item)) {
|
24899
|
-
for (
|
25479
|
+
for (let value of item) {
|
24900
25480
|
result.push(append(value, stash, enclose));
|
24901
25481
|
}
|
24902
25482
|
} else {
|
@@ -24910,8 +25490,8 @@ var require_expand = __commonJS({
|
|
24910
25490
|
return utils.flatten(result);
|
24911
25491
|
};
|
24912
25492
|
var expand2 = (ast, options = {}) => {
|
24913
|
-
|
24914
|
-
|
25493
|
+
let rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
25494
|
+
let walk = (node, parent = {}) => {
|
24915
25495
|
node.queue = [];
|
24916
25496
|
let p4 = parent;
|
24917
25497
|
let q = parent.queue;
|
@@ -24928,7 +25508,7 @@ var require_expand = __commonJS({
|
|
24928
25508
|
return;
|
24929
25509
|
}
|
24930
25510
|
if (node.nodes && node.ranges > 0) {
|
24931
|
-
|
25511
|
+
let args = utils.reduce(node.nodes);
|
24932
25512
|
if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
|
24933
25513
|
throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
|
24934
25514
|
}
|
@@ -24940,7 +25520,7 @@ var require_expand = __commonJS({
|
|
24940
25520
|
node.nodes = [];
|
24941
25521
|
return;
|
24942
25522
|
}
|
24943
|
-
|
25523
|
+
let enclose = utils.encloseBrace(node);
|
24944
25524
|
let queue = node.queue;
|
24945
25525
|
let block = node;
|
24946
25526
|
while (block.type !== "brace" && block.type !== "root" && block.parent) {
|
@@ -24948,7 +25528,7 @@ var require_expand = __commonJS({
|
|
24948
25528
|
queue = block.queue;
|
24949
25529
|
}
|
24950
25530
|
for (let i2 = 0; i2 < node.nodes.length; i2++) {
|
24951
|
-
|
25531
|
+
let child = node.nodes[i2];
|
24952
25532
|
if (child.type === "comma" && node.type === "brace") {
|
24953
25533
|
if (i2 === 1)
|
24954
25534
|
queue.push("");
|
@@ -24975,12 +25555,12 @@ var require_expand = __commonJS({
|
|
24975
25555
|
}
|
24976
25556
|
});
|
24977
25557
|
|
24978
|
-
// node_modules/.pnpm/braces@3.0.
|
25558
|
+
// node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/constants.js
|
24979
25559
|
var require_constants2 = __commonJS({
|
24980
|
-
"node_modules/.pnpm/braces@3.0.
|
25560
|
+
"node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/constants.js"(exports2, module2) {
|
24981
25561
|
"use strict";
|
24982
25562
|
module2.exports = {
|
24983
|
-
MAX_LENGTH:
|
25563
|
+
MAX_LENGTH: 1024 * 64,
|
24984
25564
|
// Digits
|
24985
25565
|
CHAR_0: "0",
|
24986
25566
|
/* 0 */
|
@@ -25076,9 +25656,9 @@ var require_constants2 = __commonJS({
|
|
25076
25656
|
}
|
25077
25657
|
});
|
25078
25658
|
|
25079
|
-
// node_modules/.pnpm/braces@3.0.
|
25659
|
+
// node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/parse.js
|
25080
25660
|
var require_parse2 = __commonJS({
|
25081
|
-
"node_modules/.pnpm/braces@3.0.
|
25661
|
+
"node_modules/.pnpm/braces@3.0.2/node_modules/braces/lib/parse.js"(exports2, module2) {
|
25082
25662
|
"use strict";
|
25083
25663
|
var stringify4 = require_stringify();
|
25084
25664
|
var {
|
@@ -25110,24 +25690,25 @@ var require_parse2 = __commonJS({
|
|
25110
25690
|
CHAR_NO_BREAK_SPACE,
|
25111
25691
|
CHAR_ZERO_WIDTH_NOBREAK_SPACE
|
25112
25692
|
} = require_constants2();
|
25113
|
-
var
|
25693
|
+
var parse7 = (input, options = {}) => {
|
25114
25694
|
if (typeof input !== "string") {
|
25115
25695
|
throw new TypeError("Expected a string");
|
25116
25696
|
}
|
25117
|
-
|
25118
|
-
|
25697
|
+
let opts = options || {};
|
25698
|
+
let max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
25119
25699
|
if (input.length > max) {
|
25120
25700
|
throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
25121
25701
|
}
|
25122
|
-
|
25123
|
-
|
25702
|
+
let ast = { type: "root", input, nodes: [] };
|
25703
|
+
let stack = [ast];
|
25124
25704
|
let block = ast;
|
25125
25705
|
let prev = ast;
|
25126
25706
|
let brackets = 0;
|
25127
|
-
|
25707
|
+
let length = input.length;
|
25128
25708
|
let index4 = 0;
|
25129
25709
|
let depth = 0;
|
25130
25710
|
let value;
|
25711
|
+
let memo = {};
|
25131
25712
|
const advance = () => input[index4++];
|
25132
25713
|
const push = (node) => {
|
25133
25714
|
if (node.type === "text" && prev.type === "dot") {
|
@@ -25160,6 +25741,7 @@ var require_parse2 = __commonJS({
|
|
25160
25741
|
}
|
25161
25742
|
if (value === CHAR_LEFT_SQUARE_BRACKET) {
|
25162
25743
|
brackets++;
|
25744
|
+
let closed = true;
|
25163
25745
|
let next;
|
25164
25746
|
while (index4 < length && (next = advance())) {
|
25165
25747
|
value += next;
|
@@ -25198,7 +25780,7 @@ var require_parse2 = __commonJS({
|
|
25198
25780
|
continue;
|
25199
25781
|
}
|
25200
25782
|
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
25201
|
-
|
25783
|
+
let open = value;
|
25202
25784
|
let next;
|
25203
25785
|
if (options.keepQuotes !== true) {
|
25204
25786
|
value = "";
|
@@ -25220,8 +25802,8 @@ var require_parse2 = __commonJS({
|
|
25220
25802
|
}
|
25221
25803
|
if (value === CHAR_LEFT_CURLY_BRACE) {
|
25222
25804
|
depth++;
|
25223
|
-
|
25224
|
-
|
25805
|
+
let dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
|
25806
|
+
let brace = {
|
25225
25807
|
type: "brace",
|
25226
25808
|
open: true,
|
25227
25809
|
close: false,
|
@@ -25241,7 +25823,7 @@ var require_parse2 = __commonJS({
|
|
25241
25823
|
push({ type: "text", value });
|
25242
25824
|
continue;
|
25243
25825
|
}
|
25244
|
-
|
25826
|
+
let type = "close";
|
25245
25827
|
block = stack.pop();
|
25246
25828
|
block.close = true;
|
25247
25829
|
push({ type, value });
|
@@ -25252,7 +25834,7 @@ var require_parse2 = __commonJS({
|
|
25252
25834
|
if (value === CHAR_COMMA && depth > 0) {
|
25253
25835
|
if (block.ranges > 0) {
|
25254
25836
|
block.ranges = 0;
|
25255
|
-
|
25837
|
+
let open = block.nodes.shift();
|
25256
25838
|
block.nodes = [open, { type: "text", value: stringify4(block) }];
|
25257
25839
|
}
|
25258
25840
|
push({ type: "comma", value });
|
@@ -25260,7 +25842,7 @@ var require_parse2 = __commonJS({
|
|
25260
25842
|
continue;
|
25261
25843
|
}
|
25262
25844
|
if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
|
25263
|
-
|
25845
|
+
let siblings = block.nodes;
|
25264
25846
|
if (depth === 0 || siblings.length === 0) {
|
25265
25847
|
push({ type: "text", value });
|
25266
25848
|
continue;
|
@@ -25281,7 +25863,7 @@ var require_parse2 = __commonJS({
|
|
25281
25863
|
}
|
25282
25864
|
if (prev.type === "range") {
|
25283
25865
|
siblings.pop();
|
25284
|
-
|
25866
|
+
let before = siblings[siblings.length - 1];
|
25285
25867
|
before.value += prev.value + value;
|
25286
25868
|
prev = before;
|
25287
25869
|
block.ranges--;
|
@@ -25306,31 +25888,31 @@ var require_parse2 = __commonJS({
|
|
25306
25888
|
node.invalid = true;
|
25307
25889
|
}
|
25308
25890
|
});
|
25309
|
-
|
25310
|
-
|
25891
|
+
let parent = stack[stack.length - 1];
|
25892
|
+
let index5 = parent.nodes.indexOf(block);
|
25311
25893
|
parent.nodes.splice(index5, 1, ...block.nodes);
|
25312
25894
|
}
|
25313
25895
|
} while (stack.length > 0);
|
25314
25896
|
push({ type: "eos" });
|
25315
25897
|
return ast;
|
25316
25898
|
};
|
25317
|
-
module2.exports =
|
25899
|
+
module2.exports = parse7;
|
25318
25900
|
}
|
25319
25901
|
});
|
25320
25902
|
|
25321
|
-
// node_modules/.pnpm/braces@3.0.
|
25903
|
+
// node_modules/.pnpm/braces@3.0.2/node_modules/braces/index.js
|
25322
25904
|
var require_braces = __commonJS({
|
25323
|
-
"node_modules/.pnpm/braces@3.0.
|
25905
|
+
"node_modules/.pnpm/braces@3.0.2/node_modules/braces/index.js"(exports2, module2) {
|
25324
25906
|
"use strict";
|
25325
25907
|
var stringify4 = require_stringify();
|
25326
25908
|
var compile = require_compile();
|
25327
25909
|
var expand2 = require_expand();
|
25328
|
-
var
|
25910
|
+
var parse7 = require_parse2();
|
25329
25911
|
var braces = (input, options = {}) => {
|
25330
25912
|
let output = [];
|
25331
25913
|
if (Array.isArray(input)) {
|
25332
|
-
for (
|
25333
|
-
|
25914
|
+
for (let pattern of input) {
|
25915
|
+
let result = braces.create(pattern, options);
|
25334
25916
|
if (Array.isArray(result)) {
|
25335
25917
|
output.push(...result);
|
25336
25918
|
} else {
|
@@ -25345,7 +25927,7 @@ var require_braces = __commonJS({
|
|
25345
25927
|
}
|
25346
25928
|
return output;
|
25347
25929
|
};
|
25348
|
-
braces.parse = (input, options = {}) =>
|
25930
|
+
braces.parse = (input, options = {}) => parse7(input, options);
|
25349
25931
|
braces.stringify = (input, options = {}) => {
|
25350
25932
|
if (typeof input === "string") {
|
25351
25933
|
return stringify4(braces.parse(input, options), options);
|
@@ -26003,7 +26585,7 @@ var require_parse3 = __commonJS({
|
|
26003
26585
|
var syntaxError = (type, char) => {
|
26004
26586
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
26005
26587
|
};
|
26006
|
-
var
|
26588
|
+
var parse7 = (input, options) => {
|
26007
26589
|
if (typeof input !== "string") {
|
26008
26590
|
throw new TypeError("Expected a string");
|
26009
26591
|
}
|
@@ -26153,7 +26735,7 @@ var require_parse3 = __commonJS({
|
|
26153
26735
|
output = token.close = `)$))${extglobStar}`;
|
26154
26736
|
}
|
26155
26737
|
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
26156
|
-
const expression =
|
26738
|
+
const expression = parse7(rest, { ...options, fastpaths: false }).output;
|
26157
26739
|
output = token.close = `)${expression})${extglobStar})`;
|
26158
26740
|
}
|
26159
26741
|
if (token.prev.type === "bos") {
|
@@ -26682,7 +27264,7 @@ var require_parse3 = __commonJS({
|
|
26682
27264
|
}
|
26683
27265
|
return state;
|
26684
27266
|
};
|
26685
|
-
|
27267
|
+
parse7.fastpaths = (input, options) => {
|
26686
27268
|
const opts = { ...options };
|
26687
27269
|
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
26688
27270
|
const len = input.length;
|
@@ -26751,7 +27333,7 @@ var require_parse3 = __commonJS({
|
|
26751
27333
|
}
|
26752
27334
|
return source;
|
26753
27335
|
};
|
26754
|
-
module2.exports =
|
27336
|
+
module2.exports = parse7;
|
26755
27337
|
}
|
26756
27338
|
});
|
26757
27339
|
|
@@ -26761,7 +27343,7 @@ var require_picomatch = __commonJS({
|
|
26761
27343
|
"use strict";
|
26762
27344
|
var path5 = require("path");
|
26763
27345
|
var scan = require_scan();
|
26764
|
-
var
|
27346
|
+
var parse7 = require_parse3();
|
26765
27347
|
var utils = require_utils3();
|
26766
27348
|
var constants = require_constants3();
|
26767
27349
|
var isObject = (val2) => val2 && typeof val2 === "object" && !Array.isArray(val2);
|
@@ -26851,7 +27433,7 @@ var require_picomatch = __commonJS({
|
|
26851
27433
|
picomatch.parse = (pattern, options) => {
|
26852
27434
|
if (Array.isArray(pattern))
|
26853
27435
|
return pattern.map((p4) => picomatch.parse(p4, options));
|
26854
|
-
return
|
27436
|
+
return parse7(pattern, { ...options, fastpaths: false });
|
26855
27437
|
};
|
26856
27438
|
picomatch.scan = (input, options) => scan(input, options);
|
26857
27439
|
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
@@ -26877,10 +27459,10 @@ var require_picomatch = __commonJS({
|
|
26877
27459
|
}
|
26878
27460
|
let parsed = { negated: false, fastpaths: true };
|
26879
27461
|
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
26880
|
-
parsed.output =
|
27462
|
+
parsed.output = parse7.fastpaths(input, options);
|
26881
27463
|
}
|
26882
27464
|
if (!parsed.output) {
|
26883
|
-
parsed =
|
27465
|
+
parsed = parse7(input, options);
|
26884
27466
|
}
|
26885
27467
|
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
26886
27468
|
};
|
@@ -26907,9 +27489,9 @@ var require_picomatch2 = __commonJS({
|
|
26907
27489
|
}
|
26908
27490
|
});
|
26909
27491
|
|
26910
|
-
// node_modules/.pnpm/micromatch@4.0.
|
27492
|
+
// node_modules/.pnpm/micromatch@4.0.5/node_modules/micromatch/index.js
|
26911
27493
|
var require_micromatch = __commonJS({
|
26912
|
-
"node_modules/.pnpm/micromatch@4.0.
|
27494
|
+
"node_modules/.pnpm/micromatch@4.0.5/node_modules/micromatch/index.js"(exports2, module2) {
|
26913
27495
|
"use strict";
|
26914
27496
|
var util2 = require("util");
|
26915
27497
|
var braces = require_braces();
|
@@ -41867,7 +42449,7 @@ var require_public_api = __commonJS({
|
|
41867
42449
|
}
|
41868
42450
|
return doc;
|
41869
42451
|
}
|
41870
|
-
function
|
42452
|
+
function parse7(src, reviver, options) {
|
41871
42453
|
let _reviver = void 0;
|
41872
42454
|
if (typeof reviver === "function") {
|
41873
42455
|
_reviver = reviver;
|
@@ -41906,7 +42488,7 @@ var require_public_api = __commonJS({
|
|
41906
42488
|
}
|
41907
42489
|
return new Document.Document(value, _replacer, options).toString(options);
|
41908
42490
|
}
|
41909
|
-
exports2.parse =
|
42491
|
+
exports2.parse = parse7;
|
41910
42492
|
exports2.parseAllDocuments = parseAllDocuments;
|
41911
42493
|
exports2.parseDocument = parseDocument;
|
41912
42494
|
exports2.stringify = stringify4;
|
@@ -44332,7 +44914,7 @@ var require_extension = __commonJS({
|
|
44332
44914
|
else
|
44333
44915
|
dest[name].push(elem);
|
44334
44916
|
}
|
44335
|
-
function
|
44917
|
+
function parse7(header) {
|
44336
44918
|
const offers = /* @__PURE__ */ Object.create(null);
|
44337
44919
|
let params = /* @__PURE__ */ Object.create(null);
|
44338
44920
|
let mustUnescape = false;
|
@@ -44487,7 +45069,7 @@ var require_extension = __commonJS({
|
|
44487
45069
|
}).join(", ");
|
44488
45070
|
}).join(", ");
|
44489
45071
|
}
|
44490
|
-
module2.exports = { format: format2, parse:
|
45072
|
+
module2.exports = { format: format2, parse: parse7 };
|
44491
45073
|
}
|
44492
45074
|
});
|
44493
45075
|
|
@@ -44519,7 +45101,7 @@ var require_websocket = __commonJS({
|
|
44519
45101
|
var {
|
44520
45102
|
EventTarget: { addEventListener: addEventListener2, removeEventListener }
|
44521
45103
|
} = require_event_target();
|
44522
|
-
var { format: format2, parse:
|
45104
|
+
var { format: format2, parse: parse7 } = require_extension();
|
44523
45105
|
var { toBuffer } = require_buffer_util();
|
44524
45106
|
var closeTimeout = 30 * 1e3;
|
44525
45107
|
var kAborted = Symbol("kAborted");
|
@@ -45206,7 +45788,7 @@ var require_websocket = __commonJS({
|
|
45206
45788
|
}
|
45207
45789
|
let extensions;
|
45208
45790
|
try {
|
45209
|
-
extensions =
|
45791
|
+
extensions = parse7(secWebSocketExtensions);
|
45210
45792
|
} catch (err2) {
|
45211
45793
|
const message = "Invalid Sec-WebSocket-Extensions header";
|
45212
45794
|
abortHandshake(websocket, socket, message);
|
@@ -45382,7 +45964,7 @@ var require_subprotocol = __commonJS({
|
|
45382
45964
|
"node_modules/.pnpm/ws@8.17.0/node_modules/ws/lib/subprotocol.js"(exports2, module2) {
|
45383
45965
|
"use strict";
|
45384
45966
|
var { tokenChars } = require_validation();
|
45385
|
-
function
|
45967
|
+
function parse7(header) {
|
45386
45968
|
const protocols = /* @__PURE__ */ new Set();
|
45387
45969
|
let start = -1;
|
45388
45970
|
let end = -1;
|
@@ -45421,7 +46003,7 @@ var require_subprotocol = __commonJS({
|
|
45421
46003
|
protocols.add(protocol2);
|
45422
46004
|
return protocols;
|
45423
46005
|
}
|
45424
|
-
module2.exports = { parse:
|
46006
|
+
module2.exports = { parse: parse7 };
|
45425
46007
|
}
|
45426
46008
|
});
|
45427
46009
|
|
@@ -50251,7 +50833,7 @@ var init_v1 = __esm({
|
|
50251
50833
|
});
|
50252
50834
|
|
50253
50835
|
// node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/parse.js
|
50254
|
-
function
|
50836
|
+
function parse2(uuid) {
|
50255
50837
|
if (!validate_default(uuid)) {
|
50256
50838
|
throw TypeError("Invalid UUID");
|
50257
50839
|
}
|
@@ -50279,7 +50861,7 @@ var parse_default;
|
|
50279
50861
|
var init_parse = __esm({
|
50280
50862
|
"node_modules/.pnpm/uuid@9.0.1/node_modules/uuid/dist/esm-node/parse.js"() {
|
50281
50863
|
init_validate();
|
50282
|
-
parse_default =
|
50864
|
+
parse_default = parse2;
|
50283
50865
|
}
|
50284
50866
|
});
|
50285
50867
|
|
@@ -58236,7 +58818,7 @@ var require_dist_cjs39 = __commonJS({
|
|
58236
58818
|
providerConfigFromInit: () => providerConfigFromInit
|
58237
58819
|
});
|
58238
58820
|
module2.exports = __toCommonJS2(src_exports2);
|
58239
|
-
var
|
58821
|
+
var import_url8 = require("url");
|
58240
58822
|
var import_property_provider = require_dist_cjs12();
|
58241
58823
|
var import_buffer2 = require("buffer");
|
58242
58824
|
var import_http3 = require("http");
|
@@ -58343,7 +58925,7 @@ var require_dist_cjs39 = __commonJS({
|
|
58343
58925
|
};
|
58344
58926
|
}
|
58345
58927
|
if (process.env[ENV_CMDS_FULL_URI]) {
|
58346
|
-
const parsed = (0,
|
58928
|
+
const parsed = (0, import_url8.parse)(process.env[ENV_CMDS_FULL_URI]);
|
58347
58929
|
if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) {
|
58348
58930
|
throw new import_property_provider.CredentialsProviderError(
|
58349
58931
|
`${parsed.hostname} is not a valid container metadata service hostname`,
|
@@ -65812,7 +66394,7 @@ var require_postgres_interval = __commonJS({
|
|
65812
66394
|
if (!(this instanceof PostgresInterval)) {
|
65813
66395
|
return new PostgresInterval(raw2);
|
65814
66396
|
}
|
65815
|
-
extend(this,
|
66397
|
+
extend(this, parse7(raw2));
|
65816
66398
|
}
|
65817
66399
|
var properties = ["seconds", "minutes", "hours", "days", "months", "years"];
|
65818
66400
|
PostgresInterval.prototype.toPostgres = function() {
|
@@ -65874,7 +66456,7 @@ var require_postgres_interval = __commonJS({
|
|
65874
66456
|
var microseconds = fraction + "000000".slice(fraction.length);
|
65875
66457
|
return parseInt(microseconds, 10) / 1e3;
|
65876
66458
|
}
|
65877
|
-
function
|
66459
|
+
function parse7(interval) {
|
65878
66460
|
if (!interval)
|
65879
66461
|
return {};
|
65880
66462
|
var matches = INTERVAL.exec(interval);
|
@@ -66368,13 +66950,13 @@ var require_binaryParsers = __commonJS({
|
|
66368
66950
|
console.log("ERROR: ElementType not implemented: " + elementType2);
|
66369
66951
|
}
|
66370
66952
|
};
|
66371
|
-
var
|
66953
|
+
var parse7 = function(dimension, elementType2) {
|
66372
66954
|
var array = [];
|
66373
66955
|
var i3;
|
66374
66956
|
if (dimension.length > 1) {
|
66375
66957
|
var count = dimension.shift();
|
66376
66958
|
for (i3 = 0; i3 < count; i3++) {
|
66377
|
-
array[i3] =
|
66959
|
+
array[i3] = parse7(dimension, elementType2);
|
66378
66960
|
}
|
66379
66961
|
dimension.unshift(count);
|
66380
66962
|
} else {
|
@@ -66384,7 +66966,7 @@ var require_binaryParsers = __commonJS({
|
|
66384
66966
|
}
|
66385
66967
|
return array;
|
66386
66968
|
};
|
66387
|
-
return
|
66969
|
+
return parse7(dims, elementType);
|
66388
66970
|
};
|
66389
66971
|
var parseText = function(value) {
|
66390
66972
|
return value.toString("utf8");
|
@@ -67032,7 +67614,7 @@ var require_type_overrides = __commonJS({
|
|
67032
67614
|
var require_pg_connection_string = __commonJS({
|
67033
67615
|
"node_modules/.pnpm/pg-connection-string@2.6.4/node_modules/pg-connection-string/index.js"(exports2, module2) {
|
67034
67616
|
"use strict";
|
67035
|
-
function
|
67617
|
+
function parse7(str) {
|
67036
67618
|
if (str.charAt(0) === "/") {
|
67037
67619
|
const config2 = str.split(" ");
|
67038
67620
|
return { host: config2[0], database: config2[1] };
|
@@ -67108,8 +67690,8 @@ var require_pg_connection_string = __commonJS({
|
|
67108
67690
|
}
|
67109
67691
|
return config;
|
67110
67692
|
}
|
67111
|
-
module2.exports =
|
67112
|
-
|
67693
|
+
module2.exports = parse7;
|
67694
|
+
parse7.parse = parse7;
|
67113
67695
|
}
|
67114
67696
|
});
|
67115
67697
|
|
@@ -67119,7 +67701,7 @@ var require_connection_parameters = __commonJS({
|
|
67119
67701
|
"use strict";
|
67120
67702
|
var dns = require("dns");
|
67121
67703
|
var defaults3 = require_defaults();
|
67122
|
-
var
|
67704
|
+
var parse7 = require_pg_connection_string().parse;
|
67123
67705
|
var val2 = function(key, config, envVar) {
|
67124
67706
|
if (envVar === void 0) {
|
67125
67707
|
envVar = process.env["PG" + key.toUpperCase()];
|
@@ -67154,9 +67736,9 @@ var require_connection_parameters = __commonJS({
|
|
67154
67736
|
};
|
67155
67737
|
var ConnectionParameters = class {
|
67156
67738
|
constructor(config) {
|
67157
|
-
config = typeof config === "string" ?
|
67739
|
+
config = typeof config === "string" ? parse7(config) : config || {};
|
67158
67740
|
if (config.connectionString) {
|
67159
|
-
config = Object.assign({}, config,
|
67741
|
+
config = Object.assign({}, config, parse7(config.connectionString));
|
67160
67742
|
}
|
67161
67743
|
this.user = val2("user", config);
|
67162
67744
|
this.database = val2("database", config);
|
@@ -67827,7 +68409,7 @@ var require_serializer = __commonJS({
|
|
67827
68409
|
);
|
67828
68410
|
};
|
67829
68411
|
var emptyArray = [];
|
67830
|
-
var
|
68412
|
+
var parse7 = (query2) => {
|
67831
68413
|
const name = query2.name || "";
|
67832
68414
|
if (name.length > 63) {
|
67833
68415
|
console.error("Warning! Postgres only supports 63 characters for query names.");
|
@@ -67976,7 +68558,7 @@ var require_serializer = __commonJS({
|
|
67976
68558
|
sendSASLInitialResponseMessage,
|
67977
68559
|
sendSCRAMClientFinalMessage,
|
67978
68560
|
query,
|
67979
|
-
parse:
|
68561
|
+
parse: parse7,
|
67980
68562
|
bind,
|
67981
68563
|
execute,
|
67982
68564
|
describe,
|
@@ -68354,12 +68936,12 @@ var require_dist2 = __commonJS({
|
|
68354
68936
|
return serializer_1.serialize;
|
68355
68937
|
} });
|
68356
68938
|
var parser_1 = require_parser2();
|
68357
|
-
function
|
68939
|
+
function parse7(stream, callback) {
|
68358
68940
|
const parser = new parser_1.Parser();
|
68359
68941
|
stream.on("data", (buffer2) => parser.parse(buffer2, callback));
|
68360
68942
|
return new Promise((resolve2) => stream.on("end", () => resolve2()));
|
68361
68943
|
}
|
68362
|
-
exports2.parse =
|
68944
|
+
exports2.parse = parse7;
|
68363
68945
|
}
|
68364
68946
|
});
|
68365
68947
|
|
@@ -68405,7 +68987,7 @@ var require_connection = __commonJS({
|
|
68405
68987
|
"use strict";
|
68406
68988
|
var net2 = require("net");
|
68407
68989
|
var EventEmitter = require("events").EventEmitter;
|
68408
|
-
var { parse:
|
68990
|
+
var { parse: parse7, serialize: serialize3 } = require_dist2();
|
68409
68991
|
var { getStream, getSecureStream } = require_stream6();
|
68410
68992
|
var flushBuffer = serialize3.flush();
|
68411
68993
|
var syncBuffer = serialize3.sync();
|
@@ -68492,7 +69074,7 @@ var require_connection = __commonJS({
|
|
68492
69074
|
});
|
68493
69075
|
}
|
68494
69076
|
attachListeners(stream) {
|
68495
|
-
|
69077
|
+
parse7(stream, (msg) => {
|
68496
69078
|
var eventName = msg.name === "error" ? "errorMessage" : msg.name;
|
68497
69079
|
if (this._emitMessage) {
|
68498
69080
|
this.emit("message", msg);
|
@@ -71754,7 +72336,7 @@ function Subscribe(postgres2, options) {
|
|
71754
72336
|
}
|
71755
72337
|
function data(x4) {
|
71756
72338
|
if (x4[0] === 119) {
|
71757
|
-
|
72339
|
+
parse3(x4.subarray(25), state2, sql3.options.parsers, handle, options.transform);
|
71758
72340
|
} else if (x4[0] === 107 && x4[17]) {
|
71759
72341
|
state2.lsn = x4.subarray(1, 9);
|
71760
72342
|
pong();
|
@@ -71784,7 +72366,7 @@ function Subscribe(postgres2, options) {
|
|
71784
72366
|
function Time(x3) {
|
71785
72367
|
return new Date(Date.UTC(2e3, 0, 1) + Number(x3 / BigInt(1e3)));
|
71786
72368
|
}
|
71787
|
-
function
|
72369
|
+
function parse3(x3, state, parsers2, handle, transform) {
|
71788
72370
|
const char = (acc, [k2, v6]) => (acc[k2.charCodeAt(0)] = v6, acc);
|
71789
72371
|
Object.entries({
|
71790
72372
|
R: (x4) => {
|
@@ -80286,7 +80868,7 @@ var require_extension2 = __commonJS({
|
|
80286
80868
|
else
|
80287
80869
|
dest[name].push(elem);
|
80288
80870
|
}
|
80289
|
-
function
|
80871
|
+
function parse7(header) {
|
80290
80872
|
const offers = /* @__PURE__ */ Object.create(null);
|
80291
80873
|
let params = /* @__PURE__ */ Object.create(null);
|
80292
80874
|
let mustUnescape = false;
|
@@ -80441,7 +81023,7 @@ var require_extension2 = __commonJS({
|
|
80441
81023
|
}).join(", ");
|
80442
81024
|
}).join(", ");
|
80443
81025
|
}
|
80444
|
-
module2.exports = { format: format2, parse:
|
81026
|
+
module2.exports = { format: format2, parse: parse7 };
|
80445
81027
|
}
|
80446
81028
|
});
|
80447
81029
|
|
@@ -80473,7 +81055,7 @@ var require_websocket2 = __commonJS({
|
|
80473
81055
|
var {
|
80474
81056
|
EventTarget: { addEventListener: addEventListener2, removeEventListener }
|
80475
81057
|
} = require_event_target2();
|
80476
|
-
var { format: format2, parse:
|
81058
|
+
var { format: format2, parse: parse7 } = require_extension2();
|
80477
81059
|
var { toBuffer } = require_buffer_util2();
|
80478
81060
|
var closeTimeout = 30 * 1e3;
|
80479
81061
|
var kAborted = Symbol("kAborted");
|
@@ -81153,7 +81735,7 @@ var require_websocket2 = __commonJS({
|
|
81153
81735
|
}
|
81154
81736
|
let extensions;
|
81155
81737
|
try {
|
81156
|
-
extensions =
|
81738
|
+
extensions = parse7(secWebSocketExtensions);
|
81157
81739
|
} catch (err2) {
|
81158
81740
|
const message = "Invalid Sec-WebSocket-Extensions header";
|
81159
81741
|
abortHandshake(websocket, socket, message);
|
@@ -81327,7 +81909,7 @@ var require_subprotocol2 = __commonJS({
|
|
81327
81909
|
"node_modules/.pnpm/ws@8.14.2_bufferutil@4.0.8_utf-8-validate@6.0.3/node_modules/ws/lib/subprotocol.js"(exports2, module2) {
|
81328
81910
|
"use strict";
|
81329
81911
|
var { tokenChars } = require_validation2();
|
81330
|
-
function
|
81912
|
+
function parse7(header) {
|
81331
81913
|
const protocols = /* @__PURE__ */ new Set();
|
81332
81914
|
let start = -1;
|
81333
81915
|
let end = -1;
|
@@ -81366,7 +81948,7 @@ var require_subprotocol2 = __commonJS({
|
|
81366
81948
|
protocols.add(protocol2);
|
81367
81949
|
return protocols;
|
81368
81950
|
}
|
81369
|
-
module2.exports = { parse:
|
81951
|
+
module2.exports = { parse: parse7 };
|
81370
81952
|
}
|
81371
81953
|
});
|
81372
81954
|
|
@@ -99253,7 +99835,7 @@ var require_esprima = __commonJS({
|
|
99253
99835
|
var jsx_parser_1 = __webpack_require__2(3);
|
99254
99836
|
var parser_1 = __webpack_require__2(8);
|
99255
99837
|
var tokenizer_1 = __webpack_require__2(15);
|
99256
|
-
function
|
99838
|
+
function parse7(code, options, delegate) {
|
99257
99839
|
var commentHandler = null;
|
99258
99840
|
var proxyDelegate = function(node, metadata) {
|
99259
99841
|
if (delegate) {
|
@@ -99298,17 +99880,17 @@ var require_esprima = __commonJS({
|
|
99298
99880
|
}
|
99299
99881
|
return ast;
|
99300
99882
|
}
|
99301
|
-
exports3.parse =
|
99883
|
+
exports3.parse = parse7;
|
99302
99884
|
function parseModule(code, options, delegate) {
|
99303
99885
|
var parsingOptions = options || {};
|
99304
99886
|
parsingOptions.sourceType = "module";
|
99305
|
-
return
|
99887
|
+
return parse7(code, parsingOptions, delegate);
|
99306
99888
|
}
|
99307
99889
|
exports3.parseModule = parseModule;
|
99308
99890
|
function parseScript(code, options, delegate) {
|
99309
99891
|
var parsingOptions = options || {};
|
99310
99892
|
parsingOptions.sourceType = "script";
|
99311
|
-
return
|
99893
|
+
return parse7(code, parsingOptions, delegate);
|
99312
99894
|
}
|
99313
99895
|
exports3.parseScript = parseScript;
|
99314
99896
|
function tokenize(code, options, delegate) {
|
@@ -108860,7 +109442,7 @@ var require_named_placeholders = __commonJS({
|
|
108860
109442
|
var DQUOTE = 34;
|
108861
109443
|
var SQUOTE = 39;
|
108862
109444
|
var BSLASH = 92;
|
108863
|
-
function
|
109445
|
+
function parse7(query) {
|
108864
109446
|
let ppos = RE_PARAM.exec(query);
|
108865
109447
|
let curpos = 0;
|
108866
109448
|
let start = 0;
|
@@ -108975,17 +109557,17 @@ var require_named_placeholders = __commonJS({
|
|
108975
109557
|
if (cache && (tree = cache.get(query))) {
|
108976
109558
|
return toArrayParams(tree, paramsObj);
|
108977
109559
|
}
|
108978
|
-
tree = join7(
|
109560
|
+
tree = join7(parse7(query));
|
108979
109561
|
if (cache) {
|
108980
109562
|
cache.set(query, tree);
|
108981
109563
|
}
|
108982
109564
|
return toArrayParams(tree, paramsObj);
|
108983
109565
|
}
|
108984
|
-
compile.parse =
|
109566
|
+
compile.parse = parse7;
|
108985
109567
|
return compile;
|
108986
109568
|
}
|
108987
109569
|
function toNumbered(q, params) {
|
108988
|
-
const tree =
|
109570
|
+
const tree = parse7(q);
|
108989
109571
|
const paramsArr = [];
|
108990
109572
|
if (tree.length == 1) {
|
108991
109573
|
return [tree[0], paramsArr];
|
@@ -111139,7 +111721,7 @@ function parseObjectRow(fields, rawRow, cast2) {
|
|
111139
111721
|
return acc;
|
111140
111722
|
}, {});
|
111141
111723
|
}
|
111142
|
-
function
|
111724
|
+
function parse4(result, cast2, returnAs) {
|
111143
111725
|
const fields = result.fields ?? [];
|
111144
111726
|
const rows = result.rows ?? [];
|
111145
111727
|
return rows.map((row) => returnAs === "array" ? parseArrayRow(fields, row, cast2) : parseObjectRow(fields, row, cast2));
|
@@ -111248,7 +111830,7 @@ var init_dist2 = __esm({
|
|
111248
111830
|
field.type || (field.type = "NULL");
|
111249
111831
|
}
|
111250
111832
|
const castFn = options.cast || this.config.cast || cast;
|
111251
|
-
const rows = result ?
|
111833
|
+
const rows = result ? parse4(result, castFn, options.as || "object") : [];
|
111252
111834
|
const headers = fields.map((f3) => f3.name);
|
111253
111835
|
const typeByName = (acc, { name, type }) => ({ ...acc, [name]: type });
|
111254
111836
|
const types4 = fields.reduce(typeByName, {});
|
@@ -111291,6 +111873,7 @@ var init_connections = __esm({
|
|
111291
111873
|
init_utils2();
|
111292
111874
|
init_global();
|
111293
111875
|
init_outputs();
|
111876
|
+
init_utils();
|
111294
111877
|
preparePostgresDB = async (credentials2) => {
|
111295
111878
|
if ("driver" in credentials2) {
|
111296
111879
|
if (credentials2.driver === "aws-data-api") {
|
@@ -111357,7 +111940,8 @@ var init_connections = __esm({
|
|
111357
111940
|
const pg = await Promise.resolve().then(() => __toESM(require_lib3()));
|
111358
111941
|
const { drizzle } = await import("drizzle-orm/node-postgres");
|
111359
111942
|
const { migrate } = await import("drizzle-orm/node-postgres/migrator");
|
111360
|
-
const
|
111943
|
+
const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
|
111944
|
+
const client = "url" in credentials2 ? new pg.default.Pool({ connectionString: credentials2.url, max: 1 }) : new pg.default.Pool({ ...credentials2, ssl, max: 1 });
|
111361
111945
|
const db2 = drizzle(client);
|
111362
111946
|
const migrateFn = async (config) => {
|
111363
111947
|
return migrate(db2, config);
|
@@ -111409,11 +111993,11 @@ var init_connections = __esm({
|
|
111409
111993
|
"'@vercel/postgres' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
|
111410
111994
|
)
|
111411
111995
|
);
|
111412
|
-
const {
|
111996
|
+
const { VercelPool: VercelPool2 } = await Promise.resolve().then(() => (init_index_node(), index_node_exports));
|
111413
111997
|
const { drizzle } = await import("drizzle-orm/vercel-postgres");
|
111414
111998
|
const { migrate } = await import("drizzle-orm/vercel-postgres/migrator");
|
111415
|
-
const
|
111416
|
-
client
|
111999
|
+
const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
|
112000
|
+
const client = "url" in credentials2 ? new VercelPool2({ connectionString: credentials2.url }) : new VercelPool2({ ...credentials2, ssl });
|
111417
112001
|
await client.connect();
|
111418
112002
|
const db2 = drizzle(client);
|
111419
112003
|
const migrateFn = async (config) => {
|
@@ -111444,16 +112028,16 @@ var init_connections = __esm({
|
|
111444
112028
|
"'@neondatabase/serverless' can only connect to remote Neon/Vercel Postgres/Supabase instances through a websocket"
|
111445
112029
|
)
|
111446
112030
|
);
|
111447
|
-
const {
|
112031
|
+
const { Pool, neonConfig } = await Promise.resolve().then(() => (init_serverless2(), serverless_exports));
|
111448
112032
|
const { drizzle } = await import("drizzle-orm/neon-serverless");
|
111449
112033
|
const { migrate } = await import("drizzle-orm/neon-serverless/migrator");
|
111450
|
-
const
|
112034
|
+
const ssl = "ssl" in credentials2 ? credentials2.ssl === "prefer" || credentials2.ssl === "require" || credentials2.ssl === "allow" ? { rejectUnauthorized: false } : credentials2.ssl === "verify-full" ? {} : credentials2.ssl : {};
|
112035
|
+
const client = "url" in credentials2 ? new Pool({ connectionString: credentials2.url, max: 1 }) : new Pool({ ...credentials2, max: 1, ssl });
|
112036
|
+
neonConfig.webSocketConstructor = wrapper_default;
|
111451
112037
|
const db2 = drizzle(client);
|
111452
112038
|
const migrateFn = async (config) => {
|
111453
112039
|
return migrate(db2, config);
|
111454
112040
|
};
|
111455
|
-
client.neonConfig.webSocketConstructor = wrapper_default;
|
111456
|
-
await client.connect();
|
111457
112041
|
const query = async (sql2, params) => {
|
111458
112042
|
const result = await client.query(sql2, params ?? []);
|
111459
112043
|
return result.rows;
|
@@ -111555,11 +112139,11 @@ var init_connections = __esm({
|
|
111555
112139
|
);
|
111556
112140
|
process.exit(1);
|
111557
112141
|
};
|
111558
|
-
prepareSqliteParams = (params,
|
112142
|
+
prepareSqliteParams = (params, driver3) => {
|
111559
112143
|
return params.map((param) => {
|
111560
112144
|
if (param && typeof param === "object" && "type" in param && "value" in param && param.type === "binary") {
|
111561
112145
|
const value = typeof param.value === "object" ? JSON.stringify(param.value) : param.value;
|
111562
|
-
if (
|
112146
|
+
if (driver3 === "d1-http") {
|
111563
112147
|
return value;
|
111564
112148
|
}
|
111565
112149
|
return Buffer.from(value);
|
@@ -111569,8 +112153,8 @@ var init_connections = __esm({
|
|
111569
112153
|
};
|
111570
112154
|
connectToSQLite = async (credentials2) => {
|
111571
112155
|
if ("driver" in credentials2) {
|
111572
|
-
const { driver:
|
111573
|
-
if (
|
112156
|
+
const { driver: driver3 } = credentials2;
|
112157
|
+
if (driver3 === "turso") {
|
111574
112158
|
assertPackages("@libsql/client");
|
111575
112159
|
const { createClient: createClient2 } = await import("@libsql/client");
|
111576
112160
|
const { drizzle } = await import("drizzle-orm/libsql");
|
@@ -111607,7 +112191,7 @@ var init_connections = __esm({
|
|
111607
112191
|
}
|
111608
112192
|
};
|
111609
112193
|
return { ...db2, ...proxy, migrate: migrateFn };
|
111610
|
-
} else if (
|
112194
|
+
} else if (driver3 === "d1-http") {
|
111611
112195
|
const { drizzle } = await import("drizzle-orm/sqlite-proxy");
|
111612
112196
|
const { migrate } = await import("drizzle-orm/sqlite-proxy/migrator");
|
111613
112197
|
const remoteCallback = async (sql2, params, method) => {
|
@@ -111667,7 +112251,7 @@ var init_connections = __esm({
|
|
111667
112251
|
};
|
111668
112252
|
return { ...db2, ...proxy, migrate: migrateFn };
|
111669
112253
|
} else {
|
111670
|
-
assertUnreachable(
|
112254
|
+
assertUnreachable(driver3);
|
111671
112255
|
}
|
111672
112256
|
}
|
111673
112257
|
if (await checkPackage("@libsql/client")) {
|
@@ -111675,7 +112259,7 @@ var init_connections = __esm({
|
|
111675
112259
|
const { drizzle } = await import("drizzle-orm/libsql");
|
111676
112260
|
const { migrate } = await import("drizzle-orm/libsql/migrator");
|
111677
112261
|
const client = createClient2({
|
111678
|
-
url: credentials2.url
|
112262
|
+
url: normaliseSQLiteUrl(credentials2.url, "libsql")
|
111679
112263
|
});
|
111680
112264
|
const drzl = drizzle(client);
|
111681
112265
|
const migrateFn = async (config) => {
|
@@ -111710,7 +112294,9 @@ var init_connections = __esm({
|
|
111710
112294
|
const { default: Database } = await import("better-sqlite3");
|
111711
112295
|
const { drizzle } = await import("drizzle-orm/better-sqlite3");
|
111712
112296
|
const { migrate } = await import("drizzle-orm/better-sqlite3/migrator");
|
111713
|
-
const sqlite = new Database(
|
112297
|
+
const sqlite = new Database(
|
112298
|
+
normaliseSQLiteUrl(credentials2.url, "better-sqlite")
|
112299
|
+
);
|
111714
112300
|
const drzl = drizzle(sqlite);
|
111715
112301
|
const migrateFn = async (config) => {
|
111716
112302
|
return migrate(drzl, config);
|
@@ -115165,6 +115751,7 @@ var init_introspect_pg = __esm({
|
|
115165
115751
|
init_utils3();
|
115166
115752
|
init_pgSerializer();
|
115167
115753
|
init_global();
|
115754
|
+
init_vector();
|
115168
115755
|
pgImportsList = /* @__PURE__ */ new Set([
|
115169
115756
|
"pgTable",
|
115170
115757
|
"pgEnum",
|
@@ -115193,7 +115780,11 @@ var init_introspect_pg = __esm({
|
|
115193
115780
|
"macaddr8",
|
115194
115781
|
"bigint",
|
115195
115782
|
"doublePrecision",
|
115196
|
-
"uuid"
|
115783
|
+
"uuid",
|
115784
|
+
"vector",
|
115785
|
+
"point",
|
115786
|
+
"line",
|
115787
|
+
"geometry"
|
115197
115788
|
]);
|
115198
115789
|
objToStatement23 = (json) => {
|
115199
115790
|
json = Object.fromEntries(Object.entries(json).filter((it) => it[1]));
|
@@ -115330,6 +115921,8 @@ var init_introspect_pg = __esm({
|
|
115330
115921
|
patched = patched.startsWith("numeric(") ? "numeric" : patched;
|
115331
115922
|
patched = patched.startsWith("time(") ? "time" : patched;
|
115332
115923
|
patched = patched.startsWith("timestamp(") ? "timestamp" : patched;
|
115924
|
+
patched = patched.startsWith("vector(") ? "vector" : patched;
|
115925
|
+
patched = patched.startsWith("geometry(") ? "geometry" : patched;
|
115333
115926
|
return patched;
|
115334
115927
|
}).filter((type) => {
|
115335
115928
|
return pgImportsList.has(type);
|
@@ -115520,7 +116113,7 @@ var init_introspect_pg = __esm({
|
|
115520
116113
|
}
|
115521
116114
|
if (lowered === "date") {
|
115522
116115
|
let out = `${withCasing2(name, casing2)}: date("${name}")`;
|
115523
|
-
defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue ? `.default(${defaultValue})` : "";
|
116116
|
+
defaultValue = defaultValue === "now()" ? ".defaultNow()" : defaultValue === "CURRENT_DATE" ? `.default(sql\`${defaultValue}\`)` : defaultValue ? `.default(${defaultValue})` : "";
|
115524
116117
|
out += defaultValue;
|
115525
116118
|
return out;
|
115526
116119
|
}
|
@@ -115580,6 +116173,58 @@ var init_introspect_pg = __esm({
|
|
115580
116173
|
out += typeof defaultValue !== "undefined" ? `.default(${defaultValue})` : "";
|
115581
116174
|
return out;
|
115582
116175
|
}
|
116176
|
+
if (lowered.startsWith("point")) {
|
116177
|
+
let out = `${withCasing2(name, casing2)}: point("${name}")`;
|
116178
|
+
out += typeof defaultValue !== "undefined" ? `.default(${defaultValue})` : "";
|
116179
|
+
return out;
|
116180
|
+
}
|
116181
|
+
if (lowered.startsWith("line")) {
|
116182
|
+
let out = `${withCasing2(name, casing2)}: point("${name}")`;
|
116183
|
+
out += typeof defaultValue !== "undefined" ? `.default(${defaultValue})` : "";
|
116184
|
+
return out;
|
116185
|
+
}
|
116186
|
+
if (lowered.startsWith("geometry")) {
|
116187
|
+
let out = "";
|
116188
|
+
let isGeoUnknown = false;
|
116189
|
+
if (lowered.length !== 8) {
|
116190
|
+
const geometryOptions = lowered.slice(9, -1).split(",");
|
116191
|
+
if (geometryOptions.length === 1 && geometryOptions[0] !== "") {
|
116192
|
+
out = `${withCasing2(name, casing2)}: geometry("${name}", { type: "${geometryOptions[0]}" })`;
|
116193
|
+
} else if (geometryOptions.length === 2) {
|
116194
|
+
out = `${withCasing2(name, casing2)}: geometry("${name}", { type: "${geometryOptions[0]}", srid: ${geometryOptions[1]} })`;
|
116195
|
+
} else {
|
116196
|
+
isGeoUnknown = true;
|
116197
|
+
}
|
116198
|
+
} else {
|
116199
|
+
out = `${withCasing2(name, casing2)}: geometry("${name}")`;
|
116200
|
+
}
|
116201
|
+
out += typeof defaultValue !== "undefined" ? `.default(${defaultValue})` : "";
|
116202
|
+
if (isGeoUnknown) {
|
116203
|
+
let unknown2 = `// TODO: failed to parse geometry type because found more than 2 options inside geometry function '${type}'
|
116204
|
+
// Introspect is currently supporting only type and srid options
|
116205
|
+
`;
|
116206
|
+
unknown2 += ` ${withCasing2(name, casing2)}: unknown("${name}")`;
|
116207
|
+
return unknown2;
|
116208
|
+
}
|
116209
|
+
return out;
|
116210
|
+
}
|
116211
|
+
if (lowered.startsWith("vector")) {
|
116212
|
+
const split = lowered.split(" ");
|
116213
|
+
let out;
|
116214
|
+
if (lowered.length !== 6) {
|
116215
|
+
out = `${withCasing2(
|
116216
|
+
name,
|
116217
|
+
casing2
|
116218
|
+
)}: vector("${name}", { dimensions: ${lowered.substring(
|
116219
|
+
7,
|
116220
|
+
lowered.length - 1
|
116221
|
+
)} })`;
|
116222
|
+
} else {
|
116223
|
+
out = `${withCasing2(name, casing2)}: vector("${name}")`;
|
116224
|
+
}
|
116225
|
+
out += typeof defaultValue !== "undefined" ? `.default(${defaultValue})` : "";
|
116226
|
+
return out;
|
116227
|
+
}
|
115583
116228
|
if (lowered.startsWith("char")) {
|
115584
116229
|
let out;
|
115585
116230
|
if (lowered.length !== 4) {
|
@@ -115693,13 +116338,35 @@ var init_introspect_pg = __esm({
|
|
115693
116338
|
let idxKey = it.name.startsWith(tableName) && it.name !== tableName ? it.name.slice(tableName.length + 1) : it.name;
|
115694
116339
|
idxKey = idxKey.endsWith("_index") ? idxKey.slice(0, -"_index".length) + "_idx" : idxKey;
|
115695
116340
|
idxKey = withCasing2(idxKey, casing2);
|
115696
|
-
const indexGeneratedName = indexName2(
|
116341
|
+
const indexGeneratedName = indexName2(
|
116342
|
+
tableName,
|
116343
|
+
it.columns.map((it2) => it2.expression)
|
116344
|
+
);
|
115697
116345
|
const escapedIndexName = indexGeneratedName === it.name ? "" : `"${it.name}"`;
|
115698
116346
|
statement += ` ${idxKey}: `;
|
115699
116347
|
statement += it.isUnique ? "uniqueIndex(" : "index(";
|
115700
116348
|
statement += `${escapedIndexName})`;
|
115701
|
-
statement +=
|
115702
|
-
statement +=
|
116349
|
+
statement += `${it.concurrently ? `.concurrently()` : ""}`;
|
116350
|
+
statement += `.using("${it.method}", ${it.columns.map((it2) => {
|
116351
|
+
if (it2.isExpression) {
|
116352
|
+
return `sql\`${it2.expression}\``;
|
116353
|
+
} else {
|
116354
|
+
return `table.${withCasing2(it2.expression, casing2)}${it2.opclass && vectorOps.includes(it2.opclass) ? `.op("${it2.opclass}")` : ""}`;
|
116355
|
+
}
|
116356
|
+
}).join(", ")})`;
|
116357
|
+
statement += it.where ? `.where(sql\`${it.where}\`)` : "";
|
116358
|
+
function reverseLogic(mappedWith) {
|
116359
|
+
let reversedString = "{";
|
116360
|
+
for (const key in mappedWith) {
|
116361
|
+
if (mappedWith.hasOwnProperty(key)) {
|
116362
|
+
reversedString += `${key}: "${mappedWith[key]}",`;
|
116363
|
+
}
|
116364
|
+
}
|
116365
|
+
reversedString = reversedString.length > 1 ? reversedString.slice(0, reversedString.length - 1) : reversedString;
|
116366
|
+
return `${reversedString}}`;
|
116367
|
+
}
|
116368
|
+
statement += it.with && Object.keys(it.with).length > 0 ? `.with(${reverseLogic(it.with)})` : "";
|
116369
|
+
statement += `,
|
115703
116370
|
`;
|
115704
116371
|
});
|
115705
116372
|
return statement;
|
@@ -116157,10 +116824,19 @@ var init_introspect = __esm({
|
|
116157
116824
|
const filter2 = (tableName) => {
|
116158
116825
|
if (matchers.length === 0)
|
116159
116826
|
return true;
|
116160
|
-
|
116161
|
-
|
116162
|
-
if (matcher.
|
116163
|
-
|
116827
|
+
let flags = [];
|
116828
|
+
for (let matcher of matchers) {
|
116829
|
+
if (matcher.negate) {
|
116830
|
+
if (!matcher.match(tableName)) {
|
116831
|
+
flags.push(false);
|
116832
|
+
}
|
116833
|
+
}
|
116834
|
+
if (matcher.match(tableName)) {
|
116835
|
+
flags.push(true);
|
116836
|
+
}
|
116837
|
+
}
|
116838
|
+
if (flags.length > 0) {
|
116839
|
+
return flags.every(Boolean);
|
116164
116840
|
}
|
116165
116841
|
return false;
|
116166
116842
|
};
|
@@ -116231,10 +116907,19 @@ var init_introspect = __esm({
|
|
116231
116907
|
const filter2 = (tableName) => {
|
116232
116908
|
if (matchers.length === 0)
|
116233
116909
|
return true;
|
116234
|
-
|
116235
|
-
|
116236
|
-
if (matcher.
|
116237
|
-
|
116910
|
+
let flags = [];
|
116911
|
+
for (let matcher of matchers) {
|
116912
|
+
if (matcher.negate) {
|
116913
|
+
if (!matcher.match(tableName)) {
|
116914
|
+
flags.push(false);
|
116915
|
+
}
|
116916
|
+
}
|
116917
|
+
if (matcher.match(tableName)) {
|
116918
|
+
flags.push(true);
|
116919
|
+
}
|
116920
|
+
}
|
116921
|
+
if (flags.length > 0) {
|
116922
|
+
return flags.every(Boolean);
|
116238
116923
|
}
|
116239
116924
|
return false;
|
116240
116925
|
};
|
@@ -116303,10 +116988,19 @@ var init_introspect = __esm({
|
|
116303
116988
|
const filter2 = (tableName) => {
|
116304
116989
|
if (matchers.length === 0)
|
116305
116990
|
return true;
|
116306
|
-
|
116307
|
-
|
116308
|
-
if (matcher.
|
116309
|
-
|
116991
|
+
let flags = [];
|
116992
|
+
for (let matcher of matchers) {
|
116993
|
+
if (matcher.negate) {
|
116994
|
+
if (!matcher.match(tableName)) {
|
116995
|
+
flags.push(false);
|
116996
|
+
}
|
116997
|
+
}
|
116998
|
+
if (matcher.match(tableName)) {
|
116999
|
+
flags.push(true);
|
117000
|
+
}
|
117001
|
+
}
|
117002
|
+
if (flags.length > 0) {
|
117003
|
+
return flags.every(Boolean);
|
116310
117004
|
}
|
116311
117005
|
return false;
|
116312
117006
|
};
|
@@ -116331,7 +117025,9 @@ var init_introspect = __esm({
|
|
116331
117025
|
squashSqliteScheme(drySQLite),
|
116332
117026
|
squashSqliteScheme(schema5),
|
116333
117027
|
tablesResolver,
|
116334
|
-
columnsResolver
|
117028
|
+
columnsResolver,
|
117029
|
+
drySQLite,
|
117030
|
+
schema5
|
116335
117031
|
);
|
116336
117032
|
writeResult({
|
116337
117033
|
cur: schema5,
|
@@ -117099,13 +117795,13 @@ var init_url = __esm({
|
|
117099
117795
|
});
|
117100
117796
|
|
117101
117797
|
// node_modules/.pnpm/hono@4.3.9/node_modules/hono/dist/utils/cookie.js
|
117102
|
-
var validCookieNameRegEx, validCookieValueRegEx,
|
117798
|
+
var validCookieNameRegEx, validCookieValueRegEx, parse5;
|
117103
117799
|
var init_cookie = __esm({
|
117104
117800
|
"node_modules/.pnpm/hono@4.3.9/node_modules/hono/dist/utils/cookie.js"() {
|
117105
117801
|
init_url();
|
117106
117802
|
validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
|
117107
117803
|
validCookieValueRegEx = /^[ !#-:<-[\]-~]*$/;
|
117108
|
-
|
117804
|
+
parse5 = (cookie, name) => {
|
117109
117805
|
const pairs = cookie.trim().split(";");
|
117110
117806
|
return pairs.reduce((parsedCookie, pairStr) => {
|
117111
117807
|
pairStr = pairStr.trim();
|
@@ -117147,13 +117843,13 @@ var init_cookie2 = __esm({
|
|
117147
117843
|
} else if (prefix === "host") {
|
117148
117844
|
finalKey = "__Host-" + key;
|
117149
117845
|
}
|
117150
|
-
const obj2 =
|
117846
|
+
const obj2 = parse5(cookie, finalKey);
|
117151
117847
|
return obj2[finalKey];
|
117152
117848
|
}
|
117153
117849
|
if (!cookie) {
|
117154
117850
|
return {};
|
117155
117851
|
}
|
117156
|
-
const obj =
|
117852
|
+
const obj = parse5(cookie);
|
117157
117853
|
return obj;
|
117158
117854
|
};
|
117159
117855
|
}
|
@@ -119566,7 +120262,7 @@ var init_dist6 = __esm({
|
|
119566
120262
|
});
|
119567
120263
|
|
119568
120264
|
// node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/index.js
|
119569
|
-
var SuperJSON, serialize2, deserialize, stringify3,
|
120265
|
+
var SuperJSON, serialize2, deserialize, stringify3, parse6, registerClass, registerCustom, registerSymbol, allowErrorProps;
|
119570
120266
|
var init_dist7 = __esm({
|
119571
120267
|
"node_modules/.pnpm/superjson@2.2.1/node_modules/superjson/dist/index.js"() {
|
119572
120268
|
init_class_registry();
|
@@ -119651,7 +120347,7 @@ var init_dist7 = __esm({
|
|
119651
120347
|
serialize2 = SuperJSON.serialize;
|
119652
120348
|
deserialize = SuperJSON.deserialize;
|
119653
120349
|
stringify3 = SuperJSON.stringify;
|
119654
|
-
|
120350
|
+
parse6 = SuperJSON.parse;
|
119655
120351
|
registerClass = SuperJSON.registerClass;
|
119656
120352
|
registerCustom = SuperJSON.registerCustom;
|
119657
120353
|
registerSymbol = SuperJSON.registerSymbol;
|
@@ -119858,13 +120554,13 @@ var init_studio2 = __esm({
|
|
119858
120554
|
const customDefaults = getCustomDefaults(sqliteSchema2);
|
119859
120555
|
let dbUrl;
|
119860
120556
|
if ("driver" in credentials2) {
|
119861
|
-
const { driver:
|
119862
|
-
if (
|
120557
|
+
const { driver: driver3 } = credentials2;
|
120558
|
+
if (driver3 === "d1-http") {
|
119863
120559
|
dbUrl = `d1-http://${credentials2.accountId}/${credentials2.databaseId}/${credentials2.token}`;
|
119864
|
-
} else if (
|
120560
|
+
} else if (driver3 === "turso") {
|
119865
120561
|
dbUrl = `turso://${credentials2.url}/${credentials2.authToken}`;
|
119866
120562
|
} else {
|
119867
|
-
assertUnreachable(
|
120563
|
+
assertUnreachable(driver3);
|
119868
120564
|
}
|
119869
120565
|
} else {
|
119870
120566
|
dbUrl = credentials2.url;
|
@@ -119976,7 +120672,7 @@ var init_studio2 = __esm({
|
|
119976
120672
|
};
|
119977
120673
|
prepareServer = async ({
|
119978
120674
|
dialect: dialect7,
|
119979
|
-
driver:
|
120675
|
+
driver: driver3,
|
119980
120676
|
proxy,
|
119981
120677
|
customDefaults,
|
119982
120678
|
schema: drizzleSchema,
|
@@ -120026,7 +120722,7 @@ var init_studio2 = __esm({
|
|
120026
120722
|
return c.json({
|
120027
120723
|
version: "6",
|
120028
120724
|
dialect: dialect7,
|
120029
|
-
driver:
|
120725
|
+
driver: driver3,
|
120030
120726
|
schemaFiles,
|
120031
120727
|
customDefaults: preparedDefaults,
|
120032
120728
|
relations: extractRelations(relationsConfig),
|
@@ -120141,7 +120837,11 @@ var upPgHandler = (out) => {
|
|
120141
120837
|
raw: report.rawMap[it]
|
120142
120838
|
})).forEach((it) => {
|
120143
120839
|
const path5 = it.path;
|
120144
|
-
|
120840
|
+
let resultV6 = it.raw;
|
120841
|
+
if (it.raw.version === "5") {
|
120842
|
+
resultV6 = updateUpToV6(it.raw);
|
120843
|
+
}
|
120844
|
+
const result = updateUpToV7(resultV6);
|
120145
120845
|
console.log(`[${source_default.green("\u2713")}] ${path5}`);
|
120146
120846
|
(0, import_fs2.writeFileSync)(path5, JSON.stringify(result, null, 2));
|
120147
120847
|
});
|
@@ -120177,6 +120877,36 @@ var updateUpToV6 = (json) => {
|
|
120177
120877
|
enums
|
120178
120878
|
};
|
120179
120879
|
};
|
120880
|
+
var updateUpToV7 = (json) => {
|
120881
|
+
const schema5 = pgSchemaV6.parse(json);
|
120882
|
+
const tables = Object.fromEntries(
|
120883
|
+
Object.entries(schema5.tables).map((it) => {
|
120884
|
+
const table4 = it[1];
|
120885
|
+
const mappedIndexes = Object.fromEntries(
|
120886
|
+
Object.entries(table4.indexes).map((idx) => {
|
120887
|
+
const { columns, ...rest } = idx[1];
|
120888
|
+
const mappedColumns = columns.map((it2) => {
|
120889
|
+
return {
|
120890
|
+
expression: it2,
|
120891
|
+
isExpression: false,
|
120892
|
+
asc: true,
|
120893
|
+
nulls: "last",
|
120894
|
+
opClass: void 0
|
120895
|
+
};
|
120896
|
+
});
|
120897
|
+
return [idx[0], { columns: mappedColumns, ...rest }];
|
120898
|
+
})
|
120899
|
+
);
|
120900
|
+
return [it[0], { ...table4, indexes: mappedIndexes }];
|
120901
|
+
})
|
120902
|
+
);
|
120903
|
+
return {
|
120904
|
+
...schema5,
|
120905
|
+
version: "7",
|
120906
|
+
dialect: "postgresql",
|
120907
|
+
tables
|
120908
|
+
};
|
120909
|
+
};
|
120180
120910
|
|
120181
120911
|
// src/cli/commands/sqliteUp.ts
|
120182
120912
|
init_source();
|
@@ -121342,7 +122072,7 @@ var printVersions = async () => {
|
|
121342
122072
|
var versions = async () => {
|
121343
122073
|
const { npmVersion } = await ormCoreVersions();
|
121344
122074
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
121345
|
-
const envVersion = "0.
|
122075
|
+
const envVersion = "0.22.0";
|
121346
122076
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
121347
122077
|
const versions2 = `drizzle-kit: ${kitVersion}
|
121348
122078
|
${ormVersion}`;
|
@@ -121529,7 +122259,7 @@ var upCommand = new import_commander.Command("up").option("--config <config>", `
|
|
121529
122259
|
var pullCommand = new import_commander.Command("introspect").option("--config <config>", `Config path [default=drizzle.config.ts]`).option("--out <out>", `Migrations folder`).option("--dialect <dialect>", "Database dialect").option("--breakpoints", `Prepare SQL statements with breakpoints`).option(
|
121530
122260
|
"--introspect-casing <introspectCasing>",
|
121531
122261
|
"Column object keys naming strategy"
|
121532
|
-
).option("--tablesFilter", `Table name filters`).option("--schemaFilter", `Schema name filters`).option("--url <url>", "Database connection URL").option("--host <host>", "Database host").option("--port <port>", "Database port").option("--user <user>", "Database user").option("--password <password>", "Database password").option("--database <database>", "Database database name").option("--ssl <ssl>", "Database ssl").option("--auth-token <authToken>", "Database auth token [Turso]").option("--driver <driver>", "Driver used for querying the database").action(async (options) => {
|
122262
|
+
).option("--tablesFilter", `Table name filters`).option("--extensionsFilters", `Table name filters`).option("--schemaFilter", `Schema name filters`).option("--url <url>", "Database connection URL").option("--host <host>", "Database host").option("--port <port>", "Database port").option("--user <user>", "Database user").option("--password <password>", "Database password").option("--database <database>", "Database database name").option("--ssl <ssl>", "Database ssl").option("--auth-token <authToken>", "Database auth token [Turso]").option("--driver <driver>", "Driver used for querying the database").action(async (options) => {
|
121533
122263
|
await printVersions();
|
121534
122264
|
await assertPackages("drizzle-orm");
|
121535
122265
|
await assertOrmCoreVersion();
|